diff options
author | fvogel <fvogelnew1@free.fr> | 2017-09-22 20:25:38 (GMT) |
---|---|---|
committer | fvogel <fvogelnew1@free.fr> | 2017-09-22 20:25:38 (GMT) |
commit | 1458a00b54cb96d3b5c8c1743447ea9d999c9300 (patch) | |
tree | 1764946a2be3db94b910f39e0d8537a70fb6e29d | |
parent | e7015e0cf1f85888d04570bdecafe3cc90068ab1 (diff) | |
download | tk-1458a00b54cb96d3b5c8c1743447ea9d999c9300.zip tk-1458a00b54cb96d3b5c8c1743447ea9d999c9300.tar.gz tk-1458a00b54cb96d3b5c8c1743447ea9d999c9300.tar.bz2 |
Fix [dd9667635d]: text anchor not set
-rw-r--r-- | library/text.tcl | 3 | ||||
-rw-r--r-- | tests/text.test | 21 |
2 files changed, 21 insertions, 3 deletions
diff --git a/library/text.tcl b/library/text.tcl index 9eb6e31..645776d 100644 --- a/library/text.tcl +++ b/library/text.tcl @@ -768,6 +768,9 @@ proc ::tk::TextKeySelect {w new} { } $w mark set $anchorname insert } else { + if {[catch {$w index $anchorname}]} { + $w mark set $anchorname insert + } if {[$w compare $new < $anchorname]} { set first $new set last $anchorname diff --git a/tests/text.test b/tests/text.test index 42b6114..6b4a597 100644 --- a/tests/text.test +++ b/tests/text.test @@ -7305,7 +7305,22 @@ test text-35.3 {widget dump -command destroys widget} -setup { } -result {ok} -test text-36.1 "bug #1777362: event handling with hyphenated windows" -setup { +test text-36.1 "bug #dd9667635d: text anchor not set" -setup { + destroy .t + pack [text .t] +} -body { + .t insert end "Hello world!" + .t tag add sel 1.0 end + # this line shall not trigger error: + # bad text index "tk::anchor1" + event generate .t <<SelectPrevLine>> + update +} -cleanup { + destroy .t +} -result {} + + +test text-37.1 "bug #1777362: event handling with hyphenated windows" -setup { proc bgerror {m} {set ::my_error $m} set ::my_error {} pack [set w [text .t-1]] @@ -7318,7 +7333,7 @@ test text-36.1 "bug #1777362: event handling with hyphenated windows" -setup { } -cleanup { destroy .t-1 } -result {} -test text-36.2 "bug #1777362: event handling with hyphenated windows" -setup { +test text-37.2 "bug #1777362: event handling with hyphenated windows" -setup { proc bgerror {m} {set ::my_error $m} set ::my_error {} pack [set w [text .t+1]] @@ -7331,7 +7346,7 @@ test text-36.2 "bug #1777362: event handling with hyphenated windows" -setup { } -cleanup { destroy $w } -result {} -test text-36.3 "bug #1777362: event handling with hyphenated windows" -setup { +test text-37.3 "bug #1777362: event handling with hyphenated windows" -setup { proc bgerror {m} {set ::my_error $m} set ::my_error {} pack [set w [text .t*1]] |