Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

@LorenzoPiombini
Copy link
Contributor

fixes #31002 #22919 and possibly a class of crashes triggered when msg_scroll_flush() is called during a screen resize.

The root cause of the crashes is that msg_scroll_flush() assumes that the message layout state is consistent with the current geometry, however, during screen_resize() this assumption is invalid:

The resize operation updates geometry in several steps, screen_resize() triggers VimResized autocmds before the resize is finished, those autocmds may execute :redraw, screenstring(), and any other function that calls into the UI layer.

These paths eventually call msg_scroll_flush(), but the message grid is still using stale positions and offsets, Which may triggers the following asserts:

row >= 0 (reproducible)
pos_delta >= 0 ( not always reproducible see chat on issue #32319)
to_scroll >= 0 ( not always reproducible see chat on issue #22919)

while trying to fix these issues I was placing several if statement, in different locations in the codebase, when i realized
that it could be safer, and a lot cleaner to make msg_scroll_flush() a no-op while the screen is resizing:

if (resizing_screen) {
  msg_scrolled_at_flush = msg_scrolled;
  msg_grid_scroll_discount = 0;
  return;
}

This ensures:

  • no geometry-dependent scroll math runs during resize
  • no interaction with stale msg_grid_pos

and once the resize completes, msg_grid_set_pos(),compute_cmdrow(),update_screen() ,msg_grid_validate() recompute the correct message layout, and normal scrolling resumes safely.

@github-actions github-actions bot added the messages UI messages, log messages, dialogs, progress, errors, warnings, feedback label Dec 2, 2025
@LorenzoPiombini LorenzoPiombini marked this pull request as ready for review December 2, 2025 19:19
@przepompownia
Copy link
Contributor

No crash for the #31002 repro, thanks for investigating!

@zeertzjq zeertzjq requested a review from bfredl December 3, 2025 00:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

messages UI messages, log messages, dialogs, progress, errors, warnings, feedback

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Assertion row >=0 failed for oneline error message

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.