Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed off by one error in operating on text objects #1370

Closed
wants to merge 1 commit into from
Closed

Fixed off by one error in operating on text objects #1370

wants to merge 1 commit into from

Conversation

Lanny
Copy link

@Lanny Lanny commented Mar 16, 2013

I'm a little nervous about this because it involved removing part of a line whose reason for existing wasn't clear. There doesn't seem to be any unwanted side effects, but it seems strange the the line existed in the first place if all it did was cause this error.

Also changed expandWordUnderCursor to select adjacent consecutive
whitespece when the cursor is on a whitespace character. This is the
default behaviour in Vim 7.2 and GVim 7.3.
@mightyguava
Copy link
Contributor

I see what you are trying to do with the whitespace changes, but this is shared logic for # and * and seems to break the tests for # and *. Maybe instead of doing this, add in preceding whitespace in the text object manipulation logic after calling expandWordUnderCursor?

As for the var wordEnd = idx + wordAfterRegex[0].length - 1;, this was based on char index rather than bounds, so wordEnd is index of the last char, not the right bound for the word. I'm ok with this change except that you'll need to remove the + 1 in var query = cm.getLine(word.start.line).substring(word.start.ch, word.end.ch + 1); in the search logic. Please test for additional breakages.

@abrooks
Copy link
Contributor

abrooks commented May 6, 2013

I've provided a working patch with tests in pull request #1503 that addresses this issue. If that item is pulled, this one can be closed.

@marijnh marijnh closed this May 6, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants