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 find method 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 markedCount is 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
Description There is a bug when using
SearchEngine.find(...)
. The problem is, thatanew SearchResult()
is returned if there is no text after the cursot (Caret). This leads to a wrong SearchResult, because the markedCount is then set to0
even if there are multiple markings before the cursor.Steps to Reproduce Specific steps to reproduce the behavior:
find
method using a valid SearchContext (e.g. search for "e" in a text that contains some "e")markedCount
is set to 0)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