The attached is a proposed workaround for the remaining speed problem
within insets. I would of course prefer a real solution, but it looks
from my attempt to write one that it would be very complicated to do
properly, requiring architectural changes that are not wise to make at
this point of the 1.4.0 freeze. Perhaps 1.4.1, or 1.5.

In the meantime the attached will allow the easy "dissolution" of
text insets by pressing backspace in the first position, just like in
math. (Didn't we once have a "dissolve" function?)

This allows a workflow where people can type their text into the
main lyxtext, and then put an inset (branch, minipage, ...) around it.
Then, if they need to do large edits to the inset's text, they can just
"dissolve" the inset, do their editing in the main lyxtext (fast again),
and then restore the inset around it.

Not exactly elegant, but IMO good enough for 1.4.0.

- Martin

Index: insettext.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insettext.C,v
retrieving revision 1.622
diff -u -p -r1.622 insettext.C
--- insettext.C 21 Oct 2005 09:55:23 -0000      1.622
+++ insettext.C 31 Dec 2005 11:08:53 -0000
@@ -251,7 +251,22 @@ void InsetText::doDispatch(LCursor & cur
        lyxerr[Debug::DEBUG] << BOOST_CURRENT_FUNCTION
     << " [ cmd.action = " << cmd.action << ']' << endl;
        setViewCache(&cur.bv());
-       text_.dispatch(cur, cmd);
+       // "Dissolve" surrounding inset:
+       if (cmd.action == LFUN_BACKSPACE && cur.depth() > 1
+           && cur.pit() == 0 && cur.pos() == 0) {
+               cur.resetAnchor();
+               cur.pit() = cur.lastpit();
+               cur.pos() = cur.lastpos();
+               cur.setSelection();
+               lyx::cap::cutSelection(cur);
+               cur.popLeft();
+               lyx::cap::pasteSelection(cur);
+               cur.resetAnchor();
+               cur.pos()++;
+               cur.setSelection();
+               lyx::cap::cutSelection(cur);
+       } else
+               text_.dispatch(cur, cmd);
 }
 
 

Attachment: pgpcibxshqExb.pgp
Description: PGP signature

Reply via email to