refactor: implement completion_insert_mode .insert
This commit is contained in:
parent
9729bae7be
commit
3051cc3b86
1 changed files with 10 additions and 1 deletions
|
|
@ -6409,7 +6409,16 @@ pub const Editor = struct {
|
|||
}
|
||||
|
||||
pub fn get_completion_replacement_selection(self: *Self, replace: Selection) ?Selection {
|
||||
return replace.from_pos(self.buf_root() catch return null, self.metrics);
|
||||
var sel = replace.from_pos(self.buf_root() catch return null, self.metrics);
|
||||
sel.normalize();
|
||||
const cursor = self.get_primary().cursor;
|
||||
return switch (tui.config().completion_insert_mode) {
|
||||
.insert => if (self.get_primary().cursor.within(sel))
|
||||
.{ .begin = sel.begin, .end = cursor }
|
||||
else
|
||||
sel,
|
||||
.replace => sel,
|
||||
};
|
||||
}
|
||||
|
||||
pub fn select(self: *Self, ctx: Context) Result {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue