diff --git a/crates/ui/src/input/state.rs b/crates/ui/src/input/state.rs index d040ab1c..fbb8dfa7 100644 --- a/crates/ui/src/input/state.rs +++ b/crates/ui/src/input/state.rs @@ -1060,6 +1060,12 @@ impl InputState { window: &mut Window, cx: &mut Context, ) { + if !self.selected_range.is_empty() { + self.replace_text_in_range(None, "", window, cx); + self.pause_blink_cursor(cx); + return; + } + let mut offset = self.start_of_line(); if offset == self.cursor() { offset = offset.saturating_sub(1); @@ -1070,7 +1076,6 @@ impl InputState { window, cx, ); - self.pause_blink_cursor(cx); } @@ -1080,6 +1085,12 @@ impl InputState { window: &mut Window, cx: &mut Context, ) { + if !self.selected_range.is_empty() { + self.replace_text_in_range(None, "", window, cx); + self.pause_blink_cursor(cx); + return; + } + let mut offset = self.end_of_line(); if offset == self.cursor() { offset = (offset + 1).clamp(0, self.text.len()); @@ -1099,6 +1110,12 @@ impl InputState { window: &mut Window, cx: &mut Context, ) { + if !self.selected_range.is_empty() { + self.replace_text_in_range(None, "", window, cx); + self.pause_blink_cursor(cx); + return; + } + let offset = self.previous_start_of_word(); self.replace_text_in_range_silent( Some(self.range_to_utf16(&(offset..self.cursor()))), @@ -1115,6 +1132,12 @@ impl InputState { window: &mut Window, cx: &mut Context, ) { + if !self.selected_range.is_empty() { + self.replace_text_in_range(None, "", window, cx); + self.pause_blink_cursor(cx); + return; + } + let offset = self.next_end_of_word(); self.replace_text_in_range_silent( Some(self.range_to_utf16(&(self.cursor()..offset))),