fix: handle replacement completion ranges in Editor.replicate_selection
This commit is contained in:
parent
d123e87b52
commit
640904addd
1 changed files with 8 additions and 7 deletions
|
|
@ -4901,16 +4901,17 @@ pub const Editor = struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn replicate_selection(self: *Self, sel: Selection) void {
|
fn replicate_selection(self: *Self, sel: Selection) void {
|
||||||
const dist = if (sel.begin.row != sel.end.row)
|
if (sel.begin.row != sel.end.row) return;
|
||||||
0
|
const primary = self.get_primary();
|
||||||
else if (sel.begin.col > sel.end.col)
|
const cursor = primary.cursor;
|
||||||
sel.begin.col - sel.end.col
|
|
||||||
else
|
const dist_begin = cursor.col - sel.begin.col;
|
||||||
sel.end.col - sel.begin.col;
|
const dist_end = sel.end.col - cursor.col;
|
||||||
|
|
||||||
for (self.cursels.items) |*cursel_| if (cursel_.*) |*cursel| {
|
for (self.cursels.items) |*cursel_| if (cursel_.*) |*cursel| {
|
||||||
var s = Selection.from_cursor(&cursel.cursor);
|
var s = Selection.from_cursor(&cursel.cursor);
|
||||||
s.begin.col -|= dist;
|
s.begin.col -|= dist_begin;
|
||||||
|
s.end.col += dist_end;
|
||||||
cursel.selection = s;
|
cursel.selection = s;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue