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

feat: align output of searchcount component with neovim default #1202

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

camoz
Copy link

@camoz camoz commented Mar 7, 2024

Neovim's default formatting for indicating the search result position, from :h search-commands:

  [1/5]         Cursor is on first of 5 matches.
  [1/>99]       Cursor is on first of more than 99 matches.
  [>99/>99]     Cursor is after 99 match of more than 99 matches.
  [?/??]        Unknown how many matches exists, generating the
                statistics was aborted because of search timeout.

Meaning of result.incomplete, from :h searchcount():

  0: search was fully completed
  1: recomputing was timed out
  2: max count exceeded

@camoz
Copy link
Author

camoz commented Mar 7, 2024

I have tested every case locally (result.incomplete == 0|1|2) and it works here. Not sure about the performance impact though.

Also, idk why that blank line was included in the diff 😕

@camoz camoz force-pushed the patch-2 branch 2 times, most recently from 64289a9 to 268ab4b Compare March 7, 2024 07:41
if result.current <= result.maxcount then
return string.format('[%d/>%d]', result.current, result.maxcount)
else
return string.format('[>%d/>%d]', result.maxcount, result.maxcount)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what do we have in result.current in this case?

Neovim's default formatting for indicating the search result position, from `:h search-commands`:

  [1/5]         Cursor is on first of 5 matches.
  [1/>99]       Cursor is on first of more than 99 matches.
  [>99/>99]     Cursor is after 99 match of more than 99 matches.
  [?/??]        Unknown how many matches exists, generating the
                statistics was aborted because of search timeout.

Meaning of result.incomplete, from `:h searchcount()`:

  0: search was fully completed
  1: recomputing was timed out
  2: max count exceeded
@camoz
Copy link
Author

camoz commented Apr 27, 2024

Been using this for nearly 2 months now without any issues...

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

2 participants