summaryrefslogtreecommitdiffstats
path: root/library
diff options
context:
space:
mode:
authorculler <culler>2019-10-22 23:17:56 (GMT)
committerculler <culler>2019-10-22 23:17:56 (GMT)
commit700099a55b64bc25128a2287a8cdd7f9655f89af (patch)
treea0608c806be994093f8cd7d06be677515ad30598 /library
parent650e19c98ffa1384bee8bf2237a85cd524532ea1 (diff)
downloadtk-700099a55b64bc25128a2287a8cdd7f9655f89af.zip
tk-700099a55b64bc25128a2287a8cdd7f9655f89af.tar.gz
tk-700099a55b64bc25128a2287a8cdd7f9655f89af.tar.bz2
More progress on implementing IME
Diffstat (limited to 'library')
-rw-r--r--library/entry.tcl12
-rw-r--r--library/text.tcl13
-rw-r--r--library/tk.tcl3
3 files changed, 28 insertions, 0 deletions
diff --git a/library/entry.tcl b/library/entry.tcl
index 0cc9ffb..8d1b1b3 100644
--- a/library/entry.tcl
+++ b/library/entry.tcl
@@ -277,6 +277,18 @@ bind Entry <Meta-Delete> {
}
}
+# Bindings for IME text input.
+
+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
+}
+bind Entry <<TkClearIMEMarkedText>> {
+ %W delete [dict get $::tk::Priv(IMETextMark) "%W"] [%W index insert]
+}
+
# A few additional bindings of my own.
bind Entry <2> {
diff --git a/library/text.tcl b/library/text.tcl
index f43366b..7525588 100644
--- a/library/text.tcl
+++ b/library/text.tcl
@@ -397,6 +397,19 @@ bind Text <Meta-Delete> {
}
}
+# Bindings for IME text input.
+
+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
+}
+bind Text <<TkClearIMEMarkedText>> {
+ %W delete IMEmarkedtext.first IMEmarkedtext.last
+}
+
# Macintosh only bindings:
if {[tk windowingsystem] eq "aqua"} {
diff --git a/library/tk.tcl b/library/tk.tcl
index 35433e8..572c1f0 100644
--- a/library/tk.tcl
+++ b/library/tk.tcl
@@ -701,7 +701,10 @@ if {[tk windowingsystem] eq "aqua"} {
}
}
+# Create a dictionary to store the starting index of the IME marked
+# text in an Entry or Text widget.
+set ::tk::Priv(IMETextMark) [dict create]
# Run the Ttk themed widget set initialization
if {$::ttk::library ne ""} {