summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvincentdarley <vincentdarley>2006-03-18 15:52:12 (GMT)
committervincentdarley <vincentdarley>2006-03-18 15:52:12 (GMT)
commit9cd09caa8af69a036f42dffe2a31f129a881bdb8 (patch)
tree9d24e3620a06f930d62656e21b95d9eae58b2b30
parentf04aa73019b758db9a04fc8a5a8cde258e1c3535 (diff)
downloadtk-9cd09caa8af69a036f42dffe2a31f129a881bdb8.zip
tk-9cd09caa8af69a036f42dffe2a31f129a881bdb8.tar.gz
tk-9cd09caa8af69a036f42dffe2a31f129a881bdb8.tar.bz2
undo/modified and empty string fix
-rw-r--r--ChangeLog5
-rw-r--r--generic/tkText.c32
2 files changed, 23 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index d30a688..b20829a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2006-03-18 Vince Darley <vincentdarley@users.sourceforge.net>
+
+ * generic/tkText.c: fix for undo/modified status of text
+ widgets when empty strings are inserted and undone.
+
2006-03-17 Pat Thoyts <patthoyts@users.sourceforge.net>
* library/clrpick.tcl: bug #1451587: avoid using abbreviated
diff --git a/generic/tkText.c b/generic/tkText.c
index f99ce02..7b8586f 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.64 2005/11/27 02:36:14 das Exp $
+ * RCS: @(#) $Id: tkText.c,v 1.65 2006/03/18 15:52:32 vincentdarley Exp $
*/
#include "default.h"
@@ -2548,24 +2548,28 @@ InsertChars(sharedTextPtr, textPtr, indexPtr, stringPtr, viewUpdate)
TkBTreeInsertChars(sharedTextPtr->tree, indexPtr, string);
/*
- * Push the insertion on the undo stack
+ * Push the insertion on the undo stack, and update
+ * the modified status of the widget
*/
- if (sharedTextPtr->undo) {
- TkTextIndex toIndex;
-
- if (sharedTextPtr->autoSeparators &&
- sharedTextPtr->lastEditMode != TK_TEXT_EDIT_INSERT) {
- TkUndoInsertUndoSeparator(sharedTextPtr->undoStack);
+ if (length > 0) {
+ if (sharedTextPtr->undo) {
+ TkTextIndex toIndex;
+
+ if (sharedTextPtr->autoSeparators &&
+ sharedTextPtr->lastEditMode != TK_TEXT_EDIT_INSERT) {
+ TkUndoInsertUndoSeparator(sharedTextPtr->undoStack);
+ }
+
+ sharedTextPtr->lastEditMode = TK_TEXT_EDIT_INSERT;
+
+ TkTextIndexForwBytes(textPtr, indexPtr, length, &toIndex);
+ TextPushUndoAction(textPtr, stringPtr, 1, indexPtr, &toIndex);
}
- sharedTextPtr->lastEditMode = TK_TEXT_EDIT_INSERT;
-
- TkTextIndexForwBytes(textPtr, indexPtr, length, &toIndex);
- TextPushUndoAction(textPtr, stringPtr, 1, indexPtr, &toIndex);
+ UpdateDirtyFlag(sharedTextPtr);
}
-
- UpdateDirtyFlag(sharedTextPtr);
+
resetViewCount = 0;
for (tPtr = sharedTextPtr->peers; tPtr != NULL ; tPtr = tPtr->next) {