Skip to content

Commit a38002d

Browse files
committed
should remove highlights if selection change is detected before debounce
1 parent c2c48d9 commit a38002d

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

crates/editor/src/editor.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4782,6 +4782,15 @@ impl Editor {
47824782
self.clear_background_highlights::<SelectedTextHighlight>(cx);
47834783
return;
47844784
}
4785+
if self.selections.count() != 1 || self.selections.line_mode {
4786+
self.clear_background_highlights::<SelectedTextHighlight>(cx);
4787+
return;
4788+
}
4789+
let selection = self.selections.newest::<Point>(cx);
4790+
if selection.is_empty() || selection.start.row != selection.end.row {
4791+
self.clear_background_highlights::<SelectedTextHighlight>(cx);
4792+
return;
4793+
}
47854794
let debounce = EditorSettings::get_global(cx).selection_highlight_debounce;
47864795
self.selection_highlight_task = Some(cx.spawn_in(window, |editor, mut cx| async move {
47874796
cx.background_executor()

0 commit comments

Comments
 (0)