summaryrefslogtreecommitdiffstats
path: root/generic/tkText.c
diff options
context:
space:
mode:
authorpatthoyts@users.sourceforge.net <patthoyts>2006-10-17 10:21:48 (GMT)
committerpatthoyts@users.sourceforge.net <patthoyts>2006-10-17 10:21:48 (GMT)
commit06cc270ccfda24e642bc15d31fed60803f75e8ca (patch)
treef2e3c2358a8814697991e809019215ff5f2b3659 /generic/tkText.c
parentb03d65e9a4c681ef585308ec51cd68755486aae3 (diff)
downloadtk-06cc270ccfda24e642bc15d31fed60803f75e8ca.zip
tk-06cc270ccfda24e642bc15d31fed60803f75e8ca.tar.gz
tk-06cc270ccfda24e642bc15d31fed60803f75e8ca.tar.bz2
generic/tkText.c: Applied suggested patch from #1536735
tests/text.test: Update test for above patch. tests/textWind.test: Corrected test to catch all messages tests/safe.test: Silence spurious win32 failure awaiting TIP150 tests/winDialog.test: Updated test for file name length check. test/winWm.test: Corrected test expectation for menu wrapping.
Diffstat (limited to 'generic/tkText.c')
-rw-r--r--generic/tkText.c38
1 files changed, 21 insertions, 17 deletions
diff --git a/generic/tkText.c b/generic/tkText.c
index 93b8925..ca1626d 100644
--- a/generic/tkText.c
+++ b/generic/tkText.c
@@ -13,7 +13,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkText.c,v 1.70 2006/09/10 17:06:32 das Exp $
+ * RCS: @(#) $Id: tkText.c,v 1.71 2006/10/17 10:21:49 patthoyts Exp $
*/
#include "default.h"
@@ -2956,6 +2956,8 @@ DeleteIndexRange(sharedTextPtr, textPtr, indexPtr1, indexPtr2, viewUpdate)
* are present on the newline that isn't going to be deleted after all
* (this simulates deleting the newline and then adding a "clean" one back
* again).
+ * Note that index1 and index2 might now be equal again which means that
+ * no text will be deleted but tags might be removed.
*/
line1 = TkBTreeLinesTo(textPtr, index1.linePtr);
@@ -3087,27 +3089,29 @@ DeleteIndexRange(sharedTextPtr, textPtr, indexPtr1, indexPtr2, viewUpdate)
}
/*
- * Push the deletion on the undo stack
+ * Push the deletion on the undo stack if something was actually deleted
*/
- if (sharedTextPtr->undo) {
- Tcl_Obj *get;
-
- if (sharedTextPtr->autoSeparators
+ if (TkTextIndexCmp(&index1, &index2) < 0) {
+ if (sharedTextPtr->undo) {
+ Tcl_Obj *get;
+
+ if (sharedTextPtr->autoSeparators
&& (sharedTextPtr->lastEditMode != TK_TEXT_EDIT_DELETE)) {
- TkUndoInsertUndoSeparator(sharedTextPtr->undoStack);
+ TkUndoInsertUndoSeparator(sharedTextPtr->undoStack);
+ }
+
+ sharedTextPtr->lastEditMode = TK_TEXT_EDIT_DELETE;
+
+ get = TextGetText(textPtr, &index1, &index2, 0);
+ TextPushUndoAction(textPtr, get, 0, &index1, &index2);
}
-
- sharedTextPtr->lastEditMode = TK_TEXT_EDIT_DELETE;
-
- get = TextGetText(textPtr, &index1, &index2, 0);
- TextPushUndoAction(textPtr, get, 0, &index1, &index2);
+ UpdateDirtyFlag(sharedTextPtr);
+
+ sharedTextPtr->stateEpoch++;
+
+ TkBTreeDeleteIndexRange(sharedTextPtr->tree, &index1, &index2);
}
- UpdateDirtyFlag(sharedTextPtr);
-
- sharedTextPtr->stateEpoch++;
-
- TkBTreeDeleteIndexRange(sharedTextPtr->tree, &index1, &index2);
resetViewCount = 0;
for (tPtr = sharedTextPtr->peers; tPtr != NULL ; tPtr = tPtr->next) {