Merge pull request #227 from MinusGix/more-completion-change

Fix some places where completion would remain when it should not
This commit is contained in:
Dongdong Zhou 2022-03-24 09:31:04 +00:00 committed by GitHub
commit a8b8b7566a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View File

@ -541,7 +541,7 @@ pub fn apply_completion_item(
Ok(())
}
fn cancel_completion(&mut self) {
pub fn cancel_completion(&mut self) {
let completion = Arc::make_mut(&mut self.completion);
completion.cancel();
}
@ -1029,6 +1029,8 @@ fn paste(&mut self, ctx: &mut EventCtx, data: &RegisterData) {
}
}
}
self.update_completion(ctx);
}
fn check_selection_history(&mut self) {
@ -3453,6 +3455,7 @@ fn run_command(
let proxy = self.proxy.clone();
let buffer = self.buffer_mut();
if let Some(delta) = buffer.do_undo(proxy) {
self.update_completion(ctx);
self.jump_to_nearest_delta(&delta);
self.update_diagnositcs_offset(&delta);
}
@ -3462,6 +3465,7 @@ fn run_command(
let proxy = self.proxy.clone();
let buffer = self.buffer_mut();
if let Some(delta) = buffer.do_redo(proxy) {
self.update_completion(ctx);
self.jump_to_nearest_delta(&delta);
self.update_diagnositcs_offset(&delta);
}
@ -3664,6 +3668,7 @@ fn run_command(
let selection =
selection.apply_delta(&delta, true, InsertDrift::Default);
self.set_cursor_after_change(selection);
self.cancel_completion();
}
LapceCommand::ClipboardCopy => {
let data = self

View File

@ -2358,9 +2358,11 @@ fn mouse_down(
match mouse_event.button {
MouseButton::Left => {
self.left_click(ctx, mouse_event, editor_data, config);
editor_data.cancel_completion();
}
MouseButton::Right => {
self.right_click(ctx, editor_data, mouse_event, config);
editor_data.cancel_completion();
}
MouseButton::Middle => {}
_ => (),