focus: a stop that inherits the focus from a removed one is not revealed

A removal hands the focus to a neighbour nobody chose to show, so no scroll owner reveals it: a deleted
guide or a closed canvas text editor no longer pans the canvas to the stop beside it (photocraft#15555).
This commit is contained in:
aiongg
2026-11-21 18:49:26 +00:00
parent d67796f469
commit 9de310681e
2 changed files with 7 additions and 3 deletions
+2 -1
View File
@@ -780,7 +780,8 @@ pub(crate) enum FocusOrigin {
/// it counts as an arrival by key, and a text part selects its whole text so typing replaces it.
Open,
/// The focused stop went away and handed focus to its neighbour: neither the keyboard nor a request chose it, so
/// it is no arrival by key (a deleted guide selects no other guide).
/// it is no arrival by key (a deleted guide selects no other guide) and no scroll owner reveals it (a closed canvas
/// text editor does not pan the canvas to the stop before it).
Removal,
}
+5 -2
View File
@@ -168,11 +168,14 @@ impl State {
self.focus_stop_from(rec, FocusOrigin::Request)
}
/// [`focus_stop`](Self::focus_stop) with what moved focus there.
/// [`focus_stop`](Self::focus_stop) with what moved focus there. A stop that inherits the focus from a removed one
/// is not revealed: nothing chose to show it.
fn focus_stop_from(&mut self, rec: StopRec, origin: FocusOrigin) -> Vec<Act> {
let key = rec.stop.key();
let acts = self.enter_stop(rec, origin);
self.revealed = Some(key);
if origin != FocusOrigin::Removal {
self.revealed = Some(key);
}
acts
}