Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: (large) initial support for combining characters in ZLE.



"Mikael Magnusson" wrote:
> zsh -f
> setopt interactivecomments
> function toggleopt() {
> #is there some easier way to do this?
>   [[ $options[$1] = on ]] && setopt no$1 || setopt $1
> }
> compdef _options toggleopt=setopt
> function _togglecombining() {
>   toggleopt combiningchars
> }
> zle -N _togglecombining
> bindkey ^K _togglecombining
> print -z $'a\u0342'
> <press ctrl-k and then left, and ctrl-k again>

I haven't looked at the behaviour of user-defined widgets at all, which
will need much more work, but on exit from a widget is a good place to
fix up the cursor position.

Some more for the FAQ, too.

Index: Etc/FAQ.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Etc/FAQ.yo,v
retrieving revision 1.38
diff -u -r1.38 FAQ.yo
--- Etc/FAQ.yo	14 Apr 2008 12:53:37 -0000	1.38
+++ Etc/FAQ.yo	16 Apr 2008 08:45:51 -0000
@@ -2045,7 +2045,8 @@
   be displayed within the same screen area as the base character.  As not
   all terminals handle this, even if they correctly display the base
   multibyte character, this option is not on by default.  The KDE terminal
-  emulator tt(konsole) is known to handle combining characters.
+  emulator tt(konsole), tt(rxvt-unicode), and the Unicode version of
+  xterm, tt(uxterm), are known to handle combining characters.
 
   The tt(COMBINING_CHARS) option only affects output; combining characters
   may always be input, but when the option is off will be displayed
@@ -2157,7 +2158,7 @@
   however, using UTF-8 massively extends the number of valid characters
   that can be produced.
 
-  See also url(http://www.cl.cam.ac.uk/~mgk25/unicode.html#input)http://www.cl.cam.ac.uk/~mgk25/unicode.html#input)
+  See also url(http://www.cl.cam.ac.uk/~mgk25/unicode.html#input)(http://www.cl.cam.ac.uk/~mgk25/unicode.html#input)
   for general information on entering Unicode characters from a keyboard.
 
 
Index: Src/Zle/zle_main.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_main.c,v
retrieving revision 1.107
diff -u -r1.107 zle_main.c
--- Src/Zle/zle_main.c	3 Apr 2008 15:30:44 -0000	1.107
+++ Src/Zle/zle_main.c	16 Apr 2008 08:45:52 -0000
@@ -1344,6 +1344,12 @@
     }
     if (set_bindk)
 	bindk = save_bindk;
+    /*
+     * Goodness knows where the user's left us; make sure
+     * it's not on a combining character that won't be displayed
+     * directly.
+     */
+    CCRIGHT();
     return ret;
 }
 

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070



Messages sorted by: Reverse Date, Date, Thread, Author