]> git.lyx.org Git - features.git/commitdiff
* src/text3.C (doDispatch):
authorJürgen Spitzmüller <spitz@lyx.org>
Tue, 10 Apr 2007 11:25:02 +0000 (11:25 +0000)
committerJürgen Spitzmüller <spitz@lyx.org>
Tue, 10 Apr 2007 11:25:02 +0000 (11:25 +0000)
- add missing undo call to LFUN_QUOTE_INSERT
  (fixes bug 3439).

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17764 a592a061-630c-0410-9148-cb99ea01b6c8

src/text3.C

index 1aa9e8c53d30faa038a68e76f9a1dbfa03a3596d..8cb97ba60714f00fca1954526b2495fb90c34129 100644 (file)
@@ -585,6 +585,8 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
        case LFUN_BREAK_LINE: {
                // Not allowed by LaTeX (labels or empty par)
                if (cur.pos() > cur.paragraph().beginOfBody()) {
+                       // this avoids a double undo
+                       // FIXME: should not be needed, ideally
                        if (!cur.selection())
                                recordUndo(cur);
                        cap::replaceSelection(cur);
@@ -948,22 +950,25 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
        }
                
        case LFUN_QUOTE_INSERT: {
-               cap::replaceSelection(cur);
                Paragraph & par = cur.paragraph();
                pos_type pos = cur.pos();
-               char_type c;
-               if (pos == 0)
-                       c = ' ';
-               else if (cur.prevInset() && cur.prevInset()->isSpace())
-                       c = ' ';
-               else
-                       c = par.getChar(pos - 1);
-
-               LyXLayout_ptr const & style = par.layout();
-
                BufferParams const & bufparams = bv->buffer()->params();
+               LyXLayout_ptr const & style = par.layout();
                if (!style->pass_thru
                    && par.getFontSettings(bufparams, pos).language()->lang() != "hebrew") {
+                       // this avoids a double undo
+                       // FIXME: should not be needed, ideally
+                       if (!cur.selection())
+                               recordUndo(cur);
+                       cap::replaceSelection(cur);
+                       pos = cur.pos();
+                       char_type c;
+                       if (pos == 0)
+                               c = ' ';
+                       else if (cur.prevInset() && cur.prevInset()->isSpace())
+                               c = ' ';
+                       else
+                               c = par.getChar(pos - 1);
                        string arg = to_utf8(cmd.argument());
                        if (arg == "single")
                                cur.insert(new InsetQuotes(c,
@@ -1255,7 +1260,6 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
                InsetBase * inset = createInset(&cur.bv(), cmd);
                if (!inset)
                        break;
-
                recordUndo(cur);
                cur.clearSelection();
                insertInset(cur, inset);