Bo Peng wrote:
Abdel:

Attached are two patches. They all enable persistent selection and
fixes 3877. 3877-Bo adds flag SaveSelection to all LFUN, and 3877-JM
calls SaveSelection at selHandle, cutSelection, MOUSE_PRESS, and a few
DELETE lfuncs. Both patches should have caught 99%, if not 100%, cases
when selection needs to be saved. I have not tried to move selHandle
to BufferView.

I personally like my solution and I guess JMarc likes his so your vote
will put one of them in. :-)
I think I prefer the LFUN based solution as it is more systematic. But at the same time why keep Cursor::selHandle() if we do that? The added benefit of your patch is that we could get rid of that completely and replace the following loc in text3, etc:

       needsUpdate |= cur.selHandle(cmd.action == LFUN_BUFFER_END_SELECT);

with:

+       // if this LFUN will clear selection, saveSelection for persistent
+       // selection
+       if (lyxaction.funcHasFlag(cmd.action, LyXAction::SaveSelection)) {
+               saveSelection(cur.bv().cursor());
+               needsUpdate = true;
+
        switch (cmd.action) {


at the beginning of Text::dispatch(); same thing for math and tabular. But you can probably do that also as a second step.

Abdel.

Reply via email to