RSyntaxTextArea
RSyntaxTextArea copied to clipboard
Marked Count is always zero if cursor at end of file
Description
There is a bug when using SearchEngine.find(...) . The problem is, thata new SearchResult() is returned if there is no text after the cursot (Caret). This leads to a wrong SearchResult, because the markedCount is then set to 0 even if there are multiple markings before the cursor.
Steps to Reproduce Specific steps to reproduce the behavior:
- Set the cursor at the end of a JTextArea
- call the
findmethod using a valid SearchContext (e.g. search for "e" in a text that contains some "e") - Now all the "e" got marked but an empty new SearchResult is returned (variable
markedCountis set to 0) - If you set the cursor one back (second last position), everything works as expected
Expected behavior
The variable markedCount should be set to the correct number when returned.
Actual behavior
variable markedCount is set to 0 even if there are markings.
Screenshots Add a screenshot if it helps explain the problem.
Java version jdk-17.0.6.10
Additional context
Just change the line to return new SearchResult(null, 0, markAllCount); in the SearchEngine Class