diff --git a/crates/gpui_elements/src/editable_text/input_element.rs b/crates/gpui_elements/src/editable_text/input_element.rs index c7a806f8a9..677bfe98d4 100644 --- a/crates/gpui_elements/src/editable_text/input_element.rs +++ b/crates/gpui_elements/src/editable_text/input_element.rs @@ -344,9 +344,8 @@ impl Element for TextInputElement { } } - let has_selection = !selection.is_empty() && !showing_placeholder; let is_focused = focus_handle.is_focused(window); - if !has_selection && is_focused && cursor_visible { + if !showing_placeholder && is_focused && cursor_visible { const CURSOR_WIDTH: f32 = 2.0; let quad = fill( Bounds::new( diff --git a/crates/gpui_elements/src/editable_text/shared_state.rs b/crates/gpui_elements/src/editable_text/shared_state.rs index ff63b59d84..fb47a13a5b 100644 --- a/crates/gpui_elements/src/editable_text/shared_state.rs +++ b/crates/gpui_elements/src/editable_text/shared_state.rs @@ -472,7 +472,7 @@ impl TextInputStateBase { fn select_to(&mut self, caret_pos: usize, cx: &mut impl TextStateNotifier) { //cx.emit(CursorTrigger::PauseBlinkingForUserAction); let caret_pos = caret_pos.min(self.storage().content_utf8().len()); - self.selected_range = caret_pos..self.selected_range.start; + self.selected_range.start = caret_pos; //self.scroll_to_cursor(); cx.notify_changed(); } @@ -532,7 +532,6 @@ impl TextInputStateBase { let caret_pos = self .storage .offset_from_caret(self.caret_pos(), direction, boundary); - // TODO: this is borked, its not extending the current selection self.select_to(caret_pos, cx); }