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

No marking if cursor is at end of file #536

Closed
SamKry opened this issue Feb 22, 2024 · 1 comment
Closed

No marking if cursor is at end of file #536

SamKry opened this issue Feb 22, 2024 · 1 comment
Labels
Milestone

Comments

@SamKry
Copy link

SamKry commented Feb 22, 2024

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 SamKry added the bug label Feb 22, 2024
SamKry pushed a commit to SamKry/RSyntaxTextArea that referenced this issue Feb 22, 2024
# Pullrequest for issue bobbylight#536

**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()`.
@bobbylight bobbylight added this to the 3.4.1 milestone Apr 12, 2024
bobbylight pushed a commit that referenced this issue Apr 12, 2024
# Pullrequest for issue #536

**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()`.
@bobbylight
Copy link
Owner

Thanks for the bug report and the fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants