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

Replace/Find button skips every second occurrence #1540

Closed
2 tasks done
basilevs opened this issue Jan 22, 2024 · 1 comment · Fixed by #1541
Closed
2 tasks done

Replace/Find button skips every second occurrence #1540

basilevs opened this issue Jan 22, 2024 · 1 comment · Fixed by #1541
Labels
bug Something isn't working

Comments

@basilevs
Copy link
Contributor

basilevs commented Jan 22, 2024

Steps to reproduce

From a fresh installation and clean workspace:

  • Create an "Untitled Text Document"
  • Enter following content:
testa!
testb!
testc!
  • Set the cursor to the start of the document
  • Hit Command+F
  • Fill "Find" field with (\w)!
  • Fill "Replace with" field with \1 !
  • Set checkbox "Regular expressions"
  • Hit Find button
  • Hit Replace/Find button
Screenshot 2024-01-22 at 21 34 03

I expected:

testa !
testb!
testc!

But got:

testa!
testb !
testc!
Screenshot 2024-01-22 at 21 34 28

Tested under this environment:

  • Ubuntu 22.04.3 LTS
  • Eclipse SDK: Version: 2024-03 (4.31) Build id: I20240121-1800

Community

  • I understand reporting an issue to this OSS project does not mandate anyone to fix it. Other contributors may consider the issue, or not, at their own convenience. The most efficient way to get it fixed is that I fix it myself and contribute it back as a good quality patch to the project.
@basilevs basilevs added the bug Something isn't working label Jan 22, 2024
HeikoKlare added a commit to HeikoKlare/eclipse.platform.ui that referenced this issue Jan 22, 2024
The replace functionality of the FindAndReplaceLogic checks whether the
current selection fits to the current search string and otherwise
performs a find operation first. To this end, it compares the text
selection with the search string, even if regex search is used. In regex
search mode, this check will usually fail and a find operation is
performed even though a correct string is already selected. This results
in the replacement of the next instead of the current match.

With this change, the check for whether the currently selected string
fits to the search string properly considers regex search mode. It also
adds an according regression test.

Fixes eclipse-platform#1540
HeikoKlare added a commit to HeikoKlare/eclipse.platform.ui that referenced this issue Jan 22, 2024
The replace functionality of the FindAndReplaceLogic checks whether the
current selection fits to the current search string and otherwise
performs a find operation first. To this end, it compares the text
selection with the search string, even if regex search is used. In regex
search mode, this check will usually fail and a find operation is
performed even though a correct string is already selected. This results
in the replacement of the next instead of the current match.

With this change, the check for whether the currently selected string
fits to the search string properly considers regex search mode. It also
adds an according regression test.

Fixes eclipse-platform#1540
@HeikoKlare
Copy link
Contributor

Thanks for reporting, @basilevs! I've proposed a fix in #1541. I've successfully tested your scenario with the fix.

HeikoKlare added a commit to HeikoKlare/eclipse.platform.ui that referenced this issue Jan 23, 2024
…pse-platform#1540

The replace functionality of the FindAndReplaceLogic checks whether the
current selection fits to the current search string and otherwise
performs a find operation first. To this end, it compares the text
selection with the search string, even if regex search is used. In regex
search mode, this check will usually fail and a find operation is
performed even though a correct string is already selected. This results
in the replacement of the next instead of the current match.

With this change, the check for whether the currently selected string
fits to the search string properly considers regex search mode. In
consequence, all replace operations consider the current selection for
replacement if fitting. It also adds an according regression tests.

Fixes eclipse-platform#1540
HeikoKlare added a commit to HeikoKlare/eclipse.platform.ui that referenced this issue Jan 27, 2024
…pse-platform#1540

The replace functionality of the FindAndReplaceLogic checks whether the
current selection fits to the current search string and otherwise
performs a find operation first. To this end, it compares the text
selection with the search string, even if regex search is used. In regex
search mode, this check will usually fail and a find operation is
performed even though a correct string is already selected. This results
in the replacement of the next instead of the current match.

With this change, the check for whether the currently selected string
fits to the search string properly considers regex search mode. In
consequence, all replace operations consider the current selection for
replacement if fitting. It also adds an according regression tests.

Fixes eclipse-platform#1540
HeikoKlare added a commit to HeikoKlare/eclipse.platform.ui that referenced this issue Jan 28, 2024
…pse-platform#1540

The replace functionality of the FindAndReplaceLogic checks whether the
current selection fits to the current search string and otherwise
performs a find operation first. To this end, it compares the text
selection with the search string, even if regex search is used. In regex
search mode, this check will usually fail and a find operation is
performed even though a correct string is already selected. This results
in the replacement of the next instead of the current match.

With this change, the check for whether the currently selected string
fits to the search string properly considers regex search mode. In
consequence, all replace operations consider the current selection for
replacement if fitting. It also adds an according regression tests.

Fixes eclipse-platform#1540
HeikoKlare added a commit to HeikoKlare/eclipse.platform.ui that referenced this issue Jan 29, 2024
…pse-platform#1540

The replace functionality of the FindAndReplaceLogic checks whether the
current selection fits to the current search string and otherwise
performs a find operation first. To this end, it compares the text
selection with the search string, even if regex search is used. In regex
search mode, this check will usually fail and a find operation is
performed even though a correct string is already selected. This results
in the replacement of the next instead of the current match.

With this change, the check for whether the currently selected string
fits to the search string properly considers regex search mode. In
consequence, all replace operations consider the current selection for
replacement if fitting. It also adds an according regression tests.

Fixes eclipse-platform#1540
HeikoKlare added a commit to HeikoKlare/eclipse.platform.ui that referenced this issue Jan 29, 2024
…pse-platform#1540

The replace functionality of the FindAndReplaceLogic checks whether the
current selection fits to the current search string and otherwise
performs a find operation first. To this end, it compares the text
selection with the search string, even if regex search is used. In regex
search mode, this check will usually fail and a find operation is
performed even though a correct string is already selected. This results
in the replacement of the next instead of the current match.

With this change, the check for whether the currently selected string
fits to the search string properly considers regex search mode. In
consequence, all replace operations consider the current selection for
replacement if fitting. It also adds according regression tests.

Fixes eclipse-platform#1540
HeikoKlare added a commit to HeikoKlare/eclipse.platform.ui that referenced this issue Jan 29, 2024
…pse-platform#1540

The replace functionality of the FindAndReplaceLogic checks whether the
current selection fits to the current search string and otherwise
performs a find operation first. To this end, it compares the text
selection with the search string, even if regex search is used. In regex
search mode, this check will usually fail and a find operation is
performed even though a correct string is already selected. This results
in the replacement of the next instead of the current match.

With this change, the check for whether the currently selected string
fits to the search string properly considers regex search mode. In
consequence, all replace operations consider the current selection for
replacement if fitting. It also adds according regression tests.

Fixes eclipse-platform#1540
HeikoKlare added a commit to HeikoKlare/eclipse.platform.ui that referenced this issue Jan 29, 2024
…pse-platform#1540

The replace functionality of the FindAndReplaceLogic checks whether the
current selection fits to the current search string and otherwise
performs a find operation first. To this end, it compares the text
selection with the search string, even if regex search is used. In regex
search mode, this check will usually fail and a find operation is
performed even though a correct string is already selected. This results
in the replacement of the next instead of the current match.

With this change, the check for whether the currently selected string
fits to the search string properly considers regex search mode. In
consequence, all replace operations consider the current selection for
replacement if fitting. It also adds according regression tests.

Fixes eclipse-platform#1540
HeikoKlare added a commit to HeikoKlare/eclipse.platform.ui that referenced this issue Jan 29, 2024
…pse-platform#1540

The replace functionality of the FindAndReplaceLogic checks whether the
current selection fits to the current search string and otherwise
performs a find operation first. To this end, it compares the text
selection with the search string, even if regex search is used. In regex
search mode, this check will usually fail and a find operation is
performed even though a correct string is already selected. This results
in the replacement of the next instead of the current match.

With this change, the check for whether the currently selected string
fits to the search string properly considers regex search mode. In
consequence, all replace operations consider the current selection for
replacement if fitting. It also adds according regression tests.

Fixes eclipse-platform#1540
HeikoKlare added a commit that referenced this issue Jan 29, 2024
The replace functionality of the FindAndReplaceLogic checks whether the
current selection fits to the current search string and otherwise
performs a find operation first. To this end, it compares the text
selection with the search string, even if regex search is used. In regex
search mode, this check will usually fail and a find operation is
performed even though a correct string is already selected. This results
in the replacement of the next instead of the current match.

With this change, the check for whether the currently selected string
fits to the search string properly considers regex search mode. In
consequence, all replace operations consider the current selection for
replacement if fitting. It also adds according regression tests.

Fixes #1540
amartya4256 pushed a commit to amartya4256/eclipse.platform.ui that referenced this issue Feb 8, 2024
…pse-platform#1540

The replace functionality of the FindAndReplaceLogic checks whether the
current selection fits to the current search string and otherwise
performs a find operation first. To this end, it compares the text
selection with the search string, even if regex search is used. In regex
search mode, this check will usually fail and a find operation is
performed even though a correct string is already selected. This results
in the replacement of the next instead of the current match.

With this change, the check for whether the currently selected string
fits to the search string properly considers regex search mode. In
consequence, all replace operations consider the current selection for
replacement if fitting. It also adds according regression tests.

Fixes eclipse-platform#1540
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants