summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorculler <culler>2019-10-25 03:12:39 (GMT)
committerculler <culler>2019-10-25 03:12:39 (GMT)
commit86e70bdd43b53d05c78b4709c42753e464bb3fec (patch)
treee0fc60636953b587130820d3dddfe02a997d4d93
parentc9c3c73d09cd696f710a5c6bfd731d9cdb243276 (diff)
downloadtk-86e70bdd43b53d05c78b4709c42753e464bb3fec.zip
tk-86e70bdd43b53d05c78b4709c42753e464bb3fec.tar.gz
tk-86e70bdd43b53d05c78b4709c42753e464bb3fec.tar.bz2
Add some protections against Tcl errors during IME text entry.
-rw-r--r--library/entry.tcl6
-rw-r--r--library/text.tcl8
-rw-r--r--library/ttk/entry.tcl6
3 files changed, 16 insertions, 4 deletions
diff --git a/library/entry.tcl b/library/entry.tcl
index 2c72fee..2aab934 100644
--- a/library/entry.tcl
+++ b/library/entry.tcl
@@ -278,7 +278,11 @@ bind Entry <<TkStartIMEMarkedText>> {
dict set ::tk::Priv(IMETextMark) "%W" [%W index insert]
}
bind Entry <<TkEndIMEMarkedText>> {
- %W selection range [dict get $::tk::Priv(IMETextMark) "%W"] insert
+ if { [catch {dict get $::tk::Priv(IMETextMark) "%W"} mark] } {
+ bell
+ } else {
+ %W selection range $mark insert
+ }
}
bind Entry <<TkClearIMEMarkedText>> {
%W delete [dict get $::tk::Priv(IMETextMark) "%W"] [%W index insert]
diff --git a/library/text.tcl b/library/text.tcl
index e1130a4..bdfb78e 100644
--- a/library/text.tcl
+++ b/library/text.tcl
@@ -397,8 +397,12 @@ bind Text <<TkStartIMEMarkedText>> {
dict set ::tk::Priv(IMETextMark) "%W" [%W index insert]
}
bind Text <<TkEndIMEMarkedText>> {
- %W tag add IMEmarkedtext [dict get $::tk::Priv(IMETextMark) "%W"] insert
- %W tag configure IMEmarkedtext -underline on
+ if { [catch {dict get $::tk::Priv(IMETextMark) "%W"} mark] } {
+ bell
+ } else {
+ %W tag add IMEmarkedtext $mark insert
+ %W tag configure IMEmarkedtext -underline on
+ }
}
bind Text <<TkClearIMEMarkedText>> {
%W delete IMEmarkedtext.first IMEmarkedtext.last
diff --git a/library/ttk/entry.tcl b/library/ttk/entry.tcl
index 7bca47f..0a61ffa 100644
--- a/library/ttk/entry.tcl
+++ b/library/ttk/entry.tcl
@@ -151,7 +151,11 @@ bind TEntry <<TkStartIMEMarkedText>> {
dict set ::tk::Priv(IMETextMark) "%W" [%W index insert]
}
bind TEntry <<TkEndIMEMarkedText>> {
- %W selection range [dict get $::tk::Priv(IMETextMark) "%W"] insert
+ if { [catch {dict get $::tk::Priv(IMETextMark) "%W"} mark] } {
+ bell
+ } else {
+ %W selection range $mark insert
+ }
}
bind TEntry <<TkClearIMEMarkedText>> {
%W delete [dict get $::tk::Priv(IMETextMark) "%W"] [%W index insert]