summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2015-07-16 20:10:29 (GMT)
committerfvogel <fvogelnew1@free.fr>2015-07-16 20:10:29 (GMT)
commit669cc3928e2e48f9ebb7accede7444184fa9d3bf (patch)
treeb45bd599479b6052ba807693fb4557ac967b0907
parent1ceae426adc5b03ca14c112531356d7d936865ec (diff)
parent9e9425e69824f6b7441eada0cfa96198bd0a1926 (diff)
downloadtk-669cc3928e2e48f9ebb7accede7444184fa9d3bf.zip
tk-669cc3928e2e48f9ebb7accede7444184fa9d3bf.tar.gz
tk-669cc3928e2e48f9ebb7accede7444184fa9d3bf.tar.bz2
Fixed bug [2886436fff] - [.txt] deletes before start index - by appyling the patch proposed in the ticket: no deletion will ever happen before the start index anymore
-rw-r--r--generic/tkText.c12
-rw-r--r--tests/text.test3
-rw-r--r--tests/textDisp.test8
3 files changed, 9 insertions, 14 deletions
diff --git a/generic/tkText.c b/generic/tkText.c
index c0d0dc2..d93d8fc 100644
--- a/generic/tkText.c
+++ b/generic/tkText.c
@@ -3022,11 +3022,9 @@ DeleteIndexRange(
* 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
- * 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
+ * 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
* means that no text will be deleted but tags might be removed.
*/
@@ -3041,10 +3039,6 @@ DeleteIndexRange(
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++) {
diff --git a/tests/text.test b/tests/text.test
index d8d01a0..0a481de 100644
--- a/tests/text.test
+++ b/tests/text.test
@@ -3498,9 +3498,10 @@ Line 4"
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
diff --git a/tests/textDisp.test b/tests/textDisp.test
index aed842c..dbfeb95 100644
--- a/tests/textDisp.test
+++ b/tests/textDisp.test
@@ -653,7 +653,7 @@ test textDisp-4.9 {UpdateDisplayInfo, filling in extra vertical space} {textfont
update
.t delete 15.0 end
list [.t bbox 7.0] [.t bbox 12.0]
-} [list [list 3 [expr {2*$fixedDiff + 29}] 7 $fixedHeight] [list 3 [expr {7*$fixedDiff + 94}] 7 $fixedHeight]]
+} [list [list 3 [expr {2*$fixedDiff + 14}] 7 $fixedHeight] [list 3 [expr {7*$fixedDiff + 79}] 7 $fixedHeight]]
test textDisp-4.10 {UpdateDisplayInfo, filling in extra vertical space} {
.t delete 1.0 end
.t insert end "1\n2\n3\n4\n5\nLine 6 is such a long line that it wraps around.\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17"
@@ -662,7 +662,7 @@ test textDisp-4.10 {UpdateDisplayInfo, filling in extra vertical space} {
.t delete 13.0 end
update
list [.t index @0,0] $tk_textRelayout $tk_textRedraw
-} {5.0 {12.0 7.0 6.40 6.20 6.0 5.0} {5.0 6.0 6.20 6.40 7.0 12.0}}
+} {6.0 {13.0 7.0 6.40 6.20 6.0} {6.0 6.20 6.40 7.0 13.0}}
test textDisp-4.11 {UpdateDisplayInfo, filling in extra vertical space} {
.t delete 1.0 end
.t insert end "1\n2\n3\n4\n5\nLine 6 is such a long line that it wraps around, not once but really quite a few times.\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17"
@@ -671,7 +671,7 @@ test textDisp-4.11 {UpdateDisplayInfo, filling in extra vertical space} {
.t delete 14.0 end
update
list [.t index @0,0] $tk_textRelayout $tk_textRedraw
-} {6.40 {13.0 7.0 6.80 6.60 6.40} {6.40 6.60 6.80 7.0 13.0}}
+} {6.60 {14.0 7.0 6.80 6.60} {6.60 6.80 7.0 14.0}}
test textDisp-4.12 {UpdateDisplayInfo, filling in extra vertical space} {
.t delete 1.0 end
.t insert end "1\n2\n3\n4\n5\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16"
@@ -3659,7 +3659,7 @@ test textDisp-28.1 {"yview" option with bizarre scroll command} {
set result [.t2.t index @0,0]
update
lappend result [.t2.t index @0,0]
-} {6.0 1.0}
+} {6.0 2.0}
test textDisp-29.1 {miscellaneous: lines wrap but are still too long} {textfonts} {
catch {destroy .t2}