fix: alpha rendering of status bar
This commit is contained in:
parent
76ad218729
commit
62a4ec1400
11 changed files with 44 additions and 11 deletions
|
@ -35,8 +35,11 @@ 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.editor);
|
||||
self.plane.erase();
|
||||
self.plane.home();
|
||||
self.plane.set_style(theme.statusbar);
|
||||
_ = self.plane.fill_width(" ", .{}) catch {};
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -59,9 +59,12 @@ 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.editor);
|
||||
self.plane.erase();
|
||||
self.plane.home();
|
||||
self.plane.set_style(theme.statusbar);
|
||||
_ = self.plane.fill_width(" ", .{}) catch {};
|
||||
self.plane.home();
|
||||
|
||||
const now = zeit.instant(.{ .timezone = &self.tz }) catch return false;
|
||||
const dt = now.time();
|
||||
|
|
|
@ -40,9 +40,12 @@ 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(theme.editor);
|
||||
btn.plane.erase();
|
||||
btn.plane.home();
|
||||
btn.plane.set_style(bg_style);
|
||||
_ = btn.plane.fill_width(" ", .{}) catch {};
|
||||
btn.plane.home();
|
||||
_ = btn.plane.putstr(self.rendered) catch {};
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -78,9 +78,12 @@ pub fn layout(_: *Self, _: *Button.State(Self)) Widget.Layout {
|
|||
pub fn render(self: *Self, btn: *Button.State(Self), theme: *const Widget.Theme) bool {
|
||||
const style_base = theme.statusbar;
|
||||
const style_label = if (btn.active) theme.editor_cursor else style_base;
|
||||
btn.plane.set_base_style(style_base);
|
||||
btn.plane.set_base_style(theme.editor);
|
||||
btn.plane.erase();
|
||||
btn.plane.home();
|
||||
btn.plane.set_style(style_base);
|
||||
_ = btn.plane.fill_width(" ", .{}) catch {};
|
||||
btn.plane.home();
|
||||
btn.plane.set_style(style_label);
|
||||
if (btn.active) {
|
||||
_ = btn.plane.fill_width(" ", .{}) catch {};
|
||||
|
|
|
@ -35,9 +35,12 @@ 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.editor);
|
||||
self.plane.erase();
|
||||
self.plane.home();
|
||||
self.plane.set_style(theme.statusbar);
|
||||
_ = self.plane.fill_width(" ", .{}) catch {};
|
||||
self.plane.home();
|
||||
_ = self.plane.print(" {} ", .{keybind.current_key_event_sequence_fmt()}) catch {};
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -91,13 +91,16 @@ 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.frame += 1;
|
||||
if (self.frame - self.key_active_frame > self.wipe_after_frames)
|
||||
self.unset_key_all();
|
||||
|
||||
self.plane.set_base_style(theme.editor);
|
||||
self.plane.erase();
|
||||
self.plane.home();
|
||||
self.plane.set_style(if (self.hover) theme.statusbar_hover else theme.statusbar);
|
||||
_ = self.plane.fill_width(" ", .{}) catch {};
|
||||
self.plane.home();
|
||||
return if (self.keys[0].id > 0) self.render_active() else self.render_idle();
|
||||
}
|
||||
|
||||
|
|
|
@ -41,9 +41,12 @@ 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(theme.editor);
|
||||
btn.plane.erase();
|
||||
btn.plane.home();
|
||||
btn.plane.set_style(if (btn.active) theme.editor_cursor else if (btn.hover) theme.statusbar_hover else theme.statusbar);
|
||||
_ = btn.plane.fill_width(" ", .{}) catch {};
|
||||
btn.plane.home();
|
||||
_ = btn.plane.putstr(self.rendered) catch {};
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -69,9 +69,12 @@ 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(theme.editor);
|
||||
self.plane.erase();
|
||||
self.plane.home();
|
||||
self.plane.set_style(style_normal);
|
||||
_ = self.plane.fill_width(" ", .{}) catch {};
|
||||
self.plane.home();
|
||||
self.plane.set_style(if (self.level == .err) style_error else style_info);
|
||||
_ = self.plane.print(" {s} ", .{self.msg.items}) catch {};
|
||||
return false;
|
||||
|
|
|
@ -43,9 +43,12 @@ fn is_overlay_mode() bool {
|
|||
pub fn render(_: *void, self: *Button.State(void), theme: *const Widget.Theme) bool {
|
||||
const style_base = theme.statusbar;
|
||||
const style_label = if (self.active) theme.editor_cursor else if (self.hover) theme.editor_selection else theme.statusbar_hover;
|
||||
self.plane.set_base_style(style_base);
|
||||
self.plane.set_base_style(theme.editor);
|
||||
self.plane.erase();
|
||||
self.plane.home();
|
||||
self.plane.set_style(style_base);
|
||||
_ = self.plane.fill_width(" ", .{}) catch {};
|
||||
self.plane.home();
|
||||
self.plane.set_style(style_label);
|
||||
_ = self.plane.fill_width(" ", .{}) catch {};
|
||||
self.plane.home();
|
||||
|
|
|
@ -45,9 +45,12 @@ 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(theme.editor);
|
||||
self.plane.erase();
|
||||
self.plane.home();
|
||||
self.plane.set_style(if (self.hover) theme.statusbar_hover else theme.statusbar);
|
||||
_ = self.plane.fill_width(" ", .{}) catch {};
|
||||
self.plane.home();
|
||||
|
||||
_ = self.plane.print(" {s}{s}{s} ", .{
|
||||
mode(self.mods.ctrl, "Ⓒ ", "🅒 "),
|
||||
|
|
|
@ -39,9 +39,12 @@ 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.editor);
|
||||
self.plane.erase();
|
||||
self.plane.home();
|
||||
self.plane.set_style(theme.statusbar);
|
||||
_ = self.plane.fill_width(" ", .{}) catch {};
|
||||
self.plane.home();
|
||||
_ = self.plane.putstr(self.rendered) catch {};
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue