Skip to content

Commit

Permalink
Fix unexpected behavior in delete_word_backward and delete_word_forwa…
Browse files Browse the repository at this point in the history
  • Loading branch information
nimr0d authored and pathwave committed Nov 4, 2022
1 parent 648f72a commit 682ad54
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions helix-term/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3245,8 +3245,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);
Expand All @@ -3259,10 +3259,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);
Expand Down

0 comments on commit 682ad54

Please sign in to comment.