diff --git a/src/main.zig b/src/main.zig index 9e132b0..bdf7b68 100644 --- a/src/main.zig +++ b/src/main.zig @@ -17,7 +17,6 @@ pub var max_diff_lines: usize = 50000; pub var max_syntax_lines: usize = 50000; pub const application_name = "flow"; -pub const application_logo = "󱞏 "; pub const std_options = .{ // .log_level = if (builtin.mode == .Debug) .debug else .warn, diff --git a/src/tui/mode/input/flow.zig b/src/tui/mode/input/flow.zig index 19b8a14..465e10f 100644 --- a/src/tui/mode/input/flow.zig +++ b/src/tui/mode/input/flow.zig @@ -31,7 +31,7 @@ pub fn create(a: Allocator) !tui.Mode { }; return .{ .handler = EventHandler.to_owned(self), - .name = root.application_logo ++ root.application_name, + .name = root.application_name, .description = "default", .keybind_hints = &hints, }; diff --git a/src/tui/mode/input/home.zig b/src/tui/mode/input/home.zig index c4ae459..d0514d1 100644 --- a/src/tui/mode/input/home.zig +++ b/src/tui/mode/input/home.zig @@ -23,7 +23,7 @@ pub fn create(a: std.mem.Allocator) !tui.Mode { }; return .{ .handler = EventHandler.to_owned(self), - .name = root.application_logo ++ root.application_name, + .name = root.application_name, .description = "home", .keybind_hints = &hints, }; diff --git a/src/tui/mode/input/vim/insert.zig b/src/tui/mode/input/vim/insert.zig index 0b7c483..49e82a4 100644 --- a/src/tui/mode/input/vim/insert.zig +++ b/src/tui/mode/input/vim/insert.zig @@ -1,5 +1,4 @@ const tp = @import("thespian"); -const root = @import("root"); const key = @import("renderer").input.key; const mod = @import("renderer").input.modifier; @@ -33,7 +32,7 @@ pub fn create(a: Allocator) !tui.Mode { try self.commands.init(self); return .{ .handler = EventHandler.to_owned(self), - .name = root.application_logo ++ "INSERT", + .name = "INSERT", .description = "vim", .line_numbers = if (tui.current().config.vim_insert_gutter_line_numbers_relative) .relative else .absolute, }; diff --git a/src/tui/mode/input/vim/normal.zig b/src/tui/mode/input/vim/normal.zig index cc7c9b6..83617f5 100644 --- a/src/tui/mode/input/vim/normal.zig +++ b/src/tui/mode/input/vim/normal.zig @@ -1,5 +1,4 @@ const tp = @import("thespian"); -const root = @import("root"); const key = @import("renderer").input.key; const mod = @import("renderer").input.modifier; @@ -34,7 +33,7 @@ pub fn create(a: Allocator) !tui.Mode { try self.commands.init(self); return .{ .handler = EventHandler.to_owned(self), - .name = root.application_logo ++ "NORMAL", + .name = "NORMAL", .description = "vim", .line_numbers = if (tui.current().config.vim_normal_gutter_line_numbers_relative) .relative else .absolute, .keybind_hints = &hints, diff --git a/src/tui/mode/input/vim/visual.zig b/src/tui/mode/input/vim/visual.zig index ad4fb1d..216c856 100644 --- a/src/tui/mode/input/vim/visual.zig +++ b/src/tui/mode/input/vim/visual.zig @@ -1,5 +1,4 @@ const tp = @import("thespian"); -const root = @import("root"); const key = @import("renderer").input.key; const mod = @import("renderer").input.modifier; @@ -34,7 +33,7 @@ pub fn create(a: Allocator) !tui.Mode { try self.commands.init(self); return .{ .handler = EventHandler.to_owned(self), - .name = root.application_logo ++ "VISUAL", + .name = "VISUAL", .description = "vim", .line_numbers = if (tui.current().config.vim_visual_gutter_line_numbers_relative) .relative else .absolute, .keybind_hints = &hints, diff --git a/src/tui/status/modestate.zig b/src/tui/status/modestate.zig index ffc3d75..773fda4 100644 --- a/src/tui/status/modestate.zig +++ b/src/tui/status/modestate.zig @@ -28,8 +28,10 @@ pub fn create(a: Allocator, parent: Plane, event_handler: ?Widget.EventHandler) pub fn layout(_: *void, btn: *Button.State(void)) Widget.Layout { const name = tui.get_mode(); const width = btn.plane.egc_chunk_width(name, 0); - const padding: usize = if (is_mini_mode()) 3 else 2; - return .{ .static = width + padding }; + const logo = btn.plane.egc_chunk_width(left ++ symbol ++ right, 0); + const padding: usize = 2; + const minimode_sep: usize = if (is_mini_mode()) 1 else 0; + return .{ .static = logo + width + padding + minimode_sep }; } fn is_mini_mode() bool { @@ -41,12 +43,16 @@ fn is_overlay_mode() bool { } pub fn render(_: *void, self: *Button.State(void), theme: *const Widget.Theme) bool { - self.plane.set_base_style(" ", if (self.active) theme.editor_cursor else if (self.hover) theme.editor_selection else theme.statusbar_hover); + 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.on_styles(style.bold); self.plane.erase(); self.plane.home(); var buf: [31:0]u8 = undefined; - _ = self.plane.putstr(std.fmt.bufPrintZ(&buf, " {s} ", .{tui.get_mode()}) catch return false) catch {}; + render_logo(self, theme, 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()) render_separator(self, theme); return false; @@ -58,6 +64,26 @@ fn render_separator(self: *Button.State(void), theme: *const Widget.Theme) void _ = self.plane.putstr("") catch {}; } +const left = " "; +const symbol = "󱞏"; +const right = " "; + +fn render_logo(self: *Button.State(void), theme: *const Widget.Theme, base_style: Widget.Theme.Style) void { + // const style_symbol: Widget.Theme.Style = if (tui.find_scope_style(theme, "number")) |sty| .{ .fg = sty.style.fg, .bg = base_style.bg, .fs = base_style.fs } else base_style; + const style_symbol = if (self.active) theme.editor_cursor else if (self.hover) theme.editor_selection else theme.statusbar_hover; + const style_braces: Widget.Theme.Style = if (tui.find_scope_style(theme, "punctuation")) |sty| .{ .fg = sty.style.fg, .bg = base_style.bg, .fs = base_style.fs } else base_style; + if (left.len > 0) { + self.plane.set_style(style_braces); + _ = self.plane.putstr(" " ++ left) catch {}; + } + self.plane.set_style(style_symbol); + _ = self.plane.putstr(symbol) catch {}; + if (right.len > 0) { + self.plane.set_style(style_braces); + _ = self.plane.putstr(right) catch {}; + } +} + fn on_click(_: *void, _: *Button.State(void)) void { if (is_mini_mode()) { command.executeName("exit_mini_mode", .{}) catch {};