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

Fix search addons: searchTerm should not be matched if the beginning of matching index < 0 #1865

Merged
merged 1 commit into from
Dec 28, 2018

Conversation

ntchjb
Copy link
Contributor

@ntchjb ntchjb commented Dec 28, 2018

I tested using find previous function in search add-ons. It turns out that searching cannot go to previous line if the current result start at column index 0 as seen in the following picture:

screen shot 2561-12-29 at 02 58 08

The current selection (the first meow at second line) is stuck and couldn't continue finding other results. I think it's because lastIndexOf function still do matching string at the beginning of searchStringLine although searchStringLine's length is smaller than searchTerm, which should return -1. I fix the code by adding if clause to check whether the comparing range of searchStringLine is shorter than searchTerm or not.

searchTerm should not be matched if the beginning of matching index < 0
@Tyriar Tyriar added this to the 3.10.0 milestone Dec 28, 2018
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.

Great catch! 😃

@Tyriar Tyriar merged commit 4375b3c into xtermjs:master Dec 28, 2018
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.

2 participants