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

[Find/Replace] 'Find Next' (Ctrl+K) command broken with the overlay #2285

Open
Tracked by #2021
sratz opened this issue Sep 17, 2024 · 8 comments · May be fixed by #2308
Open
Tracked by #2021

[Find/Replace] 'Find Next' (Ctrl+K) command broken with the overlay #2285

sratz opened this issue Sep 17, 2024 · 8 comments · May be fixed by #2308
Labels
bug Something isn't working

Comments

@sratz
Copy link
Member

sratz commented Sep 17, 2024

When the find/replace overlay is enabled, the 'Find Next (Ctrl+K)' (org.eclipse.ui.edit.findNext) command has no effect.

When the find/replace overlay is disabled, it works again.

When then re-enabling the overlay, Ctrl+K still works on the 'old' search pattern that was entered in the legacy dialog.

The findNext action org.eclipse.ui.texteditor.FindNextAction works on org.eclipse.ui.texteditor.FindNextAction.getDialogSettings() which uses

IDialogSettings settings = PlatformUI.getDialogSettingsProvider(FrameworkUtil.getBundle(FindNextAction.class)).getDialogSettings();

Apparently this dialog setting is not written anymore when using the new overlay.

I guess the overlay should also write to those dialog settings to keep the search histories in sync.

@sratz sratz added the bug Something isn't working label Sep 17, 2024
@jmccabe
Copy link

jmccabe commented Sep 18, 2024

I was hoping to be the first to report this but, sadly, no, you got in before me 😢

Unless there's another key combination that can do the job, I'm going to have to revert to not using the overlay, even though it looks nice.

@HeikoKlare
Copy link
Contributor

Thank you for reporting this. I agree on the expectation that those actions should behave according to the last search operation (no matter whether it was in the dialog or overlay).

Still, this might be a bit tricker to resolve (properly). Having a static value for the search pattern worked with the existing dialog, as there was only one for the whole workbench. Now that there is one overlay per editor, we need to ensure that the context is properly considered. Maybe it is easy to fix the behavior but I am not sure whether it may also require design change to not have it work "by accident" (as the last search operation always implicitly belongs to the editor/view of interest).

@Wittmaxi
Copy link
Contributor

I am having trouble understanding what is the issue here. I just did a naive runthrough and could not reproduce any issues - this is my user-journey, everything works as (I) expected.

35

Can somebody please fill me in on what exactly is the issue here?

@Wittmaxi
Copy link
Contributor

Either way, a lot of these "quick search" command reimplement logic which was abstracted into the FindReplaceLogic class. (Ctrl+I, Ctrl+J, Ctrl+K, ...). It would be a clear improvement in code quality to make these commands re-use the logic which is now very well tested and controlled

@HeikoKlare
Copy link
Contributor

Can somebody please fill me in on what exactly is the issue here?

The search string for CTRL+K is not updated from the find/replace overlay. In your screencast, you set the search string via double-clicking the exact same search string as entered into the overlay, so it will be searched via CTRL+K. If you don't do that (just switch focus from the overlay to the editor), it will not behave as expected:

findreplace_ctrl-k

@Wittmaxi
Copy link
Contributor

Wittmaxi commented Sep 20, 2024

@HeikoKlare when refactoring the search history, I changed the name of the dialog-settings entry to "searchhistory" to fit the name to match our notion of "searching" in the overlay.

The FindNextAction still uses "findhistory" as search key.
FindNextAction; 364 vs FindReplaceOverlay; 631

This is the problem and we should make sure all three have a similar name

@HeikoKlare
Copy link
Contributor

Great, can you provide a PR with a fix?

@Wittmaxi
Copy link
Contributor

@HeikoKlare I am currently working on this

Wittmaxi added a commit to Wittmaxi/eclipse.platform.ui that referenced this issue Sep 20, 2024
The history of the FindNextAction is now synchronized with the search
history of either the FindReplaceOverlay or of the FindReplaceDialog
(whichever is active currently).

fixes eclipse-platform#2285
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
Development

Successfully merging a pull request may close this issue.

4 participants