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

Mini.jump bug: t skips matches at first column #113

Closed
3 tasks done
FreebeJan opened this issue Aug 18, 2022 · 4 comments
Closed
3 tasks done

Mini.jump bug: t skips matches at first column #113

FreebeJan opened this issue Aug 18, 2022 · 4 comments
Labels

Comments

@FreebeJan
Copy link

Contributing guidelines

Module(s)

Mini.jump

Description

In the below example file, when hitting t) on the second line, I would intuitively expect the cursor to move to he last character in line 2 as the next occurence of ) is the first char of line 3. However the cursor moves to the space before ) on line 5

Neovim version

0.7.2

Steps to reproduce

(
  t "closing parentheses" will skip line 3 and jump right to line 5 col 15
)

Something something )

2Gt)

Expected behavior

Put cursor at end of line 2

Actual behavior

Put cursor before the next match that is not on first column

@FreebeJan FreebeJan added the bug Something isn't working label Aug 18, 2022
@echasnovski
Copy link
Owner

Thanks for the issue!

This is by design, as till is meant to be understood as "just before/after the match instead of exactly on target" which is initially didn't include several lines into consideration.

All search logic is done with built-in search() function and Vim patterns. If I'll be able to achieve your outcome with them, this will be fixed. Otherwise, in my opinion, it will introduce too much complexity for relatively small gain.

As a side note: outcome of this use case is a little bit more complex than "put cursor at end of line 2". In Normal mode - yes, in Visual and Operator-pending - probably more reasonable would be to put one line to the right (on "new line character") to allow decreasing line count. Which is another complexity factor.

@echasnovski echasnovski added feature-request Feature request and removed bug Something isn't working labels Aug 19, 2022
@FreebeJan
Copy link
Author

Thank you for the response!
I agree with you that it should be the newline character for visual and operator-pending.

@echasnovski
Copy link
Owner

Thanks for the issue! It should be primarily solved on latest main by allowing putting cursor past the end of line.

Not without some issues (like with T and target being last character in line cursor is placed on the target if can't be positioned to the right of it), but it does seem like a more coherent behavior. In fact, it is now aligned with 'clever-f' (from which final solution to this issue was taken).

@FreebeJan
Copy link
Author

I have been testing it the past hour or two. It works like a charm 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants