[vim/vim] message: preserve empty lines when redrawing message scrollback (PR #21444)

11 views
Skip to first unread message

赤坂理子

unread,
Oct 4, 2026, 6:38:03 AM (2 days ago) Oct 4
to vim/vim, Subscribed

Fixes #21315

Problem

  • Reproducible on upstream commit 6d862f5 with :echo join(range(1, 1000), "\n\n") followed by f then b at the more prompt
  • Patch 9.0.0595 discarded standalone newline chunks, causing empty separator lines to vanish when redrawing scrollback

Solution

  • Store newline chunks for scrollback again in src/message.c
  • Update msg_sb_eol to avoid marking a trailing newline-only chunk as finished so the older extra-newline bug does not return
  • Add regression coverage in src/testdir/test_messages.vim with three new screendumps exercising single, double, and triple newline separators, comparing the initial page to f/b and PageDown/PageUp redraws
  • The new regression test fails on the unpatched Linux binary and passes after this fix

Validation

  • make -C src test_messages TEST_FILTER=Test_message_scrollback_empty_lines passed
  • make -C src test_messages test_cmdline test_vim9_cmd passed on macOS and Ubuntu Linux with platform/feature skips
  • make -C src/testdir codestyle passed on macOS and Ubuntu Linux
  • Same three test suites passed on Linux Clang with AddressSanitizer, UndefinedBehaviorSanitizer, and leak detection
  • Linux --with-features=tiny build and make -C src testtiny passed
  • git diff --cached --check passed
  • Existing Test_echo_verbose_system passed on Linux, skipped by the existing Mac guard on macOS
  • Resolved local prerequisites including PTY allocation, non-root user execution, and Clang sanitizer runtime
  • GitHub CI has not run yet

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

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

Commit Summary

  • 8fe0460 fix: preserve empty lines in message scrollback

File Changes

(5 files)

Patch Links:

—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/21444@github.com>

h_east

unread,
Oct 5, 2026, 10:02:16 AM (yesterday) Oct 5
to vim/vim, Subscribed
h-east left a comment (vim/vim#21444)

The msg_sb_eol() change is not covered by the new test

The comment in the new test says the single newline case checks that
no extra empty line is introduced. I reverted only the msg_sb_eol()
hunk and the new test still passes, newline_count 1 included. What
fails is the existing Test_echo_verbose_system(). So the comment
claims something the loop does not check. Please drop it, or point
to Test_echo_verbose_system() instead.

g< also changes

With this PR, g< (and G at the more prompt) shows the trailing
empty lines of a message, as they were on the screen:

:echo "a\n"
" press Enter, then g<

master shows "a" and the prompt right below it; this PR shows the
empty line between them, like the screen did. That is right, but it
is a visible change that the description does not mention and no test
covers. A g< step in the new test would pin it down.

Comment in msg_puts_display()

"including empty lines" refers to the condition that was removed.
Without it the line reads fine:

    // Store the text for scroll back.

Commit message

The subject should state the problem, and the body needs the
Problem:/Solution: lines. A pull request template was added about a
week ago and covers this, including the AI disclosure:
6918007
Could you fill it in?

—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

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

赤坂理子

unread,
Oct 5, 2026, 10:06:12 AM (yesterday) Oct 5
to vim/vim, Subscribed
akasakariko left a comment (vim/vim#21444)

I'll address these

—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

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

Reply all
Reply to author
Forward
0 new messages