commit view: Fix layout shift while loading commit (#44548)

Fixes a few cases where the commit view would layout shift as the diff
loaded. This was caused by:
- Adding the commit message buffer after all the diff files
- Using the gutter dimensions from the last frame for the avatar spacing

Release Notes:

- commit view: Fix layout shift while loading commit

---------

Co-authored-by: MrSubidubi <dev@bahn.sh>
This commit is contained in:
Agus Zubiaga
2025-12-10 15:01:49 +00:00
committed by GitHub
co-authored by MrSubidubi
parent dd431631b4
commit 21f7e6a9e6
10 changed files with 316 additions and 308 deletions
+2 -3
View File
@@ -294,11 +294,10 @@ mod test {
async fn test_scroll(cx: &mut gpui::TestAppContext) {
let mut cx = VimTestContext::new(cx, true).await;
let (line_height, visible_line_count) = cx.editor(|editor, window, _cx| {
let (line_height, visible_line_count) = cx.update_editor(|editor, window, cx| {
(
editor
.style()
.unwrap()
.style(cx)
.text
.line_height_in_pixels(window.rem_size()),
editor.visible_line_count().unwrap(),
+1 -1
View File
@@ -2399,7 +2399,7 @@ async fn test_clipping_on_mode_change(cx: &mut gpui::TestAppContext) {
.end;
editor.last_bounds().unwrap().origin
+ editor
.display_to_pixel_point(current_head, &snapshot, window)
.display_to_pixel_point(current_head, &snapshot, window, cx)
.unwrap()
});
pixel_position.x += px(100.);
@@ -304,11 +304,10 @@ impl NeovimBackedTestContext {
self.neovim.set_option(&format!("scrolloff={}", 3)).await;
// +2 to account for the vim command UI at the bottom.
self.neovim.set_option(&format!("lines={}", rows + 2)).await;
let (line_height, visible_line_count) = self.editor(|editor, window, _cx| {
let (line_height, visible_line_count) = self.update_editor(|editor, window, cx| {
(
editor
.style()
.unwrap()
.style(cx)
.text
.line_height_in_pixels(window.rem_size()),
editor.visible_line_count().unwrap(),