Closed majutsushi closed 11 years ago
Thanks for reporting this! During testing, I discovered that i' and i" can cause a region to be highlighted after the cursor position. Never realized that it's possible for it to jump to before the cursor as well! The update performs a boundary box check now instead of just handling one of the two cases. Let me know if you continue to see this problem.
Works great now, thanks! By the way, I noticed that you could simplify the compare_pos()
function by just returning the result of the subtraction instead of using ternary operators and the additional if
clause, since you're only interested in positive, equal or negative anyway.
Acknowledged. I didn't want to deal with the potential overflow issues, although in this particular case, the file has to be huuuuge for overflow to even become an issue. I guess I'm just paranoid. :)
Nvm, on second thought, that scenario isn't possible. You're right, pushing a quick fix. Thanks!
I noticed that some text objects can select unexpected regions. For example, put the following into a file:
then put the cursor on top of
empty
and pressvib
. The parentheses on the first line should now be selected. This is obviously not useful for our case. So it would make sense to check whether the region candidates actually include the original cursor position before trying to use them.