fix: make sure completion replacment always reaches at least to the cursor

Seems like sometimes LSPs may lag and not include the last entered char in
the selection.
This commit is contained in:
CJ van den Berg 2026-01-30 14:48:02 +01:00
parent 7a3b8e3fce
commit f65082bea9
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9

View file

@ -302,7 +302,7 @@ fn get_replacement_selection(editor: *ed.Editor, insert_: ?Buffer.Selection, rep
const cursor = editor.get_primary().cursor;
return switch (tui.config().completion_insert_mode) {
.insert => .{ .begin = sel.begin, .end = cursor },
.replace => sel,
.replace => if (!cursor.within(sel)) .{ .begin = sel.begin, .end = cursor } else sel,
};
}