Vincent van Ravesteijn - TNW wrote:
This is not only caused by the fact that you're using LFUN_BUFFER_SWITCH
instead of GuiView::setBuffer, but also by the fact that you now call
LFUN_FINDADV for each buffer, so it will be shown anyway when
dispatching this LFUN.
If you really want to search in hidden buffers (and/or non-current
workareas) we either have to change some design, we can hide the buffer
again when nothing is found, or freeze the view for a moment such that
we can switch buffer without showing the user.
As far as advanced F&R is concerned, I can try:
1) getting rid of the need for the BufferView, within lyxfind.cpp, i.e.,
ideally, I would like the LFUN to search within a buffer, and return
the DocIterator and length (in positions) of the match, if any
(and I really hate that passing of the BufferView to findAdv());
this should not pose any requirements on views that may exist on the
doc;
the buffer to search within may be provided in FindAndReplaceOptions
simply by name, instead of being the currentDocument();
the cursor where to start the search from would become one more
parameter of the FindAndReplaceOptions, provided by the LFUN caller
(F&R widget) -- any advice on how to textually (de)serialize a
DocIterator ?
the switch of the displayed buffer and putSelectionAt(...) operation
would
be done by the LFUN caller (F&R widget);
2) intercept the LFUN_FINDADV wherever appropriate considering 1);
3) let the LFUN dispatch in lyxfind.cpp return the required information
(match position and length) to the caller; for example, by means of
a DispatchResult sub-class (any strong objection to adding a
"DispatchResult &" to some of the existing ::dispatch() methods ?
(I suspect this would allow for removing the cursor().disp_ field
and related methods)
Or, adding a "DispatchResult &" field to the FuncRequest class itself ?
The first can be achieved by extending GuiView::setBuffer which can make
a hidden buffer the current buffer. But I foresee a lot of problems/work
because we use to think in currentWorkArea terms.[...] we should invent some
concept
like a "hidden workarea" .. Brr.
Hopefully, the approach proposed above would not require so dramatic
changes.
The last option is also useful when closing LyX (then you also see all
buffers closed one-by-one, which is annoying).
Probably people would not care too much about how bad lyx closes itself, as
long as it does not cause any data loss :-)
Bye,
T.