ref: 8204f3beedf0fb9a46a8062e217057d2c068158d
parent: 082e63f89f7e0f47d2ca8faab716f4d27c4cb208
author: qwx <qwx@sciops.net>
date: Sun Sep 29 15:02:35 EDT 2024
fix prompt drawing issues by just locking display without this, with nil argument for screen drawing just paints over the prompt; with _screen as argument, it works most of the time, then sometimes stops redrawing. instead, just freeze drawing while the prompt is on; no other user interaction is possible in the mean time anyway.
--- a/pplay.c
+++ b/pplay.c
@@ -106,15 +106,17 @@
static char *
prompt(Rune r)
{
+ int n;
Rune q;
static char buf[512];
chartorune(&q, buf);
if(q != r)
- snprint(buf, sizeof buf, "%C", r);
- if(enter("cmd:", buf, sizeof(buf)-UTFmax, mc, kc, _screen) < 0)
- return nil;
- return buf;
+ snprint(buf, sizeof buf, "%C", r);
+ lockdisplay(display);
+ n = enter("cmd:", buf, sizeof(buf)-UTFmax, mc, kc, nil);
+ unlockdisplay(display);
+ return n < 0 ? nil : buf;
}
static void