mirror of
https://github.com/helix-editor/helix.git
synced 2024-11-22 17:36:19 +04:00
Fix unexpected behavior in delete_word_backward and delete_word_forward (#4392)
This commit is contained in:
parent
f486f34ebe
commit
bad49ef2d0
@ -3238,8 +3238,8 @@ pub fn delete_word_backward(cx: &mut Context) {
|
||||
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 fn delete_word_forward(cx: &mut Context) {
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user