Skip to content

fix(preview): adopt upstream #80 and preserve wrapped content - #94

Merged
denny0223 merged 2 commits into
mainfrom
backport/upstream-80
Oct 26, 2026
Merged

denny0223 merged 2 commits into
mainfrom
backport/upstream-80

Conversation

@denny0223

@denny0223 denny0223 commented Oct 26, 2026 •

Copy link
Copy Markdown
Owner

Preview windows can hide the start of a short document and leave avoidable blank rows near EOF. This adopts upstream #80, then corrects its buffer-line cap so wrapped paragraphs after the cursor stay visible.

The original cap treats buffer lines as screen rows. With 13 wrapped paragraphs in a 120×40 UI, opening the tab preview on source line 21 places the cursor on the last screen row and hides the next paragraph. The combined change keeps the existing centering behavior when enough screen rows remain; otherwise it uses Neovim's native bottom alignment. The height check skips later buffer lines once enough screen rows have been found. It needs no new helper, option, or dependency.

History is intentionally two commits:

  1. 5225214: an unchanged git cherry-pick -x of upstream 4f6d73a, preserving the upstream author and regression test.
  2. 86c7c95: a fork correction with EOF and attached-UI wrapping tests. Review and merge the two commits together; the original backport alone has the wrapping regression described above.

The shared method serves float, tab, toggle, and split previews. Existing split synchronization remains in charge of its final view. This change does not alter window sizing or picker-specific scrolling.

Validation:

  • The permanent scroll tests distinguish all three states on Neovim 0.12.0 and 0.12.5: the fork base fails the short-document and EOF assertions; the unchanged upstream patch fails the wrapped-following-paragraph assertion; the combined change passes all 9 checks.
  • Four preview modes with scrolloff=0/5/999, checked after redraw and final split synchronization, preserve the mapped cursor, visible following wrapped content, and source state.
  • make -k test passes on both supported Neovim versions; whole-repository StyLua 2.5.2 and Luacheck 1.2.0 pass (134 Lua files, zero warnings/errors). Optional local Snacks/Telescope integration cases skip because their plugin checkouts are not installed.

All 11 baseline checks passed for 86c7c95: Tests, Lint, Terminal, and Media tools. Rawhide is intentionally skipped in baseline runs.

Earlier macOS jobs were cancelled before execution because GitHub could not acquire hosted arm64 runners. Both macOS versions subsequently executed and passed; the final Neovim 0.12.0 job passed on attempt 4, including the core tests and the required-result gate. No CI exception is needed.

The upstream fix and fork correction were reviewed in multiple rounds for correctness, user-visible behavior, test sensitivity, and maintenance cost before the commits were created.

delphinus and others added 2 commits October 26, 2026 23:53
The float preview centers the line under the source cursor. When the
whole document fit the window, that still scrolled it: with the cursor
near the end, the first lines, the heading included, went out of view
and the bottom rows were left empty.

The topline is now capped so the last line reaches no higher than the
bottom of the window. Every line takes at least one row, so the window
stays filled when lines wrap.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
(cherry picked from commit 4f6d73a)
Capping the topline by buffer line count moves the cursor to the bottom
when following wrapped content already fills the screen. Measure the
remaining screen rows, stopping before later buffer lines once a window
is filled, and use the existing native EOF alignment only when those
rows would leave a gap.

Keep the original centering path when enough screen rows remain. Add EOF
and attached-UI wrapping regressions alongside the upstream tests.

Upstream-PR: delphinus#80
@denny0223
denny0223 merged commit 54f0ff8 into main Oct 26, 2026
27 of 31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants