From ff6706002f89b9c10b98ebd08c00962aacf0a4c7 Mon Sep 17 00:00:00 2001 From: Alfredo Braunstein Date: Tue, 18 May 2004 07:18:02 +0000 Subject: [PATCH] avoid to update when navigating git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8759 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/ChangeLog | 6 ++++++ src/cursor.C | 8 +------- src/text3.C | 20 ++++++++++++++++++++ 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 52fb677a22..e9fc946a52 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ + +2004-05-18 Alfredo Braunstein + + * text3.C (dispatch): supress update when only moving the cursor + * cursor.C (selHandle): remove commented code + 2004-05-17 Georg Baum * paragraph.C (startTeXParParams): correct column count diff --git a/src/cursor.C b/src/cursor.C index dcefbe3181..f563141a2e 100644 --- a/src/cursor.C +++ b/src/cursor.C @@ -386,14 +386,8 @@ void LCursor::info(std::ostream & os) const void LCursor::selHandle(bool sel) { //lyxerr << "LCursor::selHandle" << endl; - if (sel == selection()) { -#ifdef WITH_WARNINGS -#warning Alfredo: This is too strong (Andre) -#endif - //if (!sel) - // noUpdate(); + if (sel == selection()) return; - } resetAnchor(); selection() = sel; diff --git a/src/text3.C b/src/text3.C index 05b46a12ba..5709367613 100644 --- a/src/text3.C +++ b/src/text3.C @@ -382,6 +382,8 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd) BOOST_ASSERT(cur.text() == this); BufferView * bv = &cur.bv(); CursorSlice sl = cur.top(); + bool sel = cur.selection(); + bool moving = false; switch (cmd.action) { @@ -427,6 +429,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd) break; case LFUN_WORDRIGHT: + moving = true; if (!cur.mark()) cur.clearSelection(); if (isRTL(cur.paragraph())) @@ -437,6 +440,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd) break; case LFUN_WORDLEFT: + moving = true; if (!cur.mark()) cur.clearSelection(); if (isRTL(cur.paragraph())) @@ -461,6 +465,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd) break; case LFUN_RIGHT: + moving = true; case LFUN_RIGHTSEL: //lyxerr << "handle LFUN_RIGHT[SEL]:\n" << cur << endl; cur.selHandle(cmd.action == LFUN_RIGHTSEL); @@ -475,6 +480,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd) break; case LFUN_LEFT: + moving = true; case LFUN_LEFTSEL: //lyxerr << "handle LFUN_LEFT[SEL]:\n" << cur << endl; cur.selHandle(cmd.action == LFUN_LEFTSEL); @@ -489,6 +495,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd) break; case LFUN_UP: + moving = true; case LFUN_UPSEL: //lyxerr << "handle LFUN_UP[SEL]:\n" << cur << endl; cur.selHandle(cmd.action == LFUN_UPSEL); @@ -500,6 +507,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd) break; case LFUN_DOWN: + moving = true; case LFUN_DOWNSEL: //lyxerr << "handle LFUN_DOWN[SEL]:\n" << cur << endl; cur.selHandle(cmd.action == LFUN_DOWNSEL); @@ -579,6 +587,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd) } case LFUN_UP_PARAGRAPH: + moving = true; if (!cur.mark()) cur.clearSelection(); cursorUpParagraph(cur); @@ -586,6 +595,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd) break; case LFUN_DOWN_PARAGRAPH: + moving = true; if (!cur.mark()) cur.clearSelection(); cursorDownParagraph(cur); @@ -593,6 +603,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd) break; case LFUN_PRIOR: + moving = true; if (!cur.mark()) cur.clearSelection(); finishChange(cur, false); @@ -605,6 +616,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd) break; case LFUN_NEXT: + moving = true; if (!cur.mark()) cur.clearSelection(); finishChange(cur, false); @@ -1586,6 +1598,14 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd) cur.undispatched(); break; } + + // avoid to update when navigating + if (moving + && &sl.inset() == &cur.inset() + && sl.idx() == cur.idx() + && sel == false + && cur.selection() == false) + cur.noUpdate(); } -- 2.39.5