aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/commands.rs
diff options
context:
space:
mode:
authorPascal Kuthe2023-04-04 21:34:47 +0000
committerBlaž Hrastnik2023-05-18 06:16:50 +0000
commit5406e9f629313221c8ae97583393dfd6221d3dfc (patch)
tree9aea16dd0b4ac73f9ab989e4b433b594d0b34ab6 /helix-term/src/commands.rs
parent91da0dc172dde1a972be7708188a134db70562c3 (diff)
correctly handle completion rerequest
Diffstat (limited to 'helix-term/src/commands.rs')
-rw-r--r--helix-term/src/commands.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index 7d86bc0b..8d70cd9e 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -33,7 +33,7 @@ use helix_core::{
use helix_view::{
clipboard::ClipboardType,
document::{FormatterError, Mode, SCRATCH_BUFFER_NAME},
- editor::{Action, Motion},
+ editor::{Action, CompleteAction, Motion},
info::Info,
input::KeyEvent,
keyboard::KeyCode,
@@ -4254,7 +4254,12 @@ pub fn completion(cx: &mut Context) {
iter.reverse();
let offset = iter.take_while(|ch| chars::char_is_word(*ch)).count();
let start_offset = cursor.saturating_sub(offset);
- let savepoint = doc.savepoint(view);
+ let savepoint = if let Some(CompleteAction::Selected { savepoint }) = &cx.editor.last_completion
+ {
+ savepoint.clone()
+ } else {
+ doc.savepoint(view)
+ };
let trigger_doc = doc.id();
let trigger_view = view.id;