On 05/04/2018 06:02 AM, Helge Hafting wrote: > I wanted to replace the string "PTI" with "pti" in small caps. > > So, Edit->Find/replace (Advanced) > > Typed "PTI" in the search box. Typed "pti" in replace box. > > At this point, I realize that my document lacks the "Logical Markup" > module, so I can't get small caps yet. > > So, into Document->Settings to fix that. And the problems start. > > First problem: When the advanced search box is active, any changes > made to document settings are lost upon closing the dialog! > > Understanding this took some time - I can only guess that advanced > search is a "document" of its own, similar to having several documents > open? I can understand this from a programmer point of view, but this > is NOT intuitive for users. For a user, the search dialog is NOT a > document of its own, no matter how advanced it may be. Also, this > state of affairs is also counterproductive. > > The next attempt was to work around this by clicking the main window > first, and change document settings for the main window. That part > works, the setting are now retained. But: > > Second problem: I can now use small caps in my document. But I still > cannot do so in the advanced search dialog, because advanced search > uses its own document settings. I have added a layout module, but this > do not show up. And I cannot work around this by adding a layout > module to the settings when advanced search has focus - because that > does not work. Restarting LyX does not help, the dialog has its own > settings where only document class matches the document being searched. > > The third workaround attempt was to create a small cap string in the > main document, and paste it into advanced search. This yielded an > error box about an "unknown text style", as the style I added to my > document is unknown to the search dialog. Similar to pasting into > another document without the logical markup module. > > But this worked. Using replace, I was able to get what I wanted. The > style that was "unknown" to the search dialog was still known to the > document itself. > > So working around this is possible, but I consider it a bug. Advanced > search ought to use all the settings & styles of the document being > searched. > > > Suggested fix: > > Do not keep an extra set of document settings around for "advanced > search". Instead, use the same document settings (and layout modules > and so on) as the document advanced search is operating on. And allow > changing those settings while advanced search has focus - such change > should go into the underlying document because conceptually, the > search dialog is NOT a separate document. (Even if it perhaps is > implemented that way?) > > Advanced search already follows the document class - changing the > document class to "letter" immediately allows replacing plain text > with "Adress" type text, for example. It'd be nice if this worked for > text styles added by layout modules as well.
I have attached a patch to the bug report https://www.lyx.org/trac/ticket/11138 I believe it should fix most of this. Comments welcome. Riki