Activate last item if item's number is greater than the last one's (#31471)

Release Notes:

- N/A
This commit is contained in:
Kirill Bulatov 2025-05-27 02:24:53 +03:00 committed by GitHub
parent e84463648a
commit fe0bcd14d2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -3249,12 +3249,18 @@ impl Render for Pane {
.on_action(cx.listener(Pane::toggle_zoom))
.on_action(
cx.listener(|pane: &mut Pane, action: &ActivateItem, window, cx| {
pane.activate_item(action.0, true, true, window, cx);
pane.activate_item(
action.0.min(pane.items.len().saturating_sub(1)),
true,
true,
window,
cx,
);
}),
)
.on_action(
cx.listener(|pane: &mut Pane, _: &ActivateLastItem, window, cx| {
pane.activate_item(pane.items.len() - 1, true, true, window, cx);
pane.activate_item(pane.items.len().saturating_sub(1), true, true, window, cx);
}),
)
.on_action(