RSyntaxTextArea icon indicating copy to clipboard operation
RSyntaxTextArea copied to clipboard

No marking if cursor is at end of file

Open SamKry opened this issue 1 year ago • 0 comments

Description There is a bug when using SearchEngine.find(...) . The problem is, that getFindInText() is called before the marking and if there is no text after the cursot (Caret), a new SearchResult() is returned.

Steps to Reproduce Specific steps to reproduce the behavior:

  1. Set the cursor at the end of a JTextArea
  2. call the find method using a valid SearchContext (e.g. search for "e" in a text that contains some "e")
  3. Now a empty new SearchResult is returned and no "e" got marked in the text.
  4. If you set the cursor one back (second last position), everything works as expected

Expected behavior All matching results should be marked regardless of the current cursor position. Even if wrap around is disabled

Actual behavior No marking if cursor at last position.

Screenshots Add a screenshot if it helps explain the problem.

Java version jdk-17.0.6.10

Additional context Just call markAllImpl() before getFindInText().

I will create a pullrequest with a fix.

SamKry avatar Feb 22 '24 11:02 SamKry