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

Fixes improve search addon behavior when there are > 1000 results #4504

Merged
merged 7 commits into from
May 17, 2023

Conversation

jeanp413
Copy link
Contributor

@jeanp413 jeanp413 commented May 7, 2023

Fixes #4444

If there's more than 1k matches, it will highlight the first 1k matches

@Tyriar
Copy link
Member

Tyriar commented May 8, 2023

Incremental means if you search "test" and then search "a", the search will find "testa" if the current search term's next letter is a, as opposed to non-incremental where it searches from the end of the current search term. This is typing in vscode's find widget (incremental) vs pressing enter (non-incremental).

@jeanp413
Copy link
Contributor Author

jeanp413 commented May 8, 2023

So it's broken in master branch?
Steps:

  • search jeanp
  • press enter to select the second match
  • type i so the search term is jeanpi
  • it selects the last match
    • I expect the selection to still be the second match and just expand it (this is the behavior I see in the vscode editor find widget), is this how it should work?

incremental_search

@meganrogge meganrogge self-assigned this May 9, 2023
@meganrogge meganrogge requested a review from Tyriar May 9, 2023 13:38
@Tyriar
Copy link
Member

Tyriar commented May 9, 2023

Yes it does seem to be broken, incremental should not jump to the result at the bottom

@jeanp413
Copy link
Contributor Author

jeanp413 commented May 9, 2023

I fixed the incremental code but the flag is redundant

  • it will always be incremental if there's a selection in the terminal (which I like as it behaves as the vscode editor), with this I only needed to fix 1 test
  • if I make the flag required, around 6 test will fail

@Tyriar Tyriar self-assigned this May 11, 2023
Copy link
Member

@Tyriar Tyriar left a comment

Choose a reason for hiding this comment

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

The behavior seems mostly correct now, I do notice the following issues though:

addons/xterm-addon-search/src/SearchAddon.ts Outdated Show resolved Hide resolved
addons/xterm-addon-search/typings/xterm-addon-search.d.ts Outdated Show resolved Hide resolved
@jeanp413
Copy link
Contributor Author

jeanp413 commented May 12, 2023

Pressing shift, ctrl or alt will do a non-incremental search

Are you referring to this ?, as I mentioned the incremental flag does not have any effect now (it can be removed in a separate PR), if there's a selection in the terminal then search will be incremental, but I also found a bug I fixed in the last commit and added a test, so maybe that was it

Doing an incremental search will not apply the white activeMatchBorder defined here

It's a bug in the decorations rendering, it does not take into account if it's on the top or bottom layer so it could happen that a decoration in top layer renders below, PR fixing it #4516

@Tyriar
Copy link
Member

Tyriar commented May 15, 2023

I mean this, I'm pressing only shift, ctrl and alt in the gif. It's moving the active match but should do nothing:

Recording 2023-05-15 at 05 08 01

@jeanp413
Copy link
Contributor Author

jeanp413 commented May 15, 2023

I thinks that's an issue with the dom events used in the demo, it's always using keyup for everything and always fire a seach, vscode search widget uses input to detect the actual input changed and also onKeyDown to handle special cases like enter, up/down arrow, tab, etc here

Copy link
Member

@Tyriar Tyriar left a comment

Choose a reason for hiding this comment

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

lgtm 👏

@Tyriar Tyriar added this to the 5.2.0 milestone May 17, 2023
@Tyriar Tyriar merged commit 6e8c59f into xtermjs:master May 17, 2023
@jeanp413 jeanp413 deleted the jp/fix-4444 branch May 17, 2023 14:23
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.

Improve search addon behavior when there are > 1000 results
3 participants