From 3922ce3447f2885592da596fae8c652655178811 Mon Sep 17 00:00:00 2001 From: yabu76 Date: Sat, 20 Sep 2025 10:19:53 +0900 Subject: [PATCH] Fix output-line-delay behavior If output-line-delay is non-zero and output-delay is any, line delay time set output-line-delay. If output-line-delay is zero and output-delay is non-zero, line delay time set output-delay. It was previously (output-line-delay + output-delay) in any case. Also, since the buffer was flushed after the line delay, there was a possibility that the delay would be reduced or not applied at all. --- src/tty.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/tty.c b/src/tty.c index 6cc0ab0..b5e8c10 100644 --- a/src/tty.c +++ b/src/tty.c @@ -283,15 +283,14 @@ ssize_t tty_write(int fd, const void *buffer, size_t count) } bytes_written += retval; + fsync(fd); + tcdrain(fd); + if (option.output_line_delay && *(unsigned char*)buffer == '\n') { delay(option.output_line_delay); } - - fsync(fd); - tcdrain(fd); - - if (option.output_delay) + else if (option.output_delay) { delay(option.output_delay); }