shithub: riscv

Download patch

ref: 0f50c54b5ec2c8d2ca681021deaedc0cffdf7f1a
parent: 2ab25e3ec07a11f18066e37c2841b6d294091fcb
author: Sigrid Solveig Haflínudóttir <[email protected]>
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
+++ b/sys/src/cmd/aux/kbdfs/kbdfs.c
@@ -787,6 +787,7 @@
 
 		if(r == 'x' || r == 'X'){
 			i = (r == 'X') ? 4 : 6;
+			j = i;
 			r = 0;
 			do {
 				if(nextrune(rawchan, &rr))
@@ -797,8 +798,13 @@
 					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;
@@ -805,6 +811,7 @@
 		} else {
 			if(nextrune(rawchan, &rr))
 				continue;
+Nothex:
 			for(i = 0; i<nelem(tab); i++){
 				if(tab[i].ld[0] != r)
 					continue;