diff --git a/crates/gpui_elements/src/editable_text/caret.rs b/crates/gpui_elements/src/editable_text/caret.rs index 592d87c755..401cfa3ebb 100644 --- a/crates/gpui_elements/src/editable_text/caret.rs +++ b/crates/gpui_elements/src/editable_text/caret.rs @@ -73,7 +73,7 @@ impl Caret { { let handle = cx.subscribe(emitter, |state, _emitter, event, cx| match event { CaretNotify::PauseBlinking => { - if state.interval.is_zero() { + if state.interval.is_zero() || !state.has_focus { return; } @@ -100,9 +100,9 @@ impl Caret { return is_focused; } - match (is_focused, was_focused) { + match (was_focused, is_focused) { // Caret has a blinking interval, and gained focused. - (true, false) => { + (false, true) => { self.has_focus = true; self.paused = false; @@ -112,7 +112,7 @@ impl Caret { true } // Caret has a blinking interval and lost focus - (false, true) => { + (true, false) => { self.has_focus = false; self.visible = false; self.paused = false; diff --git a/crates/gpui_elements/src/editable_text/state.rs b/crates/gpui_elements/src/editable_text/state.rs index 525411fd19..c0b1838cfb 100644 --- a/crates/gpui_elements/src/editable_text/state.rs +++ b/crates/gpui_elements/src/editable_text/state.rs @@ -1138,8 +1138,8 @@ impl<'app> EditableTextActionHandler> for EditableTextState window: &mut Window, cx: &mut Context<'app, Self>, ) { - let character_pos = self.index_for_pixel_point(text_position, window.line_height()); if self.is_selecting && self.click_count == 1 { + let character_pos = self.index_for_pixel_point(text_position, window.line_height()); self.select_to(character_pos, cx); } }