╭──────────╮ │← previous│ ╰──────────╯ ╭ changed ────────────╮ │src/ui/Repo/Files.zig│ ╰─────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────╮ │445 if (self.box.getFocus().children.contains(g)) { │ │446 var buf: [ui.RoutablePage.repo_route_max_len]u8 = undefined;│ │447 var sel_path = self.data.dir; │ │446 - var sel_start: usize = 0; │ │448 + var sel_line: usize = 0; │ │449 if (self.selectedEntry()) |entry| { │ │450 if (!entry.is_dir and entry.loaded) { │ │451 sel_path = if (self.data.dir.len == 0) │ ╰─────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │452 entry.name │ │453 else │ │454 std.fmt.bufPrint(&buf, "{s}/{s}", .{ self.data.dir, entry.name }) catch self.data.dir; │ │453 - sel_start = entry.window_start; │ │455 + sel_line = lineNumber(entry.window_start); │ │456 } │ │457 } │ │456 - if (ui.RoutablePage.repoFilesRoute(self.data.identity, self.data.ref_or_oid, self.data.ref_or_oid_value, sel_path, sel_start)) |route|│ │458 + if (ui.RoutablePage.repoFilesRoute(self.data.identity, self.data.ref_or_oid, self.data.ref_or_oid_value, sel_path, sel_line)) |route| │ │459 self.session.data.current_page = route; │ │460 } │ │461 } │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │538 // the window links sit above the scroll, so they stay put │ │539 // while the content scrolls. │ │540 if (entry.window_start > 0) try self.addNavLink(allocator, nav_box, "scroll to top", entry, 0); │ │539 - if (entry.has_more) try self.addNavLink(allocator, nav_box, "next lines →", entry, entry.window_start + file_page); │ │541 + if (entry.has_more) try self.addNavLink(allocator, nav_box, "next lines →", entry, lineNumber(entry.window_start + file_page));│ │542 if (!entry.loaded) { │ │543 // the placeholder carries the file's "a:" link, so enter │ │544 // (or a click) here loads the file like on its list row. │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │812 const route = ui.RoutablePage.repoFilesRoute(data.identity, data.ref_or_oid, data.ref_or_oid_value, path, 0) orelse return error.RouteTooLong;│ │813 const prefix = if (loaded) "ai:" else "a:"; │ │814 return std.fmt.allocPrint(page_arena.allocator(), "{s}{s}", .{ prefix, try route.toUrl(page_arena) }); │ │815 +} │ │816 + │ │817 +// the url `line` value for a content window: its first line's 1-based number, │ │818 +// except the first window, which serializes as unset (0). │ │819 +fn lineNumber(window_start: usize) usize { │ │820 + return if (window_start == 0) 0 else window_start + 1; │ │821 } │ │822 │ │823 // `dir`/`name`, or just `name` at the root. │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯