summaryrefslogtreecommitdiffstats
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
commit1dd511525f1f43ac44dc5b21e02fd7eed000031e (patch)
treef1f555fa5da0f90485983fb07861c91ce36bc4ae
parentc95a1b4225cd1669e9fc9148949c3f1d40c3840e (diff)
downloadtxr-1dd511525f1f43ac44dc5b21e02fd7eed000031e.tar.gz
txr-1dd511525f1f43ac44dc5b21e02fd7eed000031e.tar.bz2
txr-1dd511525f1f43ac44dc5b21e02fd7eed000031e.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.
-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));