aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/ui
diff options
context:
space:
mode:
authorPascal Kuthe2023-03-02 18:10:47 +0000
committerBlaž Hrastnik2023-03-09 04:01:02 +0000
commit2588fa3710921683c16a84ffd91103a0823a033b (patch)
tree6ff584e2e3a440a5ec18ab8be491f95b7a85a158 /helix-term/src/ui
parent4300a3ad058ea383a59a0a90f31a597eb264a7d4 (diff)
save selection before completion savepoint
Currently, the selection is not saved/restored when completion checkpoints are applied. This is usually fine because undoing changes usually restores maps selections back in insert mode. But this is not always the case and especially problematic in the presence of multi-cursor completions (since completions are applied relative to the selection/cursor) and snippets (which can change the selection)
Diffstat (limited to 'helix-term/src/ui')
-rw-r--r--helix-term/src/ui/completion.rs2
-rw-r--r--helix-term/src/ui/editor.rs4
2 files changed, 3 insertions, 3 deletions
diff --git a/helix-term/src/ui/completion.rs b/helix-term/src/ui/completion.rs
index 85931fe3..179a8cf8 100644
--- a/helix-term/src/ui/completion.rs
+++ b/helix-term/src/ui/completion.rs
@@ -235,7 +235,7 @@ impl Completion {
);
// initialize a savepoint
- doc.savepoint();
+ doc.savepoint(&view);
doc.apply(&transaction, view.id);
editor.last_completion = Some(CompleteAction {
diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs
index 2ea1b714..62f04cc9 100644
--- a/helix-term/src/ui/editor.rs
+++ b/helix-term/src/ui/editor.rs
@@ -914,8 +914,8 @@ impl EditorView {
doc.apply(&tx, view.id);
}
InsertEvent::TriggerCompletion => {
- let (_, doc) = current!(cxt.editor);
- doc.savepoint();
+ let (view, doc) = current!(cxt.editor);
+ doc.savepoint(view);
}
}
}