fix: handle replacement completion ranges in Editor.replicate_selection

This commit is contained in:
CJ van den Berg 2026-01-28 17:49:22 +01:00
parent d123e87b52
commit 640904addd
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9

View file

@ -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;
}; };
} }