diff options
author | vincentdarley <vincentdarley> | 2006-03-18 15:52:12 (GMT) |
---|---|---|
committer | vincentdarley <vincentdarley> | 2006-03-18 15:52:12 (GMT) |
commit | 9cd09caa8af69a036f42dffe2a31f129a881bdb8 (patch) | |
tree | 9d24e3620a06f930d62656e21b95d9eae58b2b30 /generic | |
parent | f04aa73019b758db9a04fc8a5a8cde258e1c3535 (diff) | |
download | tk-9cd09caa8af69a036f42dffe2a31f129a881bdb8.zip tk-9cd09caa8af69a036f42dffe2a31f129a881bdb8.tar.gz tk-9cd09caa8af69a036f42dffe2a31f129a881bdb8.tar.bz2 |
undo/modified and empty string fix
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tkText.c | 32 |
1 files changed, 18 insertions, 14 deletions
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) { |