diff --git a/crates/ui-canvas/src/canvas_controls/guides/mod.rs b/crates/ui-canvas/src/canvas_controls/guides/mod.rs index bb77d676b..2d8989a17 100644 --- a/crates/ui-canvas/src/canvas_controls/guides/mod.rs +++ b/crates/ui-canvas/src/canvas_controls/guides/mod.rs @@ -125,7 +125,7 @@ struct PendingKey(Option); /// modifiers (Ctrl turns snapping off). /// - The guides are one Tab stop. Page Up and Page Down select the previous or next guide (vertical guides left to /// right, then horizontal ones top to bottom), the arrow keys nudge the selected one across its axis (Shift moves -/// it by the large step) and Delete or Backspace removes it. With the canvas focused, Delete or Backspace removes +/// it by the large step) and Delete or Backspace removes it and clears the selection. With the canvas focused, Delete or Backspace removes /// the selected guide unless it is locked, before the canvas's tool and the app's shortcuts. /// - A press on a guide selects it, so [`GuidesOutput::select`] reports the key. A press on the canvas background /// (one that reaches the canvas's tool) clears the selection, reported as `Some(None)`. @@ -386,12 +386,8 @@ impl<'a> Guides<'a> { let forward = cx.intents().take_exact(&Intent::delete(true, Granularity::Unit)); let backward = cx.intents().take_exact(&Intent::delete(false, Granularity::Unit)); if forward || backward { - let next = place::after_removal(guides, &place::keyboard_order(guides), guide.key); cx.set(place::removed(guides, guide.key)); - self.report.select = Some(next); - if let Some(next) = next { - cx.focus_part(next.part(GUIDE)); - } + self.report.select = Some(None); } } } diff --git a/crates/ui-canvas/src/canvas_controls/guides/place.rs b/crates/ui-canvas/src/canvas_controls/guides/place.rs index 96389f591..8139c88a7 100644 --- a/crates/ui-canvas/src/canvas_controls/guides/place.rs +++ b/crates/ui-canvas/src/canvas_controls/guides/place.rs @@ -120,9 +120,3 @@ pub(super) fn with_guide(guides: &[Guide], guide: Guide) -> Vec { pub(super) fn fresh_key(guides: &[Guide]) -> GuideKey { GuideKey::new(guides.iter().map(|guide| guide.key.get() + 1).max().unwrap_or(0)) } - -/// The guide that holds the place of `key` once it is gone: the next in `order`, else the one before it. -pub(super) fn after_removal(guides: &[Guide], order: &[usize], key: GuideKey) -> Option { - let at = order.iter().position(|&index| guides[index].key == key)?; - order.get(at + 1).or_else(|| at.checked_sub(1).and_then(|before| order.get(before))).map(|&index| guides[index].key) -}