Compare commits
No commits in common. "d0ce904faaf11492172ea69115fb182c5d815e6b" and "4389eccdce0de635ce371945d11d05cde7c4193d" have entirely different histories.
d0ce904faa
...
4389eccdce
5 changed files with 4 additions and 24 deletions
|
@ -173,7 +173,6 @@ const LoadError = (error{ NotFound, NotAnObject } || std.json.ParseError(std.jso
|
||||||
const Namespace = struct {
|
const Namespace = struct {
|
||||||
name: []const u8,
|
name: []const u8,
|
||||||
fallback: ?*const Namespace = null,
|
fallback: ?*const Namespace = null,
|
||||||
no_defaults: bool = false,
|
|
||||||
modes: std.StringHashMapUnmanaged(BindingSet),
|
modes: std.StringHashMapUnmanaged(BindingSet),
|
||||||
|
|
||||||
init_command: ?Command = null,
|
init_command: ?Command = null,
|
||||||
|
@ -202,7 +201,7 @@ const Namespace = struct {
|
||||||
try self.load_settings(allocator, mode_entry.value_ptr.*);
|
try self.load_settings(allocator, mode_entry.value_ptr.*);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!self.no_defaults and !std.mem.eql(u8, self.name, default_namespace) and self.fallback == null)
|
if (!std.mem.eql(u8, self.name, default_namespace) and self.fallback == null)
|
||||||
self.fallback = try get_or_load_namespace(default_namespace);
|
self.fallback = try get_or_load_namespace(default_namespace);
|
||||||
|
|
||||||
var modes = parsed.value.object.iterator();
|
var modes = parsed.value.object.iterator();
|
||||||
|
@ -225,14 +224,12 @@ const Namespace = struct {
|
||||||
init_command: ?[]const std.json.Value = null,
|
init_command: ?[]const std.json.Value = null,
|
||||||
deinit_command: ?[]const std.json.Value = null,
|
deinit_command: ?[]const std.json.Value = null,
|
||||||
inherit: ?[]const u8 = null,
|
inherit: ?[]const u8 = null,
|
||||||
no_defaults: ?bool = null,
|
|
||||||
};
|
};
|
||||||
const parsed = try std.json.parseFromValue(JsonSettings, allocator, settings_value, .{
|
const parsed = try std.json.parseFromValue(JsonSettings, allocator, settings_value, .{
|
||||||
.ignore_unknown_fields = true,
|
.ignore_unknown_fields = true,
|
||||||
});
|
});
|
||||||
defer parsed.deinit();
|
defer parsed.deinit();
|
||||||
self.fallback = if (parsed.value.inherit) |fallback| try get_or_load_namespace(fallback) else null;
|
self.fallback = if (parsed.value.inherit) |fallback| try get_or_load_namespace(fallback) else null;
|
||||||
self.no_defaults = parsed.value.no_defaults orelse false;
|
|
||||||
if (parsed.value.init_command) |cmd| self.init_command = try Command.load(allocator, cmd);
|
if (parsed.value.init_command) |cmd| self.init_command = try Command.load(allocator, cmd);
|
||||||
if (parsed.value.deinit_command) |cmd| self.deinit_command = try Command.load(allocator, cmd);
|
if (parsed.value.deinit_command) |cmd| self.deinit_command = try Command.load(allocator, cmd);
|
||||||
}
|
}
|
||||||
|
|
|
@ -616,7 +616,7 @@ pub const Editor = struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self.buffer) |buffer| if (buffer.get_meta()) |meta| {
|
if (self.buffer) |buffer| if (buffer.get_meta()) |meta| {
|
||||||
const frame_ = tracy.initZone(@src(), .{ .name = "extract_state" });
|
const frame_ = tracy.initZone(@src(), .{ .name = extract_state });
|
||||||
defer frame_.deinit();
|
defer frame_.deinit();
|
||||||
try self.extract_state(meta, .none);
|
try self.extract_state(meta, .none);
|
||||||
};
|
};
|
||||||
|
@ -4083,7 +4083,7 @@ pub const Editor = struct {
|
||||||
try self.update_buf(root);
|
try self.update_buf(root);
|
||||||
self.clamp();
|
self.clamp();
|
||||||
}
|
}
|
||||||
pub const smart_insert_pair_meta: Meta = .{ .arguments = &.{.string} };
|
pub const smart_insert_pair_meta = .{ .arguments = &.{.string} };
|
||||||
|
|
||||||
pub fn enable_fast_scroll(self: *Self, _: Context) Result {
|
pub fn enable_fast_scroll(self: *Self, _: Context) Result {
|
||||||
self.fast_scroll = true;
|
self.fast_scroll = true;
|
||||||
|
|
|
@ -290,16 +290,6 @@ const cmds = struct {
|
||||||
}
|
}
|
||||||
pub const palette_menu_up_meta: Meta = .{};
|
pub const palette_menu_up_meta: Meta = .{};
|
||||||
|
|
||||||
pub fn palette_menu_pagedown(self: *Self, _: Ctx) Result {
|
|
||||||
self.menu.select_last();
|
|
||||||
}
|
|
||||||
pub const palette_menu_pagedown_meta: Meta = .{};
|
|
||||||
|
|
||||||
pub fn palette_menu_pageup(self: *Self, _: Ctx) Result {
|
|
||||||
self.menu.select_first();
|
|
||||||
}
|
|
||||||
pub const palette_menu_pageup_meta: Meta = .{};
|
|
||||||
|
|
||||||
pub fn palette_menu_activate(self: *Self, _: Ctx) Result {
|
pub fn palette_menu_activate(self: *Self, _: Ctx) Result {
|
||||||
self.menu.activate_selected();
|
self.menu.activate_selected();
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,11 +32,7 @@ pub fn load_entries(palette: *Type) !usize {
|
||||||
(try palette.entries.addOne()).* = .{ .label = try palette.allocator.dupe(u8, task), .hint = "" };
|
(try palette.entries.addOne()).* = .{ .label = try palette.allocator.dupe(u8, task), .hint = "" };
|
||||||
} else return error.InvalidTaskMessageField;
|
} else return error.InvalidTaskMessageField;
|
||||||
}
|
}
|
||||||
return if (palette.entries.items.len == 0) label.len else blk: {
|
return if (palette.entries.items.len == 0) label.len else 1;
|
||||||
var longest: usize = 0;
|
|
||||||
for (palette.entries.items) |item| longest = @max(longest, item.label.len);
|
|
||||||
break :blk if (longest < label.len) return label.len - longest + 1 else 1;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn clear_entries(palette: *Type) void {
|
pub fn clear_entries(palette: *Type) void {
|
||||||
|
|
|
@ -156,7 +156,6 @@ const TabBar = struct {
|
||||||
|
|
||||||
fn update_tabs(self: *Self) !void {
|
fn update_tabs(self: *Self) !void {
|
||||||
try self.update_tab_buffers();
|
try self.update_tab_buffers();
|
||||||
const prev_widget_count = self.widget_list.widgets.items.len;
|
|
||||||
while (self.widget_list.pop()) |widget| if (widget.dynamic_cast(Button.State(Tab)) == null)
|
while (self.widget_list.pop()) |widget| if (widget.dynamic_cast(Button.State(Tab)) == null)
|
||||||
widget.deinit(self.widget_list.allocator);
|
widget.deinit(self.widget_list.allocator);
|
||||||
var first = true;
|
var first = true;
|
||||||
|
@ -170,8 +169,6 @@ const TabBar = struct {
|
||||||
if (tab.widget.dynamic_cast(Button.State(Tab))) |btn|
|
if (tab.widget.dynamic_cast(Button.State(Tab))) |btn|
|
||||||
try btn.update_label(Tab.name_from_buffer(tab.buffer));
|
try btn.update_label(Tab.name_from_buffer(tab.buffer));
|
||||||
}
|
}
|
||||||
if (prev_widget_count != self.widget_list.widgets.items.len)
|
|
||||||
tui.refresh_hover();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn update_tab_buffers(self: *Self) !void {
|
fn update_tab_buffers(self: *Self) !void {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue