fix: replace full completion item correctly in completion_dropdown
This commit is contained in:
parent
394eb5405f
commit
8c9146a1c5
1 changed files with 6 additions and 6 deletions
|
|
@ -108,8 +108,9 @@ pub fn update_query(self: *Type, query: []const u8) void {
|
||||||
primary.selection = get_insert_selection(self, editor.get_primary().cursor);
|
primary.selection = get_insert_selection(self, editor.get_primary().cursor);
|
||||||
const b = editor.buf_for_update() catch return;
|
const b = editor.buf_for_update() catch return;
|
||||||
const root_ = editor.insert(b.root, primary, query, b.allocator) catch return;
|
const root_ = editor.insert(b.root, primary, query, b.allocator) catch return;
|
||||||
primary.selection = null;
|
|
||||||
self.value.cursor = editor.get_primary().cursor;
|
self.value.cursor = editor.get_primary().cursor;
|
||||||
|
if (self.value.replace) |*sel| sel.* = .{ .begin = sel.begin, .end = self.value.cursor };
|
||||||
|
primary.selection = null;
|
||||||
editor.update_buf(root_) catch {};
|
editor.update_buf(root_) catch {};
|
||||||
editor.clamp();
|
editor.clamp();
|
||||||
editor.need_render();
|
editor.need_render();
|
||||||
|
|
@ -117,13 +118,12 @@ pub fn update_query(self: *Type, query: []const u8) void {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_insert_selection(self: *Type, cursor: ed.Cursor) ed.Selection {
|
fn get_insert_selection(self: *Type, cursor: ed.Cursor) ed.Selection {
|
||||||
const begin = if (self.value.replace) |sel|
|
return if (self.value.replace) |sel|
|
||||||
sel.begin
|
sel
|
||||||
else if (self.value.start.selection) |sel|
|
else if (self.value.start.selection) |sel|
|
||||||
sel.begin
|
sel
|
||||||
else
|
else
|
||||||
self.value.start.cursor;
|
.{ .begin = self.value.start.cursor, .end = cursor };
|
||||||
return .{ .begin = begin, .end = cursor };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn clear_entries(self: *Type) void {
|
pub fn clear_entries(self: *Type) void {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue