refactor: remove unused parameter in set_base_style
This commit is contained in:
parent
0a43fa853f
commit
cfb9f8cf11
25 changed files with 28 additions and 28 deletions
|
@ -293,7 +293,7 @@ pub fn set_bg_palindex(self: *Plane, idx: c_uint) !void {
|
|||
self.style.bg = .{ .index = @intCast(idx) };
|
||||
}
|
||||
|
||||
pub inline fn set_base_style(self: *Plane, _: [*c]const u8, style_: Style) void {
|
||||
pub inline fn set_base_style(self: *Plane, style_: Style) void {
|
||||
self.style_base.fg = if (style_.fg) |col| to_cell_color(col) else .default;
|
||||
self.style_base.bg = if (style_.bg) |col| to_cell_color(col) else .default;
|
||||
if (style_.fs) |fs| set_font_style(&self.style, fs);
|
||||
|
|
|
@ -29,7 +29,7 @@ pub fn Options(context: type) type {
|
|||
pub fn do_nothing(_: *context, _: *State(Context)) void {}
|
||||
|
||||
pub fn on_render_default(_: *context, self: *State(Context), theme: *const Widget.Theme) bool {
|
||||
self.plane.set_base_style(" ", if (self.active) theme.scrollbar_active else if (self.hover) theme.scrollbar_hover else theme.scrollbar);
|
||||
self.plane.set_base_style(if (self.active) theme.scrollbar_active else if (self.hover) theme.scrollbar_hover else theme.scrollbar);
|
||||
self.plane.erase();
|
||||
self.plane.home();
|
||||
_ = self.plane.print(" {s} ", .{self.opts.label}) catch {};
|
||||
|
|
|
@ -22,7 +22,7 @@ pub fn Options(context: type) type {
|
|||
pub fn do_nothing(_: context, _: *State(Context)) void {}
|
||||
|
||||
pub fn on_render_default(_: context, self: *State(Context), theme: *const Widget.Theme) bool {
|
||||
self.plane.set_base_style(" ", if (self.text.items.len > 0) theme.input else theme.input_placeholder);
|
||||
self.plane.set_base_style(if (self.text.items.len > 0) theme.input else theme.input_placeholder);
|
||||
self.plane.erase();
|
||||
self.plane.home();
|
||||
if (self.text.items.len > 0) {
|
||||
|
|
|
@ -27,7 +27,7 @@ pub fn Options(context: type) type {
|
|||
|
||||
pub fn on_render_default(_: context, button: *Button.State(*State(Context)), theme: *const Widget.Theme, selected: bool) bool {
|
||||
const style_base = if (button.active) theme.editor_cursor else if (button.hover or selected) theme.editor_selection else theme.editor;
|
||||
button.plane.set_base_style(" ", style_base);
|
||||
button.plane.set_base_style(style_base);
|
||||
button.plane.erase();
|
||||
button.plane.home();
|
||||
_ = button.plane.print(" {s} ", .{button.opts.label}) catch {};
|
||||
|
|
|
@ -815,7 +815,7 @@ pub const Editor = struct {
|
|||
const frame = tracy.initZone(@src(), .{ .name = "editor render screen" });
|
||||
defer frame.deinit();
|
||||
|
||||
self.plane.set_base_style(" ", theme.editor);
|
||||
self.plane.set_base_style(theme.editor);
|
||||
self.plane.erase();
|
||||
if (hl_row) |_|
|
||||
self.render_line_highlight(&self.get_primary().cursor, theme) catch {};
|
||||
|
|
|
@ -122,7 +122,7 @@ inline fn get_width(self: *Self) usize {
|
|||
pub fn render(self: *Self, theme: *const Widget.Theme) bool {
|
||||
const frame = tracy.initZone(@src(), .{ .name = "gutter render" });
|
||||
defer frame.deinit();
|
||||
self.plane.set_base_style(" ", theme.editor_gutter);
|
||||
self.plane.set_base_style(theme.editor_gutter);
|
||||
self.plane.erase();
|
||||
if (self.linenum) {
|
||||
const relative = self.relative or if (tui.current().input_mode) |mode| mode.line_numbers == .relative else false;
|
||||
|
|
|
@ -122,7 +122,7 @@ pub fn reset(self: *Self) void {
|
|||
}
|
||||
|
||||
pub fn render(self: *Self, theme: *const Widget.Theme) bool {
|
||||
self.plane.set_base_style(" ", theme.panel);
|
||||
self.plane.set_base_style(theme.panel);
|
||||
self.plane.erase();
|
||||
self.plane.home();
|
||||
return self.menu.container_widget.render(theme);
|
||||
|
@ -148,7 +148,7 @@ fn handle_render_menu(self: *Self, button: *Button.State(*Menu.State(*Self)), th
|
|||
if (idx >= self.entries.items.len) {
|
||||
return false;
|
||||
}
|
||||
button.plane.set_base_style(" ", style_base);
|
||||
button.plane.set_base_style(style_base);
|
||||
button.plane.erase();
|
||||
button.plane.home();
|
||||
const entry = &self.entries.items[idx];
|
||||
|
|
|
@ -76,7 +76,7 @@ pub fn receive(_: *Self, _: tp.pid_ref, m: tp.message) error{Exit}!bool {
|
|||
fn menu_on_render(_: *Self, button: *Button.State(*Menu.State(*Self)), theme: *const Widget.Theme, selected: bool) bool {
|
||||
const style_base = if (button.active) theme.editor_cursor else if (button.hover or selected) theme.editor_selection else theme.editor;
|
||||
if (button.active or button.hover or selected) {
|
||||
button.plane.set_base_style(" ", style_base);
|
||||
button.plane.set_base_style(style_base);
|
||||
button.plane.erase();
|
||||
} else {
|
||||
button.plane.set_base_style_bg_transparent(" ", style_base);
|
||||
|
@ -134,7 +134,7 @@ fn menu_action_quit(_: **Menu.State(*Self), _: *Button.State(*Menu.State(*Self))
|
|||
}
|
||||
|
||||
pub fn render(self: *Self, theme: *const Widget.Theme) bool {
|
||||
self.plane.set_base_style("", theme.editor);
|
||||
self.plane.set_base_style(theme.editor);
|
||||
self.plane.erase();
|
||||
self.plane.home();
|
||||
if (self.fire) |*fire| fire.render();
|
||||
|
|
|
@ -50,7 +50,7 @@ pub fn set_content(self: *Self, content: []const u8) !void {
|
|||
}
|
||||
|
||||
pub fn render(self: *Self, theme: *const Widget.Theme) bool {
|
||||
self.plane.set_base_style(" ", theme.panel);
|
||||
self.plane.set_base_style(theme.panel);
|
||||
self.plane.erase();
|
||||
self.plane.home();
|
||||
for (self.lines.items) |line| {
|
||||
|
|
|
@ -52,7 +52,7 @@ pub fn deinit(self: *Self, allocator: Allocator) void {
|
|||
}
|
||||
|
||||
pub fn render(self: *Self, theme: *const Widget.Theme) bool {
|
||||
self.plane.set_base_style(" ", theme.panel);
|
||||
self.plane.set_base_style(theme.panel);
|
||||
self.plane.erase();
|
||||
self.plane.home();
|
||||
const height = self.plane.dim_y();
|
||||
|
|
|
@ -200,5 +200,5 @@ fn show_font(self: *Self, font: ?Widget.Theme.FontStyle) void {
|
|||
}
|
||||
|
||||
fn reset_style(self: *Self) void {
|
||||
self.plane.set_base_style(" ", (self.theme orelse return).panel);
|
||||
self.plane.set_base_style((self.theme orelse return).panel);
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ pub fn render(self: *Self, theme: *const Widget.Theme) bool {
|
|||
const style_normal = theme.panel;
|
||||
const style_info: Widget.Theme.Style = .{ .fg = theme.editor_information.fg, .fs = theme.editor_information.fs };
|
||||
const style_error: Widget.Theme.Style = .{ .fg = theme.editor_error.fg, .fs = theme.editor_error.fs };
|
||||
self.plane.set_base_style(" ", style_normal);
|
||||
self.plane.set_base_style(style_normal);
|
||||
self.plane.erase();
|
||||
self.plane.home();
|
||||
const height = self.plane.dim_y();
|
||||
|
|
|
@ -98,7 +98,7 @@ inline fn max_menu_width() usize {
|
|||
fn on_render_menu(_: *Self, button: *Button.State(*Menu.State(*Self)), theme: *const Widget.Theme, selected: bool) bool {
|
||||
const style_base = if (button.active) theme.editor_cursor else if (button.hover or selected) theme.editor_selection else theme.editor_widget;
|
||||
const style_keybind = if (tui.find_scope_style(theme, "entity.name")) |sty| sty.style else style_base;
|
||||
button.plane.set_base_style(" ", style_base);
|
||||
button.plane.set_base_style(style_base);
|
||||
button.plane.erase();
|
||||
button.plane.home();
|
||||
var file_path: []const u8 = undefined;
|
||||
|
|
|
@ -117,7 +117,7 @@ pub fn Create(options: type) type {
|
|||
fn on_render_menu(_: *Self, button: *Button.State(*Menu.State(*Self)), theme: *const Widget.Theme, selected: bool) bool {
|
||||
const style_label = if (button.active) theme.editor_cursor else if (button.hover or selected) theme.editor_selection else theme.editor_widget;
|
||||
const style_hint = if (tui.find_scope_style(theme, "entity.name")) |sty| sty.style else style_label;
|
||||
button.plane.set_base_style(" ", style_label);
|
||||
button.plane.set_base_style(style_label);
|
||||
button.plane.erase();
|
||||
button.plane.home();
|
||||
var label: []const u8 = undefined;
|
||||
|
|
|
@ -126,7 +126,7 @@ pub fn render(self: *Self, theme: *const Widget.Theme) bool {
|
|||
theme.scrollbar;
|
||||
const frame = tracy.initZone(@src(), .{ .name = "scrollbar_v render" });
|
||||
defer frame.deinit();
|
||||
self.plane.set_base_style(" ", style);
|
||||
self.plane.set_base_style(style);
|
||||
self.plane.erase();
|
||||
smooth_bar_at(&self.plane, @intCast(self.pos_scrn), @intCast(self.view_scrn)) catch {};
|
||||
return false;
|
||||
|
|
|
@ -35,7 +35,7 @@ pub fn layout(self: *Self) Widget.Layout {
|
|||
}
|
||||
|
||||
pub fn render(self: *Self, theme: *const Widget.Theme) bool {
|
||||
self.plane.set_base_style(" ", theme.statusbar);
|
||||
self.plane.set_base_style(theme.statusbar);
|
||||
self.plane.erase();
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ pub fn layout(_: *Self) Widget.Layout {
|
|||
}
|
||||
|
||||
pub fn render(self: *Self, theme: *const Widget.Theme) bool {
|
||||
self.plane.set_base_style(" ", theme.statusbar);
|
||||
self.plane.set_base_style(theme.statusbar);
|
||||
self.plane.erase();
|
||||
self.plane.home();
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ pub fn layout(self: *Self, _: *Button.State(Self)) Widget.Layout {
|
|||
|
||||
pub fn render(self: *Self, btn: *Button.State(Self), theme: *const Widget.Theme) bool {
|
||||
const bg_style = if (btn.active) theme.editor_cursor else if (btn.hover) theme.statusbar_hover else theme.statusbar;
|
||||
btn.plane.set_base_style(" ", bg_style);
|
||||
btn.plane.set_base_style(bg_style);
|
||||
btn.plane.erase();
|
||||
btn.plane.home();
|
||||
_ = btn.plane.putstr(self.rendered) catch {};
|
||||
|
|
|
@ -78,7 +78,7 @@ pub fn layout(_: *Self, _: *Button.State(Self)) Widget.Layout {
|
|||
pub fn render(self: *Self, btn: *Button.State(Self), theme: *const Widget.Theme) bool {
|
||||
const frame = tracy.initZone(@src(), .{ .name = @typeName(@This()) ++ " render" });
|
||||
defer frame.deinit();
|
||||
btn.plane.set_base_style(" ", if (btn.active) theme.editor_cursor else theme.statusbar);
|
||||
btn.plane.set_base_style(if (btn.active) theme.editor_cursor else theme.statusbar);
|
||||
btn.plane.erase();
|
||||
btn.plane.home();
|
||||
if (tui.current().mini_mode) |_|
|
||||
|
|
|
@ -93,7 +93,7 @@ fn render_idle(self: *Self) bool {
|
|||
pub fn render(self: *Self, theme: *const Widget.Theme) bool {
|
||||
const frame = tracy.initZone(@src(), .{ .name = @typeName(@This()) ++ " render" });
|
||||
defer frame.deinit();
|
||||
self.plane.set_base_style(" ", if (self.hover) theme.statusbar_hover else theme.statusbar);
|
||||
self.plane.set_base_style(if (self.hover) theme.statusbar_hover else theme.statusbar);
|
||||
self.frame += 1;
|
||||
if (self.frame - self.key_active_frame > self.wipe_after_frames)
|
||||
self.unset_key_all();
|
||||
|
|
|
@ -41,7 +41,7 @@ pub fn layout(self: *Self, btn: *Button.State(Self)) Widget.Layout {
|
|||
}
|
||||
|
||||
pub fn render(self: *Self, btn: *Button.State(Self), theme: *const Widget.Theme) bool {
|
||||
btn.plane.set_base_style(" ", if (btn.active) theme.editor_cursor else if (btn.hover) theme.statusbar_hover else theme.statusbar);
|
||||
btn.plane.set_base_style(if (btn.active) theme.editor_cursor else if (btn.hover) theme.statusbar_hover else theme.statusbar);
|
||||
btn.plane.erase();
|
||||
btn.plane.home();
|
||||
_ = btn.plane.putstr(self.rendered) catch {};
|
||||
|
|
|
@ -69,7 +69,7 @@ pub fn render(self: *Self, theme: *const Widget.Theme) bool {
|
|||
const style_normal = theme.statusbar;
|
||||
const style_info: Widget.Theme.Style = .{ .fg = theme.statusbar.fg, .fs = theme.editor_information.fs };
|
||||
const style_error: Widget.Theme.Style = .{ .fg = theme.editor_error.fg, .fs = theme.editor_error.fs };
|
||||
self.plane.set_base_style(" ", style_normal);
|
||||
self.plane.set_base_style(style_normal);
|
||||
self.plane.erase();
|
||||
self.plane.home();
|
||||
self.plane.set_style(if (self.level == .err) style_error else style_info);
|
||||
|
|
|
@ -42,7 +42,7 @@ fn is_overlay_mode() bool {
|
|||
|
||||
pub fn render(_: *void, self: *Button.State(void), theme: *const Widget.Theme) bool {
|
||||
const base_style = if (self.active) theme.editor_cursor else if (self.hover) theme.editor_selection else theme.statusbar_hover;
|
||||
self.plane.set_base_style(" ", base_style);
|
||||
self.plane.set_base_style(base_style);
|
||||
self.plane.on_styles(style.bold);
|
||||
self.plane.erase();
|
||||
self.plane.home();
|
||||
|
@ -52,7 +52,7 @@ pub fn render(_: *void, self: *Button.State(void), theme: *const Widget.Theme) b
|
|||
} else {
|
||||
_ = self.plane.putstr(" ") catch {};
|
||||
}
|
||||
self.plane.set_base_style(" ", base_style);
|
||||
self.plane.set_base_style(base_style);
|
||||
self.plane.on_styles(style.bold);
|
||||
_ = self.plane.putstr(std.fmt.bufPrintZ(&buf, "{s} ", .{tui.get_mode()}) catch return false) catch {};
|
||||
if (is_mini_mode())
|
||||
|
|
|
@ -49,7 +49,7 @@ pub fn layout(_: *Self) Widget.Layout {
|
|||
pub fn render(self: *Self, theme: *const Widget.Theme) bool {
|
||||
const frame = tracy.initZone(@src(), .{ .name = @typeName(@This()) ++ " render" });
|
||||
defer frame.deinit();
|
||||
self.plane.set_base_style(" ", if (self.hover) theme.statusbar_hover else theme.statusbar);
|
||||
self.plane.set_base_style(if (self.hover) theme.statusbar_hover else theme.statusbar);
|
||||
self.plane.erase();
|
||||
self.plane.home();
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ pub fn layout(self: *Self) Widget.Layout {
|
|||
pub fn render(self: *Self, theme: *const Widget.Theme) bool {
|
||||
const frame = tracy.initZone(@src(), .{ .name = @typeName(@This()) ++ " render" });
|
||||
defer frame.deinit();
|
||||
self.plane.set_base_style(" ", theme.statusbar);
|
||||
self.plane.set_base_style(theme.statusbar);
|
||||
self.plane.erase();
|
||||
self.plane.home();
|
||||
_ = self.plane.putstr(self.rendered) catch {};
|
||||
|
|
Loading…
Add table
Reference in a new issue