>>>>> "Joost" == Joost Verburg <[EMAIL PROTECTED]> writes:

Joost> Jean-Marc Lasgouttes wrote:
>> I committed the cutSelection part (see cutsel.diff). The remaining
>> part is attached. Note that I changed the font-changing stuff to
>> use a temporary cursor so that there is no need to restore the
>> original selection. Does that seem reasonable?

Joost> Yes. No crashes or weird behavior anymore.

OK, I applied tablefont.diff (below) and all that remains is the paste
part. I did not apply it yet because I am not sure it is the right
patch (resets cursor). Is it really important?

JMarc

Index: src/insets/insettabular.C
===================================================================
--- src/insets/insettabular.C	(revision 15096)
+++ src/insets/insettabular.C	(working copy)
@@ -728,27 +728,22 @@ void InsetTabular::doDispatch(LCursor & 
 			row_type rs, re;
 			col_type cs, ce;
 			getSelection(cur, rs, re, cs, ce);
+			LCursor tmpcur = cur;
 			for (row_type i = rs; i <= re; ++i) {
 				for (col_type j = cs; j <= ce; ++j) {
 					// cursor follows cell:
-					cur.idx() = tabular.getCellNumber(i, j);
+					tmpcur.idx() = tabular.getCellNumber(i, j);
 					// select this cell only:
-					cur.pos() = 0;
-					cur.resetAnchor();
-					cur.pos() = cur.top().lastpos();
-					cur.setCursor(cur);
-					cur.setSelection();
-					cell(cur.idx())->dispatch(cur, cmd);
+					tmpcur.pit() = 0;
+					tmpcur.pos() = 0;
+					tmpcur.resetAnchor();
+					tmpcur.pit() = tmpcur.lastpit();
+					tmpcur.pos() = tmpcur.top().lastpos();
+					tmpcur.setCursor(tmpcur);
+					tmpcur.setSelection();
+					cell(tmpcur.idx())->dispatch(tmpcur, cmd);
 				}
 			}
-			// Restore original selection
-			cur.idx() = tabular.getCellNumber(rs, cs);
-			cur.pos() = 0;
-			cur.resetAnchor();
-			cur.idx() = tabular.getCellNumber(re, ce);
-			cur.pos() = cur.top().lastpos();
-			cur.setCursor(cur);
-			cur.setSelection();
 			break;
 		} else {
 			cell(cur.idx())->dispatch(cur, cmd);
Index: src/insets/insettabular.C
===================================================================
--- src/insets/insettabular.C	(revision 15086)
+++ src/insets/insettabular.C	(working copy)
@@ -684,7 +684,10 @@ void InsetTabular::doDispatch(LCursor & 
 			if (insertAsciiString(cur.bv(), clip, false)) {
 				// content has been replaced,
 				// so cursor might be invalid
-				cur.pos() = cur.lastpos();
+				if (cur.pit() > cur.lastpit())
+					cur.pit() = cur.lastpit();
+				if (cur.pos() > cur.lastpos())
+					cur.pos() = cur.lastpos();
 				bvcur.setCursor(cur);
 				break;
 			}

Reply via email to