Skip to content

Conversation

@taylorplewe
Copy link

@taylorplewe taylorplewe commented Nov 15, 2025

Currently, following a jump command from the language server (e.g., goto_definition), the view scrolls vertically to reveal the definition but not horizontally. This often results in the newly highlighted definition being offscreen (specifically on vertical monitors), resulting in a confusing user experience.

This pull request fixes this by invoking view.ensure_cursor_in_view() at the end of jump_to_position() in helix-term/src/commands/lsp.rs. Please don't hesitate to suggest a better way of achieving this if there is one (which is likely.) My gut tells me both align_view() and ensure_cursor_in_view() do not both need to be invoked, but removing the former resulted in buggy behavior when I tested it.

For regular (synchronous) commands, such as rotate_selections_forward (mapped to )), the view is scrolled horizontally to reveal the primary cursor because view.ensure_cursor_in_view() is invoked following all command execution (currently line 1481 of helix-term/src/ui/editor.rs).

Before:
hx-goto-def-scroll-horizontal-before

After:
hx-goto-def-scroll-horizontal-after

@taylorplewe taylorplewe marked this pull request as ready for review November 15, 2025 21:47
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.

1 participant