actually implement suggestion on 9fans of earlier this year, after seeing that cinap has already done so. to recap x followed by 1-6 hex digits yields a rune with the given codepoint. if there are less than 6 hex digits, then the terminating character is not represented in the output. a difference from the previous suggestion is that the terminating character need only be not a hex digit. i think there are additional ideas that might be fruitful. it would be neat if a non-typing key like compose or shift would terminate, then the terminating character could be included in the output. Reference: /n/atom/patch/applied2013/composex Date: Sat Oct 19 17:47:47 CES 2013 Signed-off-by: quanstro@quanstro.net --- /sys/src/9/port/latin1.c Sat Oct 19 17:42:22 2013 +++ /sys/src/9/port/latin1.c Sat Oct 19 17:42:23 2013 @@ -46,7 +46,8 @@ * failure, or something < -1 if n is too small. In the latter case, the result * is minus the required n. */ -static char esctab[] = {'X', 5, 'Y', 7}; +static char esctab[] = {'X', 5, 5, 'Y', 7, 7, 'x', 7, 3}; +static char inset[] = "0123456789abcdefABCDEF"; long latin1(Rune *k, int n) @@ -55,10 +56,12 @@ int c, i; char* p; - for(i = 0; i < nelem(esctab); i += 2) + for(i = 0; i < nelem(esctab); i += 3) if(k[0] == esctab[i]){ if(n>=esctab[i+1]) return unicode(k, esctab[i+1]); + else if(n>=esctab[i+2] && strchr(inset, k[n-1]) == nil) + return unicode(k, n-1); else return -esctab[i+1]; } --- /sys/src/nix/port/latin1.c Sat Oct 19 17:42:24 2013 +++ /sys/src/nix/port/latin1.c Sat Oct 19 17:42:24 2013 @@ -46,7 +46,8 @@ * failure, or something < -1 if n is too small. In the latter case, the result * is minus the required n. */ -static char esctab[] = {'X', 5, 'Y', 7}; +static char esctab[] = {'X', 5, 5, 'Y', 7, 7, 'x', 7, 3}; +static char inset[] = "0123456789abcdefABCDEF"; long latin1(Rune *k, int n) @@ -55,10 +56,12 @@ int c, i; char* p; - for(i = 0; i < nelem(esctab); i += 2) + for(i = 0; i < nelem(esctab); i += 3) if(k[0] == esctab[i]){ if(n>=esctab[i+1]) return unicode(k, esctab[i+1]); + else if(n>=esctab[i+2] && strchr(inset, k[n-1]) == nil) + return unicode(k, n-1); else return -esctab[i+1]; } --- /sys/man/6/keyboard Sat Oct 19 17:42:25 2013 +++ /sys/man/6/keyboard Sat Oct 19 17:42:26 2013 @@ -89,11 +89,11 @@ .L a to .LR f ) -or a capital -.L Y -and exactly six hexadecimal characters -to type a single rune with the value represented by -the typed number. +or a lower case +.L x +followed by up to 6 hexadecimal characters. If the sequence +is shorter than 6 hexadecimal characters, the terminator will +not appear in the output. There are shorthands for many characters, comprising the compose key followed by a two- or three-character sequence. There are several rules guiding the design of the sequences, as