diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2021-09-24 15:01:44 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2021-09-24 15:01:44 (GMT) |
commit | 4af4b242bba3b66fc9db8237966ca8e90d26c094 (patch) | |
tree | 3dc0c5839dad28e524b6bdf19782f34ed6c0b7fc /library/entry.tcl | |
parent | a977ccf930aad868900cecb481c5fe028a08f578 (diff) | |
download | tk-4af4b242bba3b66fc9db8237966ca8e90d26c094.zip tk-4af4b242bba3b66fc9db8237966ca8e90d26c094.tar.gz tk-4af4b242bba3b66fc9db8237966ca8e90d26c094.tar.bz2 |
Make IME bindings not leak into global variables
Diffstat (limited to 'library/entry.tcl')
-rw-r--r-- | library/entry.tcl | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/library/entry.tcl b/library/entry.tcl index 99f6eb4..1af9e65 100644 --- a/library/entry.tcl +++ b/library/entry.tcl @@ -276,11 +276,7 @@ bind Entry <<TkStartIMEMarkedText>> { dict set ::tk::Priv(IMETextMark) "%W" [%W index insert] } bind Entry <<TkEndIMEMarkedText>> { - if {[catch {dict get $::tk::Priv(IMETextMark) "%W"} mark]} { - bell - } else { - %W selection range $mark insert - } + ::tk::EntryEndIMEMarkedText %W } bind Entry <<TkClearIMEMarkedText>> { %W delete [dict get $::tk::Priv(IMETextMark) "%W"] [%W index insert] @@ -289,6 +285,23 @@ bind Entry <<TkAccentBackspace>> { tk::EntryBackspace %W } +# ::tk::EntryEndIMEMarkedText -- +# Handles input method text marking in an entry +# +# Arguments: +# w - The entry window. + +proc ::tk::EntryEndIMEMarkedText {w} { + variable Priv + if {[catch { + set mark [dict get $Priv(IMETextMark) $w] + }]} { + bell + return + } + $w selection range $mark insert +} + # A few additional bindings of my own. bind Entry <Button-2> { |