-
Notifications
You must be signed in to change notification settings - Fork 193
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
Find/Replace overlay: immediate replace after selected text #2011 #2052
Conversation
Test Results 1 815 files ±0 1 815 suites ±0 1h 35m 4s ⏱️ + 1m 15s For more details on these failures, see this check. Results for commit 866fba1. ± Comparison against base commit 816820a. ♻️ This comment has been updated with latest results. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Functionality is sound and aligns with the FindReplaceOverlay
. Test is a proper regression test. Thank you!
Just one thing: I do not understand the commit message. Where is the bug in the implementation of the IFindReplaceTargetExtension3
? And if that was the case, why not fix that implementation?
@HeikoKlare the Bug we need to work around is the one we already encountered when implementing /**
* The TextViewer implementation of IFindReplaceLogic is misleading and not adhering to the
* Interface: IFindReplaceTargetExtension3#replaceSelection will NOT replace the selection if
* nothing was previously found. This does not generally have to be the case and thus we mock a
* target that is setup like this:
*
* The text contained is {@code ~SELECTEDTEXT~abcd} with ~ marking the boundaries of the
* selection. We perform a search for "NOTFOUND" first - the selection stays put since the
* string was not found. At this point, we do not want to perform
* {@code replaceSelection("NOTFOUND")} since an implementation adhering to the specification of
* the function would just overwrite the current selection.
*/ In short: the editor will only replace a selection if it "searched" for it before, even though we would expect it to "blindly replace" the selection. As for fixing the implementation, I am not sure if we want to get into that; we would need to write tests for the Implementation of FindReplaceTargetExtension3 of the Editor, learn and debug the code and hope that no user depends on this behavior. What do you think? |
@HeikoKlare we can fix that bug first and then rebase this PR on that PR - what do you think? |
Yes, makes sense 👍 |
@HeikoKlare I rebased this PR on #2056 as discussed. |
I have fixed the merging conflicts. |
…latform#2011 The TextViewer implementation of IFindReplaceTargetExtension3.replaceSelection() does not perform a replace operation if no preceeding find operation was called. To address this accepted deviation from the interface's specification, this change forces the overlay to search for an initializing word again so that the Editor can then later replace it if required. fixes eclipse-platform#2011
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works as expected, thank you!
I've rebased on master and resolved newly introduced conflicts. If checks succeed, I consider this ready to be merged.
Failing test is unrelated: #1935 |
Thank you for this fix! |
Work around for a bug of the Editor's implementation of the
FindReplaceTargetExtension3; when initializing the search with an
already selected string, force the overlay to search for it again so
that the Editor can then later replace it if required.
fixes #2011