Andre Poenitz wrote:
> That's ok.

OK, then here returns my modified patch from yesterday which had already these 
changes. Please apply if there are no further objections.

Thanks,
Jürgen.
Index: src/ChangeLog
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/ChangeLog,v
retrieving revision 1.1381
diff -u -r1.1381 ChangeLog
--- src/ChangeLog	2003/06/17 15:33:45	1.1381
+++ src/ChangeLog	2003/06/17 16:36:07
@@ -1,3 +1,8 @@
+2003-06-16  Juergen Spitzmueller  <[EMAIL PROTECTED]>
+
+	* text3.C: introduce function overwriteSelection() and use it
+	to delete selections in some cases (bugs 673, 702, 954).
+
 2003-06-17  Lars Gullik Bjønnes  <[EMAIL PROTECTED]>

 	* text3.C (dispatch): handle arg to LFUN_PASTE, call
Index: src/text3.C
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/text3.C,v
retrieving revision 1.81
diff -u -r1.81 text3.C
--- src/text3.C	2003/06/17 15:33:47	1.81
+++ src/text3.C	2003/06/17 16:36:12
@@ -138,6 +138,15 @@
 		return inset;
 	}
 
+	void overwriteSelection(LyXText * lt)
+	{
+		if (lt->selection.set()) {
+			lt->update();
+			lt->cutSelection(true, false);
+			lt->update();
+		}
+	}
+
 } // anon namespace
 
 
@@ -366,6 +375,7 @@
 {
 	lt->update();
 	InsetSpecialChar * new_inset = new InsetSpecialChar(kind);
+	overwriteSelection(lt);
 	if (!bv->insertInset(new_inset))
 		delete new_inset;
 	else
@@ -721,6 +731,8 @@
 			break;
 
 		bv->beforeChange(this);
+		// FIXME: WTF doesn't this work?
+		// overwriteSelection(bv->getLyXText());
 		insertInset(new InsetNewline);
 		update();
 		setCursor(cursor.par(), cursor.pos());
@@ -831,6 +843,8 @@
 
 	case LFUN_BREAKPARAGRAPH:
 		bv->beforeChange(this);
+		// FIXME: WTF doesn't this work?
+		// overwriteSelection(bv->getLyXText());
 		breakParagraph(bv->buffer()->paragraphs, 0);
 		update();
 		selection.cursor = cursor;
@@ -840,6 +854,8 @@
 
 	case LFUN_BREAKPARAGRAPHKEEPLAYOUT:
 		bv->beforeChange(this);
+		// FIXME: WTF doesn't this work?
+		// overwriteSelection(bv->getLyXText());
 		breakParagraph(bv->buffer()->paragraphs, 1);
 		update();
 		selection.cursor = cursor;
@@ -853,6 +869,8 @@
 		// Otherwise, do the same as LFUN_BREAKPARAGRAPH.
 		LyXCursor cur = cursor;
 		bv->beforeChange(this);
+		// FIXME: WTF doesn't this work?
+		// overwriteSelection(bv->getLyXText());
 		if (cur.pos() == 0) {
 			if (cur.par()->params().spaceTop() == VSpace(VSpace::NONE)) {
 				setParagraph(
@@ -1023,6 +1041,7 @@
 
 	case LFUN_PASTE: {
 		cmd.message(_("Paste"));
+		overwriteSelection(bv->getLyXText());
 		// clear the selection
 		bv->toggleSelection();
 		clearSelection();
@@ -1195,6 +1214,7 @@
 	}
 
 	case LFUN_QUOTE: {
+		overwriteSelection(bv->getLyXText());
 		ParagraphList::iterator pit = cursor.par();
 		lyx::pos_type pos = cursor.pos();
 		char c;
@@ -1216,6 +1236,7 @@
 	}
 
 	case LFUN_DATE_INSERT: {
+		overwriteSelection(bv->getLyXText());
 		time_t now_time_t = time(NULL);
 		struct tm * now_tm = localtime(&now_time_t);
 		setlocale(LC_TIME, "");

Reply via email to