Alfredo Braunstein wrote:

> second attempt to have an updateless cursor movement.

Except that I forgot to restrict it to the few LFUNs that need it.
Third attempt.

Alfredo
? PosIterator.C-save
? PosIterator.h-save
? all.diff
? bfs.cpp
? files
? save
? frontends/screen.C-save
Index: cursor.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/cursor.C,v
retrieving revision 1.100
diff -u -p -u -r1.100 cursor.C
--- cursor.C	29 Apr 2004 14:48:59 -0000	1.100
+++ cursor.C	15 May 2004 12:14:25 -0000
@@ -386,14 +386,8 @@ void LCursor::info(std::ostream & os) co
 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;
Index: text3.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text3.C,v
retrieving revision 1.252
diff -u -p -u -r1.252 text3.C
--- text3.C	29 Apr 2004 09:54:57 -0000	1.252
+++ text3.C	15 May 2004 12:14:27 -0000
@@ -382,6 +382,8 @@ void LyXText::dispatch(LCursor & cur, Fu
 	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, Fu
 		break;
 
 	case LFUN_WORDRIGHT:
+		moving = true;
 		if (!cur.mark())
 			cur.clearSelection();
 		if (isRTL(cur.paragraph()))
@@ -437,6 +440,7 @@ void LyXText::dispatch(LCursor & cur, Fu
 		break;
 
 	case LFUN_WORDLEFT:
+		moving = true;
 		if (!cur.mark())
 			cur.clearSelection();
 		if (isRTL(cur.paragraph()))
@@ -461,6 +465,7 @@ void LyXText::dispatch(LCursor & cur, Fu
 		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, Fu
 		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, Fu
 		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, Fu
 		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, Fu
 	}
 
 	case LFUN_UP_PARAGRAPH:
+		moving = true;
 		if (!cur.mark())
 			cur.clearSelection();
 		cursorUpParagraph(cur);
@@ -586,6 +595,7 @@ void LyXText::dispatch(LCursor & cur, Fu
 		break;
 
 	case LFUN_DOWN_PARAGRAPH:
+		moving = true;
 		if (!cur.mark())
 			cur.clearSelection();
 		cursorDownParagraph(cur);
@@ -593,6 +603,7 @@ void LyXText::dispatch(LCursor & cur, Fu
 		break;
 
 	case LFUN_PRIOR:
+		moving = true;
 		if (!cur.mark())
 			cur.clearSelection();
 		finishChange(cur, false);
@@ -605,6 +616,7 @@ void LyXText::dispatch(LCursor & cur, Fu
 		break;
 
 	case LFUN_NEXT:
+		moving = true;
 		if (!cur.mark())
 			cur.clearSelection();
 		finishChange(cur, false);
@@ -1586,6 +1598,14 @@ void LyXText::dispatch(LCursor & cur, Fu
 		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();
 }
 
 

Reply via email to