editor: Use em_advance everywhere for horizontal scroll position computations (#33514)

Closes #33472

This PR fixes some regressions that were introduced in
https://github.com/zed-industries/zed/pull/32558, which updated the
editor scrolling to use `em_advance` instead of `em_width` for the
horizontal scroll position calculation.
However, not all occurrences were updated, which caused issues with wrap
guides and some small stuttering with horizontal autoscroll whilst
typing/navigating with the keyboard.

Release Notes:

- Fixed an issue where horizontal autoscrolling would stutter and indent
guides would drift when scrolling horizontally.
This commit is contained in:
Finn Evers 2025-06-27 11:32:50 +02:00 committed by GitHub
parent e6bc1308af
commit 4c2415b338
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 29 additions and 18 deletions

View file

@ -275,10 +275,10 @@ pub fn deploy_context_menu(
cx,
),
None => {
let character_size = editor.character_size(window);
let character_size = editor.character_dimensions(window);
let menu_position = MenuPosition::PinnedToEditor {
source: source_anchor,
offset: gpui::point(character_size.width, character_size.height),
offset: gpui::point(character_size.em_width, character_size.line_height),
};
Some(MouseContextMenu::new(
editor,