From 71b94112158180720a8b1cf13cf49f6b1c8e8dc2 Mon Sep 17 00:00:00 2001 From: Alexander Bocken Date: Thu, 25 Sep 2025 18:29:01 +0200 Subject: [PATCH] cleaner version of previous fix --- st.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/st.c b/st.c index ca4c4b2..d983037 100644 --- a/st.c +++ b/st.c @@ -3030,13 +3030,13 @@ drawregion(int x1, int y1, int x2, int y2) continue; /* draw from horizontally scrolled position */ - /* ensure we draw at least the visible width, limited by actual line content */ - int visible_width = MIN(x2, linelen - term.hscr); - if (visible_width < x2 && linelen > term.hscr) { - /* if line extends beyond what we calculated, draw more */ - visible_width = MIN(x2, MAX(visible_width, term.col)); + /* fix inconsistent line lengths: ensure we draw full terminal width when possible */ + int draw_width = MIN(x2, linelen - term.hscr); + if (draw_width < x2 && linelen > term.hscr) { + /* expand to terminal width if line might have more content */ + draw_width = x2; } - xdrawline(&line[term.hscr], x1, y, visible_width); + xdrawline(&line[term.hscr], x1, y, draw_width); } }