mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-26 03:17:43 +00:00
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:
@@ -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,
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user