]> git.lyx.org Git - features.git/commitdiff
Consider deleted text when inserting quote inset.
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Mon, 21 Jan 2013 13:49:45 +0000 (14:49 +0100)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Wed, 6 Feb 2013 09:24:09 +0000 (10:24 +0100)
This bug was reported against the ubuntu build:
  https://bugs.launchpad.net/bugs/1100046

Additionally, some extra code for avoiding double undo entries has
been removed, since this is handled by grouped undo now.

src/Text3.cpp
status.20x

index d0f8981fb4bd74a6e63c8fefc115c09682496c5b..a889b8b09b6ca6c684edb9035d53df18252037db 100644 (file)
@@ -909,15 +909,12 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
        case LFUN_NEWLINE_INSERT: {
                InsetNewlineParams inp;
                docstring arg = cmd.argument();
-               // this avoids a double undo
-               // FIXME: should not be needed, ideally
-               if (!cur.selection())
-                       cur.recordUndo();
-               cap::replaceSelection(cur);
                if (arg == "linebreak")
                        inp.kind = InsetNewlineParams::LINEBREAK;
                else
                        inp.kind = InsetNewlineParams::NEWLINE;
+               cap::replaceSelection(cur);
+               cur.recordUndo();
                cur.insert(new InsetNewline(inp));
                cur.posForward();
                moveCursor(cur, false);
@@ -1356,14 +1353,14 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
        }
 
        case LFUN_QUOTE_INSERT: {
-               // this avoids a double undo
-               // FIXME: should not be needed, ideally
-               if (!cur.selection())
-                       cur.recordUndo();
                cap::replaceSelection(cur);
+               cur.recordUndo();
 
                Paragraph const & par = cur.paragraph();
                pos_type pos = cur.pos();
+               // Ignore deleted text before cursor
+               while (pos > 0 && par.isDeleted(pos - 1))
+                       --pos;
 
                BufferParams const & bufparams = bv->buffer().params();
                bool const hebrew = 
index a7074b9625730add1bf39a4250164a6056f1b929..abf1cc737f18a79bc88294291ce2bf5938306089 100644 (file)
@@ -115,6 +115,8 @@ What's new
   
 - Allow arguments in PassThru environments (bug 7646).
 
+- Consider deleted text when inserting quote inset.
+
 - Fix a few selection bugs in tabular (bugs 4981, 7988).
 
 - Show the output of configure.py while the LaTeX packages are being checked