╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ Settings.zig ─────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
102 103 pub fn input(self: *View, allocator: std.mem.Allocator, key: Key, root_focus: *Focus) !void { 104 _ = allocator; 105 if (self.session.data.user_id == null) return; // blank/disabled when logged out 106 switch (key) { 107 .enter => try self.toggle(), 108 .mouse => |mouse| { 109 if (inp.leftClickOn(root_focus, self.button_id, mouse)) { 110 try self.toggle(); 111 } 112 }, 113 else => {}, 114 } 115 } 116 117 fn toggle(self: *View) !void { 118 try self.session.push(.toggle_ansi); 119 } 120 121 pub fn clearGrid(self: *View) void { 122 self.center.clearGrid(); 123 } 124 125 pub fn getGrid(self: View) ?Grid { 126 return self.center.getGrid(); 127 } 128 129 pub fn getFocus(self: *View) *Focus { 130 return self.center.getFocus(); 131 } 132 133 pub fn getSelectedIndex(self: View) ?usize { 134 _ = self; 135 return 0; 136 } 137 }; 138 139 fn ansiLabel(session: *const ui.Session) []const u8 { 140 const label_on = "turn off ANSI art"; 141 const label_off = "turn on ANSI art"; 142 return if (session.data.enable_ansi) label_on else label_off; 143 } 144