]> git.lyx.org Git - lyx.git/blobdiff - src/text3.C
Fix #1736
[lyx.git] / src / text3.C
index 0b230da156c4c545db65166b2b586e8955691fb3..9b46dce830635025f9b750d5f877051e06b45587 100644 (file)
@@ -301,6 +301,7 @@ void specialChar(LCursor & cur, InsetSpecialChar::Kind kind)
 {
        lyx::cap::replaceSelection(cur);
        cur.insert(new InsetSpecialChar(kind));
+       cur.posRight();
 }
 
 
@@ -625,6 +626,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
                if (cur.pos() > cur.paragraph().beginOfBody()) {
                        lyx::cap::replaceSelection(cur);
                        cur.insert(new InsetNewline);
+                       cur.posRight();
                        moveCursor(cur, false);
                }
                break;
@@ -800,8 +802,10 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
        case LFUN_SPACE_INSERT:
                if (cur.paragraph().layout()->free_spacing)
                        insertChar(cur, ' ');
-               else
+               else {
                        doInsertInset(cur, this, cmd, false, false);
+                       cur.posRight();
+               }
                moveCursor(cur, false);
                break;
 
@@ -1129,25 +1133,24 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
 
                // ignore motions deeper nested than the real anchor
                LCursor & bvcur = cur.bv().cursor();
-               if (!bvcur.anchor_.hasPart(cur))
-                       break;
-               CursorSlice old = cur.top();
-               setCursorFromCoordinates(cur, cmd.x, cmd.y);
+               if (bvcur.anchor_.hasPart(cur)) {
+                       CursorSlice old = cur.top();
+                       setCursorFromCoordinates(cur, cmd.x, cmd.y);
+
+                       // This is to allow jumping over large insets
+                       // FIXME: shouldn't be top-text-specific
+                       if (isMainText() && cur.top() == old) {
+                               if (cmd.y - bv->top_y() >= bv->workHeight())
+                                       cursorDown(cur);
+                               else if (cmd.y - bv->top_y() < 0)
+                                       cursorUp(cur);
+                       }
 
-               // This is to allow jumping over large insets
-               // FIXME: shouldn't be top-text-specific
-               if (isMainText() && cur.top() == old) {
-                       if (cmd.y - bv->top_y() >= bv->workHeight())
-                               cursorDown(cur);
-                       else if (cmd.y - bv->top_y() < 0)
-                               cursorUp(cur);
+                       // don't set anchor_
+                       bv->cursor().setCursor(cur);
+                       bv->cursor().selection() = true;
+                       lyxerr << "MOTION: " << bv->cursor() << endl;
                }
-
-               // don't set anchor_
-               bv->cursor().setCursor(cur);
-               bv->cursor().selection() = true;
-               lyxerr << "MOTION: " << bv->cursor() << endl;
                break;
        }
 
@@ -1489,6 +1492,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
                        setLayout(cur, tclass.defaultLayoutName());
                        setParagraph(cur, Spacing(), LYX_ALIGN_LAYOUT, string(), 0);
                        insertInset(cur, new InsetFloatList(cmd.argument));
+                       cur.posRight();
                } else {
                        lyxerr << "Non-existent float type: "
                               << cmd.argument << endl;