Attachment "textdelete.patch" to
ticket [2886436f]
added by
danckaert
2009-10-26 19:01:37.
Index: generic/tkText.c
===================================================================
RCS file: /cvsroot/tktoolkit/tk/generic/tkText.c,v
retrieving revision 1.92
diff -u -r1.92 tkText.c
--- generic/tkText.c 22 Oct 2009 21:36:24 -0000 1.92
+++ generic/tkText.c 26 Oct 2009 11:53:40 -0000
@@ -2979,9 +2979,7 @@
* The code below is ugly, but it's needed to make sure there is always a
* dummy empty line at the end of the text. If the final newline of the
* file (just before the dummy line) is being deleted, then back up index
- * to just before the newline. If there is a newline just before the first
- * character being deleted, then back up the first index too, so that an
- * even number of lines gets deleted. Furthermore, remove any tags that
+ * to just before the newline. Furthermore, remove any tags that
* 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
@@ -2998,10 +2996,6 @@
oldIndex2 = index2;
TkTextIndexBackChars(NULL, &oldIndex2, 1, &index2, COUNT_INDICES);
line2--;
- if ((index1.byteIndex == 0) && (line1 != 0)) {
- TkTextIndexBackChars(NULL, &index1, 1, &index1, COUNT_INDICES);
- line1--;
- }
arrayPtr = TkBTreeGetTags(&index2, NULL, &arraySize);
if (arrayPtr != NULL) {
for (i = 0; i < arraySize; i++) {
Index: tests/text.test
===================================================================
RCS file: /cvsroot/tktoolkit/tk/tests/text.test,v
retrieving revision 1.55
diff -u -r1.55 text.test
--- tests/text.test 22 Oct 2009 21:36:24 -0000 1.55
+++ tests/text.test 26 Oct 2009 11:53:46 -0000
@@ -3424,9 +3424,10 @@
list [.t tag ranges sel] [.t get 1.0 end]
} -cleanup {
destroy .t
-} -result {{1.0 3.5} {Line 1
+} -result {{1.0 4.0} {Line 1
abcde
12345
+
}}
test text-19.9 {DeleteChars procedure} -body {
text .t