shithub: riscv

Download patch

ref: 924a6155c2f559aa34a546b8b651bd49dc0bb8b2
parent: 69d2f49c1ac1de82e6f75a167799ad934f67579b
author: qwx <qwx@sciops.net>
date: Thu Apr 10 02:47:29 EDT 2025

eui: fix /dev/kbd message parsing

revealed by redefining default keybinds to something like
hjkl. utfrune rescans the entire buffer including the
message type character, when we just want to match the
current rune from that same buffer against the key binds.

--- a/sys/src/games/eui.c
+++ b/sys/src/games/eui.c
@@ -151,10 +151,11 @@
 				warp10 = !warp10;
 				break;
 			}
-			for(kp=kkn.n; kp!=nil; kp=kp->n){
-				if(utfrune(buf, kp->r))
+			for(kp=kkn.n; kp!=nil; kp=kp->n)
+				if(kp->r == r){
 					k |= kp->k;
-			}
+					break;
+				}
 		}
 		if((k & ax0) == ax0)
 			k &= ~ax0;
--