aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bb.c2
-rw-r--r--bterm.h18
-rw-r--r--config.def.h1
3 files changed, 8 insertions, 13 deletions
diff --git a/bb.c b/bb.c
index a2dd99f..6352e44 100644
--- a/bb.c
+++ b/bb.c
@@ -1216,7 +1216,7 @@ void bb_browse(bb_t *bb, const char *path)
int key;
get_keyboard_input:
- key = bgetkey(tty_in, &mouse_x, &mouse_y, KEY_DELAY);
+ key = bgetkey(tty_in, &mouse_x, &mouse_y);
switch (key) {
case KEY_MOUSE_LEFT: {
struct timespec clicktime;
diff --git a/bterm.h b/bterm.h
index c233c84..395016a 100644
--- a/bterm.h
+++ b/bterm.h
@@ -103,15 +103,11 @@
#define move_cursor(f, x, y) fprintf((f), CSI "%d;%dH", (int)(y)+1, (int)(x)+1)
-
-#define ESC_DELAY 10
-
-int bgetkey(FILE *in, int *mouse_x, int *mouse_y, int timeout);
+int bgetkey(FILE *in, int *mouse_x, int *mouse_y);
const char *bkeyname(int key);
-static inline int nextchar(int fd, int timeout)
+static inline int nextchar(int fd)
{
- (void)timeout;
char c;
return read(fd, &c, 1) == 1 ? c : -1;
}
@@ -121,18 +117,18 @@ static inline int nextchar(int fd, int timeout)
* If mouse_x or mouse_y are non-null and a mouse event occurs, they will be
* set to the position of the mouse (0-indexed).
*/
-int bgetkey(FILE *in, int *mouse_x, int *mouse_y, int timeout)
+int bgetkey(FILE *in, int *mouse_x, int *mouse_y)
{
int fd = fileno(in);
int numcode = 0, super = 0;
- int c = nextchar(fd, timeout);
+ int c = nextchar(fd);
if (c == '\x1b')
goto escape;
return c;
escape:
- c = nextchar(fd, ESC_DELAY);
+ c = nextchar(fd);
// Actual escape key:
if (c < 0)
return KEY_ESC;
@@ -146,7 +142,7 @@ int bgetkey(FILE *in, int *mouse_x, int *mouse_y, int timeout)
}
CSI_start:
- c = nextchar(fd, ESC_DELAY);
+ c = nextchar(fd);
if (c == -1)
return -1;
@@ -213,7 +209,7 @@ int bgetkey(FILE *in, int *mouse_x, int *mouse_y, int timeout)
return -1;
SS3:
- switch (nextchar(fd, ESC_DELAY)) {
+ switch (nextchar(fd)) {
case 'P': return KEY_F1;
case 'Q': return KEY_F2;
case 'R': return KEY_F3;
diff --git a/config.def.h b/config.def.h
index 14b6460..27e51d7 100644
--- a/config.def.h
+++ b/config.def.h
@@ -80,7 +80,6 @@ typedef struct {
} column_t;
// Configurable options:
-#define KEY_DELAY 50
#define SCROLLOFF MIN(5, (termheight-4)/2)
#define CMDFILE_FORMAT "/tmp/bb.XXXXXX"
#define SORT_INDICATOR "↓"