diff options
author | patthoyts <patthoyts@users.sourceforge.net> | 2006-10-17 10:21:48 (GMT) |
---|---|---|
committer | patthoyts <patthoyts@users.sourceforge.net> | 2006-10-17 10:21:48 (GMT) |
commit | e58a5fcd90ad9607b9357a1c82417e651ad8ae18 (patch) | |
tree | f2e3c2358a8814697991e809019215ff5f2b3659 /generic | |
parent | df7092fbb134cfbb28d68c0deca1a6241df8ca02 (diff) | |
download | tk-e58a5fcd90ad9607b9357a1c82417e651ad8ae18.zip tk-e58a5fcd90ad9607b9357a1c82417e651ad8ae18.tar.gz tk-e58a5fcd90ad9607b9357a1c82417e651ad8ae18.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')
-rw-r--r-- | generic/tkText.c | 38 |
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) { |