In Linux, I can type any (or almost any) Unicode character into
text editors such as Leafpad, Pluma and Vim by holding Ctrl+Shift+U
and typing the Unicode code. For example, Ctrl+Shift+U+2013 makes —.
Why doesn't that work in my Tcl/Tk text widgets?
On 3/29/2023 5:37 PM, Luc wrote:
It had no effect in Tkcon. Do you suggest another approach?
Interesting - it works here even from a plain tclsh shell on command
line as well as in text widgets, etc. I tested with emojis from here: https://www.unicode.org/emoji/charts/emoji-list.html
What OS and what version are you using?
In Linux, I can type any (or almost any) Unicode character into
text editors such as Leafpad, Pluma and Vim by holding Ctrl+Shift+U
and typing the Unicode code. For example, Ctrl+Shift+U+2013 makes —.
Why doesn't that work in my Tcl/Tk text widgets?
On 3/29/2023 4:03 PM, Luc wrote:
In Linux, I can type any (or almost any) Unicode character into
text editors such as Leafpad, Pluma and Vim by holding Ctrl+Shift+U
and typing the Unicode code. For example, Ctrl+Shift+U+2013 makes —.
Why doesn't that work in my Tcl/Tk text widgets?
You probably have an incompatible encoding.
Do this and see if things improve:
% encoding system utf-8
It had no effect in Tkcon. Do you suggest another approach?
Luc <luc@sep.invalid> wrote:
In Linux, I can type any (or almost any) Unicode character into
text editors such as Leafpad, Pluma and Vim by holding Ctrl+Shift+U
and typing the Unicode code. For example, Ctrl+Shift+U+2013 makes —.
Why doesn't that work in my Tcl/Tk text widgets?
Because you have not implemented it for your text widgets.
X does not provide a "unicode hex entry" subsystem. So handling entry
of unicode via typing the hex code is left up to the individual
applications to implement.
Most of them use a gui toolkit (GTK or QT) and this keystroke is
probably part of the library, so it comes along for free for the
individual apps.
Tk is its own 'gui library' and it does not build in a "enter hex of
unicode code point" feature. So you have to add it on yourself.
On 3/29/23 16:57, Rich wrote:
Luc <l...@sep.invalid> wrote:
In Linux, I can type any (or almost any) Unicode character into
text editors such as Leafpad, Pluma and Vim by holding Ctrl+Shift+U
and typing the Unicode code. For example, Ctrl+Shift+U+2013 makes —.
Why doesn't that work in my Tcl/Tk text widgets?
Because you have not implemented it for your text widgets.
X does not provide a "unicode hex entry" subsystem. So handling entry
of unicode via typing the hex code is left up to the individual applications to implement.
Most of them use a gui toolkit (GTK or QT) and this keystroke is
probably part of the library, so it comes along for free for the individual apps.
Tk is its own 'gui library' and it does not build in a "enter hex of unicode code point" feature. So you have to add it on yourself.Luc, that being said, if you develop such a set of bindings for the
Entry and Text widgets, you may want to consider packaging them up and submitting them to TkLib.
On 3/29/23 16:57, Rich wrote:
Luc <luc@sep.invalid> wrote:
In Linux, I can type any (or almost any) Unicode character into
text editors such as Leafpad, Pluma and Vim by holding Ctrl+Shift+U
and typing the Unicode code. For example, Ctrl+Shift+U+2013 makes —.
Why doesn't that work in my Tcl/Tk text widgets?
Because you have not implemented it for your text widgets.
X does not provide a "unicode hex entry" subsystem. So handling entry
of unicode via typing the hex code is left up to the individual applications to implement.
Most of them use a gui toolkit (GTK or QT) and this keystroke is
probably part of the library, so it comes along for free for the
individual apps.
Tk is its own 'gui library' and it does not build in a "enter hex of unicode code point" feature. So you have to add it on yourself.
Luc, that being said, if you develop such a set of bindings for the
Entry and Text widgets, you may want to consider packaging them up and submitting them to TkLib.
May be this helps:
https://wiki.tcl-lang.org/page/Entering+Unicode+characters+in+a+widget
Best,
Detlef
On 3/29/2023 5:37 PM, Luc wrote:
It had no effect in Tkcon. Do you suggest another approach?
Interesting - it works here even from a plain tclsh shell on command
line as well as in text widgets, etc. I tested with emojis from here: https://www.unicode.org/emoji/charts/emoji-list.html
What OS and what version are you using?
What happens when you copy/paste an emoji directly like from that site?
On Thu, 30 Mar 2023 09:32:00 -0700 (PDT), D Groth wrote:
May be this helps:
https://wiki.tcl-lang.org/page/Entering+Unicode+characters+in+a+widget
Best,It does. It works! It works pretty well.
Detlef
Except that I added it to my text editor and now many - not all - of the
key bindings won't work anymore. I will have to have a closer look into
that code and see if I can figure out what is going on.
Very handy! Thank you.
--
Luc
Hmm, I added as well an oowidgets example for easier use to the oowidgets Wikipage at the very end.
https://wiki.tcl-lang.org/page/oowidgets
or here embedded into the oowidgets project the manual page:
https://htmlpreview.github.io/?https://raw.githubusercontent.com/mittelmark/oowidgets/master/paul/txmixins.html
Which keybindings did not work anymore?
Detlef
On Thu, 30 Mar 2023 23:12:42 -0700 (PDT), D Groth wrote:
Hmm, I added as well an oowidgets example for easier use to the oowidgets Wikipage at the very end.
https://wiki.tcl-lang.org/page/oowidgets
or here embedded into the oowidgets project the manual page:
https://htmlpreview.github.io/?https://raw.githubusercontent.com/mittelmark/oowidgets/master/paul/txmixins.html
Which keybindings did not work anymore?
DetlefThese bindings don't work anymore while all others still work:
bind $::w <Control-KeyRelease-f> {p.searchreplace}
bind $::w <Alt_L><j> {p.gui6.switchtop}
bind $::w <Alt_L><q> {exit 0}
I've read that script many times and I can't really understand
how it is supposed to work so I can't find out why some bindings
won't work anymore.
--
Luc
bind $::w <Alt_L><j> {p.gui6.switchtop}
bind $::w <Alt_L><q> {exit 0}
There is now an update from BEO in the wiki which says it does not
interfere with other bindings:
Could you try this out?
https://wiki.tcl-lang.org/page/Entering+Unicode+characters+in+a+widget
Detlef
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 485 |
Nodes: | 16 (2 / 14) |
Uptime: | 131:24:45 |
Calls: | 9,655 |
Calls today: | 3 |
Files: | 13,707 |
Messages: | 6,166,553 |