Compare commits
3 commits
eb1b0b7b7a
...
da942fe640
| Author | SHA1 | Date | |
|---|---|---|---|
| da942fe640 | |||
| 7dab15da20 | |||
| 93bfc70171 |
3 changed files with 24 additions and 18 deletions
|
|
@ -3427,6 +3427,10 @@ pub const Editor = struct {
|
|||
}
|
||||
|
||||
fn move_cursor_word_left_space(root: Buffer.Root, cursor: *Cursor, metrics: Buffer.Metrics) error{Stop}!void {
|
||||
if (is_eol_left(root, cursor, metrics)) {
|
||||
try move_cursor_left(root, cursor, metrics);
|
||||
return;
|
||||
}
|
||||
try move_cursor_left(root, cursor, metrics);
|
||||
var next = cursor.*;
|
||||
next.move_left(root, metrics) catch
|
||||
|
|
|
|||
|
|
@ -40,24 +40,25 @@ pub const defaultValue: ValueType = .{};
|
|||
var max_description: usize = 0;
|
||||
|
||||
pub fn load_entries(self: *Type) !usize {
|
||||
max_description = 0;
|
||||
var max_label_len: usize = 0;
|
||||
|
||||
const editor = tui.get_active_editor() orelse return error.NotFound;
|
||||
self.value.start = editor.get_primary().*;
|
||||
var iter: []const u8 = editor.completions.items;
|
||||
while (iter.len > 0) {
|
||||
var cbor_item: []const u8 = undefined;
|
||||
if (!try cbor.matchValue(&iter, cbor.extract_cbor(&cbor_item))) return error.BadCompletion;
|
||||
(try self.entries.addOne(self.allocator)).* = .{ .cbor = cbor_item, .label = undefined, .sort_text = undefined };
|
||||
}
|
||||
|
||||
max_description = 0;
|
||||
var max_label_len: usize = 0;
|
||||
for (self.entries.items) |*item| {
|
||||
const values = get_values(item.cbor);
|
||||
const values = get_values(cbor_item);
|
||||
if (self.value.replace == null) if (get_replace_selection(values.replace)) |replace| {
|
||||
self.value.replace = replace;
|
||||
};
|
||||
item.label = values.label;
|
||||
item.sort_text = values.sort_text;
|
||||
const item = try self.entries.addOne(self.allocator);
|
||||
item.* = .{
|
||||
.cbor = cbor_item,
|
||||
.label = values.label,
|
||||
.sort_text = values.sort_text,
|
||||
};
|
||||
|
||||
var lines = std.mem.splitScalar(u8, values.label_description, '\n');
|
||||
const label_description_len: usize = if (lines.next()) |desc| desc.len else values.label_description.len;
|
||||
|
|
|
|||
|
|
@ -35,24 +35,25 @@ pub const defaultValue: ValueType = .{};
|
|||
var max_description: usize = 0;
|
||||
|
||||
pub fn load_entries(palette: *Type) !usize {
|
||||
max_description = 0;
|
||||
var max_label_len: usize = 0;
|
||||
|
||||
const editor = tui.get_active_editor() orelse return error.NotFound;
|
||||
palette.value.start = editor.get_primary().*;
|
||||
var iter: []const u8 = editor.completions.items;
|
||||
while (iter.len > 0) {
|
||||
var cbor_item: []const u8 = undefined;
|
||||
if (!try cbor.matchValue(&iter, cbor.extract_cbor(&cbor_item))) return error.BadCompletion;
|
||||
(try palette.entries.addOne(palette.allocator)).* = .{ .cbor = cbor_item, .label = undefined, .sort_text = undefined };
|
||||
}
|
||||
|
||||
max_description = 0;
|
||||
var max_label_len: usize = 0;
|
||||
for (palette.entries.items) |*item| {
|
||||
const values = get_values(item.cbor);
|
||||
const values = get_values(cbor_item);
|
||||
if (palette.value.replace == null) if (get_replace_selection(values.replace)) |replace| {
|
||||
palette.value.replace = replace;
|
||||
};
|
||||
item.label = values.label;
|
||||
item.sort_text = values.sort_text;
|
||||
const item = (try palette.entries.addOne(palette.allocator));
|
||||
item.* = .{
|
||||
.cbor = cbor_item,
|
||||
.label = values.label,
|
||||
.sort_text = values.sort_text,
|
||||
};
|
||||
|
||||
var lines = std.mem.splitScalar(u8, values.label_description, '\n');
|
||||
const label_description_len = if (lines.next()) |desc| desc.len else values.label_description.len;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue