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

Continues search #529

Open
dzmipt opened this issue Jan 19, 2024 · 0 comments
Open

Continues search #529

dzmipt opened this issue Jan 19, 2024 · 0 comments
Assignees

Comments

@dzmipt
Copy link
Contributor

dzmipt commented Jan 19, 2024

Status quo
I have a RSTA and search panel with a "what" text and "Find" button. I can type in a "what" text and click "Find" button. "Find" button performs SearchEngine.find(rsta, searchContext). When I click the button multiple time, the next "what" word is selected. This scenario works perfectly.

Describe the solution you'd like
I want to modify searching - when I am typing "what" word, I want the search is being performed in the background.

For example, if I have rsta with the following content
abc abd
The caret is at offset 0.

  1. I type a => the first char "a" is selected.
  2. I press b; "what" is ab => the first 2 chars "ab" are selected.
  3. I press d; "what" is now abd => and only now "abd" is selected.

What I did
I added whatTextField.getDocument().addDocumentListener() with calling SearchEngine.find(). However in the use-case above when I pressed on the 2nd step b, the second occurrence of "ab" is selected.

What is proposed
I think it is needed one more field to the SearchContext which controls if the search should start from the selectionStart or from the selectionEnd.
And also SearchContext.forward should be taken into account.

@bobbylight bobbylight self-assigned this Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants