diff --git a/crates/ui/src/input/state.rs b/crates/ui/src/input/state.rs index 34a3b863..1750046f 100644 --- a/crates/ui/src/input/state.rs +++ b/crates/ui/src/input/state.rs @@ -1512,6 +1512,8 @@ impl InputState { pub(super) fn clean(&mut self, window: &mut Window, cx: &mut Context) { self.replace_text("", window, cx); + self.selected_range = (0..0).into(); + self.scroll_to(0, cx); } pub(super) fn escape(&mut self, action: &Escape, window: &mut Window, cx: &mut Context) { diff --git a/crates/ui/src/input/text_input.rs b/crates/ui/src/input/text_input.rs index 49af7792..2c07d0d1 100644 --- a/crates/ui/src/input/text_input.rs +++ b/crates/ui/src/input/text_input.rs @@ -406,6 +406,7 @@ impl RenderOnce for TextInput { move |_, window, cx| { state.update(cx, |state, cx| { state.clean(window, cx); + state.focus(window, cx); }) } }))