╭──────────╮ │← previous│ ╰──────────╯ ╭ changed ──────╮ │src/ui/Quit.zig│ ╰───────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │69 try self.center.build(allocator, constraint, root_focus); │ │70 } │ │71 │ │72 - pub fn input(self: *View, allocator: std.mem.Allocator, key: inp.Key, root_focus: *Focus) !void {│ │72 + pub fn input(self: *View, allocator: std.mem.Allocator, key: Key, root_focus: *Focus) !void { │ │73 _ = allocator; │ │74 switch (key) { │ │75 .enter => { │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭ changed ──────╮ │src/ui/Repo.zig│ ╰───────────────╯ ╭──────────────────────────────────────────────────────────╮ │ 5 const xitui = xit.xitui; │ │ 6 const wgt = xitui.widget; │ │ 7 const layout = xitui.layout; │ │ 8 -const inp = xitui.input; │ │ 8 +const Key = xitui.input.Key; │ │ 9 const Grid = xitui.grid.Grid; │ │10 const Focus = xitui.focus.Focus; │ │11 +const inp = @import("./input.zig"); │ │12 │ │13 pub const Header = @import("./Repo/Header.zig"); │ │14 pub const SubHeader = @import("./Repo/SubHeader.zig");│ ╰──────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │256 try self.box.build(allocator, constraint, root_focus); │ │257 } │ │258 │ │258 - pub fn input(self: *View, allocator: std.mem.Allocator, key: inp.Key, root_focus: *Focus) !void {│ │259 + pub fn input(self: *View, allocator: std.mem.Allocator, key: Key, root_focus: *Focus) !void { │ │260 if (self.getFocus().child_id) |child_id| { │ │261 if (self.box.children.getIndex(child_id)) |current_index| { │ │262 const child = &self.box.children.values()[current_index].widget; │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────╮ │263 var index = current_index; │ │264 │ │264 - const Direction = enum { up, down, none }; │ │265 - const direction: Direction = switch (key) { │ │266 - .arrow_up => .up, │ │267 - .arrow_down => .down, │ │268 - .mouse => |mouse| if (mouse.action == .scroll) │ │269 - (if (mouse.action.scroll == .up) .up else .down)│ │270 - else │ │271 - .none, │ │272 - else => .none, │ │273 - }; │ │265 + const direction = inp.vertDirection(key); │ │266 │ │267 switch (direction) { │ │268 .up => { │ ╰─────────────────────────────────────────────────────────────────────────────╯ ╭ changed ──────────────╮ │src/ui/Repo/Commits.zig│ ╰───────────────────────╯ ╭───────────────────────────────────────────────╮ │ 8 const xitui = xit.xitui; │ │ 9 const wgt = xitui.widget; │ │10 const layout = xitui.layout; │ │11 -const inp = xitui.input; │ │11 +const Key = xitui.input.Key; │ │12 const Grid = xitui.grid.Grid; │ │13 const Focus = xitui.focus.Focus; │ │14 +const inp = @import("../input.zig"); │ │15 │ │16 const SubHeader = @import("SubHeader.zig");│ │17 │ ╰───────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │620 sc.getFocus().version +%= 1; │ │621 } │ │622 │ │622 - pub fn input(self: *View, allocator: std.mem.Allocator, key: inp.Key, root_focus: *Focus) !void {│ │623 + pub fn input(self: *View, allocator: std.mem.Allocator, key: Key, root_focus: *Focus) !void { │ │624 _ = allocator; │ │625 if (self.diffActive()) { │ │626 try self.diffInput(key, root_focus); │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────╮ │629 } │ │630 } │ │631 │ │631 - fn listInput(self: *View, key: inp.Key, root_focus: *Focus) !void { │ │632 + fn listInput(self: *View, key: Key, root_focus: *Focus) !void { │ │633 // up/down (and the scroll wheel) move the selection a row; page up/down │ │634 // jump a fixed amount. right/Enter cross into the diff pane. Enter/clicks│ │635 // on the "next" row become navigation in the host before reaching here. │ ╰───────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────╮ │636 + if (inp.rowDelta(key, @intCast(self.listBox().children.count()))) |delta| {│ │637 + return self.moveSelection(root_focus, delta); │ │638 + } │ │639 switch (key) { │ │640 .enter => if (self.selectedCommitIndex() != null) │ │641 try self.focusDiff(root_focus) │ ╰────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │644 try self.session.navigate(route); │ │645 }, │ │646 .arrow_right => try self.focusDiff(root_focus), │ │643 - .arrow_down => try self.moveSelection(root_focus, 1), │ │644 - .arrow_up => try self.moveSelection(root_focus, -1), │ │645 - .page_down => try self.moveSelection(root_focus, 10), │ │646 - .page_up => try self.moveSelection(root_focus, -10), │ │647 - .end => try self.moveSelection(root_focus, @intCast(self.listBox().children.count())), │ │648 - .home => try self.moveSelection(root_focus, -@as(isize, @intCast(self.listBox().children.count()))),│ │649 - .mouse => |mouse| switch (mouse.action) { │ │650 - .scroll => |dir| try self.moveSelection(root_focus, if (dir == .up) -1 else 1), │ │651 - else => {}, │ │652 - }, │ │647 else => {}, │ │648 } │ │649 } │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────╮ │650 │ │657 - fn diffInput(self: *View, key: inp.Key, root_focus: *Focus) !void { │ │651 + fn diffInput(self: *View, key: Key, root_focus: *Focus) !void { │ │652 const sc = self.diffScroll(); │ │653 switch (key) { │ │654 // left scrolls horizontally, then leaves for the list once flush left.│ ╰────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯