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
This commit is contained in:
cinap_lenrek 2013-10-17 18:39:44 +02:00
parent c501fe6936
commit 1015ae8ea8

View file

@ -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))