Commit: 335417da3ab7f407790931810afab4354d6b4abe
Parent: 59705d6ed3be6a21e08d9b0a973507896495f311
Author: NRK
Date: Fri, 25 Mar 2022 22:51:45 +0100
avoid redraw when there's no change
while i was timing the performance issue, i noticed that there was lots
of random redrawing going on.
turns out there were coming from here; if someone presses CTRL/ALT etc
without pressing anything else, nothing will be inserted, so nothing
will change. but the code will `break`, go down and do a needless redraw.
this patch changes it to simply return if the keypress iscntrl()
also avoid potential UB by casting *buf into an unsigned char.
Diffstat:
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/pinentry-dmenu.c b/pinentry-dmenu.c
@@ -524,9 +524,9 @@ keypress_pin(XKeyEvent *ev, KeySym ksym, char* buf, int len) {
return 1;
break;
default:
- if (!iscntrl(*buf)) {
- insert(buf, len);
- }
+ if (iscntrl((unsigned char)*buf))
+ return 1;
+ insert(buf, len);
}
return 0;