aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNimrod2022-10-21 06:08:37 +0000
committerGitHub2022-10-21 06:08:37 +0000
commitbad49ef2d095cca88a9e0bd39da329b86bda3d75 (patch)
tree7622d4e3677131da912e09e9572ceb404ed1caf3
parentf486f34ebe0e21f0e109e24037e73182b2cf510a (diff)
Fix unexpected behavior in delete_word_backward and delete_word_forward (#4392)
-rw-r--r--helix-term/src/commands.rs13
1 files changed, 7 insertions, 6 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index a8dafc33..c5ee72d2 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -3238,8 +3238,8 @@ pub mod insert {
let text = doc.text().slice(..);
let selection = doc.selection(view.id).clone().transform(|range| {
- let cursor = Range::point(range.cursor(text));
- let next = movement::move_prev_word_start(text, cursor, count);
+ let anchor = movement::move_prev_word_start(text, range, count).from();
+ let next = Range::new(anchor, range.cursor(text));
exclude_cursor(text, next, range)
});
delete_selection_insert_mode(doc, view, &selection);
@@ -3252,10 +3252,11 @@ pub mod insert {
let (view, doc) = current!(cx.editor);
let text = doc.text().slice(..);
- let selection = doc
- .selection(view.id)
- .clone()
- .transform(|range| movement::move_next_word_start(text, range, count));
+ let selection = doc.selection(view.id).clone().transform(|range| {
+ let head = movement::move_next_word_end(text, range, count).to();
+ Range::new(range.cursor(text), head)
+ });
+
delete_selection_insert_mode(doc, view, &selection);
lsp::signature_help_impl(cx, SignatureHelpInvoked::Automatic);