Repository navigation
fix(preview): adopt upstream #80 and preserve wrapped content - #94
Merged
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
git cherry-pick -xof upstream 4f6d73a, preserving the upstream author and regression test.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:
scrolloff=0/5/999, checked after redraw and final split synchronization, preserve the mapped cursor, visible following wrapped content, and source state.make -k testpasses 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.