Skip to content

startscreen.vim centering computed once at VimEnter, not recomputed on resize #9

@chiro-hiro

Description

@chiro-hiro

Severity: low · Category: robustness
Location: plugin/startscreen.vim — lines 59-63, function s:ShowStartScreen (VimEnter only); no VimResized handler

What's wrong

The vertical padding for the logo/help block is calculated a single time from winheight(0) when the start screen is first drawn at VimEnter. The buffer is nomodifiable and there is no VimResized (or WinResized) autocommand to re-render. If the terminal window is resized after Vim launches but before the user dismisses the screen (common when a terminal multiplexer or window manager reflows on startup, or the user maximizes the window), the content stays anchored to the original (often tiny) height and is visibly off-center or pushed against the top. The review brief explicitly lists 'resize' as an edge case for this file. It is cosmetic only (no error, buffer stays nomodifiable), hence low severity.

Evidence

let l:pad = (winheight(0) - len(l:lines)) / 2
if l:pad > 0
let l:lines = repeat([''], l:pad) + l:lines
endif
...
setlocal modifiable
call setline(1, l:lines)
setlocal nomodifiable nomodified

The only autocmds defined are BufWipeout (syntax cleanup, lines 89-94) and the outer VimEnter trigger (line 115). Nothing recomputes l:pad / re-renders on a window-size change.

Suggested fix

Either accept the cosmetic limitation, or add a <buffer>-local VimResized autocommand inside s:ShowStartScreen that re-runs the centering+setline step (factor the line-building + padding + setline into a helper and call it from both VimEnter and VimResized while the start-screen buffer is current). Toggle modifiable around the re-render as is already done.


Filed from an automated multi-agent source review (2026-05-29); finding adversarially verified at high confidence. Line numbers reflect the audit-fixes-2026-05 working tree.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions