http://bugzilla.lyx.org/show_bug.cgi?id=1799
cut of text in a table cell always cuts the whole cell

The attached patch fixes this.
Martin, this also fixes the ERT generation problem.

Furthermore, it brings back middle mouse button pasting in tabular.

OK to apply?

Jürgen
Index: insettabular.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insettabular.C,v
retrieving revision 1.455
diff -u -r1.455 insettabular.C
--- insettabular.C	13 Mar 2005 10:36:41 -0000	1.455
+++ insettabular.C	13 Mar 2005 11:15:47 -0000
@@ -455,8 +455,11 @@
 			break;
 		}
 
-		//if (cmd.button() == mouse_button::button2)
-		//	dispatch(cur, FuncRequest(LFUN_PASTESELECTION, "paragraph"));
+		if (cmd.button() == mouse_button::button2) {
+			cmd = FuncRequest(LFUN_PASTESELECTION, "paragraph");
+			cell(cur.idx())->dispatch(cur, cmd);
+			break;
+		}
 
 		// we'll pop up the table dialog on release
 		if (cmd.button() == mouse_button::button3)
@@ -623,10 +626,14 @@
 	}
 
 	case LFUN_CUT:
-		if (copySelection(cur)) {
-			recordUndo(cur, Undo::DELETE);
-			cutSelection(cur);
+		if (tablemode(cur)) {
+			if (copySelection(cur)) {
+				recordUndo(cur, Undo::DELETE);
+				cutSelection(cur);
+			}
 		}
+		else
+			cell(cur.idx())->dispatch(cur, cmd);
 		break;
 
 	case LFUN_BACKSPACE:
@@ -641,8 +648,11 @@
 	case LFUN_COPY:
 		if (!cur.selection())
 			break;
-		finishUndo();
-		copySelection(cur);
+		if (tablemode(cur)) {
+			finishUndo();
+			copySelection(cur);
+		} else
+			cell(cur.idx())->dispatch(cur, cmd);
 		break;
 
 	case LFUN_PASTESELECTION: {

Reply via email to