Closed vanaigr closed 6 months ago
Since now the position returned from getNextPosition()
is guaranteed to be greater than than current position, I also removed the onTheSamePos
check
It also looks like the braces in one of the README examples should be different
Thanks, fixed.
Hmmm, I remember onTheSamePos
being a fix for some edge cases. But I think your solution might be a bit cleaner. Thanks.
Hmmm, I remember
onTheSamePos
being a fix for some edge cases.
Yes, it was added in 23fa126 as a fix for, I believe, #11.
The situation in the issue is the same as in my example, with punctuationAtEnd
matching before/at the cursor position. Since the pattern always matches the position of the first comma, if the cursor is at the first comma, the movement would've kept it in place.
When calculating next match position for patterns that contain $, the result is not checked against the current position. This can lead to cursor moving backwards in some cases:
I originally encountered this issue while trying to add '$' pattern so that the motions stop at the end of the line, and noticed that it didn't work for half of the lines. The
punctuationAtEnd = "%f[^%s]%p+$"
pattern was matching closing parenthesis at the cursor position, andonTheSamePos
check skipped the current match.It also looks like the braces in one of the README examples should be different https://github.com/chrisgrieser/nvim-spider/blob/828444de406bc7df3b30c8e000ce6f54f0754499/README.md#L188-L194