eclipse-platform / eclipse.platform.ui

Eclipse Platform
https://projects.eclipse.org/projects/eclipse.platform
Eclipse Public License 2.0
78 stars 163 forks source link

[Find/Replace] Pre-selected search string is always escaped even if RegEx search is disabled #2270

Open HannesWell opened 4 days ago

HannesWell commented 4 days ago

Let's make sure issue is not already fixed in latest builds first.

Steps to reproduce

If one opens the Find/Replace overlay with text in an editor being selected as initial search input, that search input is now always escaped even if RegEx search is disabled (see screenshot below). This has the consequence that the non-RegEx search does not find the selected text because it treats the escape characters literally.

grafik

Furthermore the search input is partally hidden/truncated at left, as displayed in the screenshot.

@Wittmaxi or @HeikoKlare could you please have a look at this? IIRC this was introduced round about in the past week.

Tested under this environment:

Community

HeikoKlare commented 4 days ago

Thank you for reporting, Hannes! This is a regression introduced by the recent refactoring for checking the availability and activation state of search options (in #2209). It will be fixed along with an according regression test via #2271.

HannesWell commented 4 days ago

Thank you for reporting, Hannes! This is a regression introduced by the recent refactoring for checking the availability and activation state of search options (in #2209). It will be fixed along with an according regression test via #2271.

Thank you!

Btw. do you have an idea why the text is only partially visible initially as shown in the screenshot? Functionally it is irrelevant, but it does not look so nice and I wonder if this is a general problem in SWT?

HeikoKlare commented 3 days ago

Btw. do you have an idea why the text is only partially visible initially as shown in the screenshot? Functionally it is irrelevant, but it does not look so nice and I wonder if this is a general problem in SWT?

Sorry, I missed that statement in your original report. I have an idea and will try to evaluate it as soon as possible. In any case, I expect the problem to be solvable (easily).

I reopen the issue to be closed again via a PR for that additional issue.

HeikoKlare commented 22 hours ago

Intermediate update: I found the reason, I have fix, but not a proper one.

Reason for the behavior is that when the pre-selected text is set in the search input text field, it is not yet sized correctly. In the moment the text is set, it looks like this: image

Even if I enforce every layouting to be performed before setting the text, the wrong size is considered. I would expect a size recalculation to be sufficient, but at this point in time it should already have happened. What solves the problem is to set the text after the next paint event (by adding an execute-once paint listener at the end of the opening action). But that's rather an "I am not sure what to wait for, so wait for something that is definitely sufficient" solution than one that addresses the essential problem. I will try to find a better one...

deepika-u commented 8 hours ago

An observation: Issue of partial text visible is only seen when i select a text and open the FindReplaceOverlay freshly. Issue of partial text is not visible when FindReplaceOverlay is already open and i select a different text for search.