shithub: plan9front

Download patch

ref: 0f50c54b5ec2c8d2ca681021deaedc0cffdf7f1a
parent: 2ab25e3ec07a11f18066e37c2841b6d294091fcb
author: Sigrid Solveig Haflínudóttir <ftrvxmtrx@gmail.com>
date: Sun Nov 14 09:27:15 EST 2021

kbdfs: allow X and x to be used not just for hex composition

--- a/sys/src/cmd/aux/kbdfs/kbdfs.c	Sat Nov 13 18:04:04 2021
+++ b/sys/src/cmd/aux/kbdfs/kbdfs.c	Sun Nov 14 09:27:15 2021
@@ -787,6 +787,7 @@
 
 		if(r == 'x' || r == 'X'){
 			i = (r == 'X') ? 4 : 6;
+			j = i;
 			r = 0;
 			do {
 				if(nextrune(rawchan, &rr))
@@ -797,14 +798,20 @@
 					r = (r << 4) | (10 + (rr - 'a'));
 				else if(rr >= 'A' && rr <= 'F')
 					r = (r << 4) | (10 + (rr - 'A'));
-				else
+				else{
+					if(i == j && rr != ';'){
+						r = j == 6 ? 'x' : 'X';
+						goto Nothex;
+					}
 					break;
+				}
 			} while(--i > 0);
 			if((i == 0 || rr == ';') && r != 0 && r <= Runemax)
 				goto Forward;
 		} else {
 			if(nextrune(rawchan, &rr))
 				continue;
+Nothex:
 			for(i = 0; i<nelem(tab); i++){
 				if(tab[i].ld[0] != r)
 					continue;