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

Labels are not shown for last partially displayed line #283

Open
compleconomics opened this issue Oct 2, 2021 · 5 comments
Open

Labels are not shown for last partially displayed line #283

compleconomics opened this issue Oct 2, 2021 · 5 comments
Labels

Comments

@compleconomics
Copy link

Thanks a lot for the plugin. I generally work in label mode and have set display+=lastline in my .vimrc to show as much as possible of the last visible line.

In that case, sneak correctly highlights all my search results but does not attribute labels to any of the results in the last partially displayed line. If the display option is set to "" or if the last line is displayed entirely, everything works perfectly fine.

@justinmk justinmk added the bug label Oct 3, 2021
@justinmk
Copy link
Owner

justinmk commented Oct 3, 2021

Can't imagine what sneak logic would have this effect since the plugin just asks vim to search for text and highlight it. Can you try adding + 2 here:

func! s.get_stopline() abort
return self._reverse ? line("w0") : line("w$")
endf

like this:

return self._reverse ? line("w0") : (line("w$") + 2)

@compleconomics
Copy link
Author

Great! Works like a charm, thank you. +1 even seems to be enough to capture the remaining line.

@ggandor
Copy link
Contributor

ggandor commented Oct 3, 2021

A slight problem with this simple solution is that it labels invisible positions now, which might result in surprising behaviour - isn't there a way to check whether a match is actually on screen, before the @@@ part?

@justinmk
Copy link
Owner

justinmk commented Oct 4, 2021

A slight problem with this simple solution is that it labels invisible positions now, which might result in surprising behaviour

yeah :(

isn't there a way to check whether a match is actually on screen, before the @@@ part?

idk, grateful if anyone finds a hint.

@ggandor
Copy link
Contributor

ggandor commented Apr 26, 2022

idk, grateful if anyone finds a hint.

Checking the screenpos of the matches could be a solution - at least that is what I thought. The problems are:

  1. screenpos is incredibly slow for lots of matches (this can be mitigated with some kind of bisecting approach though).
  2. It doesn't actually work. (IMO, ignoring these partial lines can be considered buggy, or at the very least surprising behaviour from screenpos().)

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

3 participants