git: Fix project diff shortcuts (#26045)

Release Notes:

- git: Fix keyboard shortcut display in project diff view
This commit is contained in:
Conrad Irwin 2025-03-04 10:32:20 -07:00 committed by GitHub
parent ad94642e83
commit 85211889e5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 108 additions and 233 deletions

View file

@ -42,6 +42,7 @@ use gpui::{
SharedString, Size, StatefulInteractiveElement, Style, Styled, Subscription, TextRun,
TextStyleRefinement, Window,
};
use inline_completion::Direction;
use itertools::Itertools;
use language::{
language_settings::{
@ -8906,7 +8907,7 @@ fn diff_hunk_controls(
move |window, cx| {
Tooltip::for_action_in(
"Next Hunk",
&GoToHunk::default(),
&GoToHunk,
&focus_handle,
window,
cx,
@ -8921,7 +8922,11 @@ fn diff_hunk_controls(
let position =
hunk_range.end.to_point(&snapshot.buffer_snapshot);
editor.go_to_hunk_after_or_before_position(
&snapshot, position, true, true, window, cx,
&snapshot,
position,
Direction::Next,
window,
cx,
);
editor.expand_selected_diff_hunks(cx);
});
@ -8938,7 +8943,7 @@ fn diff_hunk_controls(
move |window, cx| {
Tooltip::for_action_in(
"Previous Hunk",
&GoToPreviousHunk::default(),
&GoToPreviousHunk,
&focus_handle,
window,
cx,
@ -8953,7 +8958,11 @@ fn diff_hunk_controls(
let point =
hunk_range.start.to_point(&snapshot.buffer_snapshot);
editor.go_to_hunk_after_or_before_position(
&snapshot, point, false, true, window, cx,
&snapshot,
point,
Direction::Prev,
window,
cx,
);
editor.expand_selected_diff_hunks(cx);
});