Bug 119200 - No longer possible to use regular expressions in Find toolbar
Summary: No longer possible to use regular expressions in Find toolbar
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
(earliest affected) rc
Hardware: All All
: medium normal
Assignee: Not Assigned
Keywords: bisected, regression
Depends on:
Blocks: Find-Toolbar
  Show dependency treegraph
Reported: 2018-08-10 15:08 UTC by Mike Kaganski
Modified: 2022-10-27 09:13 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:
Regression By:

Sublime Text Find&Replace example (31.25 KB, image/png)
2022-10-27 09:07 UTC, es

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Kaganski 2018-08-10 15:08:09 UTC
1. Create a new spreadsheet
2. Type "aa" to several cells
3. Ctrl+H; enable regular expressions; check that ".." regex finds cells
4. Close the dialog (!) - no matter which way: either using title bar close control, or using Close button.
5. Ctrl+F, enter "..", try to find.

In 5.4.1 and previous, this worked. Starting from and 6.0, this doesn't work.

This is a regression from https://cgit.freedesktop.org/libreoffice/core/commit/?id=97cd8e4d64632bb65445cb2f395b1385a0a2a13b for bug 111818.
Comment 1 Mike Kaganski 2018-08-10 15:31:52 UTC
Comment 2 Mike Kaganski 2018-08-11 12:54:29 UTC
Some background that I have discovered:

1. Initially (since OOo), Find toolbar followed the Use regular expressions persistent setting that Find&Replace dialog sets on its close.
2. Then, bug 62601 was filed, and fixed in commit df9e6ab514ca1c97c7eb69e169c958619c03d429 for version 4.2.
3. Then, somewhere in the 5.2 preparation cycle (possibly in commit 3a0abd3019ec3ca29b8f1378cdb32ebf741e6306), css::util::SearchAlgorithms2 constants started to be used, and the behaviour got reverted.
4. In commit 97cd8e4d64632bb65445cb2f395b1385a0a2a13b, the fix for bug 62601 was effectively restored.
5. In the proposed fix here, I'd restore the initial behaviour once again.

The problem here is that unless there's a way to explicitly set the option in the Find toolbar, overriding the stored setting makes it impossible to use regular expressions there. Restoring initial behaviour (when the option in Find&Replace dialog invisibly affects Find toolbar) is unexpected to some.

Making own controls on Find toolbar for each such setting is a natural fix, and it was implemented e.g. for Match Case; but then a problem arises about how to save the toolbar's settings. Currently, the search options are saved in a single place (and that looks reasonable); taking into account the possible implementation of Find sidebar (bug 95405), making individual settings for each possible find method would be confusing. Then it seems natural that all settings should be synchronized between the dialogs and toolbars; given that Find&Replace is modeless, it's unclear why its settings are only saved on its close.

So I see the proper fix here to have all the search UI to modify configuration immediately upon clicking a checkbox; and that change should reflect in real time in all other search UIs. E.g., clicking on Match Case checkbox on Find toolbar should immediately (un)check corresponding option on Find&Replace dialog (if it's open), and vice versa.

Asking UX advice.
Comment 3 Eike Rathke 2018-08-16 09:43:25 UTC
I think reusing hidden (inherited from and only settable in the Find&Replace dialog) settings in the Find toolbar again that was fixed for bug 62601 is bad UX. If there is no checkbox or other means to specify the algorithm then the user expects a literal search is used. (well, personally I'd expect always regexp to be used, but.. ;-)
Comment 4 Heiko Tietze 2018-08-21 08:43:24 UTC
needsUXEval needs CC libreoffice-ux-advise@lists.freedesktop.org
Comment 5 Heiko Tietze 2018-10-19 10:43:29 UTC
Removing UX from the assigned ticket. Please ask, Mike, if you need support.
Comment 6 Mike Kaganski 2019-01-15 10:16:07 UTC
Unassigning myself due to Eike's opinion.
Comment 7 V Stuart Foote 2020-01-04 16:43:04 UTC
Looking at bug 129781, and bug 129783 followed bread crumbs back to this gem.

@Mike, as for bug 102506 and possibly 129781 would an expert configuration to optionally restore ICU regex for use on the Find toolbar be a possible solution? Like you and Eike, I'd find it useful to have regex on the Find bar--but not by default. And, would it be per module, or global?
Comment 8 QA Administrators 2022-01-17 03:37:35 UTC Comment hidden (obsolete)
Comment 9 es 2022-10-27 09:07:45 UTC
Created attachment 183287 [details]
Sublime Text Find&Replace example
Comment 10 es 2022-10-27 09:12:59 UTC
The bug is still present and affects some users today
Version: / LibreOffice Community Build ID: 382eef1f22670f7f4118c8c2dd222ec7ad009daf

And the proposed solution suggested above is correct
- Add checkboxes in all the various find/find&replace etc. toolbars (better make them icons with on-hover tooltips not to waste space)
- Make the changes immediate and propagate across various find toolbars
- I'd also suggest for the Find&Replace to be the same at-the-bottom toolbar like Find, there is no need to have such a huge window, check, e.g., Sublime Text for some inspiration (see the attached screenshot) — you can fit all the options without the need to take so much screen space as buttons + shortcuts for immediate activation of those buttons, so you can switch between a regex and a regular search with an easily discoverable (from hover) shortcut

This would make finding and replacing so much more convenient to use that in its current form