Enable vterm_screen_enable_reflow() so that long lines in a terminal window reflow (re-wrap) when the terminal is resized. Added tests for both ASCII and multibyte (CJK) characters.
Fixes #2865
https://github.com/vim/vim/pull/19863
(2 files)
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
@mattn pushed 1 commit.
—
View it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
@mattn pushed 1 commit.
—
View it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
This is nice but still missing the bit that also unwraps lines that have been scrolled out of the current viewport:
image.png (view on web)I am now at line 30 so line 18 reflowed nicely, but line 1 that wasn’t on-screen as the switch happened (already pushed into the scrollback buffer) is broken.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@Cimbali Thanks for testing! I just pushed a new commit that also joins continuation lines in the scrollback buffer (lines pushed off the top of the screen). This adds a vterm_screen_sb_pushline_continuation() accessor to libvterm so that handle_pushline can detect and join continuation lines when they're scrolled out of the viewport. Please try again with the latest commit.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@mattn pushed 1 commit.
—
View it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
I'll be looking for corner case bugs for a while, so it might not work for a short time. but I'll fix this soon.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@mattn pushed 1 commit.
—
View it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
@mattn pushed 1 commit.
—
View it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
@mattn pushed 1 commit.
—
View it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
@mattn pushed 1 commit.
—
View it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
@mattn pushed 1 commit.
—
View it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
@mattn pushed 1 commit.
—
View it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
@mattn pushed 1 commit.
—
View it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
@mattn pushed 1 commit.
—
View it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
How does this differ from #8365 ?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@chrisbra
I asked Claude Code about it. I haven’t verified whether the findings are correct.
Both PRs fix the same issue #2865 — joining soft-wrapped (continuation) lines in the terminal buffer into single lines when switching to Normal mode.
| #8365 (Cimbali) | #19863 (mattn) | |
|---|---|---|
| Started | June 2021 | March 2026 |
| libvterm changes | New sb_pushline4 callback + premove callback (coordinated with upstream author leonerd) |
New vterm_screen_sb_pushline_continuation() accessor function |
| ABI compatibility | Adds sb_pushline4 while keeping old sb_pushline (ABI-compatible) |
Calls vterm_screen_sb_pushline_continuation() from within existing sb_pushline callback |
| Reflow support | None (explicitly states resize reflow is not handled) | Enables vterm_screen_enable_reflow() (re-wraps on resize) |
| Files changed | 13 files | 6 files |
| Upstream coordination | leonerd implemented in upstream libvterm (rev 843) in July 2024 | No upstream coordination (custom extension) |
| Tests | libvterm tests + Vim tests | Vim tests only |
Strengths:
premove callback provides accurate continuation info when lines scroll out of the viewportscrollbackline_pos_in_buf() / bufline_pos_in_scrollback() provide bidirectional mapping so term_getline(), term_scrape(), term_get_attr() etc. work correctly with joined linesWeaknesses:
cmd.exe does not emit continuation marksStrengths:
vterm_screen_enable_reflow()Weaknesses:
sb_pushline_continuation flag. Since #8365 already has an official upstream API (sb_pushline4) implemented by leonerd, this custom extension will conflict when syncing with upstream libvterm in the futureterm_getline(), term_scrape(), term_get_attr() and other functions that need to account for the line number offset caused by joiningterm_getline() and term_scrape() fixes may be missing — #8365 uses scrollback-to-buffer mapping functions throughout multiple call sites, while #19863's coverage of these edge cases appears more limitedFrom a practical standpoint, #19863 is attractive for its simplicity and reflow support. However, from an upstream compatibility standpoint, #8365 has a clear advantage since leonerd already implemented the sb_pushline4 API in upstream libvterm. The custom extension in #19863 will cause issues when syncing Vim's libvterm fork with upstream in the future.
Ideally, the best approach would be to use #8365's upstream-coordinated libvterm changes as the base and combine them with #19863's reflow enablement. chrisbra also asked in #19863 "How does this differ from #8365?", indicating that reconciliation between the two PRs is needed.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()