Martin Vermeer wrote:

> On Fri, Mar 12, 2004 at 03:17:32PM +0200, Martin Vermeer spake thusly:
>> 
>> ...reliably, any inset type, when opening the Document Settings
>> dialog, changing something and pressing OK/Apply.
> 
> Anybody else seeing this?

Solved with the caveman's method.

Alfredo
? ChangeLog-old
? PosIterator.C-save
? PosIterator.h-save
? bfri.C
? safe
? textcursor.C-save
? textcursor.h-save
? insets/insetcollapsable-save.C
? insets/insettext-save.C
Index: BufferView_pimpl.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/BufferView_pimpl.C,v
retrieving revision 1.519
diff -u -p -u -r1.519 BufferView_pimpl.C
--- BufferView_pimpl.C	11 Mar 2004 17:16:23 -0000	1.519
+++ BufferView_pimpl.C	17 Mar 2004 10:21:27 -0000
@@ -374,16 +374,6 @@ void BufferView::Pimpl::resizeCurrentBuf
 {
 	lyxerr[Debug::INFO] << "resizeCurrentBuffer" << endl;
 
-	int par = -1;
-	int selstartpar = -1;
-	int selendpar = -1;
-
-	pos_type pos = 0;
-	pos_type selstartpos = 0;
-	pos_type selendpos = 0;
-	bool sel = false;
-	bool mark_set  = false;
-
 	owner_->busy(true);
 
 	owner_->message(_("Formatting document..."));
@@ -393,36 +383,12 @@ void BufferView::Pimpl::resizeCurrentBuf
 	if (!text)
 		return;
 
-	LCursor & cur = bv_->cursor();
-	par = cur.par();
-	pos = cur.pos();
-	selstartpar = cur.selBegin().par();
-	selstartpos = cur.selBegin().pos();
-	selendpar = cur.selEnd().par();
-	selendpos = cur.selEnd().pos();
-	sel = cur.selection();
-	mark_set = cur.mark();
+	// save the cursor mangled in init
+	LCursor cur = bv_->cursor();
 	text->init(bv_);
 	update();
-
-	if (par != -1) {
-		cur.selection() = true;
-		// At this point just to avoid the Delete-Empty-Paragraph-
-		// Mechanism when setting the cursor.
-		cur.mark() = mark_set;
-		if (sel) {
-			text->setCursor(cur, selstartpar, selstartpos);
-			cur.resetAnchor();
-			text->setCursor(cur, selendpar, selendpos);
-			cur.setSelection();
-			text->setCursor(cur, par, pos);
-		} else {
-			text->setCursor(cur, par, pos);
-			cur.resetAnchor();
-			cur.selection() = false;
-		}
-	}
-
+	bv_->cursor() = cur;
+	bv_->cursor().updatePos();
 	fitCursor();
 
 	switchKeyMap();
Index: text2.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text2.C,v
retrieving revision 1.556
diff -u -p -u -r1.556 text2.C
--- text2.C	11 Mar 2004 17:16:28 -0000	1.556
+++ text2.C	17 Mar 2004 10:21:29 -0000
@@ -94,6 +94,7 @@ void LyXText::init(BufferView * bv)
 	current_font = getFont(beg, 0);
 
 	redoParagraphs(beg, end);
+	// why?
 	bv->cursor().resetAnchor();
 
 	updateCounters();

Reply via email to