Introduction
Introduction Statistics Contact Development Disclaimer Help
fix die() on too fast scroll input - scroll - scrollbackbuffer program for st
git clone git://git.suckless.org/scroll
Log
Files
Refs
README
LICENSE
---
commit 47f9a83aaf2304291c6b7b8812747f482f609902
parent 200c1a92277ddc3daf0cde1f4957090f5887b423
Author: Jan Klemkow <[email protected]>
Date: Mon, 20 Apr 2020 22:59:50 +0200
fix die() on too fast scroll input
Diffstat:
M scroll.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
---
diff --git a/scroll.c b/scroll.c
@@ -226,12 +226,11 @@ getcursorposition(int *x, int *y)
if (write(STDOUT_FILENO, "\033[6n", 4) < 0)
die("requesting cursor position");
- if ((n = read(STDIN_FILENO, input, sizeof(input)-1)) < 0)
- die("reading cursor position");
- input[n] = '\0';
-
- if (sscanf(input, "\033[%d;%dR", x, y) != 2)
- die("parsing cursor position: %s", input);
+ do {
+ if ((n = read(STDIN_FILENO, input, sizeof(input)-1)) < 0)
+ die("reading cursor position");
+ input[n] = '\0';
+ } while (sscanf(input, "\033[%d;%dR", x, y) != 2);
if (x <= 0 || y <= 0)
die("invalid cursor position: x=%d y=%d", x, y);
You are viewing proxied material from suckless.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.