summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--generic/tkTextIndex.c15
-rw-r--r--tests/textIndex.test12
3 files changed, 29 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index b95588b..8365fc5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-11-?? Francois Vogel <fvogelnew1@free.fr>
+
+ * generic/tkTextIndex.c: [Bug 3588824]: bug in image index handling
+ * tests/textIndex.test: for weird image names
+
2012-11-13 Jan Nijtmans <nijtmans@users.sf.net>
* win/tkWinTest.c: [Bug 3585396]: winDialog.test requires user
diff --git a/generic/tkTextIndex.c b/generic/tkTextIndex.c
index 7cfeaea..714a47d 100644
--- a/generic/tkTextIndex.c
+++ b/generic/tkTextIndex.c
@@ -328,9 +328,10 @@ TkTextGetIndex(interp, textPtr, string, indexPtr)
/*
*---------------------------------------------------------------------
* Stage 1: check to see if the index consists of nothing but a mark
- * name. We do this check now even though it's also done later, in
- * order to allow mark names that include funny characters such as
- * spaces or "+1c".
+ * name, an embedded window or an embedded image. We do this check
+ * now even though it's also done later, in order to allow mark names,
+ * embedded window names or image names that include funny characters
+ * such as spaces or "+1c".
*---------------------------------------------------------------------
*/
@@ -338,6 +339,14 @@ TkTextGetIndex(interp, textPtr, string, indexPtr)
return TCL_OK;
}
+ if (TkTextWindowIndex(textPtr, string, indexPtr) != 0) {
+ return TCL_OK;
+ }
+
+ if (TkTextImageIndex(textPtr, string, indexPtr) != 0) {
+ return TCL_OK;
+ }
+
/*
*------------------------------------------------
* Stage 2: start again by parsing the base index.
diff --git a/tests/textIndex.test b/tests/textIndex.test
index 0337fca..1837e7d 100644
--- a/tests/textIndex.test
+++ b/tests/textIndex.test
@@ -219,9 +219,21 @@ set weirdTag "funny . +- 22.1\n\t{"
set weirdMark "asdf \n{-+ 66.2\t"
.t mark set $weirdMark 4.0
.t tag config y -relief raised
+set weirdImage "foo-1"
+.t image create 2.0 -image [image create photo $weirdImage]
test textIndex-3.1 {TkTextGetIndex, weird mark names} {
list [catch {.t index $weirdMark} msg] $msg
} {0 4.0}
+test textIndex-3.2 {TkTextGetIndex, weird mark names} knownBug {
+ list [catch {.t index "$weirdMark -1char"} msg] $msg
+} {0 4.0}
+test textIndex-3.3 {TkTextGetIndex, weird image names} {
+ list [catch {.t index $weirdImage} msg] $msg
+} {0 2.0}
+test textIndex-3.4 {TkTextGetIndex, weird image names} knownBug {
+ list [catch {.t index "$weirdImage -1char"} msg] $msg
+} {0 2.0}
+.t delete 2.0 ; # remove the weirdImage
test textIndex-4.1 {TkTextGetIndex, tags} {
list [catch {.t index x.first} msg] $msg