diff options
author | fvogelnew1@free.fr <fvogel> | 2012-12-03 01:23:46 (GMT) |
---|---|---|
committer | fvogelnew1@free.fr <fvogel> | 2012-12-03 01:23:46 (GMT) |
commit | 560c9f8f8cdb52de605cac4f91c0ad66f1cca204 (patch) | |
tree | 236bce19c4dd6a7a0c46977f608dc42d1f17fb64 | |
parent | 69c55bc6ba8daea94db4f07d448e28ba1970a0f2 (diff) | |
parent | 81a8a6972a67ff1ac3f88597cf0e5b72b48d8bb7 (diff) | |
download | tk-560c9f8f8cdb52de605cac4f91c0ad66f1cca204.zip tk-560c9f8f8cdb52de605cac4f91c0ad66f1cca204.tar.gz tk-560c9f8f8cdb52de605cac4f91c0ad66f1cca204.tar.bz2 |
[Bug 3588824]: bug in image index handling for weird image names
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | generic/tkTextIndex.c | 15 | ||||
-rw-r--r-- | tests/textIndex.test | 22 |
3 files changed, 39 insertions, 3 deletions
@@ -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..885ed8e 100644 --- a/tests/textIndex.test +++ b/tests/textIndex.test @@ -219,9 +219,31 @@ 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.1 -image [image create photo $weirdImage] +set weirdEmbWin ".t.bar-1" +entry $weirdEmbWin +.t window create 3.1 -window $weirdEmbWin 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 embedded window names} { + list [catch {.t index $weirdEmbWin} msg] $msg +} {0 3.1} +test textIndex-3.4 {TkTextGetIndex, weird embedded window names} knownBug { + list [catch {.t index "$weirdEmbWin -1char"} msg] $msg +} {0 3.0} +test textIndex-3.5 {TkTextGetIndex, weird image names} { + list [catch {.t index $weirdImage} msg] $msg +} {0 2.1} +test textIndex-3.6 {TkTextGetIndex, weird image names} knownBug { + list [catch {.t index "$weirdImage -1char"} msg] $msg +} {0 2.0} +.t delete 3.1 ; # remove the weirdEmbWin +.t delete 2.1 ; # remove the weirdImage test textIndex-4.1 {TkTextGetIndex, tags} { list [catch {.t index x.first} msg] $msg |