diff options
author | cinap_lenrek <cinap_lenrek@gmx.de> | 2013-10-17 18:39:44 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@gmx.de> | 2013-10-17 18:39:44 +0200 |
commit | 1015ae8ea86cc4cdcea7ab6048440b9e5f58da26 (patch) | |
tree | 54ef49e527bebcb9c272ba4f1c5a650e065467b9 /sys/src/cmd/aux/kbdfs | |
parent | c501fe69366175312b39f7eead949f9b27c03ef6 (diff) |
kbdfs: implement <compoxe>x to enter variable length unicode as suggested by erik quanstro
from: http://9fans.net/archive/2013/04/327
since <compose>x is not yet entrenched, i have a suggestion for ease of
input. suppose <compose>x were redefined so the syntax were
"<compose>x[0-9a-f]+;". in the case that 6 hex digits are entered, then
the ";" is not necessary.
not only would this allow for entering 21-bit runes, it would also allow for
short sequences to be entered more easily.
- erik
Diffstat (limited to 'sys/src/cmd/aux/kbdfs')
-rw-r--r-- | sys/src/cmd/aux/kbdfs/kbdfs.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/sys/src/cmd/aux/kbdfs/kbdfs.c b/sys/src/cmd/aux/kbdfs/kbdfs.c index 323b23a54..8bbe77f75 100644 --- a/sys/src/cmd/aux/kbdfs/kbdfs.c +++ b/sys/src/cmd/aux/kbdfs/kbdfs.c @@ -514,22 +514,22 @@ Forward: if(nextrune(rawchan, &r)) continue; - if(r == 'X'){ + if(r == 'x' || r == 'X'){ + i = (r == 'X') ? 4 : 6; r = 0; - for(i = 0; i<4; i++){ + do { if(nextrune(rawchan, &rr)) break; - r <<= 4; if(rr >= '0' && rr <= '9') - r |= (rr - '0'); + r = (r << 4) | (rr - '0'); else if(rr >= 'a' && rr <= 'f') - r |= 10 + (rr - 'a'); + r = (r << 4) | (10 + (rr - 'a')); else if(rr >= 'A' && rr <= 'F') - r |= 10 + (rr - 'A'); + r = (r << 4) | (10 + (rr - 'A')); else break; - } - if(i == 4 && r) + } while(--i > 0); + if((i == 0 || rr == ';') && r != 0 && r < Runemax) goto Forward; } else { if(nextrune(rawchan, &rr)) |