Alfredo Braunstein wrote: > Sure. Shouldn't be needed at all, as well as a lot of > setCursor(cursor.par(), cursor.pos()) spreaded all around.
See attached. Alfredo
Index: BufferView_pimpl.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/BufferView_pimpl.C,v retrieving revision 1.479 diff -u -r1.479 BufferView_pimpl.C --- BufferView_pimpl.C 15 Dec 2003 11:36:11 -0000 1.479 +++ BufferView_pimpl.C 15 Dec 2003 16:27:19 -0000 @@ -599,7 +599,6 @@ top_y(), top_y() + workarea().workHeight(), beg, end); bv_->text()->redoParagraphs(beg, end); - bv_->getLyXText()->redoCursor(); updateScrollbar(); } screen().redraw(*bv_); Index: lyxtext.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxtext.h,v retrieving revision 1.271 diff -u -r1.271 lyxtext.h --- lyxtext.h 15 Dec 2003 11:36:13 -0000 1.271 +++ lyxtext.h 15 Dec 2003 16:27:24 -0000 @@ -182,8 +182,6 @@ /// reject selected change void rejectChange(); - /// re-computes the cached coordinates in the cursor - void redoCursor(); /// void setCursor(ParagraphList::iterator pit, lyx::pos_type pos); /// returns true if par was empty and was removed Index: text.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text.C,v retrieving revision 1.511 diff -u -r1.511 text.C --- text.C 15 Dec 2003 11:36:13 -0000 1.511 +++ text.C 15 Dec 2003 16:27:27 -0000 @@ -1602,7 +1602,6 @@ void LyXText::fullRebreak() { redoParagraphs(paragraphs().begin(), paragraphs().end()); - redoCursor(); selection.cursor = cursor; } Index: text2.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text2.C,v retrieving revision 1.521 diff -u -r1.521 text2.C --- text2.C 15 Dec 2003 11:36:14 -0000 1.521 +++ text2.C 15 Dec 2003 16:27:31 -0000 @@ -325,7 +325,6 @@ redoParagraphs(start, endpit); updateCounters(); - redoCursor(); } @@ -405,7 +404,6 @@ // this handles the counter labels, and also fixes up // depth values for follow-on (child) paragraphs updateCounters(); - redoCursor(); } @@ -456,7 +454,6 @@ unFreezeUndo(); redoParagraphs(beg, ++end); - redoCursor(); } @@ -541,7 +538,6 @@ if (implicitSelection) { clearSelection(); cursor = resetCursor; - setCursor(cursorPar(), cursor.pos()); selection.cursor = cursor; } } @@ -566,7 +562,6 @@ // Reset cursors to their original position. cursor = reset_cursor; - setCursor(cursorPar(), cursor.pos()); selection.cursor = cursor; // Clear the implicit selection. @@ -621,7 +616,6 @@ } redoParagraphs(getPar(selStart()), endpit); - redoCursor(); } @@ -996,7 +990,6 @@ // need a valid cursor. (Lgb) clearSelection(); - redoCursor(); updateCounters(); } @@ -1052,7 +1045,6 @@ redoParagraphs(cursorPar(), endpit); - setCursor(cursor.par(), cursor.pos()); clearSelection(); selection.cursor = cursor; @@ -1116,7 +1108,6 @@ bv()->buffer()->insertStringAsLines(pit, pos, current_font, str); redoParagraphs(cursorPar(), endpit); - setCursor(cursorPar(), cursor.pos()); selection.cursor = cursor; setCursor(pit, pos); setSelection(); @@ -1166,21 +1157,6 @@ } -void LyXText::redoCursor() -{ - setCursor(cursor, cursor.par(), cursor.pos(), cursor.boundary()); - - if (!selection.set()) - return; - - LyXCursor tmpcursor = cursor; - setCursor(selection.cursor.par(), selection.cursor.pos()); - selection.cursor = cursor; - setCursor(tmpcursor.par(), tmpcursor.pos()); - setSelection(); -} - - void LyXText::setCursor(LyXCursor & cur, paroffset_type par, pos_type pos, bool boundary) { @@ -1603,9 +1579,6 @@ // pagragraph because we erased the last character. if (cur.pos() > getPar(cur)->size()) cur.pos(getPar(cur)->size()); - - // recompute row et al. for this cursor - setCursor(cur, cur.par(), cur.pos(), cur.boundary()); } @@ -1719,9 +1692,6 @@ cursor.par(parOffset(tmppit)); redoParagraph(); - // correct cursor y - setCursorIntern(cursor.par(), cursor.pos()); - if (selection_position_was_oldcursor_position) { // correct selection selection.cursor = cursor; @@ -1733,8 +1703,6 @@ if (old_pit->stripLeadingSpaces()) { redoParagraph(old_pit); - // correct cursor y - setCursorIntern(cursor.par(), cursor.pos()); selection.cursor = cursor; } return false; Index: text3.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text3.C,v retrieving revision 1.196 diff -u -r1.196 text3.C --- text3.C 15 Dec 2003 11:36:15 -0000 1.196 +++ text3.C 15 Dec 2003 16:27:33 -0000 @@ -485,7 +485,6 @@ // we can set the refreshing parameters now updateCounters(); redoParagraph(cursorPar()); - setCursor(cursorPar(), cursor.pos()); bv->update(); break; } @@ -716,7 +715,6 @@ replaceSelection(bv->getLyXText()); insertInset(new InsetNewline); - setCursor(cursorPar(), cursor.pos()); moveCursor(bv, false); break; }