summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2012-01-19 05:43:46 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2012-01-19 05:43:46 (GMT)
commit2931e05764b25ec1ac949a503b9691b1b7391793 (patch)
tree648d9de77846c88ee5a8cf4b10dcb05107aac3a8
parentb2c383f4b4e1df4ee9393ca65a9ba551753739a7 (diff)
parent7657ba2c549606f98734f4172266dc110fbecaa5 (diff)
downloadtk-2931e05764b25ec1ac949a503b9691b1b7391793.zip
tk-2931e05764b25ec1ac949a503b9691b1b7391793.tar.gz
tk-2931e05764b25ec1ac949a503b9691b1b7391793.tar.bz2
[Bug-3021557]: Moving the cursor in elided text freezes Tk
-rw-r--r--ChangeLog5
-rw-r--r--generic/tkText.c14
-rw-r--r--tests/text.test15
3 files changed, 23 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index 5b78697..c6b35ca 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-01-19 Francois Vogel <fvogelnew1@free.fr>
+
+ * generic/tkText.c: [Bug-3021557]: Moving the cursor in
+ * tests/text.test: elided text freezes Tk
+
2011-11-22 Jan Nijtmans <nijtmans@users.sf.net>
* doc/wish.1: Use the same shebang comment everywhere.
diff --git a/generic/tkText.c b/generic/tkText.c
index 187be65..d4bc065 100644
--- a/generic/tkText.c
+++ b/generic/tkText.c
@@ -907,7 +907,7 @@ TextWidgetObjCmd(
* We're going to count up all display lines in the logical
* line of 'indexFromPtr' up to, but not including the logical
* line of 'indexToPtr', and then subtract off what we didn't
- * what from 'from' and add on what we didn't count from 'to.
+ * want from 'from' and add on what we didn't count from 'to.
*/
while (index.linePtr != indexToPtr->linePtr) {
@@ -916,17 +916,9 @@ TextWidgetObjCmd(
/*
* We might have skipped past indexToPtr, if we have
* multiple logical lines in a single display line.
- * Therefore we iterate through each intermediate logical
- * line, just to check. Another approach would be just to
- * use TkTextIndexCmp on every while() iteration, but that
- * would be less efficient.
*/
-
- while (fromPtr != index.linePtr) {
- fromPtr = TkBTreeNextLine(textPtr, fromPtr);
- if (fromPtr == indexToPtr->linePtr) {
- break;
- }
+ if (TkTextIndexCmp(&index,indexToPtr) > 0) {
+ break;
}
}
diff --git a/tests/text.test b/tests/text.test
index 17fcf29..44a3065 100644
--- a/tests/text.test
+++ b/tests/text.test
@@ -684,6 +684,21 @@ test text-9.2.43 {TextWidgetCmd procedure, "count" option} {
.t count -lines -chars -indices -displaylines 1.0 end
} {3 903 903 45}
.t configure -wrap none
+test text-9.2.44 {TextWidgetCmd procedure, "count" option} -setup {
+ .t delete 1.0 end
+ update
+ set res {}
+} -body {
+ .t insert end "Line 1 - This is Line 1\n"
+ .t insert end "Line 2 - This is Line 2\n"
+ .t insert end "Line 3 - This is Line 3\n"
+ .t insert end "Line 4 - This is Line 4\n"
+ .t insert end "Line 5 - This is Line 5\n"
+ lappend res [.t count -displaylines 1.19 3.24] [.t count -displaylines 1.0 end]
+ .t tag add hidden 2.9 3.17
+ .t tag configure hidden -elide true
+ lappend res [.t count -displaylines 1.19 3.24] [.t count -displaylines 1.0 end]
+} -result {2 6 2 5}
# Newer tags are higher priority
.t tag configure elide1 -elide 0