Helge Hafting ha scritto:
Can the "advanced" search do a simple search?
Ok, the current implementation has only search, but, if LyX is going
to integrate the feature, I'll be glad to implement the replace part
as well. It should not be difficult at all: the searched text is already
selected, so the only thing I have to do is delete it and replace with
the contents of the "Replace..." GuiWorkArea text. So, I need to
"emulate" a copy operation on the entire "Replace..." GuiWorkArea
contents, and a paste operation on the "main" GuiWorkArea
starting from the searched text as selected. Replacing regexps
is another story: there I'd need to export the matching text to
LaTeX, apply the regexp search and replace, then reimport it from
LaTeX to Text, and finally replace the matching text.
A simple
search will find/replace words no matter what formatting/markup they have.
Yes, it already does that. Plus, it finds text within maths (which the current
simple search doesn't do).
"Advanced" problems:

1.User types a word and a replacement word.
  a) He wants to replace unmarked words only, with other unmarked words?
      Leave matching but bold/emph words alone?
Supposingly I add the replace part, it would be somewhat possible: uncheck the "Ignore format" option, and the word is matched only if it has the same format
as typed in the Search.... GuiWorkArea. Actually, what we mean here for
"same format" should be pilotable with more fine-granularity than it is now
(both layouts, maths and font faces, and I don't know what else, as of now).
A set of checkboxes could be added (ignore/match font faces, ignore/match
paragraph layouts, full-nested or not, ignore/match math environments, etc...)
b) He wants to replace the mis-spelled word no matter how it is formatted, and keep the formatting? (I.e. the replacement for a bold word will stay bold.)
Probably, the replace in case of "ignore format" should work this way (by default ?)
2. User may want to replace unformatted versions of words with
marked-up versions. Or change the kind of markup. Or replace math, labels
  and anything else that isn't simple text.
So, we could have *two* "ignore format" checkboxes (or set of checkboxes, or
set of commonly useful choices into a radio/combo):
- the one on the "Search..." GuiWorkArea would work as described above
- the one on the "Replace..." GuiWorkArea would selectively force one or more formatting properties of the "Replace..." GuiWorkArea into the replaced text.
It seems to me, that "advanced search+replace" is intended for
case (2), and it will naturally perform (1a) as well, as "unmarked" text
is a special case of  marking.

The old dialog did (1b) - will the new one be able to? An extra checkbox?
Guess answered above (i.e. not currently).
Another problem: Some of us hope for a dockable search+replace,
avoiding the problem of "word found, but the stupid dialog is sitting on
top of it and needs to be moved away." Surely the advanced search will
need a bigger dialog, will docking be realistic?
Ok, probably I agree with the "overcrowded" adjective used by Jean-Marc
for the current dialog. Though, the best way to realize the full featured
functionality drafted in this e-mail, would be IMHO to just add a set of
"advanced" panes to the current dockable window, so its size doesn't
need to grow uncontrolled, with tens of options where the naive user
would get lost almost immediately !
By default, just show the "standard" few options very typical in almost
any text editor find. Then, the "advanced" tab, will allow more fine
control on what to search and how to replace it.

Comments ?

   T.

Reply via email to