Jean-Marc Lasgouttes wrote:
> Just that the user does not expect that the clipboard is modified.
> There should not be any clipboard modification without an explicit
> cut/copy.

Well then how about this? (As I said, the current implementation is more 
confusing than helpful).

> The solution would be to modify CutAndPaste to allow an alternative
> temporary clipboard, but this is probably a lot of work.

Certainly no work for me.

Regards,
Jürgen.

P.S.: For the sake of power users, I vote for the possibility to add a "Don't 
ask again" checkbox to the Alert dialogs.
Index: src/text3.C
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/text3.C,v
retrieving revision 1.76
diff -u -r1.76 text3.C
--- src/text3.C	2003/05/27 17:29:01	1.76
+++ src/text3.C	2003/05/28 06:58:34
@@ -27,6 +27,7 @@
 #include "box.h"
 #include "language.h"
 #include "support/tostr.h"
+#include "frontends/Alert.h"
 #include "frontends/LyXView.h"
 #include "frontends/screen.h"
 #include "frontends/Dialogs.h"
@@ -365,6 +366,8 @@
 {
 	lt->update();
 	InsetSpecialChar * new_inset = new InsetSpecialChar(kind);
+	if (lt->selection.set())
+		lt->cutSelection(true, false);
 	if (!bv->insertInset(new_inset))
 		delete new_inset;
 	else
@@ -379,18 +382,28 @@
 	BufferView * bv = cmd.view();
 
 	if (inset) {
-		bool gotsel = false;
-		if (lt->selection.set()) {
-			lt->cutSelection(true, false);
-			gotsel = true;
+		bool use_clipboard = false;
+		if (lt->selection.set() && pastesel) {
+			string const inset_name = inset->getInsetName();
+			string text = bformat(_("Do you want to insert the selected text into\n"
+				"the %1$s inset (using the clipboard)?"), inset_name);
+			int const ret = Alert::prompt(_("Paste selection to inset?"),
+				text, 1, 1, _("&Insert"), _("&Don't insert"));
+			if (ret == 0) {
+				use_clipboard = true;
+				bv->owner()->dispatch(FuncRequest(LFUN_CUT));
+			} else
+				bv->owner()->dispatch(FuncRequest(LFUN_DELETE));
+		} else if (lt->selection.set() && !pastesel) {
+				bv->owner()->dispatch(FuncRequest(LFUN_DELETE));
 		}
 		if (bv->insertInset(inset)) {
 			if (edit) {
 				FuncRequest cmd(bv, LFUN_INSET_EDIT, "left");
 				inset->localDispatch(cmd);
 			}
-			if (gotsel && pastesel)
-				bv->owner()->dispatch(FuncRequest(LFUN_PASTESELECTION));
+			if (use_clipboard)
+					bv->owner()->dispatch(FuncRequest(LFUN_PASTE));
 		}
 		else
 			delete inset;
@@ -736,7 +749,7 @@
 			// just comment out the line below...
 		} else {
 			update();
-			cutSelection(bv, true);
+			cutSelection(true, false);
 			update();
 		}
 		moveCursorUpdate(bv, false);

Reply via email to