From 80fc3b7bc5cf3ee1c8f50676cc6d9060a373085b Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Wed, 1 Oct 2025 20:20:08 +0200 Subject: [PATCH] refactor: explicitly pass theme to tui.set_terminal_style --- src/tui/tui.zig | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/tui/tui.zig b/src/tui/tui.zig index e0d934f..4336983 100644 --- a/src/tui/tui.zig +++ b/src/tui/tui.zig @@ -189,7 +189,7 @@ fn init(allocator: Allocator) InitError!*Self { } self.mainview_ = try MainView.create(allocator); resize(); - self.set_terminal_style(); + self.set_terminal_style(self.current_theme()); try save_config(); try self.init_input_namespace(); if (tp.env.get().is("restore-session")) { @@ -773,7 +773,7 @@ fn set_theme_by_name(self: *Self, name: []const u8, action: enum { none, store } self.light_parsed_theme = parsed_theme; }, } - self.set_terminal_style(); + self.set_terminal_style(&theme_); self.logger.print("theme: {s}", .{theme_.description}); switch (action) { .none => {}, @@ -1548,12 +1548,12 @@ pub const fallbacks: []const FallBack = &[_]FallBack{ .{ .ts = "text.title", .tm = "entity.name.section" }, }; -fn set_terminal_style(self: *Self) void { +fn set_terminal_style(self: *Self, theme_: *const Widget.Theme) void { if (build_options.gui or self.config_.enable_terminal_color_scheme) { - self.rdr_.set_terminal_style(self.current_theme().editor); - self.rdr_.set_terminal_cursor_color(self.current_theme().editor_cursor.bg.?); + self.rdr_.set_terminal_style(theme_.editor); + self.rdr_.set_terminal_cursor_color(theme_.editor_cursor.bg.?); if (self.rdr_.vx.caps.multi_cursor) - self.rdr_.set_terminal_secondary_cursor_color(self.current_theme().editor_cursor_secondary.bg orelse self.current_theme().editor_cursor.bg.?); + self.rdr_.set_terminal_secondary_cursor_color(theme_.editor_cursor_secondary.bg orelse theme_.editor_cursor.bg.?); } }