summaryrefslogtreecommitdiff
path: root/deps
diff options
context:
space:
mode:
Diffstat (limited to 'deps')
-rw-r--r--deps/linenoise/linenoise.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/deps/linenoise/linenoise.c b/deps/linenoise/linenoise.c
index 1b01622c5..dd86abe86 100644
--- a/deps/linenoise/linenoise.c
+++ b/deps/linenoise/linenoise.c
@@ -163,6 +163,7 @@ enum KEY_ACTION{
CTRL_F = 6, /* Ctrl-f */
CTRL_H = 8, /* Ctrl-h */
TAB = 9, /* Tab */
+ NL = 10, /* Enter typed before raw mode was enabled */
CTRL_K = 11, /* Ctrl+k */
CTRL_L = 12, /* Ctrl+l */
ENTER = 13, /* Enter */
@@ -256,8 +257,8 @@ static int enableRawMode(int fd) {
* We want read to return every single byte, without timeout. */
raw.c_cc[VMIN] = 1; raw.c_cc[VTIME] = 0; /* 1 byte, no timer */
- /* put terminal in raw mode after flushing */
- if (tcsetattr(fd,TCSAFLUSH,&raw) < 0) goto fatal;
+ /* put terminal in raw mode */
+ if (tcsetattr(fd,TCSANOW,&raw) < 0) goto fatal;
rawmode = 1;
return 0;
@@ -268,7 +269,7 @@ fatal:
static void disableRawMode(int fd) {
/* Don't even check the return value as it's too late. */
- if (rawmode && tcsetattr(fd,TCSAFLUSH,&orig_termios) != -1)
+ if (rawmode && tcsetattr(fd,TCSANOW,&orig_termios) != -1)
rawmode = 0;
}
@@ -840,6 +841,8 @@ static int linenoiseEdit(int stdin_fd, int stdout_fd, char *buf, size_t buflen,
}
switch(c) {
+ case NL: /* enter, typed before raw mode was enabled */
+ break;
case ENTER: /* enter */
history_len--;
free(history[history_len]);