summaryrefslogtreecommitdiffstats
path: root/stream.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2018-11-01 06:20:19 -0700
committerKaz Kylheku <kaz@kylheku.com>2018-11-01 06:20:19 -0700
commitdd0546bbc205601423d5281133c73f83196d1aaa (patch)
treef1f555fa5da0f90485983fb07861c91ce36bc4ae /stream.c
parent157e051e3cb9232509b6df1dd57f4ae172809f25 (diff)
downloadtxr-dd0546bbc205601423d5281133c73f83196d1aaa.tar.gz
txr-dd0546bbc205601423d5281133c73f83196d1aaa.tar.bz2
txr-dd0546bbc205601423d5281133c73f83196d1aaa.zip
repl: bugfix: slow paste into terminal window.
* stream.c (stream_init): When stdin is a TTY, we make it unbuffered. This affects the parenthesis matching and incomplete line warning flash in the listener, in the following way. The listener uses the poll function to execute delays which is canceled by the presence of TTY input. This logic breaks when data is pasted into the terminal, because the stdin stream buffers the input.
Diffstat (limited to 'stream.c')
-rw-r--r--stream.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/stream.c b/stream.c
index 3887e77f..69c891bf 100644
--- a/stream.c
+++ b/stream.c
@@ -4533,8 +4533,10 @@ void stream_init(void)
reg_var(print_circle_s = intern(lit("*print-circle*"), user_package), nil);
#if HAVE_ISATTY
- if (isatty(fileno(stdin)) == 1)
+ if (isatty(fileno(stdin)) == 1) {
stream_set_prop(std_input, real_time_k, t);
+ setbuf(stdin, 0);
+ }
#endif
reg_fun(format_s, func_n2v(formatv));