• I can't type Unicode into text widgets

    From Luc@21:1/5 to All on Wed Mar 29 17:03:03 2023
    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?


    --
    Luc


    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From saitology9@21:1/5 to Luc on Wed Mar 29 16:46:30 2023
    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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From saitology9@21:1/5 to All on Wed Mar 29 17:52:33 2023
    On 3/29/2023 5:44 PM, saitology9 wrote:
    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?

    Because it may be the way you are entering these characters. I can't
    type Ctrl+Shift+U+2013 on my keyboard as the modifier sequence breaks on
    the "U". Too many modifiers :-) Maybe check the text widget doc's to
    see how you are supposed to type it in.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Rich@21:1/5 to Luc on Wed Mar 29 21:57:53 2023
    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.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Luc@21:1/5 to All on Wed Mar 29 18:37:42 2023
    On Wed, 29 Mar 2023 16:46:30 -0400, saitology9 wrote:

    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


    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From saitology9@21:1/5 to Luc on Wed Mar 29 17:44:13 2023
    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?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Gerald Lester@21:1/5 to Rich on Wed Mar 29 17:28:40 2023
    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.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From D Groth@21:1/5 to Gerald Lester on Thu Mar 30 09:32:00 2023
    Gerald Lester schrieb am Donnerstag, 30. März 2023 um 00:28:45 UTC+2:
    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.

    May be this helps:

    https://wiki.tcl-lang.org/page/Entering+Unicode+characters+in+a+widget

    Best,
    Detlef

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Luc@21:1/5 to Gerald Lester on Fri Mar 31 00:35:46 2023
    On Wed, 29 Mar 2023 17:28:40 -0500, Gerald Lester wrote:

    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.


    Gerald, I am deeply honored by the enormous amount of confidence you deposit
    in me and my abilities and I am sad to disappoint you. I'm afraid I cannot undertake such task because I wouldn't even know where to start and I know
    I would never be able to finish it. Genuinely sorry.


    --
    Luc


    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Luc@21:1/5 to D Groth on Fri Mar 31 00:38:12 2023
    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,
    Detlef


    It does. It works! It works pretty well.

    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


    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Luc@21:1/5 to All on Fri Mar 31 00:30:01 2023
    On Wed, 29 Mar 2023 17:44:13 -0400, saitology9 wrote:

    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?


    I use Debian Linux. What about you?


    --
    Luc


    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Luc@21:1/5 to All on Fri Mar 31 00:32:35 2023
    On Wed, 29 Mar 2023 17:52:33 -0400, saitology9 wrote:

    What happens when you copy/paste an emoji directly like from that site?

    Pasting from elsewhere works, although "emojis" usually refers to a
    relatively new bunch of Unicode characters that Tcl doesn't even support
    except for one package whose name I forget.


    --
    Luc


    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From D Groth@21:1/5 to Luc on Thu Mar 30 23:12:42 2023
    Luc schrieb am Freitag, 31. März 2023 um 05:38:16 UTC+2:
    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,
    Detlef
    It does. It works! It works pretty well.

    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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Luc@21:1/5 to D Groth on Mon Apr 3 00:42:14 2023
    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?

    Detlef


    These 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


    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From D Groth@21:1/5 to Luc on Mon Apr 3 01:20:30 2023
    Luc schrieb am Montag, 3. April 2023 um 05:42:19 UTC+2:
    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?

    Detlef
    These 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


    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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From dave bruchie@21:1/5 to All on Mon Apr 3 08:30:18 2023
    you might try replacing these bindings:

    bind $::w <Alt_L><j> {p.gui6.switchtop}
    bind $::w <Alt_L><q> {exit 0}

    with

    bind $::w <Alt-j> {p.gui6.switchtop}
    bind $::w <Alt-q> {exit 0}

    Dave B

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Luc@21:1/5 to All on Mon Apr 3 14:05:28 2023
    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


    Yes, the new one works as expected. Excellent! Thank you!

    Please send my regards to BEO, whoever that is.

    --
    Luc


    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)