aboutsummaryrefslogtreecommitdiff
path: root/bb.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2019-05-22 15:47:47 -0700
committerBruce Hill <bruce@bruce-hill.com>2019-05-22 15:47:47 -0700
commitac69e52faaaf34a407727b493e4f636cf78fb1ca (patch)
tree00ea36be1ae52663e9b5fc4b512f0552441e38b3 /bb.c
parent512cbbdae42b3313bc7debb3efbcf50c3276982f (diff)
Added polling for blocking key reads
Diffstat (limited to 'bb.c')
-rw-r--r--bb.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/bb.c b/bb.c
index 40febba..7e4c6cb 100644
--- a/bb.c
+++ b/bb.c
@@ -28,6 +28,7 @@
#define writez(fd, str) write(fd, str, strlen(str))
#define IS_SELECTED(p) ((p)->atme)
+#define KEY_DELAY -1
static struct termios orig_termios;
static int termfd;
@@ -544,7 +545,7 @@ static void explore(char *path, int print_dir, int print_selection, char sep)
render(&state);
skip_redraw:
scrolloff = MIN(SCROLLOFF, (height-4)/2);
- int key = term_getkey(termfd, &mouse_x, &mouse_y);
+ int key = term_getkey(termfd, &mouse_x, &mouse_y, KEY_DELAY);
switch (key) {
case KEY_MOUSE_LEFT: {
struct timespec clicktime;
@@ -754,7 +755,7 @@ static void explore(char *path, int print_dir, int print_selection, char sep)
term_move(0, height-1);
writez(termfd, "\e[K\e[1mSort by (a)lphabetic (s)ize (t)ime (p)ermissions:\e[0m \e[?25h");
try_sort_again:
- switch (term_getkey(termfd, &mouse_x, &mouse_y)) {
+ switch (term_getkey(termfd, &mouse_x, &mouse_y, -1)) {
case 'a': case 'A':
sort_alpha:
if (state.sortmethod == SORT_ALPHA)