From 111f1bb981d6d6ed6f9116dc297d74ad20010401 Mon Sep 17 00:00:00 2001 From: Thorsten Töpper Date: Tue, 24 Jun 2025 22:01:17 +0200 Subject: output: limit fputc_all_cols to 72-144 --- src/output.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/output.c b/src/output.c index 254d73f..396f3ef 100644 --- a/src/output.c +++ b/src/output.c @@ -34,7 +34,13 @@ void out_print_time_by_option(struct list_node *ptr); inline int fputc_all_cols(char c, FILE *fdout) { struct winsize terminal; ioctl(STDOUT_FILENO, TIOCGWINSZ, &terminal); - return fputc_width_x(c, ((terminal.ws_col == 0) ? 72 : terminal.ws_col), fdout); + /* Somehow not always ws_col == 0, instead > 300 characters */ + if (terminal.ws_col == 0) { + terminal.ws_col = 72; + } else if (terminal.ws_col > 144) { + terminal.ws_col = 144; + } + return fputc_width_x(c, terminal.ws_col, fdout); } -- cgit v1.2.3-70-g09d2