]> git.lyx.org Git - lyx.git/blobdiff - src/text3.C
bug 2298: cursorTop/Bottom/Home/End does not redraw after dEPM
[lyx.git] / src / text3.C
index 9acb2a761065e78c8b9341dcc08f07ea087c6f28..f34b24ab10557bd252a2c50804a54a987362078d 100644 (file)
@@ -387,7 +387,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
                if (cur.depth() == 1) {
                        if (!cur.mark())
                                cur.clearSelection();
-                       cursorTop(cur);
+                       needsUpdate = cursorTop(cur);
                        finishChange(cur, false);
                } else {
                        cur.undispatched();
@@ -398,7 +398,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
                if (cur.depth() == 1) {
                        if (!cur.selection())
                                cur.resetAnchor();
-                       cursorTop(cur);
+                       needsUpdate = cursorTop(cur);
                        finishChange(cur, true);
                } else {
                        cur.undispatched();
@@ -409,7 +409,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
                if (cur.depth() == 1) {
                        if (!cur.mark())
                                cur.clearSelection();
-                       cursorBottom(cur);
+                       needsUpdate = cursorBottom(cur);
                        finishChange(cur, false);
                } else {
                        cur.undispatched();
@@ -420,7 +420,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
                if (cur.depth() == 1) {
                        if (!cur.selection())
                                cur.resetAnchor();
-                       cursorBottom(cur);
+                       needsUpdate = cursorBottom(cur);
                        finishChange(cur, true);
                } else {
                        cur.undispatched();
@@ -520,7 +520,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
                update(cur);
                if (!cur.selection())
                        cur.resetAnchor();
-               cursorPrevious(cur);
+               needsUpdate = cursorPrevious(cur);
                finishChange(cur, true);
                break;
 
@@ -528,7 +528,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
                update(cur);
                if (!cur.selection())
                        cur.resetAnchor();
-               cursorNext(cur);
+               needsUpdate = cursorNext(cur);
                finishChange(cur, true);
                break;
 
@@ -536,7 +536,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
                update(cur);
                if (!cur.selection())
                        cur.resetAnchor();
-               cursorHome(cur);
+               needsUpdate = cursorHome(cur);
                finishChange(cur, true);
                break;
 
@@ -544,7 +544,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
                update(cur);
                if (!cur.selection())
                        cur.resetAnchor();
-               cursorEnd(cur);
+               needsUpdate = cursorEnd(cur);
                finishChange(cur, true);
                break;
 
@@ -604,14 +604,14 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
        case LFUN_HOME:
                if (!cur.mark())
                        cur.clearSelection();
-               cursorHome(cur);
+               needsUpdate = cursorHome(cur);
                finishChange(cur, false);
                break;
 
        case LFUN_END:
                if (!cur.mark())
                        cur.clearSelection();
-               cursorEnd(cur);
+               needsUpdate = cursorEnd(cur);
                finishChange(cur, false);
                break;
 
@@ -628,12 +628,16 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
 
        case LFUN_DELETE:
                if (!cur.selection()) {
+                       if (cur.pos() == cur.paragraph().size())
+                               // Par boundary, force full-screen update
+                               singleParUpdate = false;
                        needsUpdate = Delete(cur);
                        cur.resetAnchor();
                        // It is possible to make it a lot faster still
                        // just comment out the line below...
                } else {
                        cutSelection(cur, true, false);
+                       singleParUpdate = false;
                }
                moveCursor(cur, false);
                break;
@@ -656,6 +660,9 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
        case LFUN_BACKSPACE:
                if (!cur.selection()) {
                        if (bv->owner()->getIntl().getTransManager().backspace()) {
+                               // Par boundary, full-screen update
+                               if (cur.pos() == 0)
+                                       singleParUpdate = false;
                                needsUpdate = backspace(cur);
                                cur.resetAnchor();
                                // It is possible to make it a lot faster still
@@ -663,6 +670,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
                        }
                } else {
                        cutSelection(cur, true, false);
+                       singleParUpdate = false;
                }
                bv->switchKeyMap();
                break;
@@ -1532,10 +1540,14 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
 
        if (singleParUpdate)
                // Inserting characters does not change par height
-               if (cur.bottom().paragraph().dim().height() 
+               if (cur.bottom().paragraph().dim().height() 
                    == olddim.height()) {
                        // if so, update _only_ this paragraph
-                       cur.bv().update(Update::SinglePar | Update::Force);
+                       cur.bv().update(Update::SinglePar |
+                                       Update::FitCursor |
+                                       Update::MultiParSel);
+                       cur.noUpdate();
+                       return;
                } else
                        needsUpdate = true;
        if (!needsUpdate