[vim/vim] use redraw_as_cleared() instead of screenclear() to avoid flicker (PR #19732)

2 views
Skip to first unread message

mattn

unread,
Mar 17, 2026, 7:48:36 PM (4 hours ago) Mar 17
to vim/vim, Subscribed

The flicker is caused by screenclear() in win_do_lines() (screen.c). When the scroll amount is large (Rows - line_count < 5) and the window spans the full width, screenclear() clears the entire terminal screen before redrawing all lines. The blank screen is visible as flicker. This is why the flickering occurs during scrolling.

With a vertical split, wp->w_width != topframe->fr_width, so this condition (screen.c:3803) is skipped and the scroll region path is used instead, which shifts content in-place without blanking.

The fix is to replace screenclear() with redraw_as_cleared(). screenclear() both invalidates the internal ScreenLines[] buffer and sends T_CL to clear the terminal. redraw_as_cleared() only invalidates the buffer. Since this path returns FAIL, the caller redraws all lines via win_line() which overwrites each character in place, so the screen is never blank.

closes #18972


You can view, comment on, or merge this pull request online at:

  https://github.com/vim/vim/pull/19732

Commit Summary

  • 9a76c6e use redraw_as_cleared() instead of screenclear() to avoid flicker

File Changes

(1 file)

Patch Links:


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19732@github.com>

mattn

unread,
Mar 17, 2026, 8:25:25 PM (4 hours ago) Mar 17
to vim/vim, Subscribed
mattn left a comment (vim/vim#19732)

@chrisbra The CI failure (Test_message_more_scrollback in linux (huge, gcc, no_x11_wl)) is not caused by this PR. It was introduced by commit c4d2122 (patch 9.2.0192: not correctly recognizing raw key codes). Confirmed by bisect and by reproducing the same failure on the latest master.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19732/c4078841046@github.com>

Reply all
Reply to author
Forward
0 new messages