diff options
author | fvogel <fvogelnew1@free.fr> | 2012-12-03 01:23:46 (GMT) |
---|---|---|
committer | fvogel <fvogelnew1@free.fr> | 2012-12-03 01:23:46 (GMT) |
commit | 82b9f9d366526e6f6665fff5d223ba9b8bc5de98 (patch) | |
tree | 236bce19c4dd6a7a0c46977f608dc42d1f17fb64 | |
parent | 0b6e717a44dff02a2ce046473bbe798a8e07d6c9 (diff) | |
parent | 19fbc8aec9cd206f6df2611aa7a553599f3e5931 (diff) | |
download | tk-82b9f9d366526e6f6665fff5d223ba9b8bc5de98.zip tk-82b9f9d366526e6f6665fff5d223ba9b8bc5de98.tar.gz tk-82b9f9d366526e6f6665fff5d223ba9b8bc5de98.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 |