commands: Correct another case that always used primary().

This commit is contained in:
Blaž Hrastnik 2021-03-04 14:12:19 +09:00
parent 7e4830215e
commit 565fb94afe

View file

@ -125,6 +125,10 @@ pub fn move_line_start(cx: &mut Context) {
doc.set_selection(selection); doc.set_selection(selection);
} }
// TODO: move vs extend could take an extra type Extend/Move that would
// Range::new(if Move { pos } if Extend { range.anchor }, pos)
// since these all really do the same thing
pub fn move_next_word_start(cx: &mut Context) { pub fn move_next_word_start(cx: &mut Context) {
let count = cx.count; let count = cx.count;
let doc = cx.doc(); let doc = cx.doc();
@ -958,9 +962,7 @@ pub fn format_selections(cx: &mut Context) {
.selection() .selection()
.ranges() .ranges()
.iter() .iter()
.map(|range| { .map(|range| helix_lsp::util::range_to_lsp_range(doc.text().slice(..), *range))
helix_lsp::util::range_to_lsp_range(doc.text().slice(..), doc.selection().primary())
})
.collect(); .collect();
for range in ranges { for range in ranges {