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); } }