From 046979b877f02a91cf52cc86b84c5619cb9363d3 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 6 Oct 2026 19:06:32 -0300 Subject: Def and Refs in a language-served file's tag, a diff viewer's tinted word edits, context rows that hold still under a scroll, and the pardes skill Def and Refs (gd, gr, Ctrl-click; chorded 2-1 at the selection) for a file a language server speaks for; hunks.zig stacks a unified diff as a diff viewer does, its changed words on a tinted ground as delta's do; the tree-sitter context rows stay put while the body glides under a scroll; .agents/skills gains the pardes skill beside pardes-9p. --- src/gui/gui.zig | 69 ++++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 59 insertions(+), 10 deletions(-) (limited to 'src/gui/gui.zig') diff --git a/src/gui/gui.zig b/src/gui/gui.zig index 65b3f926..5a026664 100644 --- a/src/gui/gui.zig +++ b/src/gui/gui.zig @@ -1873,6 +1873,7 @@ const Gui = struct { scroll_rect: pardes.Rect = .{ .x = 0, .y = 0, .w = 0, .h = 0 }, scroll_body_y: u16 = 0, // that rect's first BODY row (Tagbottom moves it) scroll_body_h: u16 = 0, // and its BODY rows, which a taller tag leaves fewer of + scroll_held_px: f32 = 0, // its tree-sitter context band, which never moves scroll_col: u16 = 0, // where the wheel turned: crossed rows are delivered scroll_row: u16 = 0, // THERE, not wherever the pointer has drifted to since scroll_delta: f32 = 0, // finite raw distance waiting for the render batch @@ -5367,7 +5368,7 @@ fn stepGlide(g: *Gui, core: *pardes.Pardes, gpa: std.mem.Allocator) void { /// The glide's picture: the pane's body rows moved by the offset, and in /// the gap it opens the rows that left, as `emitScrollRows` draws a /// touchpad's fraction. -fn emitGlideRows(g: *Gui, instances: [*]CellInstance, base: u32, surface: *pardes.Surface, layout: CellLayout, win_w: f32, win_h: f32, page: Ground) u32 { +fn emitGlideRows(g: *Gui, instances: [*]CellInstance, base: u32, surface: *pardes.Surface, layout: CellLayout, win_w: f32, win_h: f32, page: Ground, held: u16) u32 { const glide = &g.glide; for (surface.panelTracks()) |track| if (track.active() and track.pane == glide.pane) return 0; @@ -5383,10 +5384,12 @@ fn emitGlideRows(g: *Gui, instances: [*]CellInstance, base: u32, surface: *parde g.scroll_body_h = bh; var shifted = layout; shifted.y_off -= glide.offset * layout.h; + const kept = holdContext(g, surface, glide.pane, held, bh, layout); + shifted.y_off += kept.lift; const cursor_idx: u32 = if (surface.cursor) |cu| @as(u32, cu.y) * surface.cols + cu.x else std.math.maxInt(u32); const cursor_bar = if (surface.cursor) |cu| cu.bar else false; var n: u32 = 0; - var row = y0; + var row = y0 + kept.rows; while (row < y0 + bh) : (row += 1) { const line = surface.cells[@as(usize, row) * surface.cols ..][0..surface.cols]; const row_cursor: ?usize = if (surface.cursor) |cu| if (cu.y == row) cu.x else null else null; @@ -5400,9 +5403,9 @@ fn emitGlideRows(g: *Gui, instances: [*]CellInstance, base: u32, surface: *parde // The gap: rows past the top while the picture lags a move down, past // the bottom for one up; as many as it opens. const gap: u16 = @intFromFloat(@min(@ceil(@abs(glide.offset)), @as(f32, @floatFromInt(bh)))); - const kept = if (glide.offset < 0) glide.nabove else glide.nbelow; + const nkept = if (glide.offset < 0) glide.nabove else glide.nbelow; const rows = if (glide.offset < 0) glide.above else glide.below; - for (0..@min(gap, kept)) |i| { + for (0..@min(gap, nkept)) |i| { const cells = rows[i * bw ..][0..bw]; // Row -1 - i above the body, or bh + i below it, in grid rows. const at_row: i32 = if (glide.offset < 0) @as(i32, y0) - 1 - @as(i32, @intCast(i)) else @as(i32, y0) + bh + @as(i32, @intCast(i)); @@ -5560,8 +5563,9 @@ fn stepScroll(g: *Gui, core: *pardes.Pardes, gpa: std.mem.Allocator) void { if (g.scroll_lag == 0) resetScroll(g); } -fn emitScrollRows(g: *Gui, instances: [*]CellInstance, base: u32, surface: *pardes.Surface, layout: CellLayout, win_w: f32, win_h: f32, page: Ground) u32 { - if (g.glide.offset != 0) return emitGlideRows(g, instances, base, surface, layout, win_w, win_h, page); +fn emitScrollRows(g: *Gui, instances: [*]CellInstance, base: u32, surface: *pardes.Surface, layout: CellLayout, win_w: f32, win_h: f32, page: Ground, held: u16) u32 { + g.scroll_held_px = 0; + if (g.glide.offset != 0) return emitGlideRows(g, instances, base, surface, layout, win_w, win_h, page, held); const scroll_pane = g.scroll_pane orelse return 0; if (g.scroll_lag == 0) return 0; for (surface.panelTracks()) |track| @@ -5575,10 +5579,12 @@ fn emitScrollRows(g: *Gui, instances: [*]CellInstance, base: u32, surface: *pard if (x0 + bw > surface.cols or y0 + bh > surface.rows) return 0; // resized under us var shifted = layout; shifted.y_off -= g.scroll_lag * layout.h; + const kept = holdContext(g, surface, scroll_pane, held, bh, layout); + shifted.y_off += kept.lift; const cursor_idx: u32 = if (surface.cursor) |cu| @as(u32, cu.y) * surface.cols + cu.x else std.math.maxInt(u32); const cursor_bar = if (surface.cursor) |cu| cu.bar else false; var n: u32 = 0; - var row = y0; + var row = y0 + kept.rows; while (row < y0 + bh) : (row += 1) { const line = surface.cells[@as(usize, row) * surface.cols ..][0..surface.cols]; const row_cursor: ?usize = if (surface.cursor) |cu| if (cu.y == row) cu.x else null else null; @@ -5600,12 +5606,52 @@ fn emitScrollRows(g: *Gui, instances: [*]CellInstance, base: u32, surface: *pard return n; } +/// A scrolling body's tree-sitter context rows hold still: the shifted +/// rows start under them and are clipped below their band, and where a +/// body layer stacks them at the tagline's height (TreeContextTagStyle) +/// the rows under them are drawn up to meet them, where the layer has them. +fn holdContext(g: *Gui, surface: *const pardes.Surface, id: usize, held: u16, bh: u16, layout: CellLayout) struct { rows: u16, lift: f32 } { + const rows = @min(held, bh); + const layered = id < surface.body_layers.len and surface.body_layers[id].rows != 0 and surface.body_layers[id].context_rows != 0; + const row_px = if (layered) std.math.clamp(@as(f32, @floatFromInt(g.tagline_height)), 1, @max(1, layout.h)) else layout.h; + g.scroll_held_px = @as(f32, @floatFromInt(rows)) * row_px; + return .{ .rows = rows, .lift = @as(f32, @floatFromInt(rows)) * (row_px - layout.h) }; +} + +test "a scroll's shifted rows start under the context rows, and its scissor below their band" { + var surface: pardes.Surface = .{}; + var g: Gui = undefined; + g.tagline_height = 12; + g.scroll_rect = .{ .x = 0, .y = 0, .w = 40, .h = 20 }; + g.scroll_body_y = 1; + g.scroll_body_h = 19; + const layout: CellLayout = .{ .w = 10, .h = 20, .x_off = 0, .y_off = 0 }; + // On the grid, three body-high rows are held, and nothing moves up. + const grid = holdContext(&g, &surface, 0, 3, 19, layout); + try std.testing.expectEqual(@as(u16, 3), grid.rows); + try std.testing.expectEqual(@as(f32, 0), grid.lift); + const clip = scrollScissor(&g, layout, 400, 400); + try std.testing.expectEqual(@as(c_int, 20 + 3 * 20), clip.y); + try std.testing.expectEqual(@as(c_int, 16 * 20), clip.h); + // In a body layer they are tagline-high: the rows under them move up + // by what each is shorter, to where the layer draws them. + surface.body_layers[0].rows = 30; + surface.body_layers[0].context_rows = 3; + const layered = holdContext(&g, &surface, 0, 3, 19, layout); + try std.testing.expectEqual(@as(f32, 3 * (12 - 20)), layered.lift); + try std.testing.expectEqual(@as(c_int, 20 + 3 * 12), scrollScissor(&g, layout, 400, 400).y); + // None held: the whole body moves. + surface.body_layers[0].rows = 0; + try std.testing.expectEqual(@as(u16, 0), holdContext(&g, &surface, 0, 0, 19, layout).rows); + try std.testing.expectEqual(@as(c_int, 20), scrollScissor(&g, layout, 400, 400).y); +} + fn scrollScissor(g: *const Gui, layout: CellLayout, sw: u32, sh: u32) c.SDL_Rect { const r = g.scroll_rect; const px = layout.x_off + @as(f32, @floatFromInt(r.x + config.GUTTER)) * layout.w; - const py = layout.y_off + @as(f32, @floatFromInt(g.scroll_body_y)) * layout.h; + const py = layout.y_off + @as(f32, @floatFromInt(g.scroll_body_y)) * layout.h + g.scroll_held_px; const pw = @as(f32, @floatFromInt(r.w - config.GUTTER)) * layout.w; - const ph = @as(f32, @floatFromInt(g.scroll_body_h)) * layout.h; + const ph = @max(0, @as(f32, @floatFromInt(g.scroll_body_h)) * layout.h - g.scroll_held_px); const x0 = std.math.clamp(@as(i32, @intFromFloat(@floor(px))), 0, @as(i32, @intCast(sw))); const y0 = std.math.clamp(@as(i32, @intFromFloat(@floor(py))), 0, @as(i32, @intCast(sh))); const x1 = std.math.clamp(@as(i32, @intFromFloat(@ceil(px + pw))), x0, @as(i32, @intCast(sw))); @@ -6426,7 +6472,10 @@ fn renderFrame( } for (groups.items[0..groups.len], 0..) |group, index| std.debug.assert(cell_next[index] == group.cell_start + group.cell_count); - shifted = emitScrollRows(g, instances, cell_total, surface, layout, win_w, win_h, page); + // The body's context rows, which its scroll leaves where they are. + const scrolling: ?usize = if (g.glide.offset != 0) g.glide.pane else g.scroll_pane; + const held: u16 = if (core) |p| if (scrolling) |id| if (p.panes[id]) |pane| pane.context_rows else 0 else 0 else 0; + shifted = emitScrollRows(g, instances, cell_total, surface, layout, win_w, win_h, page, held); // Over a theme's plaques a see-through cell with no ink blends to // the plaque under it, so it draws nothing: its quad goes, and the // cells are drawn unblended (a third of the GPU's frame at 4K) -- cgit v1.3 From bc3d18d27f9fc1155db7fac3946c4d38774f9e65 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Wed, 21 Oct 2026 14:35:15 -0300 Subject: Build with Zig 0.17 ghostty, libvaxis and uucode move to ghostty's 0.17 pins, cloud9 to its 0.17 main, SDL to castholm's release-3.4.x (3.4.18), zstbi and tree-sitter to forks with 0.17 build files (see build.zig.zon). A bare zig build copies the binaries into ~/.local/bin (-Dhome-install=false leaves it out): 0.17 keeps the prefix from build scripts. A terminal's edited copy goes when the program clears the screen. tinywin.snap is gone; perf baselines are re-recorded. Co-Authored-By: Claude Opus 5.5 --- README.md | 2 +- build.zig | 289 +++++++++++++++----------------- build.zig.zon | 45 ++--- build/snap.zig | 6 +- docs/typ/building.typ | 12 +- docs/typ/install.typ | 2 +- mupdf.zig | 6 +- src/9p_io.zig | 14 +- src/CHANGELOG.md | 8 + src/Layer.zig | 4 +- src/Messages.zig | 14 +- src/TerminalImages.zig | 82 ++++++++- src/builtins.zig | 26 +-- src/colors.zig | 70 ++++---- src/config.zig | 21 ++- src/detached/client.zig | 8 +- src/detached/wire.zig | 39 +++-- src/draw.zig | 22 +-- src/dump.zig | 24 +-- src/esp32p4.zig | 2 +- src/esp32p4/input_rescue.zig | 2 +- src/esp32p4/selftest.zig | 2 +- src/fs.zig | 8 +- src/gui/Post.zig | 14 +- src/gui/gui.zig | 20 +-- src/host_io.zig | 14 +- src/image.zig | 6 +- src/linux/v9fs.zig | 4 +- src/locations.zig | 24 +-- src/look.zig | 6 +- src/lsp/lsp.zig | 2 +- src/lsp/lsp_client.zig | 2 +- src/macos.zig | 26 +-- src/main.zig | 6 + src/memory.zig | 2 +- src/modal.zig | 2 +- src/ninep/addr.zig | 2 +- src/ninep/cols.zig | 10 +- src/ninep/ctl.zig | 14 +- src/ninep/events.zig | 10 +- src/ninep/pane.zig | 11 +- src/ninep/pty.zig | 6 +- src/ninep/screen.zig | 2 +- src/ninep/tree.zig | 16 +- src/normal.zig | 2 +- src/pager.zig | 2 +- src/panes.zig | 2 +- src/pardes.zig | 32 ++-- src/pdf.zig | 10 +- src/regexp.zig | 12 +- src/sam_edit.zig | 2 +- src/syntax.zig | 2 +- src/terminal.zig | 30 +++- src/tty/tty.zig | 22 +-- test/deck/replay.zig | 5 +- test/deck/schema.zig | 10 +- test/e2e_harness.zig | 2 +- test/fs_bench.zig | 4 +- test/history.zig | 10 +- test/hxdiff.zig | 14 +- test/image_harness.zig | 2 +- test/lspbench.zig | 2 +- test/monkey.zig | 2 +- test/panes.zig | 50 +++--- test/pdf.zig | 8 +- test/pdf_scroll_bench.zig | 2 +- test/pdf_sections_bench.zig | 2 +- test/perf-baseline-gui-Debug.json | 1 - test/perf-baseline-gui-debug.json | 1 + test/perf-baseline-tty-Debug.json | 1 - test/perf-baseline-tty-ReleaseFast.json | 1 - test/perf-baseline-tty-debug.json | 1 + test/perf-baseline-tty-fast.json | 1 + test/perf.zig | 15 +- test/snapshot.zig | 40 ++--- test/snapshots/exec.golden | 8 +- test/snapshots/tinywin.golden | 83 --------- test/snapshots/tinywin.snap | 31 ---- test/unit_profile_test.zig | 7 +- tools/gen_themes.zig | 15 +- 80 files changed, 664 insertions(+), 677 deletions(-) delete mode 100644 test/perf-baseline-gui-Debug.json create mode 100644 test/perf-baseline-gui-debug.json delete mode 100644 test/perf-baseline-tty-Debug.json delete mode 100644 test/perf-baseline-tty-ReleaseFast.json create mode 100644 test/perf-baseline-tty-debug.json create mode 100644 test/perf-baseline-tty-fast.json delete mode 100644 test/snapshots/tinywin.golden delete mode 100644 test/snapshots/tinywin.snap (limited to 'src/gui/gui.zig') diff --git a/README.md b/README.md index 3a566d2a..0a03bdba 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ looks; the keys are helix's; every session is a virtual filesystem, served over 9P, that any program can drive. Get the source with `git clone https://git.sr.ht/~gbrls/pardes && cd pardes` -(also at https://git.0x4200.cafe/pardes). Install with Zig 0.16: +(also at https://git.0x4200.cafe/pardes). Install with Zig 0.17: `zig build -Dplatform=tty --prefix ~/.local` for `pardes` in a terminal, or `-Dplatform=gui` for the `pardes-gui` window. The terminal should report the mouse; Shift-Esc needs the kitty keyboard diff --git a/build.zig b/build.zig index 0246d55f..ddd41a03 100644 --- a/build.zig +++ b/build.zig @@ -59,13 +59,14 @@ pub fn build(b: *std.Build) void { const requested_platform = b.option(Platform, "platform", "which shell to build (tty, gui, web, macos, esp32p4); absent builds the tty cli and the SDL gui together"); const platform = requested_platform orelse .tty; const also_gui = requested_platform == null; - const home_install = also_gui and prefixIsUntouched(b); - if (home_install) { - if (b.graph.environ_map.get("HOME")) |home| { - b.resolveInstallPrefix(b.pathJoin(&.{ home, ".local" }), .{}); - std.debug.print("pardes: installing into {s} (override with --prefix)\n", .{b.install_prefix}); - } - } + // A bare `zig build` also copies the binaries into ~/.local/bin. Zig + // 0.17 keeps the prefix in the maker process, out of this script's + // reach, so `--prefix` no longer turns it off: -Dhome-install=false does. + const home_bin: ?[]const u8 = if (also_gui and (b.option(bool, "home-install", "a bare `zig build` also copies the binaries into ~/.local/bin (default: true)") orelse true)) + if (b.graph.environ_map.get("HOME")) |home| b.pathJoin(&.{ home, ".local", "bin" }) else null + else + null; + const home_install = home_bin != null; const esp32p4_target: std.Target.Query = .{ .cpu_arch = .riscv32, .os_tag = .freestanding, @@ -114,18 +115,18 @@ pub fn build(b: *std.Build) void { const is_web_target = target.result.cpu.arch == .wasm32 and target.result.os.tag == .freestanding; const is_esp32p4_target = target.result.cpu.arch == .riscv32 and target.result.os.tag == .freestanding; const optimize = if (is_web) - .ReleaseSmall - else if (is_esp32p4_target and requested_optimize == .Debug) - .ReleaseFast + .small + else if (is_esp32p4_target and requested_optimize == .debug) + .fast else requested_optimize; const test_build = b.step("test-build", "compile unit-test programs without running them"); const doc_typ_opts = b.addOptions(); - doc_typ_opts.addOption([]const u8, "dir", b.pathFromRoot("docs/typ")); + doc_typ_opts.addOptionPathUntracked("dir", b.path("docs/typ")); // The docs (docs/typ, docs/site): each output is one typst run, and each // reads docs/typ/builtins-*.json; `builtins-json` refreshes this build's from the // registry first (the tool is wired below, once the core module is). - const typst_bin: ?[]const u8 = b.findProgram(&.{"typst"}, &.{}) catch null; + const typst_bin: ?[]const u8 = b.findProgram(.{ .names = &.{"typst"} }); var doc_renders: [3]?*std.Build.Step.Run = @splat(null); const cheatsheet_step = b.step("cheatsheet", "render docs/typ/cheatsheet-a4.typ to /share/doc/pardes/cheatsheet.pdf (needs typst)"); const book_step = b.step("book", "render docs/typ/book.typ to /share/doc/pardes/pardes.pdf (needs typst)"); @@ -139,11 +140,13 @@ pub fn build(b: *std.Build) void { sheet.addFileArg(b.path("docs/typ/cheatsheet-a4.typ")); sheet.has_side_effects = true; cheatsheet_step.dependOn(&b.addInstallFile(sheet.addOutputFileArg("cheatsheet.pdf"), "share/doc/pardes/cheatsheet.pdf").step); - const book = b.addSystemCommand(&.{ typst, "compile", "--ignore-system-fonts", "--root", b.pathFromRoot(".") }); + const book = b.addSystemCommand(&.{ typst, "compile", "--ignore-system-fonts", "--root", "." }); + book.setCwd(b.path(".")); book.addFileArg(b.path("docs/typ/book.typ")); book.has_side_effects = true; book_step.dependOn(&b.addInstallFile(book.addOutputFileArg("pardes.pdf"), "share/doc/pardes/pardes.pdf").step); - const site = b.addSystemCommand(&.{ typst, "compile", "--format", "bundle", "--features", "bundle,html", "--root", b.pathFromRoot(".") }); + const site = b.addSystemCommand(&.{ typst, "compile", "--format", "bundle", "--features", "bundle,html", "--root", "." }); + site.setCwd(b.path(".")); site.addFileArg(b.path("docs/site/site.typ")); const site_dir = site.addOutputDirectoryArg("site"); site.has_side_effects = true; @@ -168,7 +171,7 @@ pub fn build(b: *std.Build) void { .root_source_file = b.path("test/unit_profile.zig"), }), }); - const c_optimize: std.builtin.OptimizeMode = if (optimize == .Debug) .ReleaseFast else optimize; + const c_optimize: std.lang.Optimize = if (optimize == .debug) .fast else optimize; const default_grammars: TreeSitterGrammars = if (is_web) .zig else if (is_esp32p4) .disabled else .full; const requested_grammars = b.option(TreeSitterGrammars, "tree-sitter", "tree-sitter grammar set: disabled, zig, minimal (c/c++/zig), full"); const tree_sitter_grammars = requested_grammars orelse default_grammars; @@ -321,7 +324,7 @@ pub fn build(b: *std.Build) void { .name = "pardes-gen-themes", .root_module = b.createModule(.{ .target = b.graph.host, - .optimize = .Debug, + .optimize = .debug, .root_source_file = b.path("tools/gen_themes.zig"), }), }); @@ -353,7 +356,7 @@ pub fn build(b: *std.Build) void { // `pardes ` alone, like a tarball build; -Dstamp-commit=true // stamps one anyway. const stamp_commit = b.option(bool, "stamp-commit", "embed the git commit in --version and crash records (default: release builds and the ~/.local install)") orelse - (optimize != .Debug or home_install); + (optimize != .debug or home_install); const shell_cfg: ShellConfig = .{ .tree_sitter_grammars = tree_sitter_grammars, .tracy = tracy != null, @@ -391,9 +394,7 @@ pub fn build(b: *std.Build) void { if (tree_sitter_grammars != .disabled) { const tree_sitter_mod = b.dependency("tree_sitter", .{ .target = target, .optimize = c_optimize }).module("tree_sitter"); if (is_web) { - const web_libc_include: std.Build.LazyPath = .{ - .cwd_relative = b.path("src/web/libc/include").getPath(b), - }; + const web_libc_include = b.path("src/web/libc/include"); for (tree_sitter_mod.link_objects.items) |link_object| switch (link_object) { .other_step => |lib| { lib.root_module.link_libc = false; @@ -417,12 +418,11 @@ pub fn build(b: *std.Build) void { (tree_sitter_grammars == .zig and g.tier == .zig)) { const dep = b.dependency(g.dep, .{}); - const query_path = dep.path(g.query); - const query = std.Io.Dir.cwd().readFileAlloc(io, query_path.getPath(b), b.allocator, .limited(0x100000)) catch @panic("read " ++ g.name ++ " highlights"); + const query = configureRead(b, io, dep.builder.root, g.query, 0x100000) catch @panic("read " ++ g.name ++ " highlights"); ts_queries.addOption([]const u8, g.name ++ "_highlights", query); // helix's textobject queries, vendored (vendor/queries); a // grammar without one gets none - const objects = std.Io.Dir.cwd().readFileAlloc(io, b.pathFromRoot("vendor/queries/" ++ g.name ++ "/textobjects.scm"), b.allocator, .limited(0x100000)) catch ""; + const objects = configureRead(b, io, b.root, "vendor/queries/" ++ g.name ++ "/textobjects.scm", 0x100000) catch ""; ts_queries.addOption([]const u8, g.name ++ "_textobjects", objects); const lib = b.addLibrary(.{ @@ -438,8 +438,9 @@ pub fn build(b: *std.Build) void { const ts_cflags = [_][]const u8{ "-fno-sanitize=function", "-DTREE_SITTER_REUSE_ALLOCATOR", + // Relative to the build root, the compiler's working directory. "-include", - b.path("src/tree_sitter_heap.h").getPath(b), + "src/tree_sitter_heap.h", }; lib.root_module.addCSourceFile(.{ .file = dep.path(g.src ++ "/parser.c"), .flags = &ts_cflags }); if (g.scanner) lib.root_module.addCSourceFile(.{ .file = dep.path(g.src ++ "/scanner.c"), .flags = &ts_cflags }); @@ -467,7 +468,7 @@ pub fn build(b: *std.Build) void { // (src/regexp.zig). A bump that moves the anchor stops the build. const mvzr_mod = mvzr: { const dep = b.dependency("mvzr", .{ .target = target, .optimize = optimize }); - const src = std.Io.Dir.cwd().readFileAlloc(io, dep.path("src/mvzr.zig").getPath(b), b.allocator, .limited(1 << 20)) catch @panic("read mvzr"); + const src = configureRead(b, io, dep.builder.root, "src/mvzr.zig", 1 << 20) catch @panic("read mvzr"); const anchor = "fn matchPattern(patt: []const RegOp, sets: []const CharSet, haystack: []const u8, i_in: usize) ?OpMatch {\n"; const at = (std.mem.indexOf(u8, src, anchor) orelse @panic("mvzr's matchPattern changed: redo its step budget in build.zig")) + anchor.len; const spend = @@ -536,7 +537,17 @@ pub fn build(b: *std.Build) void { \\ ; if (std.mem.count(u8, backed, end_anchor) != 1) @panic("mvzr's parser changed: redo its `$` before `|` in build.zig"); - const patched = std.mem.replaceOwned(u8, b.allocator, backed, end_anchor, end_before_alt) catch @panic("OOM"); + var patched = std.mem.replaceOwned(u8, b.allocator, backed, end_anchor, end_before_alt) catch @panic("OOM"); + // Zig 0.17 removed `**`; mvzr still has it (its PR #16 replaces it upstream). + for ([_][3][]const u8{ + .{ "[1]RegOp{.{ .unused = {} }} ** ops", "@splat(.{ .unused = {} })", "1" }, + .{ "[1]CharSet{.{ .low = 0, .hi = 0 }} ** char_sets", "@splat(.{ .low = 0, .hi = 0 })", "1" }, + .{ "\"a\" ** 2048", "&@as([2048]u8, @splat('a'))", "2" }, + .{ "\"12345,\" ** 255", "std.mem.asBytes(&@as([255][6]u8, @splat(\"12345,\".*)))", "1" }, + }) |edit| { + if (std.mem.count(u8, patched, edit[0]) != std.fmt.parseInt(usize, edit[2], 10) catch unreachable) std.debug.panic("mvzr changed at `{s}`: redo its `**` patch in build.zig", .{edit[0]}); + patched = std.mem.replaceOwned(u8, b.allocator, patched, edit[0], edit[1]) catch @panic("OOM"); + } break :mvzr b.createModule(.{ .root_source_file = b.addWriteFiles().add("mvzr.zig", patched), .target = target, .optimize = optimize }); }; @@ -582,6 +593,7 @@ pub fn build(b: *std.Build) void { }); mupdf.linkTo(mupdf_mod); mupdf_mod.addImport("c_heap", c_heap_mod); + mupdf_mod.addImport("pdf_c", b.addTranslateC(.{ .root_source_file = b.path("src/pdf_bridge.h"), .target = target, .optimize = optimize }).createModule()); mupdf_mod.addIncludePath(b.path("src")); mupdf_mod.addCSourceFile(.{ .file = b.path("src/pdf_bridge.c"), @@ -599,12 +611,13 @@ pub fn build(b: *std.Build) void { const pdf_bench_mod = b.createModule(.{ .target = target, - .optimize = .ReleaseFast, + .optimize = .fast, .root_source_file = b.path("src/pdf.zig"), .link_libc = true, }); mupdf.linkTo(pdf_bench_mod); pdf_bench_mod.addImport("c_heap", c_heap_mod); + pdf_bench_mod.addImport("pdf_c", b.addTranslateC(.{ .root_source_file = b.path("src/pdf_bridge.h"), .target = target, .optimize = .fast }).createModule()); pdf_bench_mod.addIncludePath(b.path("src")); pdf_bench_mod.addCSourceFile(.{ .file = b.path("src/pdf_bridge.c"), @@ -614,14 +627,14 @@ pub fn build(b: *std.Build) void { .name = "pardes-pdf-bench", .root_module = b.createModule(.{ .target = target, - .optimize = .ReleaseFast, + .optimize = .fast, .root_source_file = b.path("test/pdf_bench.zig"), .link_libc = true, }), }); pdf_bench.root_module.addImport("mupdf", pdf_bench_mod); const run_pdf_bench = b.addRunArtifact(pdf_bench); - if (b.args) |args| run_pdf_bench.addArgs(args); + run_pdf_bench.addPassthruArgs(); run_pdf_bench.setCwd(b.path(".")); pdf_bench_step.dependOn(&run_pdf_bench.step); @@ -629,7 +642,7 @@ pub fn build(b: *std.Build) void { .name = "pardes-pdf-sections-bench", .root_module = b.createModule(.{ .target = target, - .optimize = .ReleaseFast, + .optimize = .fast, .root_source_file = b.path("test/pdf_sections_bench.zig"), .link_libc = true, }), @@ -637,10 +650,10 @@ pub fn build(b: *std.Build) void { pdf_sections_bench.root_module.addImport("pardes", core_module); pdf_sections_bench.root_module.addImport("mupdf", mupdf_mod); const sections_bench_opts = b.addOptions(); - sections_bench_opts.addOption(bool, "release_fast_core", optimize == .ReleaseFast); + sections_bench_opts.addOption(bool, "release_fast_core", optimize == .fast); pdf_sections_bench.root_module.addOptions("pdf_sections_bench_config", sections_bench_opts); const run_pdf_sections_bench = b.addRunArtifact(pdf_sections_bench); - if (b.args) |args| run_pdf_sections_bench.addArgs(args); + run_pdf_sections_bench.addPassthruArgs(); run_pdf_sections_bench.setCwd(b.path(".")); pdf_sections_bench_step.dependOn(&run_pdf_sections_bench.step); @@ -648,7 +661,7 @@ pub fn build(b: *std.Build) void { .name = "pardes-pdf-pointer-bench", .root_module = b.createModule(.{ .target = target, - .optimize = .ReleaseFast, + .optimize = .fast, .root_source_file = b.path("test/pdf_pointer_bench.zig"), .link_libc = true, }), @@ -656,7 +669,7 @@ pub fn build(b: *std.Build) void { pdf_pointer_bench.root_module.addImport("pardes", core_module); pdf_pointer_bench.root_module.addImport("mupdf", mupdf_mod); const run_pdf_pointer_bench = b.addRunArtifact(pdf_pointer_bench); - if (b.args) |args| run_pdf_pointer_bench.addArgs(args); + run_pdf_pointer_bench.addPassthruArgs(); run_pdf_pointer_bench.setCwd(b.path(".")); pdf_pointer_bench_step.dependOn(&run_pdf_pointer_bench.step); @@ -672,11 +685,11 @@ pub fn build(b: *std.Build) void { pdf_scroll_bench.root_module.addImport("pardes", core_module); pdf_scroll_bench.root_module.addImport("mupdf", mupdf_mod); const scroll_bench_opts = b.addOptions(); - scroll_bench_opts.addOption(bool, "release_fast_core", optimize == .ReleaseFast); + scroll_bench_opts.addOption(bool, "release_fast_core", optimize == .fast); scroll_bench_opts.addOption([]const u8, "core_optimize", @tagName(optimize)); pdf_scroll_bench.root_module.addOptions("pdf_scroll_bench_config", scroll_bench_opts); const run_pdf_scroll_bench = b.addRunArtifact(pdf_scroll_bench); - if (b.args) |args| run_pdf_scroll_bench.addArgs(args); + run_pdf_scroll_bench.addPassthruArgs(); run_pdf_scroll_bench.setCwd(b.path(".")); pdf_scroll_bench_step.dependOn(&run_pdf_scroll_bench.step); } @@ -712,15 +725,13 @@ pub fn build(b: *std.Build) void { // - An X10 mouse report and a kitty graphics reply cut short by a read // wait for their rest: the first became three bytes of text, the // second sliced past its input. - // - A malformed color or clipboard reply is dropped instead of failing - // the parse, which stopped input; so is a byte no UTF-8 starts with. - // - An OSC reply ends at its first terminator: one ended by BEL ran on to - // the next sequence's ESC and left what lay between as text. + // - A byte no UTF-8 starts with is dropped instead of failing the parse, + // which stopped input. (vaxis itself now drops a malformed color or + // clipboard reply and ends an OSC at its first terminator.) // - A device report's fields are sought in the sequence, not past it. // A bump that moves an anchor stops the build. { - const parser_path = vaxis_dep.path("src/Parser.zig").getPath(b); - var src = std.Io.Dir.cwd().readFileAlloc(io, parser_path, b.allocator, .limited(1 << 20)) catch @panic("read vaxis Parser.zig"); + var src = configureRead(b, io, vaxis_dep.builder.root, "src/Parser.zig", 1 << 20) catch @panic("read vaxis Parser.zig"); const edits = [_]struct { anchor: []const u8, with: []const u8, count: usize = 1 }{ .{ .anchor = @@ -731,7 +742,7 @@ pub fn build(b: *std.Build) void { \\ 0x5F => return parseApc(input), \\ // pardes's patch (its build.zig): ESC before a key's sequence is Alt on the key. \\ 0x1B => if (input.len > 2 and (input[2] == '[' or input[2] == 'O')) { - \\ var inner = if (input[2] == '[') parseCsi(input[1..], &self.buf) else parseSs3(input[1..]); + \\ var inner = if (input[2] == '[') parseCsi(input[1..], &self.buf, self.cursor_position_requests) else parseSs3(input[1..]); \\ if (inner.n == 0) return inner; \\ if (inner.event) |*event| switch (event.*) { \\ .key_press, .key_release => |*key| key.mods.alt = true, @@ -765,71 +776,17 @@ pub fn build(b: *std.Build) void { \\ switch (input[2]) { , }, - .{ - .anchor = - \\ const esc_result = skipUntilST(input); - \\ if (esc_result.n > 0) break :blk esc_result.n; - \\ - \\ // No escape, could be BEL terminated - \\ const bel = std.mem.indexOfScalarPos(u8, input, 2, 0x07) orelse return .{ - \\ .event = null, - \\ .n = 0, - \\ }; - \\ bel_terminated = true; - \\ break :blk bel + 1; - , - .with = - \\ // pardes's patch (its build.zig): whichever terminator comes first ends it. - \\ const esc = std.mem.indexOfScalarPos(u8, input, 2, 0x1b); - \\ const bel = std.mem.indexOfScalarPos(u8, input, 2, 0x07); - \\ if (bel != null and (esc == null or bel.? < esc.?)) { - \\ bel_terminated = true; - \\ break :blk bel.? + 1; - \\ } - \\ const esc_result = skipUntilST(input); - \\ if (esc_result.n > 0) break :blk esc_result.n; - \\ return .{ .event = null, .n = 0 }; - , - }, - .{ - .anchor = " const color = try Color.rgbFromSpec(color_spec);\n", - .with = " const color = Color.rgbFromSpec(color_spec) catch return null_event; // pardes's patch (its build.zig)\n", - .count = 2, - }, - .{ - .anchor = - \\ if (input[semicolon_idx + 1] != 'c') return null_event; - \\ const payload = if (bel_terminated) - \\ input[semicolon_idx + 3 .. sequence.len - 1] - \\ else - \\ input[semicolon_idx + 3 .. sequence.len - 2]; - \\ const decoder = std.base64.standard.Decoder; - \\ const text = try paste_allocator.?.alloc(u8, try decoder.calcSizeForSlice(payload)); - \\ try decoder.decode(text, payload); - , - .with = - \\ // pardes's patch (its build.zig): a malformed reply is dropped. - \\ const body_end = if (bel_terminated) sequence.len - 1 else sequence.len - 2; - \\ if (semicolon_idx + 3 > body_end or input[semicolon_idx + 1] != 'c') return null_event; - \\ const payload = input[semicolon_idx + 3 .. body_end]; - \\ const decoder = std.base64.standard.Decoder; - \\ const gpa = paste_allocator orelse return null_event; - \\ const text = gpa.alloc(u8, decoder.calcSizeForSlice(payload) catch return null_event) catch return null_event; - \\ decoder.decode(text, payload) catch { - \\ gpa.free(text); - \\ return null_event; - \\ }; - , - }, .{ .anchor = \\ 'A', 'B', 'C', 'D', 'E', 'F', 'H', 'P', 'Q', 'R', 'S' => { + \\ // Legacy keys \\ , .with = \\ 'A', 'B', 'C', 'D', 'E', 'F', 'H', 'P', 'Q', 'R', 'S' => { \\ // pardes's patch (its build.zig): a cursor position report is no key. \\ if (final == 'R' and cursorReport(sequence)) return null_event; + \\ // Legacy keys \\ , }, @@ -882,8 +839,7 @@ pub fn build(b: *std.Build) void { // (InactiveDim on a focus change) sent every blank of every pane it // touched again: 7 KB a click for three shell panes. The terminal // keeps the old ink there, and so does vaxis's last frame. - const render_path = vaxis_dep.path("src/Vaxis.zig").getPath(b); - var render_src = std.Io.Dir.cwd().readFileAlloc(io, render_path, b.allocator, .limited(1 << 20)) catch @panic("read vaxis Vaxis.zig"); + var render_src = configureRead(b, io, vaxis_dep.builder.root, "src/Vaxis.zig", 1 << 20) catch @panic("read vaxis Vaxis.zig"); const render_anchor = \\ if ((!self.refresh and \\ last.eql(cell) and @@ -941,7 +897,7 @@ pub fn build(b: *std.Build) void { var ghostty_vt_for_snap: ?*std.Build.Module = null; const ghostty_simd = !freestanding_core and (!target.result.os.tag.isDarwin() or b.graph.host.result.os.tag.isDarwin()); - const ghostty_optimize: std.builtin.OptimizeMode = if (optimize == .Debug) .ReleaseSafe else optimize; + const ghostty_optimize: std.lang.Optimize = if (optimize == .debug) .safe else optimize; const ghostty_dep = if (is_esp32p4) null else b.lazyDependency("ghostty", .{ .target = target, .optimize = ghostty_optimize, .simd = ghostty_simd, .@"app-runtime" = .none, .@"emit-xcframework" = false }); if (ghostty_dep) |dep| { const ghostty_vt = dep.module("ghostty-vt"); @@ -1017,6 +973,17 @@ pub fn build(b: *std.Build) void { const sdl_lib = dep.artifact("SDL3"); gm.linkLibrary(sdl_lib); gm.addIncludePath(dep.path("include")); + // gui.zig's `c`: SDL and the font shim, which @cImport gave it before Zig 0.17. + const header = b.addWriteFiles().add("gui_c.h", + \\#define SDL_DISABLE_OLD_NAMES 1 + \\#include + \\#include "font.h" + \\ + ); + const gui_c = b.addTranslateC(.{ .root_source_file = header, .target = target, .optimize = optimize }); + gui_c.addIncludePath(dep.path("include")); + gui_c.addIncludePath(b.path("src/gui")); + gm.addImport("gui_c", gui_c.createModule()); } gm.linkLibrary(freetype.?); // HarfBuzz from source, like FreeType: its FreeType integration @@ -1105,7 +1072,7 @@ pub fn build(b: *std.Build) void { }) |file| web_step.dependOn(&b.addInstallFileWithDir(b.path(file[0]), .{ .custom = "web" }, file[1]).step); const run_web_harness = b.addSystemCommand(&.{ "node", "test/web_harness.mjs" }); - run_web_harness.addArg(b.getInstallPath(.{ .custom = "web" }, "")); + run_web_harness.addDirectoryArg(installed("web")); run_web_harness.step.dependOn(web_step); b.step("web-harness", "run the dependency-free JS/WASM DOM harness").dependOn(&run_web_harness.step); b.getInstallStep().dependOn(web_step); @@ -1149,9 +1116,9 @@ pub fn build(b: *std.Build) void { const min_version = b.fmt("{d}.{d}", .{ macos_min_version.major, macos_min_version.minor }); const swift_mode: []const u8 = switch (optimize) { - .Debug => "-Onone", - .ReleaseSmall => "-Osize", - .ReleaseFast, .ReleaseSafe => "-O", + .debug => "-Onone", + .small => "-Osize", + .fast, .safe => "-O", }; const link = b.addSystemCommand(&.{ "swiftc", swift_mode, "-target", triple, "-import-objc-header" }); @@ -1218,7 +1185,8 @@ pub fn build(b: *std.Build) void { const sign = b.addSystemCommand(&.{ "codesign", "--force", "--sign", macos_identity }); if (!std.mem.eql(u8, macos_identity, "-")) sign.addArgs(&.{ "--options", "runtime", "--timestamp" }); - sign.addArg(b.getInstallPath(.prefix, "pardes.app")); + sign.setCwd(installed("")); + sign.addArg("pardes.app"); sign.has_side_effects = true; sign.step.dependOn(&install_app_bin.step); sign.step.dependOn(&install_plist.step); @@ -1227,8 +1195,8 @@ pub fn build(b: *std.Build) void { app_step.dependOn(&sign.step); const dmg = b.addSystemCommand(&.{ "hdiutil", "create", "-volname", "pardes", "-ov", "-format", "UDZO", "-srcfolder" }); - dmg.addArg(b.getInstallPath(.prefix, "pardes.app")); - dmg.addArg(b.getInstallPath(.prefix, "pardes.dmg")); + dmg.setCwd(installed("")); + dmg.addArgs(&.{ "pardes.app", "pardes.dmg" }); dmg.has_side_effects = true; dmg.step.dependOn(&sign.step); dmg_step.dependOn(&dmg.step); @@ -1267,7 +1235,7 @@ pub fn build(b: *std.Build) void { const run_e2e = std.Build.Step.Run.create(b, "run macos-e2e"); run_e2e.addFileArg(runnable); run_e2e.setCwd(b.path(".")); - if (b.args) |args| run_e2e.addArgs(args); + run_e2e.addPassthruArgs(); run_e2e.has_side_effects = true; e2e_step.dependOn(&run_e2e.step); } else e2e_step.dependOn(&b.addFail("macos-e2e needs a Darwin host and target").step); @@ -1290,7 +1258,7 @@ pub fn build(b: *std.Build) void { .linkage = if (static) .static else null, .root_module = root_mod, }); - b.installArtifact(exe); + installHome(b, exe, home_bin); if (gui_mod) |gm| { var gui_name: []const u8 = "pardes-gui"; if (target.result.os.tag != .linux or target.result.cpu.arch != .x86_64) @@ -1300,7 +1268,7 @@ pub fn build(b: *std.Build) void { .linkage = if (static) .static else null, .root_module = gm, }); - b.installArtifact(gui_exe); + installHome(b, gui_exe, home_bin); } const run = b.addRunArtifact(exe); b.step("run", "descend to the pardes").dependOn(&run.step); @@ -1312,7 +1280,7 @@ pub fn build(b: *std.Build) void { }); const run_iso = b.addRunArtifact(iso_exe); // Something to look at on arrival, read out of the binary itself. - if (b.args) |args| run_iso.addArgs(args) else run_iso.addArg("src/pardes.zig"); + run_iso.addPassthruArgs(); const iso_step = b.step("run-isolated", "descend to a pardes with no host but the terminal"); iso_step.dependOn(&run_iso.step); } @@ -1370,15 +1338,9 @@ pub fn build(b: *std.Build) void { hxdiff.root_module.addImport("pardes", core_module); const run_hxdiff = b.addRunArtifact(hxdiff); run_hxdiff.has_side_effects = true; - if (b.args) |args| run_hxdiff.addArgs(args) else { - run_hxdiff.addArgs(&.{ - "--strict", - "test/hxcases/cases.jsonl", - "test/hxcases/goldens.jsonl", - "test/hxcases/waivers.jsonl", - }); - run_hxdiff.setCwd(b.path(".")); - } + // Bare, it runs the checked-in suite (test/hxdiff.zig). + run_hxdiff.addPassthruArgs(); + run_hxdiff.setCwd(b.path(".")); const hxdiff_step = b.step("hxdiff", "compare Helix results (-- --strict cases reference [waivers]; cases alone emits)"); hxdiff_step.dependOn(&run_hxdiff.step); @@ -1403,16 +1365,8 @@ pub fn build(b: *std.Build) void { const run_hxparity = b.addRunArtifact(hxdiff); run_hxparity.has_side_effects = true; run_hxparity.addArg("--parity"); - if (b.args) |args| run_hxparity.addArgs(args) else { - run_hxparity.addArgs(&.{ - "--strict", - "--waivers", - "test/hxcases/parity-waivers.jsonl", - "test/hxcases/cases.jsonl", - "test/hxcases/parity.jsonl", - }); - run_hxparity.setCwd(b.path(".")); - } + run_hxparity.addPassthruArgs(); + run_hxparity.setCwd(b.path(".")); const hxparity_step = b.step("hxparity", "run the file-vs-pty editing parity suite (-- [--waivers w.jsonl] ...)"); hxparity_step.dependOn(&run_hxparity.step); @@ -1427,21 +1381,21 @@ pub fn build(b: *std.Build) void { .name = "pardes-lspbench", .root_module = b.createModule(.{ .target = target, - .optimize = .ReleaseFast, + .optimize = .fast, .root_source_file = b.path("test/lspbench.zig"), .link_libc = true, }), }); lspbench.root_module.addImport("pardes", core_module); const run_lspbench = b.addRunArtifact(lspbench); - if (b.args) |args| run_lspbench.addArgs(args); + run_lspbench.addPassthruArgs(); run_lspbench.setCwd(b.path(".")); run_lspbench.has_side_effects = true; const lspbench_step = b.step("lspbench", "language-backend latency + feature matrix (-- [--json] [--check] [repo-root]), or one query (-- probe : [arg] [--reps N])"); lspbench_step.dependOn(&run_lspbench.step); const run_lspbench_check = b.addRunArtifact(lspbench); run_lspbench_check.addArg("--check"); - if (b.args) |args| run_lspbench_check.addArgs(args); + run_lspbench_check.addPassthruArgs(); run_lspbench_check.setCwd(b.path(".")); run_lspbench_check.has_side_effects = true; const lspbench_check_step = b.step("lspbench-check", "require every configured language probe to complete correctly"); @@ -1449,12 +1403,12 @@ pub fn build(b: *std.Build) void { const locations_bench_step = b.step("locations-bench", "measure cold/warm result formatting (-Doptimize=ReleaseFast; CSV on stderr)"); - if (optimize != .ReleaseFast) { + if (optimize != .fast) { locations_bench_step.dependOn(&b.addFail("locations-bench requires -Doptimize=ReleaseFast").step); } else { const locations_bench_module = b.createModule(.{ .target = target, - .optimize = .ReleaseFast, + .optimize = .fast, .root_source_file = b.path("test/locations_bench.zig"), .link_libc = true, }); @@ -1465,7 +1419,7 @@ pub fn build(b: *std.Build) void { locations_bench_step.dependOn(&run_locations_bench.step); } - const perf_optimize: std.builtin.OptimizeMode = .ReleaseFast; + const perf_optimize: std.lang.Optimize = .fast; const perf_options = b.addOptions(); const perf_target = std.Target.Query.fromTarget(&target.result); perf_options.addOption(PerfBuild, "identity", .{ @@ -1499,7 +1453,7 @@ pub fn build(b: *std.Build) void { perf.root_module.addOptions("perf_options", perf_options); const run_perf = b.addRunArtifact(perf); run_perf.has_side_effects = true; - if (b.args) |args| run_perf.addArgs(args); + run_perf.addPassthruArgs(); run_perf.setCwd(b.path(".")); const perf_step = b.step("perf", "gesture latency or bounded terminal stress (-- [--json] [--reps N] [--base old.json] [--terminal-mib N])"); perf_step.dependOn(&run_perf.step); @@ -1536,7 +1490,7 @@ pub fn build(b: *std.Build) void { .name = "pardes-fs-bench", .root_module = b.createModule(.{ .target = target, - .optimize = .ReleaseFast, + .optimize = .fast, .root_source_file = b.path("test/fs_bench.zig"), .link_libc = true, }), @@ -1544,7 +1498,7 @@ pub fn build(b: *std.Build) void { fs_bench.root_module.addImport("pardes", core_module); const run_fs_bench = b.addRunArtifact(fs_bench); run_fs_bench.has_side_effects = true; - if (b.args) |args| run_fs_bench.addArgs(args); + run_fs_bench.addPassthruArgs(); run_fs_bench.setCwd(b.path(".")); const fs_bench_step = b.step("fs-bench", "9P filesystem request cost and allocation count (-- [--json] [--reps N])"); fs_bench_step.dependOn(&run_fs_bench.step); @@ -1581,11 +1535,11 @@ pub fn build(b: *std.Build) void { }); syntax_runner.root_module.addImport("syntax", syntax_module); const run_syntax = b.addRunArtifact(syntax_runner); - if (b.args) |args| run_syntax.addArgs(args); + run_syntax.addPassthruArgs(); b.step("syntax", "emit deterministic syntax snapshots").dependOn(&run_syntax.step); const run_syntax_bench = b.addRunArtifact(syntax_runner); run_syntax_bench.addArg("--bench"); - if (b.args) |args| run_syntax_bench.addArgs(args); + run_syntax_bench.addPassthruArgs(); run_syntax_bench.has_side_effects = true; b.step("syntax-bench", "measure highlighting latency and allocations").dependOn(&run_syntax_bench.step); const syntax_test = b.addTest(.{ @@ -1611,7 +1565,7 @@ pub fn build(b: *std.Build) void { // part of fs-test; the long run is manual. const run_monkey9p = b.addSystemCommand(&.{ "python3", "-B", "test/monkey9p.py" }); run_monkey9p.addArtifactArg(exe); - if (b.args) |args| run_monkey9p.addArgs(args); + run_monkey9p.addPassthruArgs(); run_monkey9p.setCwd(b.path(".")); run_monkey9p.has_side_effects = true; b.step("monkey-9p", "random 9P operations checking the documented rules (-- [--seed N]... [--steps M] [--replay F] [--shrink F] [--no-shrink])").dependOn(&run_monkey9p.step); @@ -1622,7 +1576,7 @@ pub fn build(b: *std.Build) void { if (platform == .gui) { const run_monkey_gui = b.addSystemCommand(&.{ "python3", "-B", "test/gui_monkey.py" }); run_monkey_gui.addArtifactArg(exe); - if (b.args) |args| run_monkey_gui.addArgs(args); + run_monkey_gui.addPassthruArgs(); run_monkey_gui.setCwd(b.path(".")); run_monkey_gui.has_side_effects = true; monkey_gui_step.dependOn(&run_monkey_gui.step); @@ -1653,7 +1607,7 @@ pub fn build(b: *std.Build) void { }), }); // Ordinary executable; each launch asks sudo inside its own PTY. - b.installArtifact(v9fs_helper); + installHome(b, v9fs_helper, home_bin); const run_v9fs = b.addSystemCommand(&.{ "python3", "-B", "test/v9fs.py" }); run_v9fs.addArtifactArg(exe); run_v9fs.addArtifactArg(v9fs_helper); @@ -1688,7 +1642,7 @@ pub fn build(b: *std.Build) void { }), }); const run_history = b.addRunArtifact(history); - if (b.args) |args| run_history.addArgs(args); + run_history.addPassthruArgs(); run_history.has_side_effects = true; b.step("history", "compare command output and test/build runtime across jj revisions").dependOn(&run_history.step); @@ -1843,7 +1797,7 @@ pub fn build(b: *std.Build) void { if (unit_match) |check| check.addArtifactArg(shell_test); const run_profile = b.addRunArtifact(unit_profile); run_profile.addArtifactArg(shell_test); - if (b.args) |args| run_profile.addArgs(args); + run_profile.addPassthruArgs(); run_profile.has_side_effects = true; b.step("unit-profile", "report test request time and process memory as JSONL (-- optional filter, --timeout-ms=N)").dependOn(&run_profile.step); const profile_test = b.addExecutable(.{ @@ -1876,19 +1830,38 @@ fn testMatch(b: *std.Build, profiler: *std.Build.Step.Compile, filters: []const return check; } -fn prefixIsUntouched(b: *std.Build) bool { - if (b.dest_dir != null) return false; - const zig_out = b.build_root.join(b.allocator, &.{"zig-out"}) catch @panic("OOM"); - if (!std.mem.eql(u8, b.install_prefix, zig_out)) return false; - return std.mem.eql(u8, b.exe_dir, b.pathJoin(&.{ b.install_path, "bin" })) and - std.mem.eql(u8, b.lib_dir, b.pathJoin(&.{ b.install_path, "lib" })) and - std.mem.eql(u8, b.h_dir, b.pathJoin(&.{ b.install_path, "include" })); +/// Installs `artifact` in the prefix and, given `home_bin`, copies it there +/// too (`install` unlinks first, so a running binary is replaced). +fn installHome(b: *std.Build, artifact: *std.Build.Step.Compile, home_bin: ?[]const u8) void { + b.installArtifact(artifact); + const dir = home_bin orelse return; + const copy = b.addSystemCommand(&.{ "install", "-Dm755" }); + copy.addArtifactArg(artifact); + copy.addArg(b.pathJoin(&.{ dir, artifact.name })); + copy.has_side_effects = true; + b.getInstallStep().dependOn(©.step); +} + +/// A file read while configuring, under a package's root. A dependency's is +/// hash-addressed and never changes under the same pin; this repo's are not +/// tracked one by one, since the configure runs again on every build anyway +/// (findProgram and gitCommit poison its cache). +// ponytail: untracked repo reads; b.dependOnFileContents each one if the configure cache ever stays pure. +fn configureRead(b: *std.Build, io: std.Io, root: std.Build.Cache.Path, sub: []const u8, limit: usize) ![]u8 { + return root.root_dir.handle.readFileAlloc(io, b.pathJoin(&.{ root.subPathOrDot(), sub }), b.allocator, .limited(limit)); +} + +/// `sub` under the install prefix, known only when the build runs. +fn installed(sub: []const u8) std.Build.LazyPath { + return .{ .relative = .{ .base = .install_prefix, .sub_path = sub } }; } fn gitCommit(b: *std.Build) ?[]const u8 { + // HEAD is not a file the configure cache can track. + b.graph.poisonCache(); var code: u8 = 0; const out = b.runAllowFail( - &.{ "git", "-C", b.build_root.path orelse ".", "rev-parse", "--short=12", "HEAD" }, + &.{ "git", "rev-parse", "--short=12", "HEAD" }, &code, .ignore, ) catch return null; @@ -1985,7 +1958,7 @@ fn compileGlsl(b: *std.Build, name: []const u8) std.Build.LazyPath { fn vendoredThemes(b: *std.Build, io: std.Io) []const []const u8 { var count: usize = 0; { - var dir = b.build_root.handle.openDir(io, "vendor/themes", .{ .iterate = true }) catch @panic("open vendor/themes"); + var dir = b.root.root_dir.handle.openDir(io, "vendor/themes", .{ .iterate = true }) catch @panic("open vendor/themes"); defer dir.close(io); var it = dir.iterate(); while (it.next(io) catch @panic("read vendor/themes")) |e| { @@ -1995,7 +1968,7 @@ fn vendoredThemes(b: *std.Build, io: std.Io) []const []const u8 { } const names = b.allocator.alloc([]const u8, count) catch @panic("OOM"); - var dir = b.build_root.handle.openDir(io, "vendor/themes", .{ .iterate = true }) catch @panic("open vendor/themes"); + var dir = b.root.root_dir.handle.openDir(io, "vendor/themes", .{ .iterate = true }) catch @panic("open vendor/themes"); defer dir.close(io); var it = dir.iterate(); var index: usize = 0; diff --git a/build.zig.zon b/build.zig.zon index b1f501fe..a2fc90dd 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -9,52 +9,59 @@ // read-only HTTPS URL is what a manifest can carry. Re-pin with // `zig fetch --save=cloud9 git+https://git.sr.ht/~gbrls/cloud9#`. .cloud9 = .{ - .url = "git+https://git.sr.ht/~gbrls/cloud9#fe9772b178575fcab93de09fc61c2f13db7db1a8", - .hash = "cloud9-0.1.0-yt86qh4qHgC6OpG4gZE9yoQaO8huc5mnQCaqGwuJ0OU1", + .url = "git+https://git.sr.ht/~gbrls/cloud9#d5c37d9122240fe95d308fbe15874e14dd786c5a", + .hash = "cloud9-0.1.0-yt86qnAvHgB1dEWGakukcJ54GZ7J3mv_lm_kApzAuEOY", }, // Pinned to the exact libvaxis commit ghostty is built against, so it // is compatible with ghostty's uucode configuration (the one we share // with it via `external_uucode` in build.zig). .vaxis = .{ - .url = "git+https://github.com/rockorager/libvaxis.git#1dbbe575dff4586fe51e3217aa5c3fecdcbb6089", - .hash = "vaxis-0.6.0-BWNV_CrbCQCscGpzsAlR402rYQ_tV3aAl081c2iRRkka", + .url = "git+https://github.com/rockorager/libvaxis.git#6fd944a27fb3d6f596e981076381a3131f2448b4", + .hash = "vaxis-0.6.0-BWNV_MafDAAEzkVUvrW9NFUqnnMUoeHqrs2mecnD6D7w", }, .ghostty = .{ - .url = "git+https://github.com/ghostty-org/ghostty.git#82e53e3f6e219e0cf0499fe29c82d925ea26cd5e", - .hash = "ghostty-1.3.2-dev-5UdBCzeJJQXw_vG5Hsfx0DYUmF7Exs_9yctijqOIfp7W", + .url = "git+https://github.com/ghostty-org/ghostty.git#521cf2c5d30bd48028ca61546c64e7913764073d", + .hash = "ghostty-1.3.2-dev-5UdBC6WZfwXgQ6HmA5DH6dGNAUqtDMLrhhrHiBX-99J0", }, // Same uucode commit ghostty and vaxis both depend on. We build it // ourselves (with uucode_config.zig) so ghostty-vt and vaxis can share // a single uucode module. See build.zig for the why. .uucode = .{ - .url = "git+https://github.com/jacobsandlund/uucode#2826a37a4562284fdacd8fa029d49509cc9bffcd", - .hash = "uucode-0.2.0-ZZjBPlK5VADj7fdoq7G8LIHzD5o6FSkcBXXrRWr4jnrA", + .url = "git+https://github.com/jacobsandlund/uucode#ea62149739404a73c202b48a33bf6dd2af4bd9b0", + .hash = "uucode-0.2.0-ZZjBPoGFVgCiflJNFc6Io8xzC67B6PA5bUkk4LT0kCxg", }, + // Pivok7's fork: zig-gamedev/zstbi PR #16, "Upgrade to zig 0.17.0" + // (two lines of build.zig). Back to upstream once it is merged. .zstbi = .{ - .url = "git+https://github.com/zig-gamedev/zstbi#3813f5f113b26f644cfa01a30155cc76b3526e91", - .hash = "zstbi-0.11.0-dev-L0Ea_3GWBwAh7m54XX055vwLKPTPij5hyqyeq92MXPE2", + .url = "git+https://github.com/Pivok7/zstbi#bc96f28d341f9c7fb9cbc5dc65aa4c5cf0c8f007", + .hash = "zstbi-0.11.0-dev-L0Ea_3GWBwCpNHVwGU4MPR_oDd0FoQOYNrGodwvJ6Z45", }, - // SDL3 (castholm/SDL zig bindings) — only fetched/compiled when `-Dsdl` - // is set. Lazy so the default vaxis build never touches it. The sdl + // SDL3 (castholm/SDL zig bindings, its release-3.4.x branch for Zig + // 0.17; david-vanderson's fork, pinned before, has no 0.17 build) — only + // fetched/compiled when `-Dsdl` is set. Lazy so the default vaxis build never touches it. The sdl // package resolves its own linux deps from its own build.zig.zon. .sdl = .{ - .url = "git+https://github.com/david-vanderson/SDL#5bbcf665494fe14acadf50601edf6d5f74ebf96a", - .hash = "sdl-0.4.2+3.4.4-SDL--tB1pQFLgwvCakiiOSoZIuVaz6a6-_gOZC66AGRD", + .url = "git+https://github.com/castholm/SDL#dbcb19aa3583c318556ecae3ecbeb29b102d37c5", + .hash = "sdl-0.6.0+3.4.18-SDL--p-gqAGWpnfTLlhs0dgjDtc4P4_CHeNLGY_SX_Fv", .lazy = true, }, // tree-sitter: Zig bindings + the C runtime, plus grammars (parser.c // we link, highlights.scm we read at build time into the ts_queries module). + // pierrelgol's forks of zig-tree-sitter (here) and tree-sitter-c + // (ts_c), which pin a fork of the tree-sitter core: upstream's + // build.zig files still use APIs Zig 0.17 removed. Their diffs touch + // only the build files and tests. Back to upstream once it moves. .tree_sitter = .{ - .url = "git+https://github.com/tree-sitter/zig-tree-sitter#b55d4977d61330390fc733944da06106ff972660", - .hash = "tree_sitter-0.26.0-8heIf3CaAQB4SSumoGzq3gLSz2rkvXxcKFyskRWqDGBz", + .url = "git+https://github.com/pierrelgol/zig-tree-sitter#2ffef82a12d0305e646ade0e67c693cabc661e05", + .hash = "tree_sitter-0.26.0-8heIf1HEAQCVBaR2wlDhGTw16Ttn1bzERVIwlzNcyO6b", }, .ts_rust = .{ .url = "git+https://github.com/tree-sitter/tree-sitter-rust#77a3747266f4d621d0757825e6b11edcbf991ca5", .hash = "N-V-__8AAHJYbgAipcanYj2A6rnj9wtGzjGzANkrOsqiFAxm", }, .ts_c = .{ - .url = "git+https://github.com/tree-sitter/tree-sitter-c#b780e47fc780ddc8da13afa35a3f4ed5c157823d", - .hash = "tree_sitter_c-0.24.2-y5boS-ptQADHoCoVfjGT_nFtFQ5LbomIkW0fxG3_cmdB", + .url = "git+https://github.com/pierrelgol/tree-sitter-c#67949e4c8dc630c18a522919f2bde2e025a0d025", + .hash = "tree_sitter_c-0.24.2-y5boS-htQACe3pz6jHq4tpS8dB6WIo4-zk_ct7lAjvQT", }, .ts_typst = .{ .url = "git+https://github.com/uben0/tree-sitter-typst#13863ddcbaa7b68ee6221cea2e3143415e64aea4", @@ -185,7 +192,7 @@ .lazy = true, }, }, - .minimum_zig_version = "0.16.0", + .minimum_zig_version = "0.17.0", .paths = .{""}, .fingerprint = 0x41dc46101fc764d8, } diff --git a/build/snap.zig b/build/snap.zig index 7aa06884..35a246ad 100644 --- a/build/snap.zig +++ b/build/snap.zig @@ -44,7 +44,7 @@ pub fn addTty(b: *std.Build, opts: struct { const run_snap = b.addRunArtifact(snap); run_snap.addArtifactArg(opts.exe); run_snap.addPrefixedFileArg("--lspmock=", lspmock.getEmittedBin()); - if (b.args) |args| run_snap.addArgs(args); + run_snap.addPassthruArgs(); // scripts fork children and drive real ptys: never cached, never "up to date" run_snap.has_side_effects = true; const snap_step = b.step("snap", "run the snapshot parity suite (-- --update regenerates goldens)"); @@ -63,7 +63,7 @@ pub fn addTty(b: *std.Build, opts: struct { const run_monkey = b.addRunArtifact(monkey); run_monkey.addArtifactArg(snap); run_monkey.addArtifactArg(opts.exe); - if (b.args) |args| run_monkey.addArgs(args); + run_monkey.addPassthruArgs(); run_monkey.has_side_effects = true; b.step("monkey", "random snapshot scripts hunting panics (-- [steps] [--from=N] [--out=DIR])").dependOn(&run_monkey.step); const monkey_tests = b.addTest(.{ .root_module = monkey.root_module }); @@ -101,7 +101,7 @@ pub fn addWeb(b: *std.Build) void { run_web_snap.step.dependOn(&build_web_snap.step); run_web_snap.step.dependOn(&driver_test.step); run_web_snap.has_side_effects = true; - if (b.args) |args| run_web_snap.addArgs(args); + run_web_snap.addPassthruArgs(); b.step("web-snap", "run browser highlighting, touch, Look, resize and scroll checks").dependOn(&run_web_snap.step); b.step("web-e2e", "run the Chrome-driven DOM end-to-end suite").dependOn(&run_web_snap.step); } diff --git a/docs/typ/building.typ b/docs/typ/building.typ index ae2f3a60..8d7524f9 100644 --- a/docs/typ/building.typ +++ b/docs/typ/building.typ @@ -9,7 +9,7 @@ pieces fit. To install it, see #doc("setup", section: "install"). = Platforms -Zig *0.16.0* (`build.zig.zon` pins `minimum_zig_version`). Dependencies are +Zig *0.17.0* (`build.zig.zon` pins `minimum_zig_version`). Dependencies are fetched and pinned by the manifest; the terminal build needs no system package. The SDL shell builds SDL3 and FreeType from source. PDF support builds MuPDF and is on by default (`-Dmupdf=false` drops it). 9P over QUIC @@ -24,10 +24,11 @@ builds MuPDF and is on by default (`-Dmupdf=false` drops it). 9P over QUIC [`zig build -Dplatform=esp32p4`], [a freestanding riscv32 editor object for the ESP32-P4, with a 384 KiB heap], ) -A bare `zig build` installs into `~/.local`; `--prefix ` installs -elsewhere, except `--prefix zig-out`, which counts as no prefix. With -`-Dplatform` the default prefix is `zig-out`, so always pass `-Dplatform` -while developing. Test, benchmark and run steps build what they need +A bare `zig build` installs into the prefix (`zig-out`, or `--prefix +`) and copies the binaries into `~/.local/bin`; `-Dhome-install=false` +leaves that copy out. Zig 0.17 keeps the prefix from the build script, so +`--prefix` alone no longer stops it. With `-Dplatform` nothing is copied, +so always pass `-Dplatform` while developing. Test, benchmark and run steps build what they need without installing. `pardes --version` prints `pardes ` (from `build.zig.zon`), plus the commit for release builds and the `~/.local` install; `pardes --help` lists every flag. @@ -50,6 +51,7 @@ there; its namespace is in `src/esp32p4_gpio.zig`. [`-Djpx`], [bool, `true`: JPEG 2000, and with it scanned PDFs], [`-Dtree-sitter`], [`disabled`, `zig`, `minimal`, `full`; `full` natively, `zig` for web, `disabled` for esp32p4], [`-Dembed-sources`], [bool, `false`: serve the sources under #file("/src")], + [`-Dhome-install`], [bool: a bare `zig build` also copies the binaries into `~/.local/bin`; default true], [`-Dstamp-commit`], [bool: the git commit in `--version` and crash records; on for release builds and the `~/.local` install], [`-Dtheme-animation`], [bool; on except for esp32p4], [`-Dworkspace-tag`], [bool: draw the workspace tag row; on except for macOS, whose menu bar carries it], diff --git a/docs/typ/install.typ b/docs/typ/install.typ index 9758777d..d97d30f7 100644 --- a/docs/typ/install.typ +++ b/docs/typ/install.typ @@ -18,7 +18,7 @@ #let first = project.mirrors.first() #cmd("git clone " + first.clone + " && cd pardes") -With Zig 0.16 (the build fetches everything else; once that is +With Zig 0.17 (the build fetches everything else; once that is downloaded, a first build from a clean cache took 62 seconds on 16 cores): #cmd("# pardes, in a terminal\nzig build -Dplatform=tty --prefix ~/.local") #cmd("# pardes-gui, its own window\nzig build -Dplatform=gui --prefix ~/.local") diff --git a/mupdf.zig b/mupdf.zig index eeadaa5d..761fef92 100644 --- a/mupdf.zig +++ b/mupdf.zig @@ -293,7 +293,7 @@ fn configureModule(module: *std.Build.Module, dependency: *std.Build.Dependency, } fn flatCSources(b: *std.Build, io: std.Io, dependency: *std.Build.Dependency, relative_dir: []const u8) []const []const u8 { - var dir = std.Io.Dir.cwd().openDir(io, dependency.path(relative_dir).getPath(b), .{ .iterate = true }) catch + var dir = dependency.builder.root.root_dir.handle.openDir(io, relative_dir, .{ .iterate = true }) catch std.debug.panic("MuPDF source directory is missing: {s}", .{relative_dir}); defer dir.close(io); @@ -317,9 +317,9 @@ fn flatCSources(b: *std.Build, io: std.Io, dependency: *std.Build.Dependency, re } fn readMakelists(b: *std.Build, io: std.Io, dependency: *std.Build.Dependency) []const u8 { - return std.Io.Dir.cwd().readFileAlloc( + return dependency.builder.root.root_dir.handle.readFileAlloc( io, - dependency.path("Makelists").getPath(b), + "Makelists", b.allocator, .limited(1024 * 1024), ) catch @panic("read MuPDF Makelists"); diff --git a/src/9p_io.zig b/src/9p_io.zig index 18c51ece..27d79b93 100644 --- a/src/9p_io.zig +++ b/src/9p_io.zig @@ -1553,7 +1553,7 @@ test "a socket path too long for sun_path is no listener, and leaves the editor' } else { _ = unsetenv("XDG_RUNTIME_DIR"); }; - const long = "n" ** 120; + const long = &@as([120]u8, @splat('n')); try testing.expect(listen(testing.io, testing.allocator, p, long, "", null, null) == null); try testing.expect(pardes.turn.answer_held == null); try testing.expect(pardes.turn.wake_parked == null); @@ -1567,7 +1567,7 @@ test "a listening editor posts itself into the 9P registry and unposts on stop" _ = try std.fmt.bufPrintSentinel(&directory, "/tmp/pardes-post-XXXXXX", .{}, 0); if (mkdtemp(&directory) == null) return error.TempDirectoryFailed; const dir = std.mem.span(@as([*:0]const u8, &directory)); - const old_runtime = if (libc.getenv("XDG_RUNTIME_DIR")) |v| try gpa.dupeZ(u8, std.mem.span(v)) else null; + const old_runtime = if (libc.getenv("XDG_RUNTIME_DIR")) |v| try gpa.dupeSentinel(u8, std.mem.span(v), 0) else null; defer { if (old_runtime) |v| { _ = setenv("XDG_RUNTIME_DIR", v, 1); @@ -1628,7 +1628,7 @@ test "Unix TCP and QUIC share one listener through reads writes reconnects and r if (mkdtemp(&directory) == null) return error.TempDirectoryFailed; // What the listener posted and left inside goes with it. defer std.Io.Dir.cwd().deleteTree(testing.io, std.mem.sliceTo(&directory, 0)) catch |err| std.debug.print("deleteTree: {s}\n", .{@errorName(err)}); - const old_runtime = if (libc.getenv("XDG_RUNTIME_DIR")) |v| try gpa.dupeZ(u8, std.mem.span(v)) else null; + const old_runtime = if (libc.getenv("XDG_RUNTIME_DIR")) |v| try gpa.dupeSentinel(u8, std.mem.span(v), 0) else null; defer { if (old_runtime) |v| { _ = setenv("XDG_RUNTIME_DIR", v, 1); @@ -1749,7 +1749,7 @@ test "a change waits while the editor is out mid-step, a read does not, and the if (mkdtemp(&directory) == null) return error.TempDirectoryFailed; // What the listener posted and left inside goes with it. defer std.Io.Dir.cwd().deleteTree(testing.io, std.mem.sliceTo(&directory, 0)) catch |err| std.debug.print("deleteTree: {s}\n", .{@errorName(err)}); - const old_runtime = if (libc.getenv("XDG_RUNTIME_DIR")) |v| try gpa.dupeZ(u8, std.mem.span(v)) else null; + const old_runtime = if (libc.getenv("XDG_RUNTIME_DIR")) |v| try gpa.dupeSentinel(u8, std.mem.span(v), 0) else null; defer { if (old_runtime) |v| { _ = setenv("XDG_RUNTIME_DIR", v, 1); @@ -1824,7 +1824,7 @@ test "a held read is answered when the log has news, and a flushed one spends no if (mkdtemp(&directory) == null) return error.TempDirectoryFailed; // What the listener posted and left inside goes with it. defer std.Io.Dir.cwd().deleteTree(testing.io, std.mem.sliceTo(&directory, 0)) catch |err| std.debug.print("deleteTree: {s}\n", .{@errorName(err)}); - const old_runtime = if (libc.getenv("XDG_RUNTIME_DIR")) |v| try gpa.dupeZ(u8, std.mem.span(v)) else null; + const old_runtime = if (libc.getenv("XDG_RUNTIME_DIR")) |v| try gpa.dupeSentinel(u8, std.mem.span(v), 0) else null; defer { if (old_runtime) |v| { _ = setenv("XDG_RUNTIME_DIR", v, 1); @@ -2051,7 +2051,7 @@ test "a pane's PARDES_MOUNT is the session's directory under 9ns --mntgen, and u const names = [_][*:0]const u8{ "NINE_MNTGEN", "NINE_MOUNT", "PARDES_MOUNT" }; var saved: [names.len]?[:0]u8 = @splat(null); for (names, &saved) |name, *value| { - if (libc.getenv(name)) |old| value.* = try testing.allocator.dupeZ(u8, std.mem.span(old)); + if (libc.getenv(name)) |old| value.* = try testing.allocator.dupeSentinel(u8, std.mem.span(old), 0); } defer for (names, saved) |name, value| { if (value) |old| { @@ -2073,7 +2073,7 @@ test "9P shell environment states being inside pardes apart from how to reach it const names = [_][*:0]const u8{ "XDG_RUNTIME_DIR", "HOME", "PARDES_PID", "PARDES_9P", "PARDES_PANE" }; var saved: [names.len]?[:0]u8 = @splat(null); for (names, &saved) |name, *value| { - if (libc.getenv(name)) |old| value.* = try testing.allocator.dupeZ(u8, std.mem.span(old)); + if (libc.getenv(name)) |old| value.* = try testing.allocator.dupeSentinel(u8, std.mem.span(old), 0); } defer for (names, saved) |name, value| { if (value) |old| { diff --git a/src/CHANGELOG.md b/src/CHANGELOG.md index 4fe0760c..c6c2eadd 100644 --- a/src/CHANGELOG.md +++ b/src/CHANGELOG.md @@ -17,6 +17,14 @@ - A diff paged into a session (`git show | pardes -`) opens its `+Diff` alone; the `+Pager` no longer stays folded under it. +- Built with Zig 0.17. A bare `zig build` still puts the binaries in + `~/.local/bin`, now as a copy beside the prefix, which `--prefix` no + longer prevents; `-Dhome-install=false` does. ghostty, libvaxis, uucode + and SDL (3.4.18) move to their Zig 0.17 versions, and tree-sitter to a + 0.28 development snapshot. +- A terminal's edited copy goes when the program clears the screen, + instead of staying where its rows were. + - n/N follow Helix search registers, counts, wrapping and select mode. `*` sets a search from the selection; `Alt-*` omits word boundaries. The location ring remains as LookNext/LookPrev (Space j n/p). diff --git a/src/Layer.zig b/src/Layer.zig index 7a5fcf7e..ba45bc88 100644 --- a/src/Layer.zig +++ b/src/Layer.zig @@ -51,7 +51,7 @@ cols: u16 = 0, rows: u16 = 0, /// A body's compact rows, from its top. context_rows: u16 = 0, -context_separators: std.bit_set.StaticBitSet(limits.wrap_rows) = .initEmpty(), +context_separators: std.bit_set.StaticBitSet(limits.wrap_rows) = .empty, /// `rows * cols`, row after row. cells: []pardes.Cell = &.{}, cursor: ?struct { x: u16, y: u16, bar: bool = false } = null, @@ -72,7 +72,7 @@ pub fn capacity(layer: *const Layer, metrics: Metrics) u16 { } pub fn setContextLines(layer: *Layer, lines: []const i32) void { - layer.context_separators = .initEmpty(); + layer.context_separators = .empty; const count = @min(lines.len, layer.context_rows); var index: usize = 0; while (index + 1 < count and index < limits.wrap_rows) : (index += 1) { diff --git a/src/Messages.zig b/src/Messages.zig index 2314939f..b67a8402 100644 --- a/src/Messages.zig +++ b/src/Messages.zig @@ -519,20 +519,20 @@ pub fn errorWords(err: anyerror, buf: []u8) []const u8 { /// A ZON parse failure in a person's words: the first error the parser /// found and its line, `line 3: expected ','`. pub fn zonWhy(diag: *const std.zon.parse.Diagnostics, buf: []u8) []const u8 { - var errors = diag.iterateErrors(); - const first = errors.next() orelse return "not valid ZON"; - const loc = first.getLocation(diag); - return std.fmt.bufPrint(buf, "line {d}: {f}", .{ loc.line + 1, first.fmtMessage(diag) }) catch "not valid ZON"; + if (diag.errors.len == 0) return "not valid ZON"; + const first = diag.errors[0]; + return std.fmt.bufPrint(buf, "line {d}: {s}", .{ first.loc.line + 1, first.msg }) catch "not valid ZON"; } test "errors are said in words, and a ZON failure names its line" { var buf: [128]u8 = undefined; try std.testing.expectEqualStrings("file not found", errorWords(error.FileNotFound, &buf)); try std.testing.expectEqualStrings("too large", errorWords(error.FileTooLarge, &buf)); - var diag: std.zon.parse.Diagnostics = .{}; - defer diag.deinit(std.testing.allocator); + var arena: std.heap.ArenaAllocator = .init(std.testing.allocator); + defer arena.deinit(); + var diag: std.zon.parse.Diagnostics = undefined; const T = struct { a: u8 }; - try std.testing.expectError(error.ParseZon, std.zon.parse.fromSliceAlloc(T, std.testing.allocator, ".{\n .a = 1,\n .b = 2 }", &diag, .{})); + try std.testing.expectError(error.ParseZon, std.zon.parse.fromSlice(T, .{ .gpa = std.testing.allocator, .arena = arena.allocator(), .source = ".{\n .a = 1,\n .b = 2 }", .diagnostics = &diag })); try std.testing.expect(std.mem.startsWith(u8, zonWhy(&diag, &buf), "line 3: ")); } diff --git a/src/TerminalImages.zig b/src/TerminalImages.zig index bc1b2ea8..4140813f 100644 --- a/src/TerminalImages.zig +++ b/src/TerminalImages.zig @@ -38,6 +38,72 @@ const GlyphKey = struct { id: u32, generation: u64, src: PixelRect, cols: u16 }; /// left corner (above or left of it is negative). const Rect = struct { x: i64, y: i64, w: i64, h: i64 }; +/// The runs of Kitty placeholder cells between two pins, one row's run at a +/// time, as ghostty's own `kitty.graphics.unicode.placementIterator` gave +/// them before it moved into its RenderState, which pardes does not keep. +const PlaceholderRuns = struct { + rows: ghostty_vt.PageList.RowIterator, + row: ?ghostty_vt.Pin, + /// Where the scan of `row` resumes: a run ended by an incompatible + /// placeholder starts the next one there. + x: usize = 0, + + fn init(top: ghostty_vt.Pin, bottom: ghostty_vt.Pin) PlaceholderRuns { + var rows = top.rowIterator(.right_down, bottom); + const row = rows.next(); + return .{ .rows = rows, .row = row }; + } + + fn next(self: *PlaceholderRuns) ?gfx.unicode.Placement { + while (self.row) |row| { + if (!row.rowAndCell().row.kitty_virtual_placeholder) { + self.advance(); + continue; + } + var run: ?gfx.unicode.IncompletePlacement = null; + var start: usize = 0; + const cells = row.cells(.all); + while (self.x < cells.len) : (self.x += 1) { + const cell = &cells[self.x]; + if (cell.codepoint() != gfx.unicode.placeholder) { + if (run) |done| return complete(row, start, done); + continue; + } + const style = row.style(cell); + const curr: gfx.unicode.IncompletePlacement = .init(&style, row.grapheme(cell) orelse &.{}); + if (run) |*prev| { + if (!prev.append(&curr)) return complete(row, start, prev.*); + } else { + run = curr.start(); + start = self.x; + } + } + self.advance(); + if (run) |done| return complete(row, start, done); + } + return null; + } + + fn advance(self: *PlaceholderRuns) void { + self.row = self.rows.next(); + self.x = 0; + } + + fn complete(row: ghostty_vt.Pin, x: usize, run: gfx.unicode.IncompletePlacement) gfx.unicode.Placement { + var pin = row; + pin.x = @intCast(x); + return .{ + .pin = pin, + .image_id = run.imageId(), + .placement_id = run.placement_id orelse 0, + .col = run.col.?, + .row = run.row.?, + .width = run.width, + .height = 1, + }; + } +}; + pub fn deinit(ti: *TerminalImages, gpa: std.mem.Allocator) void { var conv = ti.converted.valueIterator(); while (conv.next()) |c| gpa.free(c.rgba); @@ -91,7 +157,7 @@ pub fn draw( // Virtual placements: shown through the placeholder cells, one run of // them on a row at a time. The placeholders themselves are not text. - var runs = gfx.unicode.placementIterator(top, bottom); + var runs: PlaceholderRuns = .init(top, bottom); while (runs.next()) |run| { const at = pages.pointFromPin(.viewport, run.pin) orelse continue; const v = at.viewport.y; @@ -104,7 +170,8 @@ pub fn draw( cell.len = 1; } const img = storage.imageById(run.image_id) orelse continue; - const rp = run.renderPlacement(storage, &img, cw, ch) catch continue; + const target = storage.placeholderTarget(run.image_id, run.placement_id) orelse continue; + const rp = run.renderPlacement(&target.placement, &img, cw, ch) catch continue; if (rp.dest_width == 0 or rp.dest_height == 0 or rp.source_width == 0 or rp.source_height == 0) continue; ctx.place(img, .{ .x = rp.source_x, .y = rp.source_y, .w = rp.source_width, .h = rp.source_height }, .{ .x = @as(i64, at.viewport.x) * cw + rp.offset_x, @@ -122,7 +189,8 @@ pub fn draw( const placed = entry.value_ptr.*; const pin = switch (placed.location) { .pin => |pin| pin, - .virtual => continue, + // ponytail: a placement relative to another (P=/Q=, new in ghostty) is not drawn; resolve its chain if a program needs it. + .virtual, .relative => continue, }; const img = storage.images.get(entry.key_ptr.image_id) orelse continue; const at = pages.pointFromPin(.screen, pin.*) orelse continue; @@ -221,7 +289,8 @@ const Ctx = struct { fn pixelsOf(ti: *TerminalImages, gpa: std.mem.Allocator, img: gfx.Image) ?[]const u8 { const n = @as(usize, img.width) * img.height; if (n == 0) return null; - if (img.format == .rgba) return if (img.data.len == n * 4) img.data else null; + const data = img.data.bytes() orelse return null; + if (img.format == .rgba) return if (data.len == n * 4) data else null; const gop = ti.converted.getOrPut(gpa, img.id) catch return null; if (gop.found_existing) { if (gop.value_ptr.generation == img.generation) { @@ -247,10 +316,11 @@ fn convert(gpa: std.mem.Allocator, img: gfx.Image, n: usize) ?[]u8 { .gray => 1, else => return null, }; - if (img.data.len != n * depth) return null; + const data = img.data.bytes() orelse return null; + if (data.len != n * depth) return null; const out = gpa.alloc(u8, n * 4) catch return null; for (0..n) |i| { - const px = img.data[i * depth ..][0..depth]; + const px = data[i * depth ..][0..depth]; out[i * 4 ..][0..4].* = switch (depth) { 3 => .{ px[0], px[1], px[2], 255 }, 2 => .{ px[0], px[0], px[0], px[1] }, diff --git a/src/builtins.zig b/src/builtins.zig index f73c5982..d9cef8c9 100644 --- a/src/builtins.zig +++ b/src/builtins.zig @@ -98,11 +98,11 @@ fn isEnabled(comptime T: type) bool { /// word that is one here, or in no build. pub fn absentWhy(name: []const u8) ?[]const u8 { @setEvalBranchQuota(20000); - inline for (@typeInfo(@This()).@"struct".decls) |d| { - if (comptime @TypeOf(@field(@This(), d.name)) == type) { - const T = @field(@This(), d.name); + inline for (@typeInfo(@This()).@"struct".decl_names) |d| { + if (comptime @TypeOf(@field(@This(), d)) == type) { + const T = @field(@This(), d); if (comptime @typeInfo(T) == .@"struct" and @hasDecl(T, "run") and !isEnabled(T)) { - if (std.mem.eql(u8, d.name, name)) return if (@hasDecl(T, "gui_only")) "GUI-only" else "not in this build"; + if (std.mem.eql(u8, d, name)) return if (@hasDecl(T, "gui_only")) "GUI-only" else "not in this build"; } } } @@ -112,12 +112,12 @@ pub fn absentWhy(name: []const u8) ?[]const u8 { fn manualBuiltinCount() comptime_int { comptime { var count = 0; - for (@typeInfo(@This()).@"struct".decls) |d| { - if (@TypeOf(@field(@This(), d.name)) != type) continue; - const T = @field(@This(), d.name); + for (@typeInfo(@This()).@"struct".decl_names) |d| { + if (@TypeOf(@field(@This(), d)) != type) continue; + const T = @field(@This(), d); if (@typeInfo(T) != .@"struct" or !@hasDecl(T, "run") or !isEnabled(T)) continue; if (@TypeOf(T.run) != fn (Ctx) void) - @compileError(d.name ++ ".run must have signature fn (Ctx) void"); + @compileError(d ++ ".run must have signature fn (Ctx) void"); count += 1; } return count; @@ -129,9 +129,9 @@ fn manualBuiltinList() [manualBuiltinCount()]type { @setEvalBranchQuota(4000); var list: [manualBuiltinCount()]type = undefined; var count = 0; - for (@typeInfo(@This()).@"struct".decls) |d| { - if (@TypeOf(@field(@This(), d.name)) != type) continue; - const T = @field(@This(), d.name); + for (@typeInfo(@This()).@"struct".decl_names) |d| { + if (@TypeOf(@field(@This(), d)) != type) continue; + const T = @field(@This(), d); if (@typeInfo(T) != .@"struct" or !@hasDecl(T, "run") or !isEnabled(T)) continue; list[count] = T; count += 1; @@ -317,7 +317,7 @@ test "Exit over a ctl write or a click names every pane it asks about, a second first.file.?.saved_hash = 0; // edited: what it had is not what it has p.newScratchBelow(p.active); const second = p.panes[p.active].?; - panes.File.setContent(p, &second.file.?, try std.testing.allocator.dupe(u8, "x" ** 120)); + panes.File.setContent(p, &second.file.?, try std.testing.allocator.dupe(u8, &@as([120]u8, @splat('x')))); try std.testing.expect(second.file.?.revision != second.file.?.saved_revision); // A ctl write, or a click through exec (ctl.captured). if (clicked) p.fs.capturing = true else p.fs.no_prompt = true; @@ -341,7 +341,7 @@ test "Exit over a ctl write or a click names every pane it asks about, a second try std.testing.expect(noticed); // Edited since: only that one is named again (acme's rule). p.fs.failure_len = 0; - panes.File.setContent(p, &second.file.?, try std.testing.allocator.dupe(u8, "y" ** 120)); + panes.File.setContent(p, &second.file.?, try std.testing.allocator.dupe(u8, &@as([120]u8, @splat('y')))); try std.testing.expect(p.executeBuiltinLine(p.active, "Exit")); try std.testing.expect(!p.quit); const again = p.fs.failure[0..p.fs.failure_len]; diff --git a/src/colors.zig b/src/colors.zig index 379d1301..dd0d8938 100644 --- a/src/colors.zig +++ b/src/colors.zig @@ -205,7 +205,7 @@ const name_tint_chroma: f32 = 0.06; /// ink where that hue holds, the name reads on its ground (nameTintFloor) /// and it stands off the ink. Null when no colour of the theme will do. fn derivedNameTint(th: *const Theme, ink: [3]u8, ground: [3]u8) ?[3]u8 { - const pal = th.palette orelse [_][3]u8{th.kw} ** 16; + const pal = th.palette orelse @as([16][3]u8, @splat(th.kw)); const sources = [_][3]u8{ th.kw, pal[4], pal[5], pal[6], pal[3], pal[2], pal[1], th.num, th.str, th.box } ++ [_][3]u8{ th.column_box orelse th.num, th.box_dirty orelse th.num, th.sel_bg, th.search_bg orelse th.num } ++ [_][3]u8{ th.diagnostic_info orelse th.num, th.diagnostic_hint orelse th.num, th.diagnostic_warning orelse th.num } ++ @@ -468,28 +468,29 @@ const curated = struct { pub const dark = @import("themes/dark.zig"); }; -fn fold(comptime C: type) [@typeInfo(C).@"struct".decls.len]Theme { +fn fold(comptime C: type) [@typeInfo(C).@"struct".decl_names.len]Theme { comptime { @setEvalBranchQuota(400000); - var out: [@typeInfo(C).@"struct".decls.len]Theme = undefined; - for (@typeInfo(C).@"struct".decls, 0..) |d, i| { + var out: [@typeInfo(C).@"struct".decl_names.len]Theme = undefined; + const theme_info = @typeInfo(Theme).@"struct"; + for (@typeInfo(C).@"struct".decl_names, 0..) |d, i| { var t: Theme = undefined; - const source = @field(C, d.name).theme; - for (@typeInfo(Theme).@"struct".fields) |f| { - @field(t, f.name) = if (f.type == ?Decor and @hasField(@TypeOf(source), f.name)) decor: { + const source = @field(C, d).theme; + for (theme_info.field_names, theme_info.field_types, theme_info.field_attrs) |name, T, attrs| { + @field(t, name) = if (T == ?Decor and @hasField(@TypeOf(source), name)) decor: { // A nested literal is folded field by field too. var decor: Decor = .{}; - const given = @field(source, f.name); - for (@typeInfo(Decor).@"struct".fields) |g| if (@hasField(@TypeOf(given), g.name)) { - @field(decor, g.name) = @field(given, g.name); + const given = @field(source, name); + for (@typeInfo(Decor).@"struct".field_names) |g| if (@hasField(@TypeOf(given), g)) { + @field(decor, g) = @field(given, g); }; break :decor decor; - } else if (@hasField(@TypeOf(source), f.name)) - @field(source, f.name) - else if (f.default_value_ptr) |ptr| - @as(*const f.type, @ptrCast(@alignCast(ptr))).* + } else if (@hasField(@TypeOf(source), name)) + @field(source, name) + else if (attrs.defaultValue(T)) |value| + value else - @compileError("theme " ++ d.name ++ " is missing " ++ f.name); + @compileError("theme " ++ d ++ " is missing " ++ name); } out[i] = t; } @@ -501,7 +502,7 @@ fn fold(comptime C: type) [@typeInfo(C).@"struct".decls.len]Theme { /// takes: a faithful port (`dracula`) keeps the plain name, and helix's /// looser copy of it is still there as `dracula_helix` (the zed ones already /// carry `_zed`). -fn foldImports(comptime ours: anytype, comptime C: type) [@typeInfo(C).@"struct".decls.len]Theme { +fn foldImports(comptime ours: anytype, comptime C: type) [@typeInfo(C).@"struct".decl_names.len]Theme { comptime { @setEvalBranchQuota(400000); var out = fold(C); @@ -514,7 +515,7 @@ fn foldImports(comptime ours: anytype, comptime C: type) [@typeInfo(C).@"struct" pub const themes = fold(curated) ++ foldImports(fold(curated), @import("generated_themes")); /// The first `native_count` of `themes` are pardes's own; the rest imported. -pub const native_count = @typeInfo(curated).@"struct".decls.len; +pub const native_count = @typeInfo(curated).@"struct".decl_names.len; /// The picker's sections (`Themes`), in ring order, each running from /// the theme it names to the next section's; `NextColor` and `Theme` still @@ -677,8 +678,8 @@ pub const ChromeTheme = struct { pub fn interpolate(from: ChromeTheme, to: ChromeTheme, step: u16, steps: u16) ChromeTheme { var out: ChromeTheme = undefined; const t = @as(f32, @floatFromInt(@min(step, steps))) / @as(f32, @floatFromInt(@max(1, steps))); - inline for (@typeInfo(ChromeTheme).@"struct".fields) |field| - @field(out, field.name) = if (step == 0) @field(from, field.name) else if (step >= steps) @field(to, field.name) else mixOklab(@field(from, field.name), @field(to, field.name), t); + inline for (@typeInfo(ChromeTheme).@"struct".field_names) |name| + @field(out, name) = if (step == 0) @field(from, name) else if (step >= steps) @field(to, name) else mixOklab(@field(from, name), @field(to, name), t); return out; } }; @@ -801,14 +802,16 @@ pub fn loadThemeFile(p: *Pardes, generation: u32, bytes: []const u8, animate: bo themeFileError(p, request, error.ThemeFileTooLarge); return false; } - const source = p.gpa.dupeZ(u8, bytes) catch |err| { + const source = p.gpa.dupeSentinel(u8, bytes, 0) catch |err| { themeFileError(p, request, err); return false; }; defer p.gpa.free(source); - var diagnostics: std.zon.parse.Diagnostics = .{}; - defer diagnostics.deinit(p.gpa); - const parsed = std.zon.parse.fromSliceAlloc(Theme, p.gpa, source, &diagnostics, .{}) catch |err| { + // The parse's results live in `arena`; the theme kept owns only its name. + var arena: std.heap.ArenaAllocator = .init(p.gpa); + defer arena.deinit(); + var diagnostics: std.zon.parse.Diagnostics = undefined; + var parsed = std.zon.parse.fromSlice(Theme, .{ .gpa = p.gpa, .arena = arena.allocator(), .source = source, .diagnostics = &diagnostics }) catch |err| { if (err != error.ParseZon) themeFileError(p, request, err) else { // Which line, and what the parser wanted there. var why: [200]u8 = undefined; @@ -817,10 +820,13 @@ pub fn loadThemeFile(p: *Pardes, generation: u32, bytes: []const u8, animate: bo return false; }; if (parsed.name.len == 0 or parsed.name.len > 255) { - std.zon.parse.free(p.gpa, parsed); themeFileError(p, request, error.InvalidThemeName); return false; } + parsed.name = p.gpa.dupe(u8, parsed.name) catch |err| { + themeFileError(p, request, err); + return false; + }; const target_chrome = ChromeTheme.fromTheme(&parsed); if (animate and p.animate_theme_changes) @@ -829,7 +835,7 @@ pub fn loadThemeFile(p: *Pardes, generation: u32, bytes: []const u8, animate: bo p.chrome_animation.snap(target_chrome); const old = p.custom_theme; p.custom_theme = parsed; - if (old) |theme_value| std.zon.parse.free(p.gpa, theme_value); + if (old) |theme_value| p.gpa.free(theme_value.name); var settled: [limits.host_path_cap]u8 = undefined; @memcpy(settled[0..request.path.len], request.path); _ = p.theme_file_loaded.set(settled[0..request.path.len]); @@ -847,7 +853,7 @@ pub fn carryTheme(p: *Pardes, old: *const Pardes, index: bool) !void { const t = old.custom_theme orelse return; var copy = t; copy.name = try p.gpa.dupe(u8, t.name); - if (p.custom_theme) |mine| std.zon.parse.free(p.gpa, mine); + if (p.custom_theme) |mine| p.gpa.free(mine.name); p.custom_theme = copy; _ = p.theme_file_loaded.set(old.theme_file_loaded.get()); } @@ -931,7 +937,7 @@ fn likeness(theme_name: []const u8, name: []const u8) usize { in_order += 1; pos = at + 1; } - const inside: usize = if (name.len > 0 and std.ascii.indexOfIgnoreCase(theme_name, name) != null) name.len * 4 else 0; + const inside: usize = if (name.len > 0 and std.ascii.findIgnoreCase(theme_name, name) != null) name.len * 4 else 0; return prefix * 3 + in_order + inside; } @@ -952,7 +958,7 @@ pub fn setThemeIndex(p: *Pardes, index: usize) void { p.chrome_animation.snap(target_chrome); if (p.custom_theme) |theme_value| { p.custom_theme = null; - std.zon.parse.free(p.gpa, theme_value); + p.gpa.free(theme_value.name); } p.theme_file_loaded.clear(); if (p.theme_file_path.get().len > 0) { @@ -1264,10 +1270,12 @@ test "legacy ThemeFile documents inherit Pardes UI roles without new fields" { rest = rest[at + std.mem.indexOfScalar(u8, rest[at..], '}').? + 1 ..]; rest = std.mem.trimStart(u8, rest, " ,"); } - const source = try std.testing.allocator.dupeZ(u8, legacy.items); + const source = try std.testing.allocator.dupeSentinel(u8, legacy.items, 0); defer std.testing.allocator.free(source); - const parsed = try std.zon.parse.fromSliceAlloc(Theme, std.testing.allocator, source, null, .{}); - defer std.zon.parse.free(std.testing.allocator, parsed); + var arena: std.heap.ArenaAllocator = .init(std.testing.allocator); + defer arena.deinit(); + var diagnostics: std.zon.parse.Diagnostics = undefined; + const parsed = try std.zon.parse.fromSlice(Theme, .{ .gpa = std.testing.allocator, .arena = arena.allocator(), .source = source, .diagnostics = &diagnostics }); try std.testing.expectEqual(@as(?[3]u8, null), parsed.tag_active_bg); try std.testing.expectEqual(@as(?[3]u8, null), parsed.tag_name_fg); try std.testing.expectEqual(@as(?[3]u8, null), parsed.tag_active_name_fg); diff --git a/src/config.zig b/src/config.zig index 50009660..8166954d 100644 --- a/src/config.zig +++ b/src/config.zig @@ -2170,10 +2170,12 @@ pub const User = struct { defer gpa.free(one_path); const bytes = try std.Io.Dir.cwd().readFileAlloc(io, one_path, gpa, .limited(4096)); defer gpa.free(bytes); - const source = try gpa.dupeZ(u8, bytes); + const source = try gpa.dupeSentinel(u8, bytes, 0); defer gpa.free(source); - const parsed = try std.zon.parse.fromSliceAlloc(Sample, gpa, source, null, .{}); - defer std.zon.parse.free(gpa, parsed); + var arena: std.heap.ArenaAllocator = .init(gpa); + defer arena.deinit(); + var diagnostics: std.zon.parse.Diagnostics = undefined; + const parsed = try std.zon.parse.fromSlice(Sample, .{ .gpa = gpa, .arena = arena.allocator(), .source = source, .diagnostics = &diagnostics }); try std.testing.expectEqualStrings("one", parsed.name); try std.testing.expectEqual([3]u8{ 1, 2, 3 }, parsed.rgb); } @@ -2239,25 +2241,26 @@ const doc_typ = struct { fn hasChordField(T: type) bool { if (@typeInfo(T) != .array or @typeInfo(@typeInfo(T).array.child) != .@"struct") return false; - for (@typeInfo(@typeInfo(T).array.child).@"struct".fields) |f| if (f.type == Chord) return true; + for (@typeInfo(@typeInfo(T).array.child).@"struct".field_types) |F| if (F == Chord) return true; return false; } /// Bound somewhere in this file: a binding, a prefix or a key list. fn bound(c: Chord) bool { const config = @import("config.zig"); - inline for (@typeInfo(config).@"struct".decls) |d| { - const v = @field(config, d.name); + inline for (@typeInfo(config).@"struct".decl_names) |d| { + const v = @field(config, d); const T = @TypeOf(v); if (T == []const Chord) { for (v) |b| if (same(b, c)) return true; } else if (T == comptime_int or T == u21 or T == u8) { // a prefix or a bare key; only the tty toggle carries Ctrl - const plain = !c.alt and !c.shift and (!c.ctrl or comptime std.mem.indexOf(u8, d.name, "toggle") != null); + const plain = !c.alt and !c.shift and (!c.ctrl or comptime std.mem.indexOf(u8, d, "toggle") != null); if (plain and v >= 0x20 and v < 0x7f and v == c.cp) return true; } else if (comptime hasChordField(T)) { - for (v) |e| inline for (@typeInfo(@TypeOf(e)).@"struct".fields) |f| - if (f.type == Chord and same(@field(e, f.name), c)) return true; + const info = @typeInfo(@TypeOf(v[0])).@"struct"; + for (v) |e| inline for (info.field_names, info.field_types) |name, F| + if (F == Chord and same(@field(e, name), c)) return true; } } return false; diff --git a/src/detached/client.zig b/src/detached/client.zig index 69ab2fdd..cf1842d9 100644 --- a/src/detached/client.zig +++ b/src/detached/client.zig @@ -1182,12 +1182,12 @@ test "detached session: a frontend is never asked to fork, write, or watch" { // One: the union a frontend decodes into has no other variant. Named // rather than counted, so re-adding `spawn` fails with the name in it. - const fields = @typeInfo(wire.ServerMsg).@"union".fields; - inline for (fields) |f| { + const fields = @typeInfo(wire.ServerMsg).@"union".field_names; + inline for (fields) |name| { for (allowed) |ok| { - if (std.mem.eql(u8, f.name, ok)) break; + if (std.mem.eql(u8, name, ok)) break; } else { - std.debug.print("ServerMsg.{s} is not an effect a frontend may perform\n", .{f.name}); + std.debug.print("ServerMsg.{s} is not an effect a frontend may perform\n", .{name}); return error.MachineLocalEffectOnTheWire; } } diff --git a/src/detached/wire.zig b/src/detached/wire.zig index c9d9b578..f1b7a1b3 100644 --- a/src/detached/wire.zig +++ b/src/detached/wire.zig @@ -20,9 +20,10 @@ const chrome_layout: u64 = 0x5e758b47fb0cf8da; comptime { @setEvalBranchQuota(10_000); var hash = std.hash.Fnv1a_64.init(); - for (@typeInfo(pardes.Chrome).@"struct".fields) |field| { - hash.update(field.name); - hash.update(@typeName(field.type)); + const info = @typeInfo(pardes.Chrome).@"struct"; + for (info.field_names, info.field_types) |name, T| { + hash.update(name); + hash.update(@typeName(T)); } if (hash.final() != chrome_layout) @compileError(std.fmt.comptimePrint("pardes.Chrome changed (layout 0x{x}): bump wire.version, then chrome_layout", .{hash.final()})); } @@ -285,21 +286,22 @@ pub const Frame = struct { region.clip > region.rect.w or region.thumb_y > region.rect.h or region.thumb_h > region.rect.h - region.thumb_y) return error.BadValue; regions.appendAssumeCapacity(region); } - inline for (@typeInfo(pardes.Chrome).@"struct".fields) |field| { - const rgb = &@field(chrome, field.name); - if (field.type == ?[3]u8) { + const info = @typeInfo(pardes.Chrome).@"struct"; + inline for (info.field_names, info.field_types) |name, T| { + const rgb = &@field(chrome, name); + if (T == ?[3]u8) { if (try r.getBool()) { rgb.* = .{ 0, 0, 0 }; for (&rgb.*.?) |*channel| channel.* = try r.getByte(); } - } else if (field.type == u8) { + } else if (T == u8) { rgb.* = try r.getByte(); - } else if (field.type == u32) { + } else if (T == u32) { rgb.* = try r.getU32(); - } else if (field.type == f32) { + } else if (T == f32) { rgb.* = @bitCast(try r.getU32()); if (!std.math.isFinite(rgb.*)) return error.BadValue; - } else if (field.type == [8]f32) { + } else if (T == [8]f32) { for (rgb) |*value| { value.* = @bitCast(try r.getU32()); if (!std.math.isFinite(value.*)) return error.BadValue; @@ -781,7 +783,7 @@ pub fn layersBound(layers: []const pardes.Layer, tags: []const pardes.Layer, reg const region_len = 1 + 1 + 4 + 8 + 1 + 2 + 2 + 1 + 2 + 4 + 4; /// The palette: each colour three bytes, a theme's optional ones a flag /// before them. -const chrome_len = @typeInfo(pardes.Chrome).@"struct".fields.len * 4 + 8 * 4; +const chrome_len = @typeInfo(pardes.Chrome).@"struct".field_names.len * 4 + 8 * 4; pub fn encodeFrameLayers(out: []u8, cols: u16, rows: u16, cursor: ?Cursor, pointer_shape: pardes.Surface.PointerShape, cells: []const pardes.Cell, prev: []const pardes.Cell, layers: []const pardes.Layer, tags: []const pardes.Layer, regions: []const pardes.Region, chrome: pardes.Chrome) Error![]const u8 { // The protocol's ceiling, enforced by the ENCODER too, and BEFORE the @@ -865,18 +867,19 @@ pub fn encodeFrameLayers(out: []u8, cols: u16, rows: u16, cursor: ?Cursor, point try w.putU32(@bitCast(region.lift)); try w.putU32(@bitCast(region.line)); } - inline for (@typeInfo(pardes.Chrome).@"struct".fields) |field| { - const rgb = @field(chrome, field.name); - if (field.type == ?[3]u8) { + const info = @typeInfo(pardes.Chrome).@"struct"; + inline for (info.field_names, info.field_types) |name, T| { + const rgb = @field(chrome, name); + if (T == ?[3]u8) { try w.putBool(rgb != null); if (rgb) |value| for (value) |channel| try w.putByte(channel); - } else if (field.type == u8) { + } else if (T == u8) { try w.putByte(rgb); - } else if (field.type == u32) { + } else if (T == u32) { try w.putU32(rgb); - } else if (field.type == f32) { + } else if (T == f32) { try w.putU32(@bitCast(rgb)); - } else if (field.type == [8]f32) { + } else if (T == [8]f32) { for (rgb) |value| try w.putU32(@bitCast(value)); } else for (rgb) |channel| try w.putByte(channel); } diff --git a/src/draw.zig b/src/draw.zig index b35d55e8..e6420ed4 100644 --- a/src/draw.zig +++ b/src/draw.zig @@ -1598,7 +1598,7 @@ test "a tag of three rows has its grip on the first, and band under it that stil test "place puts every part where the painters and layers put it, in every layout" { const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 100, .rows = 30 }); defer p.deinit(); - _ = try p.setTestFile("placed\n" ** 80); + _ = try p.setTestFile(std.mem.asBytes(&@as([80][7]u8, @splat("placed\n".*)))); p.newColumn(0); p.newScratchIn(0, p.activeColumn().?); p.newScratchBelow(0); @@ -1713,7 +1713,7 @@ test "a notice wider than its band, as a shader's compile error is, draws its en _ = try p.setTestFile("text\n"); var arena: std.heap.ArenaAllocator = .init(std.testing.allocator); defer arena.deinit(); - const long = "Shader /home/someone/shaders/test_shadertoy_invalid.glsl: error: Linking fragment stage: No function definition (body) found: " ** 3; + const long = std.mem.asBytes(&@as([3][126]u8, @splat("Shader /home/someone/shaders/test_shadertoy_invalid.glsl: error: Linking fragment stage: No function definition (body) found: ".*))); for ([_][]const u8{ "Msg " ++ long, "" }) |line| { // The Msg builtin, and the path a failed compile takes (Post.zig). if (line.len > 0) try std.testing.expect(p.executeBuiltinLine(p.active, line)) else p.setMessage(p.active, long); @@ -1952,7 +1952,7 @@ test "the focused cursor glides a jump, lands a step at once, and is exact at re if (!builtins.capabilities.lift) return error.SkipZigTest; const p = try Pardes.init(std.testing.allocator, .{ .cols = 80, .rows = 30 }); defer p.deinit(); - _ = try p.setTestFile("some text on a line\n" ** 20); + _ = try p.setTestFile(std.mem.asBytes(&@as([20][20]u8, @splat("some text on a line\n".*)))); p.settings.cursor_blink = false; var arena: std.heap.ArenaAllocator = .init(std.testing.allocator); defer arena.deinit(); @@ -2078,7 +2078,7 @@ test "a terminal's cursor lands with scrolling output, never gliding against it" defer arena.deinit(); const ms = std.time.ns_per_ms; var now: u64 = std.time.ns_per_s; - p.update(.{ .output = .{ .pane = @intCast(term), .bytes = "line\r\n" ** 20 ++ "$ some command typed" } }); + p.update(.{ .output = .{ .pane = @intCast(term), .bytes = std.mem.asBytes(&@as([20][6]u8, @splat("line\r\n".*))) ++ "$ some command typed" } }); p.advance(now); _ = try p.render(arena.allocator()); // Enter: three lines of output scroll up, the cursor to a new prompt. @@ -2101,10 +2101,10 @@ test "a monkey over notices, prompts, tags and tiny panes at a gui's metrics nev const random = prng.random(); const p = try Pardes.init(std.testing.allocator, .{ .cols = 80, .rows = 24 }); defer p.deinit(); - _ = try p.setTestFile("fuzz\n\u{754c}\u{754c} wide\n" ** 20); + _ = try p.setTestFile(std.mem.asBytes(&@as([20][17]u8, @splat("fuzz\n\u{754c}\u{754c} wide\n".*)))); var arena: std.heap.ArenaAllocator = .init(std.testing.allocator); defer arena.deinit(); - const words = [_][]const u8{ "error:", "\u{754c}", "x", "Shader /tmp/a.glsl:", "e\u{301}", "\t", "long-" ** 20, " " }; + const words = [_][]const u8{ "error:", "\u{754c}", "x", "Shader /tmp/a.glsl:", "e\u{301}", "\t", std.mem.asBytes(&@as([20][5]u8, @splat("long-".*))), " " }; const commands = [_][]const u8{ "New", "Newcol", "Collapse", "Tagbottom", "TreeContext", "Wrap", "Find", "Del", "FocusTint", "Debug" }; var text: std.ArrayListUnmanaged(u8) = .empty; defer text.deinit(std.testing.allocator); @@ -2143,7 +2143,7 @@ test "a monkey over notices, prompts, tags and tiny panes at a gui's metrics nev // A tag of several rows. 5 => if (p.panes[p.active]) |pane| { text.clearRetainingCapacity(); - for (0..random.uintAtMost(usize, 5)) |_| try text.appendSlice(std.testing.allocator, if (random.boolean()) " Look\nmore \u{754c}" else "\n" ++ "x" ** 150); + for (0..random.uintAtMost(usize, 5)) |_| try text.appendSlice(std.testing.allocator, if (random.boolean()) " Look\nmore \u{754c}" else "\n" ++ &@as([150]u8, @splat('x'))); if (pane.tag.own) |own| std.testing.allocator.free(own); pane.tag.own = try std.testing.allocator.dupe(u8, text.items); }, @@ -2173,7 +2173,7 @@ test "a wide glyph cut by a tag's or a notice's edge is joined into the grid as defer arena.deinit(); const pane = p.panes[p.active].?; // Both alignments, so one of them puts a wide glyph across each edge. - for ([_][]const u8{ "\u{754c}" ** 30, "x" ++ "\u{754c}" ** 30 }) |wide| { + for ([_][]const u8{ std.mem.asBytes(&@as([30][3]u8, @splat("\u{754c}".*))), "x" ++ std.mem.asBytes(&@as([30][3]u8, @splat("\u{754c}".*))) }) |wide| { if (pane.tag.own) |own| std.testing.allocator.free(own); pane.tag.own = try std.testing.allocator.dupe(u8, wide); var message: [200]u8 = undefined; @@ -2201,7 +2201,7 @@ test "a body with context rows is painted once, and the grid's rows are what a p if (comptime !@import("syntax.zig").enabled) return error.SkipZigTest; const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 60, .rows = 16 }); defer p.deinit(); - const pane = try p.setTestFile("pub const Box = struct {\n pub fn run() void {\n" ++ (" // body line\n" ** 30) ++ " }\n};\n"); + const pane = try p.setTestFile("pub const Box = struct {\n pub fn run() void {\n" ++ (std.mem.asBytes(&@as([30][21]u8, @splat(" // body line\n".*)))) ++ " }\n};\n"); p.gpa.free(pane.file.?.path); pane.file.?.path = try p.gpa.dupe(u8, "/test.zig"); if (!panes.File.supportsContext(pane)) return error.SkipZigTest; @@ -2250,7 +2250,7 @@ test "a body with context rows is painted once, and the grid's rows are what a p /// Two columns, the file in the left one and a shell in the right, the /// right one focused with its cursor settled. fn twoColumns(p: *Pardes, arena: *std.heap.ArenaAllocator) !void { - _ = try p.setTestFile("some text on a line\n" ** 6); + _ = try p.setTestFile(std.mem.asBytes(&@as([6][20]u8, @splat("some text on a line\n".*)))); _ = try p.newShell(1, ""); try std.testing.expect(layout.splitColumn(p, 0, 1, false)); p.sync(); @@ -2386,7 +2386,7 @@ test "a pane focus reaches brightens on the same spring the one it leaves dims o if (!builtins.capabilities.lift) return error.SkipZigTest; const p = try Pardes.init(std.testing.allocator, .{ .cols = 80, .rows = 24 }); defer p.deinit(); - _ = try p.setTestFile("some text on a line\n" ** 4); + _ = try p.setTestFile(std.mem.asBytes(&@as([4][20]u8, @splat("some text on a line\n".*)))); p.newScratchBelow(0); p.settings.inactive_dim = 40; p.settings.motion = .smooth; diff --git a/src/dump.zig b/src/dump.zig index 402918c4..545d09ec 100644 --- a/src/dump.zig +++ b/src/dump.zig @@ -421,9 +421,9 @@ pub const Parsed = struct { pub fn check(gpa: std.mem.Allocator, bytes: []const u8, why: []u8) !void { var arena: std.heap.ArenaAllocator = .init(gpa); defer arena.deinit(); - const source = try arena.allocator().dupeZ(u8, bytes); - var diag: std.zon.parse.Diagnostics = .{}; - const state = std.zon.parse.fromSliceAlloc(State, arena.allocator(), source, &diag, .{ .free_on_error = false }) catch |err| { + const source = try arena.allocator().dupeSentinel(u8, bytes, 0); + var diag: std.zon.parse.Diagnostics = undefined; + const state = std.zon.parse.fromSlice(State, .{ .gpa = gpa, .arena = arena.allocator(), .source = source, .diagnostics = &diag }) catch |err| { const said = pardes.Messages.zonWhy(&diag, why[0 .. why.len - 1]); if (said.ptr != why.ptr) @memcpy(why[0..said.len], said); why[said.len] = 0; @@ -436,21 +436,13 @@ pub fn readZon(gpa: std.mem.Allocator, bytes: []const u8, label: []const u8) !Pa var parsed: Parsed = .{ .value = undefined, .arena = .init(gpa) }; errdefer parsed.deinit(); const arena = parsed.arena.allocator(); - const source = try gpa.dupeZ(u8, bytes); + const source = try gpa.dupeSentinel(u8, bytes, 0); defer gpa.free(source); - parsed.value = if (builtin.os.tag == .emscripten or builtin.os.tag == .freestanding) - std.zon.parse.fromSliceAlloc(State, arena, source, null, .{ .free_on_error = false }) catch |err| { - if (err == error.ParseZon) log.err("parse dump {s}: {s}", .{ label, @errorName(err) }); - return err; - } - else blk: { - var diag: std.zon.parse.Diagnostics = .{}; - defer diag.deinit(arena); - break :blk std.zon.parse.fromSliceAlloc(State, arena, source, &diag, .{ .free_on_error = false }) catch |err| { - if (err == error.ParseZon) log.err("parse dump {s}: {f}", .{ label, diag }); - return err; - }; + var diag: std.zon.parse.Diagnostics = undefined; + parsed.value = std.zon.parse.fromSlice(State, .{ .gpa = gpa, .arena = arena, .source = source, .diagnostics = &diag }) catch |err| { + if (err == error.ParseZon) log.err("{f}", .{diag.fmt(label)}); + return err; }; try validate(parsed.value); return parsed; diff --git a/src/esp32p4.zig b/src/esp32p4.zig index 6772e75d..ed18efd9 100644 --- a/src/esp32p4.zig +++ b/src/esp32p4.zig @@ -506,7 +506,7 @@ fn apply(c: *pardes.Pardes, ev: vaxis.Event) void { c.update(.pointer_leave); dirty = true; }, - .focus_in, .mouse_leave => {}, + .focus_in, .mouse_leave, .cursor_position => {}, // Capability replies. vaxis's own Loop sets these fields directly (`Loop.zig:377-403`); // with no Loop, this is where they land. DA1 is the terminator: every terminal answers it // last, so it is the signal that the whole handshake is in and the detected features can be diff --git a/src/esp32p4/input_rescue.zig b/src/esp32p4/input_rescue.zig index ba6974d2..d7556d46 100644 --- a/src/esp32p4/input_rescue.zig +++ b/src/esp32p4/input_rescue.zig @@ -245,7 +245,7 @@ test "a long transmit does not lose the input that arrives during it" { defer port.sent.deinit(std.testing.allocator); var ring: Ring = .{}; - const frame = "\x1b[1;1H" ++ "x" ** 400; + const frame = "\x1b[1;1H" ++ &@as([400]u8, @splat('x')); try std.testing.expectEqual(@as(u32, 0), pump(&port, &ring, frame, 1_000_000)); // Every output byte went out, in order. diff --git a/src/esp32p4/selftest.zig b/src/esp32p4/selftest.zig index 97b43059..19b71e90 100644 --- a/src/esp32p4/selftest.zig +++ b/src/esp32p4/selftest.zig @@ -270,7 +270,7 @@ export fn zig_main() noreturn { const typed = "the quick brown fox jumps over the lazy dog, and then some more besides"; var port: FakePort = .{ .tx_cap = 2, .incoming = typed }; var ring: input_rescue.Ring = .{}; - const frame = "\x1b[1;1H" ++ "x" ** 300; + const frame = "\x1b[1;1H" ++ &@as([300]u8, @splat('x')); const abandoned = input_rescue.pump(&port, &ring, frame, 1_000_000); check("the frame went out whole", abandoned == 0 and port.sent == frame.len); diff --git a/src/fs.zig b/src/fs.zig index fb76cee3..061d4225 100644 --- a/src/fs.zig +++ b/src/fs.zig @@ -677,7 +677,7 @@ pub fn statPath(io: std.Io, path: []const u8, options: std.Io.Dir.StatFileOption } test "a path with a part over 255 bytes is NameTooLong, never a panic" { - const long = "/tmp/" ++ "x" ** 300 ++ "/f"; + const long = "/tmp/" ++ &@as([300]u8, @splat('x')) ++ "/f"; try std.testing.expectError(error.NameTooLong, statPath(std.testing.io, long, .{})); } @@ -1152,7 +1152,7 @@ pub fn find(arena: std.mem.Allocator, dir: []const u8, pat: []const u8, out: []u notes.skipped += 1; continue; }) orelse break; - if (std.ascii.indexOfIgnoreCase(e.basename, pat) != null) { + if (std.ascii.findIgnoreCase(e.basename, pat) != null) { hits[hits_len] = try arena.dupe(u8, e.path); hits_len += 1; } @@ -1167,7 +1167,7 @@ pub fn find(arena: std.mem.Allocator, dir: []const u8, pat: []const u8, out: []u } else { for (sources) |s| { if (hits_len >= hits.len) break; - if (std.ascii.indexOfIgnoreCase(std.fs.path.basename(s.path), pat) != null) { + if (std.ascii.findIgnoreCase(std.fs.path.basename(s.path), pat) != null) { hits[hits_len] = s.path; hits_len += 1; } @@ -1201,7 +1201,7 @@ fn grepText(path: []const u8, text: []const u8, pat: []const u8, out: []u8, budg while (it.next()) |raw| { line += 1; if (result.hits >= budget) break; - const at = std.ascii.indexOfIgnoreCase(raw, pat) orelse continue; + const at = std.ascii.findIgnoreCase(raw, pat) orelse continue; const ln = std.mem.trimEnd(u8, raw, " \t\r"); var cut = @min(ln.len, 200); while (cut > 0 and cut < ln.len and ln[cut] & 0xc0 == 0x80) cut -= 1; diff --git a/src/gui/Post.zig b/src/gui/Post.zig index fc256135..8d0e14d9 100644 --- a/src/gui/Post.zig +++ b/src/gui/Post.zig @@ -610,13 +610,13 @@ const GhosttyUniforms = extern struct { }; test "the uniform block is ghostty's, offset for offset, and the prefix names it in that order" { - const ours = @typeInfo(Uniforms).@"struct".fields; - const theirs = @typeInfo(GhosttyUniforms).@"struct".fields; - try std.testing.expectEqual(theirs.len, ours.len); + const ours = @typeInfo(Uniforms).@"struct"; + const theirs = @typeInfo(GhosttyUniforms).@"struct"; + try std.testing.expectEqual(theirs.field_names.len, ours.field_names.len); try std.testing.expectEqual(@sizeOf(GhosttyUniforms), @sizeOf(Uniforms)); - inline for (ours, theirs) |a, b| { - try std.testing.expectEqual(@offsetOf(GhosttyUniforms, b.name), @offsetOf(Uniforms, a.name)); - try std.testing.expectEqual(b.type, a.type); + inline for (ours.field_names, ours.field_types, theirs.field_names, theirs.field_types) |a, a_type, b, b_type| { + try std.testing.expectEqual(@offsetOf(GhosttyUniforms, b), @offsetOf(Uniforms, a)); + try std.testing.expectEqual(b_type, a_type); } // By NAME: iSelectionForegroundColor sits where ghostty's Zig says // selection_background, which is where its GLSL puts the foreground. @@ -633,7 +633,7 @@ test "the uniform block is ghostty's, offset for offset, and the prefix names it .{ "vec3", "iBackgroundColor" }, .{ "vec3", "iForegroundColor" }, .{ "vec3", "iCursorColor" }, .{ "vec3", "iCursorText" }, .{ "vec3", "iSelectionForegroundColor" }, .{ "vec3", "iSelectionBackgroundColor" }, }; - try std.testing.expectEqual(ours.len, glsl.len); + try std.testing.expectEqual(ours.field_names.len, glsl.len); // Its three blocks (Globals, Palette, Colors) read as one, in order. const start = std.mem.indexOf(u8, prefix, "uniform Globals {").?; const end = std.mem.indexOf(u8, prefix, "uniform PardesPost {").?; diff --git a/src/gui/gui.zig b/src/gui/gui.zig index 5a026664..b8687fd3 100644 --- a/src/gui/gui.zig +++ b/src/gui/gui.zig @@ -25,11 +25,7 @@ const ninep_io = @import("../9p_io.zig"); const detached_client = @import("../detached/client.zig"); const tracy = @import("../tracy.zig"); -pub const c = @cImport({ - @cDefine("SDL_DISABLE_OLD_NAMES", "1"); - @cInclude("SDL3/SDL.h"); - @cInclude("font.h"); -}); +pub const c = @import("gui_c"); // SDL3 and font.h, translated by build.zig const host_io = @import("../host_io.zig"); extern "c" fn setenv(name: [*:0]const u8, value: [*:0]const u8, overwrite: c_int) c_int; @@ -4806,7 +4802,7 @@ fn dumpThemes(ctx: ?*anyopaque, pane: u8) void { } fn putClipboard(gpa: std.mem.Allocator, text: []const u8) void { - const z = gpa.dupeZ(u8, text) catch return; + const z = gpa.dupeSentinel(u8, text, 0) catch return; defer gpa.free(z); _ = c.SDL_SetClipboardText(z.ptr); } @@ -5131,7 +5127,7 @@ test "a wheel over codex in a terminal reaches its pty as the mouse reports it a wheelAt(&g, &in, .{ .y = 1, .integer_y = 1 }, mc); try std.testing.expectEqualStrings("\x1b[<64;6;4M", try Sent.take(core, &sent)); wheelAt(&g, &in, .{ .y = -3, .integer_y = -3 }, mc); - try std.testing.expectEqualStrings("\x1b[<65;6;4M" ** 3, try Sent.take(core, &sent)); + try std.testing.expectEqualStrings(std.mem.asBytes(&@as([3][10]u8, @splat("\x1b[<65;6;4M".*))), try Sent.take(core, &sent)); try std.testing.expectEqual(@as(i32, 0), g.scroll_notch); try std.testing.expect(g.scroll_pane == null); // A touchpad's fractions add up to a turn. @@ -7157,7 +7153,7 @@ test "every pixel of a grip column is band, button or ring, and the button sits const gpa = std.testing.allocator; const core = try pardes.Pardes.init(gpa, .{ .cols = 60, .rows = 20 }); defer core.deinit(); - const pane = try core.setTestFile("text\n" ** 60); + const pane = try core.setTestFile(std.mem.asBytes(&@as([60][5]u8, @splat("text\n".*)))); pane.tag.own = try gpa.dupe(u8, "second\nthird"); core.newScratchBelow(0); for ([_]struct { w: u32, h: u32, tag: u32 }{ .{ .w = 10, .h = 20, .tag = 12 }, .{ .w = 17, .h = 35, .tag = 30 }, .{ .w = 9, .h = 19, .tag = 15 }, .{ .w = 12, .h = 24, .tag = 24 } }) |m| for ([_]bool{ false, true }) |bottom| for ([_]usize{ 0, 1 }) |focus| for ([_]bool{ false, true }) |dirty| { @@ -10156,7 +10152,7 @@ test "the selection glows round its block, on the body only, fading in over 100 const gpa = std.testing.allocator; const core = try pardes.Pardes.init(gpa, .{ .cols = 80, .rows = 24 }); defer core.deinit(); - _ = try core.setTestFile("some text on a line\n" ** 30); + _ = try core.setTestFile(std.mem.asBytes(&@as([30][20]u8, @splat("some text on a line\n".*)))); core.settings.selection_glow = true; pardes.test_api.sync(core); const s = try core.render(core.scratch.allocator()); @@ -10206,7 +10202,7 @@ test "a hovered word glows along its foot, never over the cursor, fading in over const gpa = std.testing.allocator; const core = try pardes.Pardes.init(gpa, .{ .cols = 80, .rows = 24 }); defer core.deinit(); - _ = try core.setTestFile("some text on a line\n" ** 30); + _ = try core.setTestFile(std.mem.asBytes(&@as([30][20]u8, @splat("some text on a line\n".*)))); core.settings.hover_glow = true; pardes.test_api.sync(core); const s = try core.render(core.scratch.allocator()); @@ -10256,7 +10252,7 @@ test "occlusion shades each body's edges, inside it, never a tag, a grip or the const gpa = std.testing.allocator; const core = try pardes.Pardes.init(gpa, .{ .cols = 80, .rows = 24 }); defer core.deinit(); - _ = try core.setTestFile("some text on a line\n" ** 30); + _ = try core.setTestFile(std.mem.asBytes(&@as([30][20]u8, @splat("some text on a line\n".*)))); core.settings.occlusion = true; pardes.test_api.sync(core); const s = try core.render(core.scratch.allocator()); @@ -10295,7 +10291,7 @@ test "a body tells its first line, and lapis's dots under it move a quarter as f const gpa = std.testing.allocator; const core = try pardes.Pardes.init(gpa, .{ .cols = 80, .rows = 24 }); defer core.deinit(); - const pane = try core.setTestFile("line\n" ** 80); + const pane = try core.setTestFile(std.mem.asBytes(&@as([80][5]u8, @splat("line\n".*)))); pane.scrollBy(8); try std.testing.expect(core.executeBuiltinLine(0, "Theme lapis")); core.settings.parallax = true; diff --git a/src/host_io.zig b/src/host_io.zig index a90c903d..d789a77d 100644 --- a/src/host_io.zig +++ b/src/host_io.zig @@ -172,7 +172,7 @@ pub const Lsp = struct { const declared_path = if (file) |f| f.path else ""; const path = try gpa.dupe(u8, filesystem.localPath(declared_path) orelse declared_path); errdefer gpa.free(path); - const source = try gpa.dupeZ(u8, if (file) |f| f.content else ""); + const source = try gpa.dupeSentinel(u8, if (file) |f| f.content else "", 0); errdefer gpa.free(source); const arg = try gpa.dupe(u8, req.arg); errdefer gpa.free(arg); @@ -210,7 +210,7 @@ pub const Lsp = struct { if (f.output != null) continue; const local = filesystem.localPath(f.path) orelse continue; const other_path = try gpa.dupe(u8, local); - const other_source = gpa.dupeZ(u8, f.content) catch |err| { + const other_source = gpa.dupeSentinel(u8, f.content, 0) catch |err| { gpa.free(other_path); return err; }; @@ -785,7 +785,7 @@ pub const Shell = struct { var dir_buf: [4096]u8 = undefined; const dir = dir_buf[0..try tmp.dir.realPath(std.testing.io, &dir_buf)]; var path: [4200:0]u8 = undefined; - const p = try std.fmt.bufPrintZ(&path, "{s}/mysh", .{dir}); + const p = try std.fmt.bufPrintSentinel(&path, "{s}/mysh", .{dir}, 0); try std.testing.expectEqual(Family.bash, familyOf(p.ptr)); try std.testing.expectEqual(Family.none, familyOf("/bin/sh")); } @@ -1662,7 +1662,7 @@ pub fn forkShell( test "shell spawn rejects invalid directories before creating a child" { const rcs: Shell.PromptFiles = .{}; try std.testing.expectError(error.InvalidPath, forkShell(null, 0, &rcs, "/bin/sh", "/tmp\x00/ignored", 24, 80, null)); - const too_long = [_]u8{'x'} ** 4096; + const too_long = @as([4096]u8, @splat('x')); try std.testing.expectError(error.NameTooLong, forkShell(null, 0, &rcs, "/bin/sh", &too_long, 24, 80, null)); var tmp = std.testing.tmpDir(.{}); @@ -1675,7 +1675,7 @@ test "shell spawn rejects invalid directories before creating a child" { try std.testing.expectError(error.NotDir, forkShell(null, 0, &rcs, "/bin/sh", file, 24, 80, null)); const explicit_file = try std.fmt.bufPrint(&path_buf, "/n/os{s}/file", .{directory}); try std.testing.expectError(error.NotDir, forkShell(null, 0, &rcs, "/bin/sh", explicit_file, 24, 80, null)); - const missing = try std.fmt.bufPrint(&path_buf, "{s}/missing/" ++ ("child/" ** 50), .{directory}); + const missing = try std.fmt.bufPrint(&path_buf, "{s}/missing/" ++ (std.mem.asBytes(&@as([50][6]u8, @splat("child/".*)))), .{directory}); try std.testing.expect(missing.len > 256); try std.testing.expectError(error.FileNotFound, forkShell(null, 0, &rcs, "/bin/sh", missing, 24, 80, null)); } @@ -1720,7 +1720,7 @@ test "shell spawn uses an explicit OS directory longer than 256 bytes" { if (!haveFile("/bin/sh")) return error.SkipZigTest; var tmp = std.testing.tmpDir(.{}); defer tmp.cleanup(); - const sub_path = "nested-directory-with-more-than-forty-characters/" ** 7; + const sub_path = std.mem.asBytes(&@as([7][49]u8, @splat("nested-directory-with-more-than-forty-characters/".*))); try tmp.dir.createDirPath(std.testing.io, sub_path); var directory_buf: [4096]u8 = undefined; const directory = directory_buf[0..try tmp.dir.realPathFile(std.testing.io, sub_path, &directory_buf)]; @@ -1801,7 +1801,7 @@ test "shell cwd rejects truncation and preserves an owned child path longer than const io = std.testing.io; var tmp = std.testing.tmpDir(.{}); defer tmp.cleanup(); - const nested = "nested-directory-with-more-than-forty-characters/" ** 24; + const nested = std.mem.asBytes(&@as([24][49]u8, @splat("nested-directory-with-more-than-forty-characters/".*))); try tmp.dir.createDirPath(io, nested); var path_buf: [pardes.memory.limits.host_path_cap + 1]u8 = undefined; const directory = path_buf[0..try tmp.dir.realPathFile(io, nested, &path_buf)]; diff --git a/src/image.zig b/src/image.zig index 72520ad6..8bf9de08 100644 --- a/src/image.zig +++ b/src/image.zig @@ -242,11 +242,11 @@ pub const GlyphArt = struct { const glyphs_ascii = glyphs ++ ascii_glyphs; fn matchCell(cell: *const [64][3]u8, pal: Palette, gset: []const Glyph) Cell { - var counts = [_]u16{0} ** 16; + var counts = @as([16]u16, @splat(0)); for (cell) |px| counts[nearest(px, pal)] += 1; var cand: [4]u4 = undefined; var ncand: usize = 0; - var used = [_]bool{false} ** 16; + var used = @as([16]bool, @splat(false)); while (ncand < 4) : (ncand += 1) { var best: ?usize = null; for (counts, 0..) |c, i| { @@ -432,7 +432,7 @@ pub const GlyphArt = struct { test "render: tiny image produces a grid within bounds" { const a = std.testing.allocator; // 2x2 checker, RGBA - var img = [_]u8{0} ** (2 * 2 * 4); + var img = @as([2 * 2 * 4]u8, @splat(0)); img[0] = 255; img[1] = 255; img[2] = 255; diff --git a/src/linux/v9fs.zig b/src/linux/v9fs.zig index 5e031bfe..15945e7b 100644 --- a/src/linux/v9fs.zig +++ b/src/linux/v9fs.zig @@ -64,11 +64,11 @@ pub fn helperPath(buf: []u8) ![:0]u8 { const path = if (std.c.getenv("PARDES_V9FS_HELPER")) |env| blk: { const override = std.mem.span(env); if (!std.fs.path.isAbsolute(override)) return error.AbsoluteHelperPathRequired; - break :blk try std.fmt.bufPrintZ(buf, "{s}", .{override}); + break :blk try std.fmt.bufPrintSentinel(buf, "{s}", .{override}, 0); } else blk: { var own: [4096]u8 = undefined; const parent = std.fs.path.dirname(try selfPath(&own)) orelse return error.ExecutablePathUnavailable; - break :blk try std.fmt.bufPrintZ(buf, "{s}/{s}", .{ parent, executable }); + break :blk try std.fmt.bufPrintSentinel(buf, "{s}/{s}", .{ parent, executable }, 0); }; if (std.c.access(path.ptr, 1) != 0) return error.V9fsHelperNotFound; return path; diff --git a/src/locations.zig b/src/locations.zig index 745393e5..2828566d 100644 --- a/src/locations.zig +++ b/src/locations.zig @@ -587,12 +587,13 @@ pub const Config = struct { const key = token[0..colon]; const value = token[colon + 1 ..]; var found = false; - inline for (@typeInfo(Config).@"struct".fields) |field| { - if (std.mem.eql(u8, key, field.name)) { - @field(result, field.name) = switch (@typeInfo(field.type)) { + const info = @typeInfo(Config).@"struct"; + inline for (info.field_names, info.field_types) |name, T| { + if (std.mem.eql(u8, key, name)) { + @field(result, name) = switch (@typeInfo(T)) { .bool => if (std.mem.eql(u8, value, "on")) true else if (std.mem.eql(u8, value, "off")) false else return error.ExpectedOnOrOff, - .int => std.fmt.parseInt(field.type, value, 10) catch return error.InvalidContext, - .@"enum" => std.meta.stringToEnum(field.type, value) orelse return error.InvalidLayout, + .int => std.fmt.parseInt(T, value, 10) catch return error.InvalidContext, + .@"enum" => std.meta.stringToEnum(T, value) orelse return error.InvalidLayout, else => @compileError("unsupported location setting type"), }; found = true; @@ -604,11 +605,12 @@ pub const Config = struct { } pub fn write(config: Config, writer: *std.Io.Writer) !void { - inline for (@typeInfo(Config).@"struct".fields, 0..) |field, index| { + const info = @typeInfo(Config).@"struct"; + inline for (info.field_names, info.field_types, 0..) |name, T, index| { if (index > 0) try writer.writeByte(' '); - try writer.writeAll(field.name ++ ":"); - const value = @field(config, field.name); - switch (@typeInfo(field.type)) { + try writer.writeAll(name ++ ":"); + const value = @field(config, name); + switch (@typeInfo(T)) { .bool => try writer.writeAll(if (value) "on" else "off"), .int => try writer.print("{d}", .{value}), .@"enum" => try writer.writeAll(@tagName(value)), @@ -809,11 +811,11 @@ test "locations cache bounds memory and entries and evicts least recently used" try std.testing.expectEqual(@as(usize, 2), cache.len); try std.testing.expect(cache.bytes <= 40); try std.testing.expectEqualStrings("b.unknown", cache.entries[0].path); - try std.testing.expectError(error.SourceTooLarge, cache.getBounded(gpa, "large.unknown", "x" ** 41, false, false, 40)); + try std.testing.expectError(error.SourceTooLarge, cache.getBounded(gpa, "large.unknown", &@as([41]u8, @splat('x')), false, false, 40)); try std.testing.expectEqual(@as(usize, 2), cache.len); if (syntax.supportsPath("large.zig")) { const before = cache.analyses; - try std.testing.expectError(error.SourceTooLarge, cache.getBounded(gpa, "large.zig", "x" ** 25, true, true, 40)); + try std.testing.expectError(error.SourceTooLarge, cache.getBounded(gpa, "large.zig", &@as([25]u8, @splat('x')), true, true, 40)); try std.testing.expectEqual(before, cache.analyses); } cache.deinit(gpa); diff --git a/src/look.zig b/src/look.zig index 1065cb02..f9c470cf 100644 --- a/src/look.zig +++ b/src/look.zig @@ -671,7 +671,7 @@ pub fn runSearch(p: *Pardes, id: usize, pat_raw: []const u8, kind: Search, start const cl: usize = @intCast(@max(0, pane.body.cur_row)); const cc: usize = @intCast(@max(0, pane.body.cur_col)); for (lines, 0..) |ln, i| { - const at = std.ascii.indexOfIgnoreCase(ln, pat) orelse continue; + const at = std.ascii.findIgnoreCase(ln, pat) orelse continue; const row = try std.fmt.allocPrint(arena, "{s}:{d}:{d}{c}{d} {s}\n", .{ loc, i + 1, at + 1, config.range_sep, at + pat.len, std.mem.trimEnd(u8, ln, " \t"), }); @@ -1273,7 +1273,7 @@ fn missText(text: []const u8, buf: *[miss_path_cap + "…".len]u8) []const u8 { test "a miss names a long path by its start and its end, its middle given up to …" { var cut: [miss_path_cap + "…".len]u8 = undefined; - const long = "/home/someone/" ++ "deep/" ** 80 ++ "the-file.zig"; + const long = "/home/someone/" ++ std.mem.asBytes(&@as([80][5]u8, @splat("deep/".*))) ++ "the-file.zig"; const said = missText(long, &cut); try std.testing.expect(said.len <= miss_path_cap); try std.testing.expect(std.mem.startsWith(u8, said, "/home/someone/")); @@ -2185,7 +2185,7 @@ test "Look ignores missing and out of bounds pane addresses" { test "a pointer resting where a look-hover found nothing does not wake the core every frame" { const p = try Pardes.init(std.testing.allocator, .{ .cols = 80, .rows = 24 }); defer p.deinit(); - _ = try p.setTestFile(" \n" ** 30); + _ = try p.setTestFile(std.mem.asBytes(&@as([30][6]u8, @splat(" \n".*)))); p.sync(); const r = p.rects[p.active]; // Resting on blanks in the body: a wait, then nothing to open. diff --git a/src/lsp/lsp.zig b/src/lsp/lsp.zig index 96d42bbd..4a70efe5 100644 --- a/src/lsp/lsp.zig +++ b/src/lsp/lsp.zig @@ -92,7 +92,7 @@ else pub const backend_name = "lsp-client"; pub const supports: std.EnumSet(Kind) = blk: { - var s: std.EnumSet(Kind) = .initEmpty(); + var s: std.EnumSet(Kind) = .empty; for (0..backends.len) |i| s.setUnion(backends[i].supports); break :blk s; }; diff --git a/src/lsp/lsp_client.zig b/src/lsp/lsp_client.zig index 54bbaa79..b396879b 100644 --- a/src/lsp/lsp_client.zig +++ b/src/lsp/lsp_client.zig @@ -159,7 +159,7 @@ pub const specs = [_]Spec{ /// answered per connection; a kind its server never advertised simply returns /// no rows, which the harness reports as CLAIMED-EMPTY per language — honest, /// since the claim here is about the protocol, not about every server. -pub const supports: std.EnumSet(lsp.Kind) = .initFull(); +pub const supports: std.EnumSet(lsp.Kind) = .full; /// Routing: an extension in the table whose spec is not disabled by its env /// var. Deliberately does NOT probe for the binary — this runs on the Tab diff --git a/src/macos.zig b/src/macos.zig index 20463481..37db0abd 100644 --- a/src/macos.zig +++ b/src/macos.zig @@ -724,7 +724,7 @@ fn initCore(runtime: ?*const Runtime, cols_arg: u16, rows_arg: u16) !void { // in Debug, libc's malloc otherwise. libc's measured at least as fast as // std.heap.smp_allocator everywhere and faster on MuPDF's page-sized // rasters, so this shell no longer differs. - const gpa = if (builtin.mode == .Debug) debug_gpa.allocator() else std.heap.c_allocator; + const gpa = if (builtin.mode == .debug) debug_gpa.allocator() else std.heap.c_allocator; const allocs = pardes.memory.init(gpa); errdefer pardes.memory.deinit(); @@ -858,7 +858,7 @@ export fn pardes_deinit() void { st.gpa.destroy(st.threaded); pardes.memory.deinit(); // Leaks are logged and do not fail, as std.start treats the others'. - if (builtin.mode == .Debug) { + if (builtin.mode == .debug) { _ = debug_gpa.deinit(); debug_gpa = .init; } @@ -2871,22 +2871,22 @@ test "pardes.h matches the Zig boundary" { try expectEqual(@offsetOf(c.pardes_cell_s, "len"), @offsetOf(Cell, "len")); try expectEqual(@offsetOf(c.pardes_cell_s, "flags"), @offsetOf(Cell, "flags")); try expectEqual(@sizeOf(c.pardes_scene_s), @sizeOf(Scene)); - inline for (@typeInfo(Scene).@"struct".fields) |field| - try expectEqual(@offsetOf(c.pardes_scene_s, field.name), @offsetOf(Scene, field.name)); + inline for (@typeInfo(Scene).@"struct".field_names) |name| + try expectEqual(@offsetOf(c.pardes_scene_s, name), @offsetOf(Scene, name)); try expectEqual(@sizeOf(c.pardes_panel_box_s), @sizeOf(PanelBox)); - inline for (@typeInfo(PanelBox).@"struct".fields) |field| - try expectEqual(@offsetOf(c.pardes_panel_box_s, field.name), @offsetOf(PanelBox, field.name)); + inline for (@typeInfo(PanelBox).@"struct".field_names) |name| + try expectEqual(@offsetOf(c.pardes_panel_box_s, name), @offsetOf(PanelBox, name)); try expectEqual(@sizeOf(c.pardes_panel_track_s), @sizeOf(PanelTrack)); - inline for (@typeInfo(PanelTrack).@"struct".fields) |field| { - const c_name = comptime if (std.mem.eql(u8, field.name, "motion")) + inline for (@typeInfo(PanelTrack).@"struct".field_names) |name| { + const c_name = comptime if (std.mem.eql(u8, name, "motion")) "reserved0" else - field.name; - try expectEqual(@offsetOf(c.pardes_panel_track_s, c_name), @offsetOf(PanelTrack, field.name)); + name; + try expectEqual(@offsetOf(c.pardes_panel_track_s, c_name), @offsetOf(PanelTrack, name)); } try expectEqual(@sizeOf(c.pardes_image_s), @sizeOf(Image)); - inline for (@typeInfo(Image).@"struct".fields) |field| - try expectEqual(@offsetOf(c.pardes_image_s, field.name), @offsetOf(Image, field.name)); + inline for (@typeInfo(Image).@"struct".field_names) |name| + try expectEqual(@offsetOf(c.pardes_image_s, name), @offsetOf(Image, name)); try expectEqual(@sizeOf(c.pardes_runtime_s), @sizeOf(Runtime)); try expectEqual(@as(u32, c.PARDES_COLOR_DEFAULT), color_default); @@ -3177,7 +3177,7 @@ test "mac tag layer ABI preserves logical capacity and physical grip" { }); try std.testing.expectEqual(@as(u32, 11), pardes_tag_layer_value(0, 8)); try std.testing.expectEqual(@as(u8, 'Z'), pardes_tag_layer_cells(0).?[11].text[0]); - var canonical: [24]Cell = @splat(encodeCell(.{ .text = .{'G'} ++ .{0} ** 6, .len = 1, .default = false })); + var canonical: [24]Cell = @splat(encodeCell(.{ .text = .{ 'G', 0, 0, 0, 0, 0, 0 }, .len = 1, .default = false })); var source: [24]pardes.Cell = @splat(.{}); blankTagCells(&canonical, 8, 3, &source, &core.surface.tag_layers); try std.testing.expectEqual(@as(u8, 'G'), canonical[9].text[0]); diff --git a/src/main.zig b/src/main.zig index 26259b43..e3bae75f 100644 --- a/src/main.zig +++ b/src/main.zig @@ -464,6 +464,12 @@ fn nativeMain(init: std.process.Init) !void { } opts.tty_only = explicit_tty or session_only; opts.mounts = mounts[0..mounts_len]; + // `zig build run-isolated` with nothing named: something to look at on + // arrival, read out of the binary itself. + if (pardes.isolated and positional == null) { + session_only = false; + positional = "src/pardes.zig"; + } if (detach != null and attach != null) badArgs(init.io, "--detach and --attach are opposites: one runs the session, the other joins one", .{}); // --wait waits on the pane a FILE opens: with none there is nothing to diff --git a/src/memory.zig b/src/memory.zig index abfd40f6..48403c55 100644 --- a/src/memory.zig +++ b/src/memory.zig @@ -38,7 +38,7 @@ pub const limits = struct { }; const Allocator = std.mem.Allocator; -const debug_enabled = builtin.mode == .Debug; +const debug_enabled = builtin.mode == .debug; pub const Allocators = struct { pardes: Allocator, diff --git a/src/modal.zig b/src/modal.zig index 50e0ddf4..82f1a3a0 100644 --- a/src/modal.zig +++ b/src/modal.zig @@ -163,7 +163,7 @@ pub const Normal = struct { }; pub const Input = struct { - roles: std.EnumSet(Role) = .initEmpty(), + roles: std.EnumSet(Role) = .empty, cp: u21, ctrl: bool = false, alt: bool = false, diff --git a/src/ninep/addr.zig b/src/ninep/addr.zig index b78c46e7..3feda5a2 100644 --- a/src/ninep/addr.zig +++ b/src/ninep/addr.zig @@ -646,7 +646,7 @@ test "the address language, form by form" { try testing.expectEqualStrings(c[1], th.wr(p, addr, c[0]).reply.ename); } - const nested = "," ** 4096; + const nested = &@as([4096]u8, @splat(',')); _ = th.wr(p, addr, "#0"); try testing.expectEqual(E.INVAL, th.wr(p, addr, nested).errno()); } diff --git a/src/ninep/cols.zig b/src/ninep/cols.zig index e3b456ba..59f6ae42 100644 --- a/src/ninep/cols.zig +++ b/src/ninep/cols.zig @@ -288,18 +288,18 @@ test "exactly 4096 bytes written with echo's newline after a truncation fit ever const p = try th.withFile(testing.allocator, "x\n"); defer p.deinit(); const serial = th.serialOf(p); - const text = "w" ** 4096 ++ "\n"; + const text = &@as([4096]u8, @splat('w')) ++ "\n"; for ([_]u64{ tree.Node.of(serial, .tag), tree.Node.ofCol(layout.columnSerial(p, 0), .tag), @intFromEnum(tree.TopFile.tag) }) |node| { _ = th.call(p, .{ .tag = 1, .op = .setattr, .node = node, .truncate = true }); const h = th.call(p, .{ .tag = 2, .op = .open, .node = node, .omode = 1 }).reply.handle; const r = th.call(p, .{ .tag = 3, .op = .write, .node = node, .handle = h, .data = text }); try testing.expectEqual(tree.Status.ok, r.reply.status); _ = th.call(p, .{ .tag = 4, .op = .release, .node = node, .handle = h, .opened = true }); - try testing.expect(std.mem.endsWith(u8, th.rd(p, node, 0, 1 << 16).bytes, "w" ** 4096)); + try testing.expect(std.mem.endsWith(u8, th.rd(p, node, 0, 1 << 16).bytes, &@as([4096]u8, @splat('w')))); // One more byte is over. _ = th.call(p, .{ .tag = 5, .op = .setattr, .node = node, .truncate = true }); const h2 = th.call(p, .{ .tag = 6, .op = .open, .node = node, .omode = 1 }).reply.handle; - try testing.expectEqual(E.NOSPC, th.call(p, .{ .tag = 7, .op = .write, .node = node, .handle = h2, .data = "w" ** 4097 ++ "\n" }).errno()); + try testing.expectEqual(E.NOSPC, th.call(p, .{ .tag = 7, .op = .write, .node = node, .handle = h2, .data = &@as([4097]u8, @splat('w')) ++ "\n" }).errno()); _ = th.call(p, .{ .tag = 8, .op = .release, .node = node, .handle = h2, .opened = true }); } } @@ -316,7 +316,7 @@ test "a Newcol refused because the tags would not fit logs its err alone and spe for (p.col_panes[col][0..p.col_n[col]]) |k| { const each = p.panes[k].?; if (each.tag.own) |old| p.gpa.free(old); - each.tag.own = try p.gpa.dupe(u8, "word " ** 60); + each.tag.own = try p.gpa.dupe(u8, std.mem.asBytes(&@as([60][5]u8, @splat("word ".*)))); } try testing.expect(p.col_n[col] >= 2); p.sync(); @@ -588,7 +588,7 @@ test "a refused write after a truncation leaves every kind of tag as it was, and defer p.deinit(); const serial = th.serialOf(p); const col = layout.columnSerial(p, 0); - const big = "w" ** (limits.max_tag_tail + 1); + const big = &@as([limits.max_tag_tail + 1]u8, @splat('w')); // Each tag: a truncating open, then a write too long: nothing changes. for ([_]u64{ Node.of(serial, .tag), Node.ofCol(col, .tag), @intFromEnum(tree.TopFile.tag) }) |node| { _ = th.wr(p, node, " Mine"); diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig index f6457b83..6b4bbafb 100644 --- a/src/ninep/ctl.zig +++ b/src/ninep/ctl.zig @@ -1682,9 +1682,9 @@ test "a look's miss repeats the path whole up to 256 bytes, then gives up its mi var line: [512]u8 = undefined; _ = wr(p, root, try std.fmt.bufPrint(&line, "{s}\n", .{long})); try testing.expect(th.logHas(p, try std.fmt.bufPrint(&line, "look: no match for \"{s}\"\n", .{long}))); - const huge = "é" ** 150; // 300 bytes: its middle cut to fit 256, between characters + const huge = std.mem.asBytes(&@as([150][2]u8, @splat("é".*))); // 300 bytes: its middle cut to fit 256, between characters _ = wr(p, root, huge ++ "\n"); - try testing.expect(th.logHas(p, "look: no match for \"" ++ "é" ** 63 ++ "…" ++ "é" ** 63 ++ "\"\n")); + try testing.expect(th.logHas(p, "look: no match for \"" ++ std.mem.asBytes(&@as([63][2]u8, @splat("é".*))) ++ "…" ++ std.mem.asBytes(&@as([63][2]u8, @splat("é".*))) ++ "\"\n")); } test "exec runs a builtin at the pane and records the pane it acted on" { @@ -2041,7 +2041,7 @@ test "Zerox twins dump their text once and come back on one buffer from a Restor defer p.deinit(); const first = serialOf(p); _ = wr(p, Node.of(first, .name), "/tmp/pardes-zerox-dump.txt\n"); - _ = wr(p, Node.of(first, .body), "unsaved " ** 64 ++ "\n"); + _ = wr(p, Node.of(first, .body), std.mem.asBytes(&@as([64][8]u8, @splat("unsaved ".*))) ++ "\n"); try testing.expect(p.executeBuiltinLine(0, "Zerox")); try testing.expect(p.executeBuiltinLine(0, "Zerox")); try pardes.dump.dumpState(p); @@ -2888,7 +2888,7 @@ test "a builtin that fails a ctl write logs only its err, so the same failure ag test "an exec line over the command limit fails the write and says the limit; a builtin's may be longer" { const p = try withFile(testing.allocator, "x\n"); defer p.deinit(); - const long = "echo " ++ "y" ** pardes.exec.command_max ++ "\n"; + const long = "echo " ++ &@as([pardes.exec.command_max]u8, @splat('y')) ++ "\n"; const refused = wr(p, root_exec, long); try testing.expectEqual(E.INVAL, refused.errno()); try testing.expectEqualStrings(e_too_long, refused.reply.ename); @@ -2896,7 +2896,7 @@ test "an exec line over the command limit fails the write and says the limit; a try testing.expect(th.logHas(p, try std.fmt.bufPrint(&rec, "err {d} exec: invalid command line: a command line is at most 1024 bytes", .{serialOf(p)}))); try testing.expectEqualStrings(e_control, wr(p, root_exec, "echo a\x01b\n").reply.ename); try testing.expect(th.logHas(p, try std.fmt.bufPrint(&rec, "err {d} exec: invalid command line: it holds", .{serialOf(p)}))); - try testing.expectEqual(Status.ok, wr(p, root_exec, "Msg " ++ "z" ** 1100 ++ "\n").reply.status); + try testing.expectEqual(Status.ok, wr(p, root_exec, "Msg " ++ &@as([1100]u8, @splat('z')) ++ "\n").reply.status); } test "Edit's p and = never fail for want of room for +Errors: the text is logged instead" { @@ -4012,8 +4012,8 @@ test "Back and Forward written to exec keep to the focused file, and JumpScope a defer p.deinit(); var tmp = testing.tmpDir(.{}); defer tmp.cleanup(); - try tmp.dir.writeFile(testing.io, .{ .sub_path = "a.txt", .data = "row\n" ** 100 }); - try tmp.dir.writeFile(testing.io, .{ .sub_path = "b.txt", .data = "row\n" ** 100 }); + try tmp.dir.writeFile(testing.io, .{ .sub_path = "a.txt", .data = std.mem.asBytes(&@as([100][4]u8, @splat("row\n".*))) }); + try tmp.dir.writeFile(testing.io, .{ .sub_path = "b.txt", .data = std.mem.asBytes(&@as([100][4]u8, @splat("row\n".*))) }); var dir_buf: [4096]u8 = undefined; const dir = dir_buf[0..try tmp.dir.realPath(testing.io, &dir_buf)]; var line: [4200]u8 = undefined; diff --git a/src/ninep/events.zig b/src/ninep/events.zig index 3910ac05..7b73dc0e 100644 --- a/src/ninep/events.zig +++ b/src/ninep/events.zig @@ -938,7 +938,7 @@ test "event records are acme's bytes, one per read, and .again when empty" { try testing.expectEqualStrings("ML0 ", rd(p, event, 0, 4).bytes); try testing.expectEqualStrings("3 4 3 one\n", rd(p, event, 0, 4096).bytes); - const big = "z" ** max_record_text; + const big = &@as([max_record_text]u8, @splat('z')); _ = noteAction(p, 0, .body_exec, 0, max_record_text, 0, big); try testing.expectEqualStrings("MX0 256 0 0 \n", rd(p, event, 0, 4096).bytes); @@ -1388,7 +1388,7 @@ test "opens of the log share the open records, and a closed one frees its record test "a click in the body reports the offsets of the word it takes, so the record can be written back" { const config = @import("../config.zig"); const gpa = testing.allocator; - const text = "alpha qty beta\n qty\n\tqty\ndef f(qty): return qty.x\n" ++ "w" ** 100 ++ " qty\n"; + const text = "alpha qty beta\n qty\n\tqty\ndef f(qty): return qty.x\n" ++ &@as([100]u8, @splat('w')) ++ " qty\n"; const p = try withFile(gpa, text); defer p.deinit(); // A scratch made over 9P, clicked while another pane has the keyboard. @@ -1459,7 +1459,7 @@ test "follow new skips what the log held and waits for what comes after" { test "a long msg record is cut between words at its cap, with an ellipsis" { const p = try withFile(testing.allocator, "x\n"); defer p.deinit(); - const long = "word " ** 60; // 300 bytes + const long = std.mem.asBytes(&@as([60][5]u8, @splat("word ".*))); // 300 bytes _ = wr(p, Node.of(serialOf(p), .ctl), "Msg " ++ long ++ "\n"); const log = @intFromEnum(tree.TopFile.log); const h = call(p, .{ .tag = 1, .op = .open, .node = log }).reply.handle; @@ -1485,7 +1485,7 @@ test "a record is one line of UTF-8: DEL and C1 are spaces, bytes not UTF-8 are test "a long err record keeps its end, its middle given up to an ellipsis" { const p = try withFile(testing.allocator, "x\n"); defer p.deinit(); - _ = wr(p, @intFromEnum(tree.TopFile.ctl), "Bogus" ++ "abcdefgh" ** 40 ++ "\n"); + _ = wr(p, @intFromEnum(tree.TopFile.ctl), "Bogus" ++ std.mem.asBytes(&@as([40][8]u8, @splat("abcdefgh".*))) ++ "\n"); const log = @intFromEnum(tree.TopFile.log); const h = call(p, .{ .tag = 1, .op = .open, .node = log }).reply.handle; const text = call(p, .{ .tag = 2, .op = .read, .node = log, .handle = h, .size = 1 << 16 }).bytes; @@ -1500,7 +1500,7 @@ test "a long err record keeps its end, its middle given up to an ellipsis" { test "two failures that agree only in what their records cut are two records, not one counted" { const p = try th.withFile(testing.allocator, "x\n"); defer p.deinit(); - const long = "why " ** 80; + const long = std.mem.asBytes(&@as([80][4]u8, @splat("why ".*))); p.setMessage(0, long ++ "first"); p.setMessage(0, long ++ "second"); try testing.expect(!th.logHas(p, "(x2)")); diff --git a/src/ninep/pane.zig b/src/ninep/pane.zig index 3b70d62f..8605cab8 100644 --- a/src/ninep/pane.zig +++ b/src/ninep/pane.zig @@ -1427,7 +1427,7 @@ test "a tag write past the limit is refused whole, naming the limit" { const tag = Node.of(serialOf(p), .tag); const before = try testing.allocator.dupe(u8, rd(p, tag, 0, 1 << 16).bytes); defer testing.allocator.free(before); - const big = "w" ** (limits.max_tag_tail + 10); + const big = &@as([limits.max_tag_tail + 10]u8, @splat('w')); const r = wr(p, tag, big); try testing.expectEqual(E.NOSPC, r.errno()); // `no space` is what 9ns maps to ENOSPC, so a shell through a mount @@ -1549,20 +1549,21 @@ test "a name with a component over 255 bytes is refused, and a long path's faile const p = try withFile(testing.allocator, "x\n"); defer p.deinit(); const serial = serialOf(p); - const refused = wr(p, Node.of(serial, .name), "/tmp/" ++ "c" ** 256 ++ "/f.txt\n"); + const refused = wr(p, Node.of(serial, .name), "/tmp/" ++ &@as([256]u8, @splat('c')) ++ "/f.txt\n"); try testing.expectEqual(E.INVAL, refused.errno()); try testing.expectEqualStrings("invalid file name: a component over 255 bytes", refused.reply.ename); - try testing.expectEqual(Status.ok, wr(p, Node.of(serial, .name), "/tmp/" ++ "c" ** 255 ++ "\n").reply.status); + try testing.expectEqual(Status.ok, wr(p, Node.of(serial, .name), "/tmp/" ++ &@as([255]u8, @splat('c')) ++ "\n").reply.status); // Held with no newline, it is refused by that write, not at the close. const held = call(p, .{ .tag = 1, .op = .open, .node = Node.of(serial, .name), .omode = 1 }).reply.handle; - try testing.expectEqual(E.INVAL, call(p, .{ .tag = 2, .op = .write, .node = Node.of(serial, .name), .handle = held, .data = "/tmp/" ++ "e" ** 256 }).errno()); + try testing.expectEqual(E.INVAL, call(p, .{ .tag = 2, .op = .write, .node = Node.of(serial, .name), .handle = held, .data = "/tmp/" ++ &@as([256]u8, @splat('e')) }).errno()); _ = call(p, .{ .tag = 3, .op = .release, .node = Node.of(serial, .name), .handle = held, .opened = true }); try testing.expectEqual(@as(usize, 0), p.fs.closed_lines.items.len); // A Save of a 3000-byte path the host refuses: the waiting write's // reason is at the end, the path giving up its middle. // (Under /tmp: under / a user's Save is refused permission, not // missing.) - const long = "/tmp/nonexistent-pardes-root/" ++ ("d" ** 200 ++ "/") ** 15 ++ "f.txt"; + const segment = &@as([200]u8, @splat('d')) ++ "/"; + const long = "/tmp/nonexistent-pardes-root/" ++ std.mem.asBytes(&@as([15][201]u8, @splat(segment.*))) ++ "f.txt"; const id = p.paneBySerial(serial).?; try nameBuffer(p, id, long, false); p.fs.late_failure_len = 0; diff --git a/src/ninep/pty.zig b/src/ninep/pty.zig index c58cf676..aeb57a00 100644 --- a/src/ninep/pty.zig +++ b/src/ninep/pty.zig @@ -1044,12 +1044,12 @@ test "a run's answer says cut when its output's start is gone, and reads a bound const q = try withTerm(gpa); defer q.deinit(); const kept = q.panes[0].?; - kept.terminal.?.vt.screens.get(.primary).?.pages.explicit_max_size = 1; + kept.terminal.?.vt.screens.get(.primary).?.pages.limits.set(.bytes, 1); const run = Node.of(serialOf(q), .pty_run); sh.put(q, prompt); h = sh.send(q, run); sh.put(q, c); - const lines = "pruned\r\n" ** 64; + const lines = std.mem.asBytes(&@as([64][8]u8, @splat("pruned\r\n".*))); var fed: usize = 0; while (!kept.terminal.?.stream.handler.out_start.?.garbage) : (fed += 1) { if (fed == 1000) return error.TestUnexpectedResult; @@ -1146,7 +1146,7 @@ test "a run's answer longer than its room is cut, its newline kept" { var slot: Run = .{}; const p = try th.withTerm(testing.allocator); defer p.deinit(); - answer(p, &slot, "busy: {s} is running", .{"x" ** 200}); + answer(p, &slot, "busy: {s} is running", .{&@as([200]u8, @splat('x'))}); try testing.expectEqual(slot.answer.len, slot.len); try testing.expectEqual(@as(u8, '\n'), slot.answer[slot.len - 1]); } diff --git a/src/ninep/screen.zig b/src/ninep/screen.zig index b991c3e4..8d4707e0 100644 --- a/src/ninep/screen.zig +++ b/src/ninep/screen.zig @@ -333,7 +333,7 @@ test "a terminal's body is its logical lines: a row the terminal wrapped is join const p = try th.withTerm(testing.allocator); defer p.deinit(); const pane = p.panes[0].?; - const long = "w" ** 50 ++ "x" ** 150; // wider than the pane: it wraps + const long = &@as([50]u8, @splat('w')) ++ &@as([150]u8, @splat('x')); // wider than the pane: it wraps try testing.expect(long.len > pane.cols); p.update(.{ .output = .{ .pane = 0, .bytes = long ++ "\r\nnext" } }); while (p.nextEffect()) |_| {} diff --git a/src/ninep/tree.zig b/src/ninep/tree.zig index eedab43b..5678832b 100644 --- a/src/ninep/tree.zig +++ b/src/ninep/tree.zig @@ -509,7 +509,7 @@ pub fn fitErr(text: []const u8, out: []u8) []const u8 { test "a reason past 128 bytes keeps its end: the path in it gives up its middle" { var out: [128]u8 = undefined; - const long = "Save /home/someone/projects/" ++ "deep/" ** 30 ++ "file.txt: no such directory"; + const long = "Save /home/someone/projects/" ++ std.mem.asBytes(&@as([30][5]u8, @splat("deep/".*))) ++ "file.txt: no such directory"; const fit = fitErr(long, &out); try testing.expect(fit.len <= 128); try testing.expect(std.mem.startsWith(u8, fit, "Save /home/someone/")); @@ -517,7 +517,7 @@ test "a reason past 128 bytes keeps its end: the path in it gives up its middle" try testing.expect(std.mem.indexOf(u8, fit, "…") != null); try testing.expect(std.unicode.utf8ValidateSlice(fit)); // No path: the whole text's middle goes, the end stays. - const words = "why " ** 40 ++ "the reason"; + const words = std.mem.asBytes(&@as([40][4]u8, @splat("why ".*))) ++ "the reason"; try testing.expect(std.mem.endsWith(u8, fitErr(words, &out), "the reason")); try testing.expectEqualStrings("short", fitErr("short", &out)); // Through the tree: a look at a long ./ name not there, a miss, says @@ -525,7 +525,7 @@ test "a reason past 128 bytes keeps its end: the path in it gives up its middle" const p = try th.withFile(testing.allocator, "x\n"); defer p.deinit(); var line: [512]u8 = undefined; - const r = th.wr(p, Node.of(serialOf(p), .look), try std.fmt.bufPrint(&line, "./{s}x.txt\n", .{"no-such-dir/" ** 20})); + const r = th.wr(p, Node.of(serialOf(p), .look), try std.fmt.bufPrint(&line, "./{s}x.txt\n", .{std.mem.asBytes(&@as([20][12]u8, @splat("no-such-dir/".*)))})); try testing.expectEqual(Status.ok, r.reply.status); try testing.expect(th.logHas(p, "x.txt: no such file")); } @@ -1492,17 +1492,17 @@ test "README names every file the tree serves" { return false; } }; - inline for (@typeInfo(TopFile).@"enum".fields) |f| { - const t: TopFile = @enumFromInt(f.value); + inline for (@typeInfo(TopFile).@"enum".field_values) |value| { + const t: TopFile = @enumFromInt(value); if (t != .root and !words.has(t.fileName())) { std.debug.print("README does not mention /{s}\n", .{t.fileName()}); return error.Undocumented; } } - inline for (@typeInfo(PaneFile).@"enum".fields) |f| { - const t: PaneFile = @enumFromInt(f.value); + inline for (@typeInfo(PaneFile).@"enum".field_values) |value| { + const t: PaneFile = @enumFromInt(value); const ok = if (t == .dir) true else if (t.inPty() and t != .pty) - std.mem.indexOf(u8, fs.help, "pty/" ++ comptime @as(PaneFile, @enumFromInt(f.value)).fileName()) != null + std.mem.indexOf(u8, fs.help, "pty/" ++ comptime @as(PaneFile, @enumFromInt(value)).fileName()) != null else words.has(t.fileName()); if (!ok) { diff --git a/src/normal.zig b/src/normal.zig index 77feb7cf..8de23d1c 100644 --- a/src/normal.zig +++ b/src/normal.zig @@ -1015,7 +1015,7 @@ test "gj/gk step the wrapped rows a body draws while j/k keep the file's lines" const p = try Pardes.init(gpa, .{ .tty_only = true }); defer p.deinit(); while (p.nextEffect()) |_| {} - const long = "a" ** 400; + const long = &@as([400]u8, @splat('a')); const pane = try p.setTestFile(long ++ "\nsecond\n"); p.settings.wrap = true; const width = panes.File.wrapWidth(pane, true); diff --git a/src/pager.zig b/src/pager.zig index 30418623..feabd194 100644 --- a/src/pager.zig +++ b/src/pager.zig @@ -38,7 +38,7 @@ pub fn parse(gpa: std.mem.Allocator, raw: []const u8, colour: bool) !Page { errdefer h.text.deinit(gpa); errdefer h.spans.deinit(gpa); try h.text.ensureTotalCapacity(gpa, raw.len); - var stream: ghostty_vt.Stream(*Handler) = .init(&h); + var stream: ghostty_vt.Stream(*Handler) = .init(.{ .handler = &h }); defer stream.deinit(); stream.nextSlice(raw); if (h.failed) return error.OutOfMemory; diff --git a/src/panes.zig b/src/panes.zig index ba1dedb5..07d5ccb1 100644 --- a/src/panes.zig +++ b/src/panes.zig @@ -318,7 +318,7 @@ pub const Pane = struct { /// `older` is an earlier message line still on screen; `index` says /// which (`Pane.msg_older`). pub const Kind = enum { older, message, leader, prompt }; - pub const max = @typeInfo(Kind).@"enum".fields.len - 1 + message_stack; + pub const max = @typeInfo(Kind).@"enum".field_names.len - 1 + message_stack; kinds: [max]Kind = undefined, index: [max]u8 = @splat(0), diff --git a/src/pardes.zig b/src/pardes.zig index 5f330712..8da0922d 100644 --- a/src/pardes.zig +++ b/src/pardes.zig @@ -807,7 +807,7 @@ test "TreeContext tag style preserves message rows and its opt-out survives rest if (comptime !syntax.enabled) return error.SkipZigTest; const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 60, .rows = 16 }); defer p.deinit(); - const pane = try p.setTestFile("pub const Box = struct {\n pub fn run() void {\n" ++ (" // body\n" ** 30) ++ " }\n};\n"); + const pane = try p.setTestFile("pub const Box = struct {\n pub fn run() void {\n" ++ (std.mem.asBytes(&@as([30][16]u8, @splat(" // body\n".*)))) ++ " }\n};\n"); p.gpa.free(pane.file.?.path); pane.file.?.path = try p.gpa.dupe(u8, "/test.zig"); if (!panes.File.supportsContext(pane)) return error.SkipZigTest; @@ -1247,7 +1247,9 @@ test "Def and Refs are a speaking file's tag words; gd, gr and a 2-1 chord all r const r = p.rects[0]; const x0 = r.x + config.GUTTER + panes.File.gutterWidth(pane); const use_y = p.bodyTop(pane, r) + 1; - const tag = try tagline.tagText(p, p.scratch.allocator(), pane); + // Copied out of the scratch arena, which each p.update resets. + const tag = try std.testing.allocator.dupe(u8, try tagline.tagText(p, p.scratch.allocator(), pane)); + defer std.testing.allocator.free(tag); for ([_]struct { word: []const u8, kind: lsp.Kind }{ .{ .word = " Def ", .kind = .definition }, .{ .word = " Refs", .kind = .references } }) |w| { // B1 sweeps the use of `alpha` on the second line (bytes 30..35), // leaving the cursor at its far end. @@ -1348,7 +1350,7 @@ test "acme placement: under a pane's text when it has many blank rows, else halv try std.testing.expectEqual(text_end, p.rects[second].y); // Fill both with text: no blank space is big, so the biggest pane is // halved. - const full = "x\n" ** 80; + const full = std.mem.asBytes(&@as([80][2]u8, @splat("x\n".*))); for ([_]usize{ top, second }) |id| panes.File.setContent(p, &p.panes[id].?.file.?, try p.gpa.dupe(u8, full)); p.sync(); const big = if (p.rects[second].h >= p.rects[top].h) second else top; @@ -2006,7 +2008,7 @@ test "a command pane shows how its command ended, and the next command there run try std.testing.expectEqual(@as(usize, 0), Count.signals); p.host = host_before; // A command line longer than a command pane takes is refused. - const long = "x" ** (exec.command_max + 1); + const long = &@as([exec.command_max + 1]u8, @splat('x')); try std.testing.expectEqual(@as(?usize, null), exec.execute(p, 1, long)); } @@ -2970,9 +2972,9 @@ test "restored terminals keep monotonic nonzero pane identities" { fn chordName(comptime c: config.Chord) []const u8 { comptime { const mods = (if (c.ctrl) "C-" else "") ++ (if (c.alt) "A-" else "") ++ (if (c.shift) "S-" else ""); - for (@typeInfo(Key).@"struct".decls) |d| { - if (@TypeOf(@field(Key, d.name)) != u21) continue; - if (@field(Key, d.name) == c.cp) return mods ++ d.name; + for (@typeInfo(Key).@"struct".decl_names) |d| { + if (@TypeOf(@field(Key, d)) != u21) continue; + if (@field(Key, d) == c.cp) return mods ++ d; } if (c.cp < 0x20 or c.cp > 0x7e) @compileError("chord has no name for the index"); return mods ++ &[_]u8{@as(u8, @intCast(c.cp))}; @@ -3088,11 +3090,11 @@ pub const builtin_rows: [std.enums.values(Builtin).len]Row = blk: { for (std.enums.values(Builtin), 0..) |b, i| { const keys = if (config.leader_path.get(b)) |path| leaderKeys(path) else ""; const rest = shortcuts(b); - const named = @tagName(b) ++ (if (rest.len == 0) "" else (" " ** (namew - @tagName(b).len)) ++ " " ++ rest); + const named = @tagName(b) ++ (if (rest.len == 0) "" else (&@as([namew - @tagName(b).len]u8, @splat(' '))) ++ " " ++ rest); rows[i] = .{ .path = config.leader_path.get(b), .cmd = b, - .line = keys ++ (" " ** (4 + keyw - keys.len)) ++ " " ++ named, + .line = keys ++ (&@as([4 + keyw - keys.len]u8, @splat(' '))) ++ " " ++ named, }; } const last = "\x7f"; @@ -3111,8 +3113,8 @@ comptime { @setEvalBranchQuota(20000); // one branch per string byte, behind the decl walk that folds Builtin var it = std.mem.tokenizeScalar(u8, config.topbar_str, ' '); words: while (it.next()) |w| { - for (@typeInfo(Builtin).@"enum".fields) |f| - if (std.mem.eql(u8, f.name, w)) continue :words; + for (@typeInfo(Builtin).@"enum".field_names) |name| + if (std.mem.eql(u8, name, w)) continue :words; @compileError("topbar word is not a builtin: " ++ w); } } @@ -4499,7 +4501,7 @@ pub const Pardes = struct { /// Panes made this step that found no room in their column /// (exec.placeNew): closed at the step's end, once whatever made them /// is done with them. - unplaced: std.StaticBitSet(MAX_PANES) = .initEmpty(), + unplaced: std.StaticBitSet(MAX_PANES) = .empty, /// A look's word search is running (look.lookUnresolved): from a /// terminal its rows refill the directory's one +Search (Output). word_look: bool = false, @@ -5018,7 +5020,7 @@ pub const Pardes = struct { if (p.dump_out) |d| gpa.free(d); p.fallback.deinit(); if (p.last_dump) |d| gpa.free(d); - if (p.custom_theme) |theme_value| std.zon.parse.free(gpa, theme_value); + if (p.custom_theme) |theme_value| gpa.free(theme_value.name); if (p.chord_arg) |a| gpa.free(a); for (p.spawn_dirs) |d| if (d) |dir| gpa.free(dir); p.pipe.deinit(gpa); @@ -8508,7 +8510,7 @@ test "raw tty Ctrl-B switches to editor mode without sending child input" { test "the jump list never holds two entries in a row the same, when the one between them goes" { const p = try Pardes.init(std.testing.allocator, .{ .cols = 60, .rows = 40 }); defer p.deinit(); - const pane = try p.setTestFile("a\n" ** 200); + const pane = try p.setTestFile(std.mem.asBytes(&@as([200][2]u8, @splat("a\n".*)))); const at: Loc = .{ .pane = 0, .serial = pane.serial, .line = 1, .col = 1 }; // A, a pane long closed with no file to keep it, A again, then far on. p.jumps[0] = at; @@ -9054,7 +9056,7 @@ const JumpsTest = struct { fn init(order: []const u8) !JumpsTest { const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 100, .rows = 80 }); errdefer p.deinit(); - const text = "row\n" ** 100; + const text = std.mem.asBytes(&@as([100][4]u8, @splat("row\n".*))); _ = try p.setTestFile(text); var t: JumpsTest = .{ .p = p }; for ([_][]const u8{ "/b.txt", "/test.txt", "" }, 1..) |path, n| { diff --git a/src/pdf.zig b/src/pdf.zig index d98d5ff2..5adc62d1 100644 --- a/src/pdf.zig +++ b/src/pdf.zig @@ -4,9 +4,7 @@ const std = @import("std"); const c_heap = @import("c_heap"); -const c = @cImport({ - @cInclude("pdf_bridge.h"); -}); +const c = @import("pdf_c"); // src/pdf_bridge.h, translated by build.zig /// What MuPDF allocates from, itself and the libraries it bundles (they all /// allocate through its context): `start`'s allocator, through the shared C @@ -1130,7 +1128,7 @@ pub const Document = struct { const page_number = try document.checkedPage(page); if (std.mem.indexOfScalar(u8, needle, 0) != null) return error.InvalidNeedle; - const needle_z = try gpa.dupeZ(u8, needle); + const needle_z = try gpa.dupeSentinel(u8, needle, 0); defer gpa.free(needle_z); var found: c.pardes_pdf_search_result = @@ -2067,7 +2065,7 @@ test "MuPDF search returns normalized oriented quads and word selection text" { const projected = try document.pageText(std.testing.allocator, 0); defer std.testing.allocator.free(projected); - try std.testing.expect(std.ascii.indexOfIgnoreCase(projected, "Pardes") != null); + try std.testing.expect(std.ascii.findIgnoreCase(projected, "Pardes") != null); // Exercise transactional cache replacement before searching page zero // again; a failed ownership handoff here tends to surface as a double drop. if (document.pages > 1) { @@ -2093,7 +2091,7 @@ test "MuPDF search returns normalized oriented quads and word selection text" { const text = try document.copySelection(std.testing.allocator, 0, selected.start, selected.end); defer std.testing.allocator.free(text); - try std.testing.expect(std.ascii.indexOfIgnoreCase(text, "Pardes") != null); + try std.testing.expect(std.ascii.findIgnoreCase(text, "Pardes") != null); } test "highlighted render changes pixels while plain render stays stable" { diff --git a/src/regexp.zig b/src/regexp.zig index 86132f60..4cbca57e 100644 --- a/src/regexp.zig +++ b/src/regexp.zig @@ -58,7 +58,7 @@ pub const Regex = struct { /// Timed on this machine's ReleaseSafe build: 10M steps of the worst /// patterns take 45-80 ms, and a Debug build is ten times slower. - pub const budget: u64 = if (builtin.mode == .Debug) 4_000_000 else 32_000_000; + pub const budget: u64 = if (builtin.mode == .debug) 4_000_000 else 32_000_000; pub const e_long = std.fmt.comptimePrint("bad regular expression: longer than mvzr's {d} operations (about {d} pattern characters)", .{ max_ops, max_ops }); pub const e_anchor = "bad regular expression: in a pattern with \\n, ^ can only come first and $ only just before a \\n"; @@ -503,10 +503,10 @@ test "a class with non-ASCII runes matches those runes: [éa-z], a range of them } test "a pattern past 64 characters compiles, and one past the limit says so" { - var long = try Regex.compile("a" ** 200); - const text = "x" ++ "a" ** 200 ++ "\n"; + var long = try Regex.compile(&@as([200]u8, @splat('a'))); + const text = "x" ++ &@as([200]u8, @splat('a')) ++ "\n"; try std.testing.expectEqual(@as(usize, 1), (try long.find(text, 0, text.len, text.len)).?.start); - try std.testing.expectError(error.TooLong, Regex.compile("a" ** (max_ops + 8))); + try std.testing.expectError(error.TooLong, Regex.compile(&@as([max_ops + 8]u8, @splat('a')))); try std.testing.expectError(error.Bad, Regex.compile("a[b")); } @@ -546,13 +546,13 @@ test "a search that would backtrack without end runs out of budget, promptly" { // As long a chain as mvzr compiles, over runs one `a` short of it: 2^20 // steps from every start. for (0..line.len / 20) |i| line[i * 20 + 19] = 'b'; - var chain = try Regex.compile("a?" ** 20 ++ "a" ** 20); + var chain = try Regex.compile(std.mem.asBytes(&@as([20][2]u8, @splat("a?".*))) ++ &@as([20]u8, @splat('a'))); try std.testing.expectError(error.TooSlow, chain.find(&line, 0, line.len, line.len)); } test "the match is the leftmost, however long the line" { // A window cut into the identifier would find `x... =` from its middle. - const text = "let " ++ "x" ** 100 ++ " = 1"; + const text = "let " ++ &@as([100]u8, @splat('x')) ++ " = 1"; var assign = try Regex.compile("\\s*(\\w+)\\s*="); const m = (try assign.find(text, 0, text.len, text.len)).?; try std.testing.expectEqual(@as(usize, 3), m.start); diff --git a/src/sam_edit.zig b/src/sam_edit.zig index d0c51bdb..f6253c89 100644 --- a/src/sam_edit.zig +++ b/src/sam_edit.zig @@ -1102,7 +1102,7 @@ fn expectEdit(text: []const u8, command: []const u8, want: []const u8) !void { test "an x over 100k lines is 100k searches, each with its own step budget" { const th = @import("ninep/testing.zig"); - const line = "x" ** 80 ++ "\n"; + const line = &@as([80]u8, @splat('x')) ++ "\n"; const text = try std.testing.allocator.alloc(u8, line.len * 100_000); defer std.testing.allocator.free(text); for (0..100_000) |k| @memcpy(text[line.len * k ..][0..line.len], line); diff --git a/src/syntax.zig b/src/syntax.zig index b2f5ea99..fa212ca7 100644 --- a/src/syntax.zig +++ b/src/syntax.zig @@ -1859,7 +1859,7 @@ test "syntax declaration locations clear snapshots without muting ordinary conte defer stop(); const header = "pub fn run() void {"; const content = "| \t" ++ header ++ "\n| \t const value = 42;\nfile.zig:3\t}\n"; - const snapshots = [_]u8{0xff} ** header.len; + const snapshots = @as([header.len]u8, @splat(0xff)); const Row = struct { path: []const u8 = "file.zig", code_start: usize, diff --git a/src/terminal.zig b/src/terminal.zig index 3190c6e3..a8e7931c 100644 --- a/src/terminal.zig +++ b/src/terminal.zig @@ -207,7 +207,7 @@ const LivePalette = struct { var seed = GColor.default; for (base, 0..) |rgb, i| seed[i] = rgb; - self.colors = GColor.generate256Color(seed, .initEmpty(), bg, fg, false); + self.colors = GColor.generate256Color(seed, .empty, bg, fg, false); self.key = key; return &self.colors; } @@ -609,10 +609,10 @@ pub fn create(gpa: std.mem.Allocator, cols: u16, rows: u16) !*Pane { state.vt = try ghostty_vt.Terminal.init(terminalIo(), gpa, .{ .cols = cols, .rows = rows, - .max_scrollback = 16 * 1024 * 1024, + .max_scrollback_bytes = 16 * 1024 * 1024, .kitty_image_storage_limit = if (images_enabled) TerminalImages.storage_limit else 0, }); - state.stream = .initAlloc(gpa, .{ .inner = state.vt.vtHandler() }); + state.stream = .init(.{ .handler = .{ .inner = state.vt.vtHandler() }, .allocator = gpa }); state.replay.head = 0; state.replay.len = 0; state.reply_len = 0; @@ -1055,7 +1055,11 @@ fn ingestWithPositions(pane: *Pane, bytes: []const u8) void { } }; } else failed = true; + // Whether the program cleared the screen (ED 2, a switch of screens); + // pardes reads the flag nowhere else. + pane.terminal.?.vt.flags.dirty.clear = false; ingest(pane, bytes); + const cleared = pane.terminal.?.vt.flags.dirty.clear; // RIS can destroy the alternate screen and every pin it owned. const alive = if (screens.generation(key) == generation) pages else null; var moved = false; @@ -1065,7 +1069,15 @@ fn ingestWithPositions(pane: *Pane, bytes: []const u8) void { if (pin.garbage) pointer_rows_lost = true; }; }; + // The program cleared the screen, or the rows the live copy stood on are + // gone (pruned, a reset): the copy goes with them, as what the program + // drew next. Kept, ghostty would move its rows to the top of what is + // left, over the program's new text. + var copy_lost = cleared or alive == null; for (spans[0..nspans]) |span| { + if (span.overlay == overlay) if (span.start.pin) |pin| if (alive != null and pin.garbage) { + copy_lost = true; + }; const start = pinnedRow(alive, span.start); const rows = @max(1, pinnedRow(alive, span.end) -| start +| 1); moved = moved or start != span.overlay.row or rows != span.overlay.rows; @@ -1096,6 +1108,11 @@ fn ingestWithPositions(pane: *Pane, bytes: []const u8) void { pane.clearPointerSelection(button); pane.sel[button].state = .none; }; + if (copy_lost) if (pane.ovl) |copy| { + pane.gpa.free(copy.text); + pane.ovl = null; + moved = true; + }; if (moved) pane.nsel_snap = 0; // Saved regex-preview offsets name the old flat text. if (failed) { const message = "terminal edit position reset: out of memory"; @@ -1211,7 +1228,7 @@ pub fn commandOutput(pane: *Pane, gpa: std.mem.Allocator, max_rows: usize) !Comm .whole = whole, }; } else true; - return .{ .text = try gpa.dupeZ(u8, ""), .whole = whole }; + return .{ .text = try gpa.dupeSentinel(u8, "", 0), .whole = whole }; } /// At a prompt with nothing typed on its line: no input left of the @@ -2813,7 +2830,7 @@ pub fn redo(p: *Pardes, pane: *Pane) void { pane.ensureCursorVisible(); } -pub fn ptyReport(handler: *ghostty_vt.TerminalStream.Handler, data: [:0]const u8) void { +pub fn ptyReport(handler: *ghostty_vt.TerminalStream.Handler, data: []const u8) void { const state: *State = @alignCast(@fieldParentPtr("vt", handler.terminal)); const room = state.reply.len - state.reply_len; const n = @min(room, data.len); @@ -2968,7 +2985,8 @@ test "a program that asked for focus reports hears CSI I and CSI O as its pane t /// over two cells). inline fn kittyTransmit(comptime extra: []const u8) []const u8 { return comptime blk: { - const pixels = [_]u8{ 255, 0, 0, 255, 0, 0, 0, 0, 255, 0, 0, 255 } ** 2; + const row = [_]u8{ 255, 0, 0, 255, 0, 0, 0, 0, 255, 0, 0, 255 }; + const pixels = row ++ row; var buf: [std.base64.standard.Encoder.calcSize(pixels.len)]u8 = undefined; const b64 = std.base64.standard.Encoder.encode(&buf, &pixels)[0..buf.len].*; break :blk "\x1b_Ga=T,f=24,s=4,v=2,i=7," ++ extra ++ ";" ++ b64 ++ "\x1b\\"; diff --git a/src/tty/tty.zig b/src/tty/tty.zig index ca2cb939..82cb40bd 100644 --- a/src/tty/tty.zig +++ b/src/tty/tty.zig @@ -129,7 +129,7 @@ fn readInput(loop: *Loop, tty: anytype, cache: *vaxis.GraphemeCache) !void { var parser: vaxis.Parser = .{}; var buf: [1024]u8 = undefined; var carried: usize = 0; - while (!loop.should_quit) { + while (true) { // stopInput cancels the task; the read then fails with Canceled if (carried == buf.len) return error.InputSequenceTooLong; const received = try tty.read(buf[carried..]); if (received == 0) return; @@ -295,7 +295,7 @@ test "terminal input preserves fragmented keys queries paste and text after EOF" fn getWinsize(_: *@This()) !vaxis.Winsize { return .{ .rows = 24, .cols = 80, .x_pixel = 0, .y_pixel = 0 }; } - fn inputFollows(self: *@This(), _: u32) bool { + pub fn inputFollows(self: *@This(), _: u32) bool { return self.next < self.parts.len; } fn read(self: *@This(), buf: []u8) !usize { @@ -380,7 +380,7 @@ test "terminal replies and malformed sequences never become typed text" { fn getWinsize(_: *@This()) !vaxis.Winsize { return .{ .rows = 24, .cols = 80, .x_pixel = 0, .y_pixel = 0 }; } - fn inputFollows(self: *@This(), _: u32) bool { + pub fn inputFollows(self: *@This(), _: u32) bool { return self.next < self.parts.len; } fn read(self: *@This(), buf: []u8) !usize { @@ -465,7 +465,7 @@ test "terminal input split at every byte with a gap reads as it does whole" { fn getWinsize(_: *@This()) !vaxis.Winsize { return .{ .rows = 24, .cols = 80, .x_pixel = 0, .y_pixel = 0 }; } - fn inputFollows(self: *@This(), ms: u32) bool { + pub fn inputFollows(self: *@This(), ms: u32) bool { return self.next < self.parts.len and self.gap_ms <= ms; } fn read(self: *@This(), buf: []u8) !usize { @@ -561,7 +561,7 @@ test "an ESC read by itself is the Escape key at once" { fn getWinsize(_: *@This()) !vaxis.Winsize { return .{ .rows = 24, .cols = 80, .x_pixel = 0, .y_pixel = 0 }; } - fn inputFollows(self: *@This(), _: u32) bool { + pub fn inputFollows(self: *@This(), _: u32) bool { self.asked = true; return self.next < self.parts.len; } @@ -609,7 +609,7 @@ test "a frame's answer is taken wherever the reads cut it, and never typed" { fn getWinsize(_: *@This()) !vaxis.Winsize { return .{ .rows = 24, .cols = 80, .x_pixel = 0, .y_pixel = 0 }; } - fn inputFollows(self: *@This(), _: u32) bool { + pub fn inputFollows(self: *@This(), _: u32) bool { return self.next < self.parts.len; } fn read(self: *@This(), buf: []u8) !usize { @@ -701,7 +701,7 @@ test "terminal input cancellation joins blocked reads and queued EOF" { fn getWinsize(_: *@This()) !vaxis.Winsize { return .{ .rows = 24, .cols = 80, .x_pixel = 0, .y_pixel = 0 }; } - fn inputFollows(_: *@This(), _: u32) bool { + pub fn inputFollows(_: *@This(), _: u32) bool { return false; } fn read(self: *@This(), buf: []u8) !usize { @@ -2332,7 +2332,7 @@ test "a terminal pane gets function keys as their sequences and lone modifiers n fn getWinsize(_: *@This()) !vaxis.Winsize { return .{ .rows = 24, .cols = 80, .x_pixel = 0, .y_pixel = 0 }; } - fn inputFollows(self: *@This(), _: u32) bool { + pub fn inputFollows(self: *@This(), _: u32) bool { return self.next < self.parts.len; } fn read(self: *@This(), buf: []u8) !usize { @@ -3033,7 +3033,7 @@ test "a jump leaves a trail of a few cells behind the cursor that fades in 120 m const gpa = std.testing.allocator; const core = try pardes.Pardes.init(gpa, .{ .tty_only = true, .cols = 80, .rows = 24 }); defer core.deinit(); - _ = try core.setTestFile("some text on a line\n" ** 20); + _ = try core.setTestFile(std.mem.asBytes(&@as([20][20]u8, @splat("some text on a line\n".*)))); try std.testing.expect(core.executeBuiltinLine(0, "Theme forge")); core.settings.jump_trail = true; for (0..40) |_| core.update(.tick); @@ -3078,7 +3078,7 @@ test "a notice chip casts a cell's shadow right and down, inside its body, off t const gpa = std.testing.allocator; const core = try pardes.Pardes.init(gpa, .{ .tty_only = true, .cols = 80, .rows = 24 }); defer core.deinit(); - _ = try core.setTestFile("some text on a line\n" ** 20); + _ = try core.setTestFile(std.mem.asBytes(&@as([20][20]u8, @splat("some text on a line\n".*)))); try std.testing.expect(core.executeBuiltinLine(0, "Theme forge")); core.settings.chip_shadow = true; try std.testing.expect(core.executeBuiltinLine(0, "Msg a notice")); @@ -3114,7 +3114,7 @@ test "a scrolled pane's thumb brightens and fades back in 250 ms" { const gpa = std.testing.allocator; const core = try pardes.Pardes.init(gpa, .{ .tty_only = true, .cols = 80, .rows = 24 }); defer core.deinit(); - const pane = try core.setTestFile("some text on a line\n" ** 200); + const pane = try core.setTestFile(std.mem.asBytes(&@as([200][20]u8, @splat("some text on a line\n".*)))); try std.testing.expect(core.executeBuiltinLine(0, "Theme forge")); core.settings.thumb_flash = true; for (0..40) |_| core.update(.tick); diff --git a/test/deck/replay.zig b/test/deck/replay.zig index 475f7476..49614b46 100644 --- a/test/deck/replay.zig +++ b/test/deck/replay.zig @@ -20,8 +20,9 @@ const Tally = struct { fn replay(src: [:0]const u8) !Tally { const gpa = std.testing.allocator; - const rec = try schema.parse(gpa, src); - defer schema.free(gpa, rec); + var arena: std.heap.ArenaAllocator = .init(gpa); + defer arena.deinit(); + const rec = try schema.parse(gpa, arena.allocator(), src); var d: deck.Deck = .{}; var tally: Tally = .{}; for (rec.events) |ev| { diff --git a/test/deck/schema.zig b/test/deck/schema.zig index 782c829a..401e15e8 100644 --- a/test/deck/schema.zig +++ b/test/deck/schema.zig @@ -61,10 +61,8 @@ pub const Event = struct { }; }; -pub fn parse(gpa: std.mem.Allocator, src: [:0]const u8) error{ OutOfMemory, ParseZon }!Recording { - return std.zon.parse.fromSliceAlloc(Recording, gpa, src, null, .{}); -} - -pub fn free(gpa: std.mem.Allocator, rec: Recording) void { - std.zon.parse.free(gpa, rec); +/// The recording's slices live in `arena`. +pub fn parse(gpa: std.mem.Allocator, arena: std.mem.Allocator, src: [:0]const u8) error{ OutOfMemory, ParseZon }!Recording { + var diagnostics: std.zon.parse.Diagnostics = undefined; + return std.zon.parse.fromSlice(Recording, .{ .gpa = gpa, .arena = arena, .source = src, .diagnostics = &diagnostics }); } diff --git a/test/e2e_harness.zig b/test/e2e_harness.zig index 9e67c49f..a2010c19 100644 --- a/test/e2e_harness.zig +++ b/test/e2e_harness.zig @@ -104,7 +104,7 @@ pub const Harness = struct { term.* = try ghostty_vt.Terminal.init(std.Io.Threaded.global_single_threaded.io(), gpa, .{ .cols = cols, .rows = rows, - .max_scrollback = 1024 * 1024, + .max_scrollback_bytes = 1024 * 1024, }); errdefer term.deinit(gpa); // vtStream() captures a pointer to `term`; term is heap-allocated so the diff --git a/test/fs_bench.zig b/test/fs_bench.zig index 746fe737..4764049f 100644 --- a/test/fs_bench.zig +++ b/test/fs_bench.zig @@ -272,7 +272,7 @@ pub fn main(init: std.process.Init) !void { .tag = 9, .op = .write, .node = s.node(.body), - .data = "x" ** 1024, + .data = &@as([1024]u8, @splat('x')), .size = 1024, }, "append: whole-body swap + undo snapshot"); @@ -327,7 +327,7 @@ pub fn main(init: std.process.Init) !void { try w.writeAll("]}\n"); } else { try w.print("{s:<26} {s:>9} {s:>8} {s}\n", .{ "request", "ns/op", "allocs", "note" }); - try w.print("{s:<26} {s:>9} {s:>8} {s}\n", .{ "-" ** 26, "-" ** 9, "-" ** 8, "-" ** 20 }); + try w.print("{s:<26} {s:>9} {s:>8} {s}\n", .{ &@as([26]u8, @splat('-')), &@as([9]u8, @splat('-')), &@as([8]u8, @splat('-')), &@as([20]u8, @splat('-')) }); for (rows.items) |r| try w.print("{s:<26} {d:>9} {d:>8} {s}\n", .{ r.name, r.ns, r.allocs, r.note }); } diff --git a/test/history.zig b/test/history.zig index 5ce45239..d399f7aa 100644 --- a/test/history.zig +++ b/test/history.zig @@ -432,24 +432,24 @@ test "history benchmark cases are nonempty unique and matched by name" { try std.testing.expectError(error.MissingField, readBenchmarks(arena, "{\"case\":\"first\"}")); const before = try readBenchmarks(arena, benchmark_fixture); const missing = try readBenchmarks(arena, "{\"case\":\"first\",\"bytes\":10,\"median_ns\":100,\"cold_ns\":100,\"allocations\":10,\"allocated_bytes\":1000}"); - try std.testing.expectError(error.DifferentBenchmarks, compareBenchmarks(.{before} ** 4, .{missing} ** 4, null, &report.writer)); + try std.testing.expectError(error.DifferentBenchmarks, compareBenchmarks(@splat(before), @splat(missing), null, &report.writer)); const renamed = \\{"case":"first","bytes":10,"median_ns":100,"cold_ns":100,"allocations":10,"allocated_bytes":1000} \\{"case":"renamed","bytes":20,"median_ns":100,"cold_ns":100,"allocations":10,"allocated_bytes":1000} ; const different = try readBenchmarks(arena, renamed); - try std.testing.expectError(error.DifferentBenchmarks, compareBenchmarks(.{before} ** 4, .{different} ** 4, null, &report.writer)); + try std.testing.expectError(error.DifferentBenchmarks, compareBenchmarks(@splat(before), @splat(different), null, &report.writer)); const reordered = \\{"case":"last","bytes":20,"median_ns":100,"cold_ns":100,"allocations":10,"allocated_bytes":1000} \\{"case":"first","bytes":10,"median_ns":100,"cold_ns":100,"allocations":10,"allocated_bytes":1000} ; const same = try readBenchmarks(arena, reordered); - try std.testing.expect(!try compareBenchmarks(.{before} ** 4, .{same} ** 4, 1, &report.writer)); + try std.testing.expect(!try compareBenchmarks(@splat(before), @splat(same), 1, &report.writer)); var samples = [4][]Benchmark{ before, before, before, different }; - try std.testing.expectError(error.DifferentBenchmarks, compareBenchmarks(.{before} ** 4, samples, null, &report.writer)); + try std.testing.expectError(error.DifferentBenchmarks, compareBenchmarks(@splat(before), samples, null, &report.writer)); samples[3] = try arena.dupe(Benchmark, before); samples[3][0].bytes += 1; - try std.testing.expectError(error.DifferentBenchmarkInputs, compareBenchmarks(.{before} ** 4, samples, null, &report.writer)); + try std.testing.expectError(error.DifferentBenchmarkInputs, compareBenchmarks(@splat(before), samples, null, &report.writer)); } test "history benchmark gate uses repeated process captures rather than the first process alone" { diff --git a/test/hxdiff.zig b/test/hxdiff.zig index 48c7ab93..b12bcd8e 100644 --- a/test/hxdiff.zig +++ b/test/hxdiff.zig @@ -39,7 +39,7 @@ pub fn main(init: std.process.Init) !void { var pane_override: ?[]const u8 = null; var goldens_path: ?[]const u8 = null; var waivers_path: ?[]const u8 = null; - const paths = try arena.alloc([]const u8, args.len - 1); + const paths = try arena.alloc([]const u8, @max(args.len - 1, 3)); // room for the defaults below var n_paths: usize = 0; var want_waivers = false; for (args[1..]) |a| { @@ -67,6 +67,18 @@ pub fn main(init: std.process.Init) !void { n_paths += 1; } } + // Named nothing (`zig build hxdiff` or `hxparity` bare): the checked-in + // suite, run from the repository root. + if (n_paths == 0 and !want_waivers) { + strict = true; + const defaults: []const []const u8 = if (parity) + &.{ "test/hxcases/cases.jsonl", "test/hxcases/parity.jsonl" } + else + &.{ "test/hxcases/cases.jsonl", "test/hxcases/goldens.jsonl", "test/hxcases/waivers.jsonl" }; + if (parity) waivers_path = waivers_path orelse "test/hxcases/parity-waivers.jsonl"; + @memcpy(paths[0..defaults.len], defaults); + n_paths = defaults.len; + } if (n_paths == 0 or want_waivers) fatal("usage: pardes-hxdiff [--parity] ... [goldens.jsonl [waivers.jsonl]]", .{}); const case_paths = paths[0..if (parity) n_paths else 1]; diff --git a/test/image_harness.zig b/test/image_harness.zig index 474ec48b..b45851cc 100644 --- a/test/image_harness.zig +++ b/test/image_harness.zig @@ -38,7 +38,7 @@ pub fn main(init: std.process.Init) !void { const args = try init.minimal.args.toSlice(arena); if (args.len != 3 and args.len != 4) return error.BadArgs; - const exe = try arena.dupeZ(u8, args[1]); + const exe = try arena.dupeSentinel(u8, args[1], 0); const backend = args[2]; const pdf_mode = args.len == 4 and std.mem.eql(u8, args[3], "pdf"); if (args.len == 4 and !pdf_mode) return error.BadArgs; diff --git a/test/lspbench.zig b/test/lspbench.zig index 02138d24..d0e25aee 100644 --- a/test/lspbench.zig +++ b/test/lspbench.zig @@ -216,7 +216,7 @@ fn reportText(rs: []const Result, rss: u64) void { const o = std.debug.print; o("backend: {s}\n\n", .{lsp.backend_name}); o("{s:<24} {s:>9} {s:>7} {s:>10} {s:>10} {s}\n", .{ "kind", "supports", "rows", "cold(us)", "warm(us)", "verdict" }); - o("{s}\n", .{"-" ** 78}); + o("{s}\n", .{&@as([78]u8, @splat('-'))}); var claimed: usize = 0; var working: usize = 0; var lies: usize = 0; diff --git a/test/monkey.zig b/test/monkey.zig index 83869ce4..dcea0b43 100644 --- a/test/monkey.zig +++ b/test/monkey.zig @@ -44,7 +44,7 @@ fn generate(gpa: std.mem.Allocator, seed: u64, steps: usize) ![]u8 { var s: Script = .{ .gpa = gpa }; try s.line("# pardes-monkey seed {d}, {d} steps", .{ seed, steps }); try s.line("file bad.txt hello \\xff\\xfe world\\nlatin-1 caf\\xe9 tail\\ntruncated \\xe6\\x97 here\\nend\\n", .{}); - try s.line("file wide.txt {s}tail\\nsecond line\\n", .{"\\xe6\\x97\\xa5\\xe6\\x9c\\xac\\xe8\\xaa\\x9e " ** 8}); + try s.line("file wide.txt {s}tail\\nsecond line\\n", .{std.mem.asBytes(&@as([8][37]u8, @splat("\\xe6\\x97\\xa5\\xe6\\x9c\\xac\\xe8\\xaa\\x9e ".*)))}); try s.line("lines long.txt 400 some words after the number, long enough to wrap in a narrow pane", .{}); try s.line("start 24 80 bad.txt", .{}); try s.line("wait 8000 Newcol Joincol", .{}); diff --git a/test/panes.zig b/test/panes.zig index 86e52838..54100f91 100644 --- a/test/panes.zig +++ b/test/panes.zig @@ -42,7 +42,7 @@ const TagLayerTests = struct { p.row_metrics = .{ .body_w = 10, .body_h = 20, .tagline_w = 5, .tagline_h = 10 }; p.gpa.free(pane.file.?.path); pane.file.?.path = try p.gpa.dupe(u8, "/x"); - try setTag(pane, " " ++ "a" ** 38 ++ "\t界 END"); + try setTag(pane, " " ++ &@as([38]u8, @splat('a')) ++ "\t界 END"); var frame = std.heap.ArenaAllocator.init(p.gpa); defer frame.deinit(); _ = try p.render(frame.allocator()); @@ -135,7 +135,7 @@ const TagLayerTests = struct { try std.testing.expectEqual(@as(i32, 0), p.panes[second].?.input.cur_col); p.update(.{ .key = .{ .cp = Key.escape } }); const left = p.panes[0].?; - try setTag(left, " " ++ "a" ** 110); + try setTag(left, " " ++ &@as([110]u8, @splat('a'))); _ = try p.render(frame.allocator()); const left_layer = try findLayer(p, .pane, 0); const left_text = try pardes.tagline.tagText(p, frame.allocator(), left); @@ -149,7 +149,7 @@ const TagLayerTests = struct { try std.testing.expectEqual(panes.File.rawAtDisplay(left_text, end_col), @as(usize, @intCast(left.tag.cur_col))); try std.testing.expect(left.sel[0].state == .done and left.sel[0].r0 == 0); p.update(.{ .key = .{ .cp = Key.escape } }); - const long = "a" ** 60 ++ "界END"; + const long = &@as([60]u8, @splat('a')) ++ "界END"; p.global_tag.own = try p.gpa.dupe(u8, long); for (p.col_tags[0..p.ncol]) |*tag| tag.own = try p.gpa.dupe(u8, long); _ = try p.render(frame.allocator()); @@ -581,7 +581,7 @@ const BodyHitTests = struct { const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 64, .rows = 18 }); defer p.deinit(); p.row_metrics = .{ .body_w = 10, .body_h = 20, .tagline_w = 8, .tagline_h = 10 }; - const pane = try TreeContextTests.setZigFile(p, "const Box = struct {\n pub fn work(\n value: usize,\n ) void {\n" ++ " // body\n" ** 60 ++ " }\n};\n"); + const pane = try TreeContextTests.setZigFile(p, "const Box = struct {\n pub fn work(\n value: usize,\n ) void {\n" ++ std.mem.asBytes(&@as([60][16]u8, @splat(" // body\n".*))) ++ " }\n};\n"); try std.testing.expect(p.executeBuiltinLine(0, "TreeContext")); pane.scrollBy(10); var frame = std.heap.ArenaAllocator.init(p.gpa); @@ -629,7 +629,7 @@ const LineNumberLookTests = struct { const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 64, .rows = 18 }); defer p.deinit(); p.row_metrics = .{ .body_w = 10, .body_h = 20, .tagline_w = 8, .tagline_h = 10 }; - const pane = try TreeContextTests.setZigFile(p, "const Box = struct {\n pub fn work(\n value: usize,\n ) void {\n" ++ " // body\n" ** 60 ++ " }\n};\n"); + const pane = try TreeContextTests.setZigFile(p, "const Box = struct {\n pub fn work(\n value: usize,\n ) void {\n" ++ std.mem.asBytes(&@as([60][16]u8, @splat(" // body\n".*))) ++ " }\n};\n"); try std.testing.expect(p.executeBuiltinLine(0, "TreeContext")); pane.scrollBy(30); var frame = std.heap.ArenaAllocator.init(p.gpa); @@ -686,7 +686,7 @@ const TreeContextTests = struct { if (!syntax.enabled) return error.SkipZigTest; const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 64, .rows = 18 }); defer p.deinit(); - const pane = try setZigFile(p, "const Box = struct {\n\n // omitted member comment\n\n pub fn work(\n value: usize,\n ) void {\n" ++ " // body\n" ** 30 ++ " }\n};\n"); + const pane = try setZigFile(p, "const Box = struct {\n\n // omitted member comment\n\n pub fn work(\n value: usize,\n ) void {\n" ++ std.mem.asBytes(&@as([30][16]u8, @splat(" // body\n".*))) ++ " }\n};\n"); p.row_metrics = .{ .body_w = 10, .body_h = 20, .tagline_w = 8, .tagline_h = 10 }; try std.testing.expect(p.executeBuiltinLine(0, "TreeContext")); pane.scrollBy(10); @@ -717,7 +717,7 @@ const TreeContextTests = struct { if (context and !syntax.enabled) continue; const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 64, .rows = 18 }); defer p.deinit(); - const pane = try setZigFile(p, "pub fn work() void {\n" ++ " // body\n" ** 100 ++ "}\n"); + const pane = try setZigFile(p, "pub fn work() void {\n" ++ std.mem.asBytes(&@as([100][12]u8, @splat(" // body\n".*))) ++ "}\n"); if (context) try std.testing.expect(p.executeBuiltinLine(0, "TreeContext")); var frame = std.heap.ArenaAllocator.init(p.gpa); defer frame.deinit(); @@ -792,7 +792,7 @@ const TreeContextTests = struct { if (!syntax.enabled) return error.SkipZigTest; const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 48, .rows = 14 }); defer p.deinit(); - const pane = try setZigFile(p, "pub fn @\"界name\"(\n\tvalue: usize,\n) void {\n" ++ " _ = value;\n" ** 12 ++ "}\n"); + const pane = try setZigFile(p, "pub fn @\"界name\"(\n\tvalue: usize,\n) void {\n" ++ std.mem.asBytes(&@as([12][15]u8, @splat(" _ = value;\n".*))) ++ "}\n"); pane.tag_expanded = false; // a one-row tag keeps this small screen's rows p.sync(); p.settings.wrap = false; @@ -820,7 +820,7 @@ const TreeContextTests = struct { // Read the body top again: the click cleared the announcement band the // builtin above put up, so the body moved with it. try std.testing.expectEqual(p.bodyTop(pane, p.rects[0]), cursor.y); - panes.File.setContent(p, &pane.file.?, try p.gpa.dupe(u8, "// no enclosing declaration\n" ** 18)); + panes.File.setContent(p, &pane.file.?, try p.gpa.dupe(u8, std.mem.asBytes(&@as([18][28]u8, @splat("// no enclosing declaration\n".*))))); _ = try p.render(frame.allocator()); try std.testing.expectEqual(@as(u16, 0), pane.context_rows); try std.testing.expectEqual(pane.scroll(), pane.wrapAt(0).line); @@ -942,7 +942,7 @@ const TtySelectionTests = struct { try noChildInput(p); _ = try p.render(frame.allocator()); try std.testing.expectEqualStrings(expected, pardes.test_api.heldSelection(p, 0).?); - p.update(.{ .output = .{ .pane = 0, .bytes = "\x1b]133;C\x07" ++ "\r\nnew output" ** 30 } }); + p.update(.{ .output = .{ .pane = 0, .bytes = "\x1b]133;C\x07" ++ std.mem.asBytes(&@as([30][12]u8, @splat("\r\nnew output".*))) } }); _ = try p.render(frame.allocator()); try std.testing.expectEqual(panes.Text.Mode.tty, pane.body.mode); try std.testing.expectEqualStrings(expected, pardes.test_api.heldSelection(p, 0).?); @@ -1266,7 +1266,7 @@ const ClickCursorTests = struct { test "click operands and hover follow the scrolled source selection" { const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 40, .rows = 14 }); defer p.deinit(); - const pane = try p.setTestFile("zero\none\ntwo\nthree\nalpha beta\nfive\ngamma delta\nseven\n" ++ "tail\n" ** 20); + const pane = try p.setTestFile("zero\none\ntwo\nthree\nalpha beta\nfive\ngamma delta\nseven\n" ++ std.mem.asBytes(&@as([20][5]u8, @splat("tail\n".*)))); p.presentation.enabled = false; p.settings.wrap = false; var frame = std.heap.ArenaAllocator.init(p.gpa); @@ -1323,7 +1323,7 @@ const JumpSelectionTests = struct { const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 34, .rows = 10 }); defer p.deinit(); p.settings.wrap = wrap; - const text = try std.fmt.allocPrint(p.gpa, "{s}{s}", .{ prefix, "unrelated destination text\n" ** 80 }); + const text = try std.fmt.allocPrint(p.gpa, "{s}{s}", .{ prefix, std.mem.asBytes(&@as([80][27]u8, @splat("unrelated destination text\n".*))) }); defer p.gpa.free(text); const pane = try p.setTestFile(text); var frame = std.heap.ArenaAllocator.init(p.gpa); @@ -1813,7 +1813,7 @@ test "a word the tag's wrapping breaks across rows is still one word to a click" var pad: usize = 1; const shown = while (pad < 80) : (pad += 1) { p.gpa.free(pane.file.?.path); - const path = try std.fmt.allocPrint(arena.allocator(), "/{s}/f.zig", .{("a" ** 80)[0..pad]}); + const path = try std.fmt.allocPrint(arena.allocator(), "/{s}/f.zig", .{(&@as([80]u8, @splat('a')))[0..pad]}); pane.file.?.path = try p.gpa.dupe(u8, path); p.sync(); const s = try pardes.tagline.shownTag(p, arena.allocator(), pane); @@ -1866,7 +1866,7 @@ test "terminal output keeps following new rows after scrollback eviction" { pane.body.mode = .tty; pane.tty_filter = false; const pages = &pane.terminal.?.vt.screens.active.pages; - pages.explicit_max_size = 64 * 1024; + pages.limits.set(.bytes, 64 * 1024); var frame = std.heap.ArenaAllocator.init(gpa); defer frame.deinit(); var evictions: usize = 0; @@ -1885,7 +1885,7 @@ test "terminal output keeps following new rows after scrollback eviction" { if (pages.scrollbar().total < previous) evictions += 1; } try std.testing.expect(evictions > phase); - try std.testing.expect(pages.page_size <= pages.maxSize()); + try std.testing.expect(pages.page_size <= pages.limits.max(.bytes)); const sb = pages.scrollbar(); try std.testing.expectEqual(sb.total - pane.rows, sb.offset); const full = try panes.terminal.screenTextAlloc(pane, gpa); @@ -1926,7 +1926,7 @@ test "terminal edit stays on its surviving row when old scrollback is evicted" { const pane = p.panes[0].?; pane.body.mode = .tty; const pages = &pane.terminal.?.vt.screens.active.pages; - pages.explicit_max_size = 64 * 1024; + pages.limits.set(.bytes, 64 * 1024); var next: usize = 0; while (next < 3000) { var buf: [32]u8 = undefined; @@ -1977,9 +1977,9 @@ test "terminal edits and undo survive partial history clearing and whole-screen pane.body.mode = .tty; if (action == .reset_alternate) p.update(.{ .output = .{ .pane = 0, .bytes = "\x1b[?1049h" } }); - p.update(.{ .output = .{ .pane = 0, .bytes = "old row\r\n" ** 40 } }); + p.update(.{ .output = .{ .pane = 0, .bytes = std.mem.asBytes(&@as([40][9]u8, @splat("old row\r\n".*))) } }); const pages = &pane.terminal.?.vt.screens.active.pages; - pages.explicit_max_size = 64 * 1024; + pages.limits.set(.bytes, 64 * 1024); const row: i32 = @as(i32, @intCast(pages.total_rows - pane.rows)) + @as(i32, if (action == .partial_clear_history) -1 else 2); pane.body.mode = .normal; @@ -2005,7 +2005,7 @@ test "terminal edits and undo survive partial history clearing and whole-screen const bytes = switch (action) { .clear_history, .partial_clear_history => "\x1b[3J", .reset_primary, .reset_alternate => "\x1bc", - .evict_all, .hidden_undo => "new row\r\n" ** 4000, + .evict_all, .hidden_undo => std.mem.asBytes(&@as([4000][9]u8, @splat("new row\r\n".*))), }; p.update(.{ .output = .{ .pane = 0, .bytes = bytes } }); const expected: i32 = if (action == .clear_history) 2 else 0; @@ -2045,7 +2045,7 @@ test "terminal lower scroll regions do not move edits above them" { var setup: [64]u8 = undefined; const bytes = try std.fmt.bufPrint(&setup, "\x1b[4;{d}r\x1b[{d};1H", .{ pane.rows, pane.rows }); p.update(.{ .output = .{ .pane = 0, .bytes = bytes } }); - p.update(.{ .output = .{ .pane = 0, .bytes = "tail\r\n" ** 50 } }); + p.update(.{ .output = .{ .pane = 0, .bytes = std.mem.asBytes(&@as([50][6]u8, @splat("tail\r\n".*))) } }); try std.testing.expectEqual(total, panes.terminal.scrollbar(pane).total); try std.testing.expectEqual(@as(i32, 1), pane.ovl.?.row); try std.testing.expectEqual(@as(i32, 1), pane.body.cur_row); @@ -2064,7 +2064,7 @@ test "terminal eviction and lower-region scrolling in one read preserve a surviv const pane = p.panes[0].?; pane.body.mode = .tty; const pages = &pane.terminal.?.vt.screens.active.pages; - pages.explicit_max_size = 64 * 1024; + pages.limits.set(.bytes, 64 * 1024); var next: usize = 0; while (next < 3000) { var buf: [32]u8 = undefined; @@ -2229,7 +2229,7 @@ test "prompt cancellation restores the selection before regex previews" { } test "a prompt that cannot be opened leaves the open one as it was" { - const Request = @typeInfo(@TypeOf(Pardes.startPrompt)).@"fn".params[3].type.?; + const Request = @typeInfo(@TypeOf(Pardes.startPrompt)).@"fn".param_types[3].?; for ([_]Request{ .{ .search = config.search_marker }, .save, .{ .pipe = .replace }, .{ .pipe = .ignore }, .{ .pipe = .insert }, .{ .pipe = .append } }) |request| { var failing = std.testing.FailingAllocator.init(std.testing.allocator, .{}); const p = try Pardes.init(failing.allocator(), .{ .tty_only = true }); @@ -2268,7 +2268,7 @@ test "Save's prompt starts from the pane's directory" { } test "a prompt opens with one allocation" { - const Request = @typeInfo(@TypeOf(Pardes.startPrompt)).@"fn".params[3].type.?; + const Request = @typeInfo(@TypeOf(Pardes.startPrompt)).@"fn".param_types[3].?; for ([_]Request{ .{ .search = config.search_marker }, .save, .{ .pipe = .replace }, .{ .pipe = .ignore }, .{ .pipe = .insert }, .{ .pipe = .append } }) |request| { var failing = std.testing.FailingAllocator.init(std.testing.allocator, .{}); const p = try Pardes.init(failing.allocator(), .{ .tty_only = true }); @@ -3441,7 +3441,7 @@ const PdfTests = struct { defer probe.deinit(std.testing.allocator); try std.testing.expectEqual(@as(usize, 0), probe.page); try std.testing.expect(probe.quads.len > 0); - try std.testing.expect(std.ascii.indexOfIgnoreCase(probe.text, "Pardes") != null); + try std.testing.expect(std.ascii.findIgnoreCase(probe.text, "Pardes") != null); } test "PDF point mapping restores band origin and fractional placement" { @@ -4812,7 +4812,7 @@ test "growing a file pane colors every newly visible Zig keyword" { const gpa = std.testing.allocator; const p = try Pardes.init(gpa, .{ .tty_only = true, .cols = 80, .rows = 8 }); defer p.deinit(); - const pane = try p.setTestFile("pub fn f() void { if (true) {} }\n" ** 100); + const pane = try p.setTestFile(std.mem.asBytes(&@as([100][33]u8, @splat("pub fn f() void { if (true) {} }\n".*)))); const file = &pane.file.?; gpa.free(file.path); file.path = try gpa.dupe(u8, "/resize.zig"); diff --git a/test/pdf.zig b/test/pdf.zig index a0eb8154..a51fd1a9 100644 --- a/test/pdf.zig +++ b/test/pdf.zig @@ -2080,14 +2080,14 @@ test "PDF native mouse selection, Look, and highlights share page geometry" { @as(i32, r.y + r.h - 1), )); if (!panes.Pdf.beginSelection(p, pane, col, row)) continue; - if (std.ascii.indexOfIgnoreCase(pv.selection_text, "Pardes") != null) { + if (std.ascii.findIgnoreCase(pv.selection_text, "Pardes") != null) { selected_col = col; selected_row = row; break :find_word; } }; const word_col = selected_col orelse return error.PdfMouseMappingMissedWord; - try std.testing.expect(std.ascii.indexOfIgnoreCase( + try std.testing.expect(std.ascii.findIgnoreCase( pardes.test_api.heldSelection(p, 0).?, "Pardes", ) != null); @@ -2142,7 +2142,7 @@ test "PDF native mouse selection, Look, and highlights share page geometry" { const hover = p.pdf_hover_preview orelse return error.MissingPdfHoverPreview; try std.testing.expectEqual(@as(usize, 0), hover.probe.page); try std.testing.expect(hover.probe.quads.len > 0); - try std.testing.expect(std.ascii.indexOfIgnoreCase(hover.probe.text, "Pardes") != null); + try std.testing.expect(std.ascii.findIgnoreCase(hover.probe.text, "Pardes") != null); try std.testing.expect(p.look_hover_preview == null); try std.testing.expect(p.look_hover_wait == null); @@ -2188,7 +2188,7 @@ test "PDF native mouse selection, Look, and highlights share page geometry" { // search highlights without carrying an old selection into the result. p.update(.{ .mouse = .{ .button = config.look_button, .kind = .press, .col = word_col, .row = selected_row } }); p.update(.{ .mouse = .{ .button = config.look_button, .kind = .release, .col = word_col, .row = selected_row } }); - try std.testing.expect(std.ascii.indexOfIgnoreCase(pv.search_query, "Pardes") != null); + try std.testing.expect(std.ascii.findIgnoreCase(pv.search_query, "Pardes") != null); pv.resolveSearch(p.pdf_gpa); const highlights = (try panes.Pdf.buildHighlights( pv, diff --git a/test/pdf_scroll_bench.zig b/test/pdf_scroll_bench.zig index 166fa809..fdc42660 100644 --- a/test/pdf_scroll_bench.zig +++ b/test/pdf_scroll_bench.zig @@ -597,7 +597,7 @@ fn reportText(config: Config, travel: Travel, results: []const Result) void { "total_us", "rasters", "kept", "peak_kib", "visual", "transport", }); - std.debug.print("{s}\n", .{"-" ** 160}); + std.debug.print("{s}\n", .{&@as([160]u8, @splat('-'))}); for (results) |result| std.debug.print( "{s:<16} {d:>6} {d:>7} {d:>10} {d:>10} {d:>10} {d:>10} {d:>10} {d:>11} {d:>7} {d:>5} {d:>9} {x:0>16} {x:0>16}\n", .{ diff --git a/test/pdf_sections_bench.zig b/test/pdf_sections_bench.zig index 92c9ef7c..ee26e83d 100644 --- a/test/pdf_sections_bench.zig +++ b/test/pdf_sections_bench.zig @@ -454,7 +454,7 @@ fn reportText(config: Config, results: []const Result) void { std.debug.print("{s:<42} {s:>10} {s:>10} {s:>10} {s:>10} {s:>8} {s:>8} {s}\n", .{ "scenario", "min", "median", "p90", "max", "items", "bytes", "checksum", }); - std.debug.print("{s}\n", .{"-" ** 124}); + std.debug.print("{s}\n", .{&@as([124]u8, @splat('-'))}); for (results) |result| std.debug.print( "{s:<42} {d:>10} {d:>10} {d:>10} {d:>10} {d:>8} {d:>8} {x:0>16}\n", .{ diff --git a/test/perf-baseline-gui-Debug.json b/test/perf-baseline-gui-Debug.json deleted file mode 100644 index 39f5913c..00000000 --- a/test/perf-baseline-gui-Debug.json +++ /dev/null @@ -1 +0,0 @@ -{"harness":"303736f83a625e87","build":{"compiler":"0.16.0","target":"x86_64-linux.5.10...6.19-gnu.2.38","cpu":"x86_64","driver_optimize":"ReleaseFast","core_optimize":"Debug","c_optimize":"ReleaseFast","terminal_optimize":"ReleaseSafe","platform":"gui","grammars":"full","mupdf":true,"jpx":true,"tracy":false,"quic":false,"theme_animation":true,"terminal_simd":true,"prebuilt_shaders":false},"cols":120,"rows":40,"reps":10,"only":"medium","fixtures":[{"name":"small","lines":1000,"cols":60,"bytes":62694},{"name":"medium","lines":50000,"cols":60,"bytes":3201944},{"name":"large","lines":300000,"cols":60,"bytes":19464444},{"name":"longline","lines":400,"cols":8000,"bytes":3200400},{"name":"esp32p4","lines":12,"cols":240,"bytes":2892}],"cells":[{"op":"open","fixture":"medium","min_us":1818,"med_us":2104,"p90_us":2287,"max_us":2293},{"op":"render","fixture":"medium","min_us":78,"med_us":82,"p90_us":87,"max_us":87},{"op":"key-down","fixture":"medium","min_us":79,"med_us":81,"p90_us":89,"max_us":109},{"op":"key-right","fixture":"medium","min_us":79,"med_us":84,"p90_us":85,"max_us":89},{"op":"page-down","fixture":"medium","min_us":79,"med_us":81,"p90_us":84,"max_us":87},{"op":"wheel","fixture":"medium","min_us":77,"med_us":78,"p90_us":82,"max_us":82},{"op":"edit-char","fixture":"medium","min_us":1019,"med_us":1349,"p90_us":1597,"max_us":1632},{"op":"edit-twin","fixture":"medium","min_us":2029,"med_us":2353,"p90_us":2455,"max_us":2676},{"op":"body-2m","fixture":"medium","min_us":5978,"med_us":9708,"p90_us":11361,"max_us":11666},{"op":"body-appends","fixture":"medium","min_us":117933,"med_us":211247,"p90_us":268014,"max_us":275006},{"op":"deep-sel","fixture":"medium","min_us":73,"med_us":75,"p90_us":80,"max_us":84}]} diff --git a/test/perf-baseline-gui-debug.json b/test/perf-baseline-gui-debug.json new file mode 100644 index 00000000..4b60520b --- /dev/null +++ b/test/perf-baseline-gui-debug.json @@ -0,0 +1 @@ +{"harness":"6cf9f4b8943e7e29","build":{"compiler":"0.17.0","target":"x86_64-linux.5.10...7.2-gnu.2.38","cpu":"x86_64","driver_optimize":"fast","core_optimize":"debug","c_optimize":"fast","terminal_optimize":"safe","platform":"gui","grammars":"full","mupdf":true,"jpx":true,"tracy":false,"quic":false,"theme_animation":true,"terminal_simd":true,"prebuilt_shaders":false},"cols":120,"rows":40,"reps":10,"only":"medium","fixtures":[{"name":"small","lines":1000,"cols":60,"bytes":62694},{"name":"medium","lines":50000,"cols":60,"bytes":3201944},{"name":"large","lines":300000,"cols":60,"bytes":19464444},{"name":"longline","lines":400,"cols":8000,"bytes":3200400},{"name":"esp32p4","lines":12,"cols":240,"bytes":2892}],"cells":[{"op":"open","fixture":"medium","min_us":1732,"med_us":1881,"p90_us":2035,"max_us":2072},{"op":"render","fixture":"medium","min_us":89,"med_us":92,"p90_us":101,"max_us":102},{"op":"key-down","fixture":"medium","min_us":92,"med_us":94,"p90_us":100,"max_us":100},{"op":"key-right","fixture":"medium","min_us":91,"med_us":93,"p90_us":105,"max_us":109},{"op":"page-down","fixture":"medium","min_us":91,"med_us":95,"p90_us":99,"max_us":106},{"op":"wheel","fixture":"medium","min_us":90,"med_us":95,"p90_us":101,"max_us":101},{"op":"edit-char","fixture":"medium","min_us":1226,"med_us":1678,"p90_us":2093,"max_us":2323},{"op":"edit-twin","fixture":"medium","min_us":2275,"med_us":2697,"p90_us":2868,"max_us":2920},{"op":"body-2m","fixture":"medium","min_us":5213,"med_us":11333,"p90_us":18974,"max_us":18999},{"op":"body-appends","fixture":"medium","min_us":175012,"med_us":260087,"p90_us":317184,"max_us":317469},{"op":"deep-sel","fixture":"medium","min_us":83,"med_us":85,"p90_us":86,"max_us":98}]} diff --git a/test/perf-baseline-tty-Debug.json b/test/perf-baseline-tty-Debug.json deleted file mode 100644 index 9110398c..00000000 --- a/test/perf-baseline-tty-Debug.json +++ /dev/null @@ -1 +0,0 @@ -{"harness":"303736f83a625e87","build":{"compiler":"0.16.0","target":"x86_64-linux.5.10...6.19-gnu.2.38","cpu":"x86_64","driver_optimize":"ReleaseFast","core_optimize":"Debug","c_optimize":"ReleaseFast","terminal_optimize":"ReleaseSafe","platform":"tty","grammars":"full","mupdf":true,"jpx":true,"tracy":false,"quic":false,"theme_animation":true,"terminal_simd":true,"prebuilt_shaders":false},"cols":120,"rows":40,"reps":10,"only":"medium","fixtures":[{"name":"small","lines":1000,"cols":60,"bytes":62694},{"name":"medium","lines":50000,"cols":60,"bytes":3201944},{"name":"large","lines":300000,"cols":60,"bytes":19464444},{"name":"longline","lines":400,"cols":8000,"bytes":3200400},{"name":"esp32p4","lines":12,"cols":240,"bytes":2892}],"cells":[{"op":"open","fixture":"medium","min_us":1881,"med_us":2148,"p90_us":2324,"max_us":2644},{"op":"render","fixture":"medium","min_us":79,"med_us":87,"p90_us":90,"max_us":93},{"op":"key-down","fixture":"medium","min_us":81,"med_us":84,"p90_us":86,"max_us":90},{"op":"key-right","fixture":"medium","min_us":80,"med_us":85,"p90_us":89,"max_us":102},{"op":"page-down","fixture":"medium","min_us":85,"med_us":86,"p90_us":88,"max_us":88},{"op":"wheel","fixture":"medium","min_us":79,"med_us":85,"p90_us":90,"max_us":91},{"op":"edit-char","fixture":"medium","min_us":1037,"med_us":1300,"p90_us":1639,"max_us":1647},{"op":"edit-twin","fixture":"medium","min_us":2046,"med_us":2378,"p90_us":2529,"max_us":2585},{"op":"body-2m","fixture":"medium","min_us":5790,"med_us":9510,"p90_us":12226,"max_us":12462},{"op":"body-appends","fixture":"medium","min_us":132421,"med_us":224849,"p90_us":257368,"max_us":274890},{"op":"deep-sel","fixture":"medium","min_us":75,"med_us":80,"p90_us":84,"max_us":86}]} diff --git a/test/perf-baseline-tty-ReleaseFast.json b/test/perf-baseline-tty-ReleaseFast.json deleted file mode 100644 index 4cbc8b95..00000000 --- a/test/perf-baseline-tty-ReleaseFast.json +++ /dev/null @@ -1 +0,0 @@ -{"harness":"303736f83a625e87","build":{"compiler":"0.16.0","target":"x86_64-linux.5.10...6.19-gnu.2.38","cpu":"x86_64","driver_optimize":"ReleaseFast","core_optimize":"ReleaseFast","c_optimize":"ReleaseFast","terminal_optimize":"ReleaseFast","platform":"tty","grammars":"full","mupdf":true,"jpx":true,"tracy":false,"quic":false,"theme_animation":true,"terminal_simd":true,"prebuilt_shaders":false},"cols":120,"rows":40,"reps":10,"only":"medium","fixtures":[{"name":"small","lines":1000,"cols":60,"bytes":62694},{"name":"medium","lines":50000,"cols":60,"bytes":3201944},{"name":"large","lines":300000,"cols":60,"bytes":19464444},{"name":"longline","lines":400,"cols":8000,"bytes":3200400},{"name":"esp32p4","lines":12,"cols":240,"bytes":2892}],"cells":[{"op":"open","fixture":"medium","min_us":1775,"med_us":1995,"p90_us":2092,"max_us":2094},{"op":"render","fixture":"medium","min_us":80,"med_us":86,"p90_us":89,"max_us":95},{"op":"key-down","fixture":"medium","min_us":81,"med_us":83,"p90_us":95,"max_us":101},{"op":"key-right","fixture":"medium","min_us":79,"med_us":84,"p90_us":85,"max_us":98},{"op":"page-down","fixture":"medium","min_us":80,"med_us":82,"p90_us":96,"max_us":97},{"op":"wheel","fixture":"medium","min_us":78,"med_us":80,"p90_us":87,"max_us":88},{"op":"edit-char","fixture":"medium","min_us":1036,"med_us":1377,"p90_us":1602,"max_us":1621},{"op":"edit-twin","fixture":"medium","min_us":2266,"med_us":2715,"p90_us":3695,"max_us":3927},{"op":"body-2m","fixture":"medium","min_us":4739,"med_us":8675,"p90_us":11518,"max_us":13657},{"op":"body-appends","fixture":"medium","min_us":111613,"med_us":214959,"p90_us":264859,"max_us":283506},{"op":"deep-sel","fixture":"medium","min_us":74,"med_us":76,"p90_us":89,"max_us":96}]} diff --git a/test/perf-baseline-tty-debug.json b/test/perf-baseline-tty-debug.json new file mode 100644 index 00000000..a01335bd --- /dev/null +++ b/test/perf-baseline-tty-debug.json @@ -0,0 +1 @@ +{"harness":"6cf9f4b8943e7e29","build":{"compiler":"0.17.0","target":"x86_64-linux.5.10...7.2-gnu.2.38","cpu":"x86_64","driver_optimize":"fast","core_optimize":"debug","c_optimize":"fast","terminal_optimize":"safe","platform":"tty","grammars":"full","mupdf":true,"jpx":true,"tracy":false,"quic":false,"theme_animation":true,"terminal_simd":true,"prebuilt_shaders":false},"cols":120,"rows":40,"reps":10,"only":"medium","fixtures":[{"name":"small","lines":1000,"cols":60,"bytes":62694},{"name":"medium","lines":50000,"cols":60,"bytes":3201944},{"name":"large","lines":300000,"cols":60,"bytes":19464444},{"name":"longline","lines":400,"cols":8000,"bytes":3200400},{"name":"esp32p4","lines":12,"cols":240,"bytes":2892}],"cells":[{"op":"open","fixture":"medium","min_us":2169,"med_us":2697,"p90_us":3126,"max_us":3207},{"op":"render","fixture":"medium","min_us":89,"med_us":96,"p90_us":101,"max_us":115},{"op":"key-down","fixture":"medium","min_us":93,"med_us":98,"p90_us":104,"max_us":115},{"op":"key-right","fixture":"medium","min_us":96,"med_us":97,"p90_us":102,"max_us":108},{"op":"page-down","fixture":"medium","min_us":96,"med_us":98,"p90_us":102,"max_us":103},{"op":"wheel","fixture":"medium","min_us":89,"med_us":100,"p90_us":128,"max_us":168},{"op":"edit-char","fixture":"medium","min_us":1821,"med_us":2274,"p90_us":2404,"max_us":2610},{"op":"edit-twin","fixture":"medium","min_us":2710,"med_us":3180,"p90_us":3413,"max_us":3636},{"op":"body-2m","fixture":"medium","min_us":9090,"med_us":14438,"p90_us":18158,"max_us":22063},{"op":"body-appends","fixture":"medium","min_us":241367,"med_us":375874,"p90_us":470623,"max_us":528094},{"op":"deep-sel","fixture":"medium","min_us":88,"med_us":89,"p90_us":90,"max_us":90}]} diff --git a/test/perf-baseline-tty-fast.json b/test/perf-baseline-tty-fast.json new file mode 100644 index 00000000..04fc88d3 --- /dev/null +++ b/test/perf-baseline-tty-fast.json @@ -0,0 +1 @@ +{"harness":"6cf9f4b8943e7e29","build":{"compiler":"0.17.0","target":"x86_64-linux.5.10...7.2-gnu.2.38","cpu":"x86_64","driver_optimize":"fast","core_optimize":"fast","c_optimize":"fast","terminal_optimize":"fast","platform":"tty","grammars":"full","mupdf":true,"jpx":true,"tracy":false,"quic":false,"theme_animation":true,"terminal_simd":true,"prebuilt_shaders":false},"cols":120,"rows":40,"reps":10,"only":"medium","fixtures":[{"name":"small","lines":1000,"cols":60,"bytes":62694},{"name":"medium","lines":50000,"cols":60,"bytes":3201944},{"name":"large","lines":300000,"cols":60,"bytes":19464444},{"name":"longline","lines":400,"cols":8000,"bytes":3200400},{"name":"esp32p4","lines":12,"cols":240,"bytes":2892}],"cells":[{"op":"open","fixture":"medium","min_us":1695,"med_us":2024,"p90_us":2180,"max_us":2292},{"op":"render","fixture":"medium","min_us":79,"med_us":82,"p90_us":92,"max_us":94},{"op":"key-down","fixture":"medium","min_us":81,"med_us":82,"p90_us":83,"max_us":84},{"op":"key-right","fixture":"medium","min_us":80,"med_us":82,"p90_us":91,"max_us":91},{"op":"page-down","fixture":"medium","min_us":81,"med_us":84,"p90_us":90,"max_us":171},{"op":"wheel","fixture":"medium","min_us":79,"med_us":80,"p90_us":90,"max_us":101},{"op":"edit-char","fixture":"medium","min_us":1332,"med_us":1691,"p90_us":1967,"max_us":1987},{"op":"edit-twin","fixture":"medium","min_us":2160,"med_us":2457,"p90_us":2718,"max_us":2757},{"op":"body-2m","fixture":"medium","min_us":5047,"med_us":13525,"p90_us":16257,"max_us":20323},{"op":"body-appends","fixture":"medium","min_us":155834,"med_us":261597,"p90_us":329936,"max_us":333538},{"op":"deep-sel","fixture":"medium","min_us":75,"med_us":76,"p90_us":84,"max_us":96}]} diff --git a/test/perf.zig b/test/perf.zig index c9235954..d01d1bb5 100644 --- a/test/perf.zig +++ b/test/perf.zig @@ -1054,7 +1054,7 @@ fn measureTerminalSession(io: std.Io, mib: usize, reps: usize, json: bool) !void .undo_output = undo_output, .history_rows = state.vt.screens.active.pages.scrollbar().total, .history_bytes = state.vt.screens.active.pages.page_size, - .history_limit_bytes = state.vt.screens.active.pages.maxSize(), + .history_limit_bytes = state.vt.screens.active.pages.limits.max(.bytes), .row_count_decreases = row_count_decreases, .allocator_calls = counter.calls, .allocator_live_after_output = live_after_output, @@ -1385,7 +1385,7 @@ fn reportText( for (fixtures) |fx| { if (base != null) o(" {s:>19}", .{fx.name}) else o(" {s:>12}", .{fx.name}); } - o("\n{s}\n", .{if (base != null) "-" ** (12 + fixtures.len * 20) else "-" ** (12 + fixtures.len * 13)}); + o("\n{s}\n", .{if (base != null) &@as([12 + fixtures.len * 20]u8, @splat('-')) else &@as([12 + fixtures.len * 13]u8, @splat('-'))}); var worst_jitter: f64 = 0; for (std.enums.values(Op), 0..) |op, oi| { o("{s:<12}", .{op.label()}); @@ -1412,7 +1412,7 @@ fn reportText( for (term_fixtures) |fx| { if (base != null) o(" {s:>19}", .{fx.name}) else o(" {s:>12}", .{fx.name}); } - o("\n{s}\n", .{if (base != null) "-" ** (12 + term_fixtures.len * 20) else "-" ** (12 + term_fixtures.len * 13)}); + o("\n{s}\n", .{if (base != null) &@as([12 + term_fixtures.len * 20]u8, @splat('-')) else &@as([12 + term_fixtures.len * 13]u8, @splat('-'))}); for (std.enums.values(TermOp), 0..) |op, oi| { o("{s:<12}", .{op.label()}); for (0..term_fixtures.len) |fi| { @@ -1524,10 +1524,11 @@ fn parseBase(src: []const u8, opts: Options, bytes: *const [fixtures.len]usize) defer parsed.deinit(); const report = parsed.value; if (!std.mem.eql(u8, report.harness, harness_id)) return error.BaselineHarnessMismatch; - inline for (std.meta.fields(BuildIdentity)) |field| { - const before = @field(report.build, field.name); - const after = @field(build_identity, field.name); - const same = if (field.type == []const u8) std.mem.eql(u8, before, after) else before == after; + const info = @typeInfo(BuildIdentity).@"struct"; + inline for (info.field_names, info.field_types) |name, T| { + const before = @field(report.build, name); + const after = @field(build_identity, name); + const same = if (T == []const u8) std.mem.eql(u8, before, after) else before == after; if (!same) return error.BaselineBuildMismatch; } if (report.cols != opts.cols or report.rows != opts.rows or report.reps != opts.reps or diff --git a/test/snapshot.zig b/test/snapshot.zig index 5522fbb9..2d8a8664 100644 --- a/test/snapshot.zig +++ b/test/snapshot.zig @@ -157,8 +157,8 @@ pub fn main(init: std.process.Init) !void { script_i += 1; } if (exe == null) fatal("usage: pardes-snap [scripts...] [--update] [--jobs=N]", .{}); - const exe_z = try arena.dupeZ(u8, exe.?); - lspmock_bin = if (lspmock) |p| try arena.dupeZ(u8, p) else null; + const exe_z = try arena.dupeSentinel(u8, exe.?, 0); + lspmock_bin = if (lspmock) |p| try arena.dupeSentinel(u8, p, 0) else null; if (scripts.len == 0) { scripts = try listSnaps(arena, try absPath(arena, orig_cwd, "test/snapshots")); @@ -443,7 +443,7 @@ fn runBatch( fn runOne(arena: std.mem.Allocator, exe_z: [:0]const u8, script_path: []const u8, update: bool) u8 { if (careful) beCareful(); const stem = std.fs.path.stem(script_path); - const report_z = arena.dupeZ(u8, reportPath(arena, script_path) catch return 1) catch return 1; + const report_z = arena.dupeSentinel(u8, reportPath(arena, script_path) catch return 1, 0) catch return 1; const fd = libc.open(report_z, .{ .ACCMODE = .WRONLY, .CREAT = true, .TRUNC = true }, @as(libc.mode_t, 0o644)); if (fd >= 0) { _ = libc.dup2(fd, 1); @@ -457,7 +457,7 @@ fn runOne(arena: std.mem.Allocator, exe_z: [:0]const u8, script_path: []const u8 // dirty to every manual `cmp` audit. Unlink only this script's exact path // before it starts; a new mismatch below writes it back. const actual_path = std.fmt.allocPrint(arena, "{s}.actual", .{base_path}) catch return 1; - const actual_path_z = arena.dupeZ(u8, actual_path) catch return 1; + const actual_path_z = arena.dupeSentinel(u8, actual_path, 0) catch return 1; if (record_dir == null) _ = libc.unlink(actual_path_z); const golden: ?[]u8 = if (record_dir == null) readFileAlloc(arena, golden_path) catch null else null; const started = eh.nowMs(); @@ -473,7 +473,7 @@ fn runOne(arena: std.mem.Allocator, exe_z: [:0]const u8, script_path: []const u8 return 0; } if (update) { - eh.writeFile(arena.dupeZ(u8, golden_path) catch return 1, out) catch return 1; + eh.writeFile(arena.dupeSentinel(u8, golden_path, 0) catch return 1, out) catch return 1; std.debug.print("UPDATED {s} ({d} bytes)\n", .{ stem, out.len }); return 0; } @@ -485,7 +485,7 @@ fn runOne(arena: std.mem.Allocator, exe_z: [:0]const u8, script_path: []const u8 std.debug.print("PASS {s} ({d}ms)\n", .{ stem, took }); return 0; } - eh.writeFile(arena.dupeZ(u8, actual_path) catch return 1, out) catch |err| { + eh.writeFile(arena.dupeSentinel(u8, actual_path, 0) catch return 1, out) catch |err| { std.debug.print("FAIL {s}: differs from golden; cannot write {s}: {s} ({d}ms)\n", .{ stem, actual_path, @errorName(err), took }); printFirstDiff(golden.?, out); return 1; @@ -557,7 +557,7 @@ fn runScript(arena: std.mem.Allocator, exe_z: [:0]const u8, script_path: []const try mkdir(arena, work, false); // deterministic shell: fixed prompt, no history, no user rc leakage try eh.writeFile(try std.fmt.allocPrintSentinel(arena, "{s}/.bashrc", .{home}, 0), "PS1='$ '\nHISTFILE=\n"); - _ = setenv("HOME", try arena.dupeZ(u8, home), 1); + _ = setenv("HOME", try arena.dupeSentinel(u8, home, 0), 1); // Keep startup configuration hermetic even when the developer exports an // XDG directory that points outside this per-snapshot fake home. const config_home = try std.fmt.allocPrintSentinel(arena, "{s}/.config", .{home}, 0); @@ -602,8 +602,8 @@ fn runScript(arena: std.mem.Allocator, exe_z: [:0]const u8, script_path: []const // take turns — which cost more wall clock than the other 51 scripts put // together. Scripts name it `$DUMP`. const dump_path = try std.fmt.allocPrint(arena, "{s}/dump.zon", .{base}); - _ = setenv("PARDES_DUMP", try arena.dupeZ(u8, dump_path), 1); - if (chdirRc(try arena.dupeZ(u8, work)) < 0) return error.ChdirFailed; + _ = setenv("PARDES_DUMP", try arena.dupeSentinel(u8, dump_path, 0), 1); + if (chdirRc(try arena.dupeSentinel(u8, work, 0)) < 0) return error.ChdirFailed; const chunks = try arena.alloc([]const u8, countCaptures(src)); var chunk_len: usize = 0; @@ -636,7 +636,7 @@ fn runScript(arena: std.mem.Allocator, exe_z: [:0]const u8, script_path: []const try eh.appendFile(try std.fmt.allocPrintSentinel(arena, "{s}/pardes/init", .{config_home}, 0), setting); } else if (std.mem.eql(u8, cmd, "file")) { const name = tok.next() orelse return error.BadScript; - try eh.writeFile(try arena.dupeZ(u8, name), try unescape(arena, tok.rest())); + try eh.writeFile(try arena.dupeSentinel(u8, name, 0), try unescape(arena, tok.rest())); } else if (std.mem.eql(u8, cmd, "lines")) { const name = tok.next() orelse return error.BadScript; const n = try std.fmt.parseInt(usize, tok.next() orelse return error.BadScript, 10); @@ -646,7 +646,7 @@ fn runScript(arena: std.mem.Allocator, exe_z: [:0]const u8, script_path: []const // scroll test needs and `file` can only give as one huge script line const tail = tok.rest(); const buf = try numberedLines(arena, n, tail); - try eh.writeFile(try arena.dupeZ(u8, name), buf); + try eh.writeFile(try arena.dupeSentinel(u8, name, 0), buf); } else if (std.mem.eql(u8, cmd, "ppmdiag")) { // The diagonal-split test PPM from the old e2e (white over blue), // grown to 512x512 with the white half filled by a fixed LCG @@ -658,7 +658,7 @@ fn runScript(arena: std.mem.Allocator, exe_z: [:0]const u8, script_path: []const // down to flat color and a block always wins). const name = tok.next() orelse return error.BadScript; const ppm = try ppmDiag(arena); - try eh.writeFile(try arena.dupeZ(u8, name), ppm); + try eh.writeFile(try arena.dupeSentinel(u8, name, 0), ppm); } else if (std.mem.eql(u8, cmd, "dirmk")) { try mkdir(arena, tok.next() orelse return error.BadScript, false); } else if (std.mem.eql(u8, cmd, "run")) { @@ -668,7 +668,7 @@ fn runScript(arena: std.mem.Allocator, exe_z: [:0]const u8, script_path: []const // different inotify event. This runs in the script's cwd, as a // child of the RUNNER, so nothing it does reaches the app's ptys: // whatever the app then shows, it woke up for by itself. - if (system(try arena.dupeZ(u8, tok.rest())) != 0) return error.RunFailed; + if (system(try arena.dupeSentinel(u8, tok.rest(), 0)) != 0) return error.RunFailed; } else if (std.mem.eql(u8, cmd, "start")) { const rows = try std.fmt.parseInt(u16, tok.next() orelse return error.BadScript, 10); const cols = try std.fmt.parseInt(u16, tok.next() orelse return error.BadScript, 10); @@ -676,7 +676,7 @@ fn runScript(arena: std.mem.Allocator, exe_z: [:0]const u8, script_path: []const var nextra: usize = 0; while (tok.next()) |a| : (nextra += 1) { if (nextra >= extra.len) return error.BadScript; - extra[nextra] = (try arena.dupeZ(u8, a)).ptr; + extra[nextra] = (try arena.dupeSentinel(u8, a, 0)).ptr; } if (h) |*hp| hp.deinit(); // scripts may restart (e.g. dump then -l) // a new process is a new screen: capture it whole, or its first @@ -963,13 +963,13 @@ fn treeAsleep(root: libc.pid_t) bool { while (n > 0) { n -= 1; const pid = stack[n]; - const dir_path = std.fmt.bufPrintZ(&path_buf, "/proc/{d}/task", .{pid}) catch continue; + const dir_path = std.fmt.bufPrintSentinel(&path_buf, "/proc/{d}/task", .{pid}, 0) catch continue; const dir = libc.opendir(dir_path) orelse continue; // exited between steps defer _ = libc.closedir(dir); while (libc.readdir(dir)) |d| { const tid = std.mem.sliceTo(@as([*:0]const u8, @ptrCast(&d.name)), 0); if (tid[0] == '.') continue; - const stat = readProc(&buf, std.fmt.bufPrintZ(&path_buf, "/proc/{d}/task/{s}/stat", .{ pid, tid }) catch continue) orelse continue; + const stat = readProc(&buf, std.fmt.bufPrintSentinel(&path_buf, "/proc/{d}/task/{s}/stat", .{ pid, tid }, 0) catch continue) orelse continue; // "pid (comm) S ..." — comm can hold spaces and parens, so the // state is the char two past the LAST ')' const close = std.mem.lastIndexOfScalar(u8, stat, ')') orelse continue; @@ -983,7 +983,7 @@ fn treeAsleep(root: libc.pid_t) bool { 'R', 'D', 'Z' => return false, else => {}, } - const kids = readProc(&buf, std.fmt.bufPrintZ(&path_buf, "/proc/{d}/task/{s}/children", .{ pid, tid }) catch continue) orelse continue; + const kids = readProc(&buf, std.fmt.bufPrintSentinel(&path_buf, "/proc/{d}/task/{s}/children", .{ pid, tid }, 0) catch continue) orelse continue; var it = std.mem.tokenizeAny(u8, kids, " \n"); while (it.next()) |k| { if (n >= stack.len) return false; // deeper than we can walk: assume busy @@ -1554,7 +1554,7 @@ fn absPath(arena: std.mem.Allocator, cwd: []const u8, p: []const u8) ![]const u8 } fn listSnaps(arena: std.mem.Allocator, dir_path: []const u8) ![][]const u8 { - const dir_z = try arena.dupeZ(u8, dir_path); + const dir_z = try arena.dupeSentinel(u8, dir_path, 0); const count = countSnapEntries(dir_z, dir_path); const scripts = try arena.alloc([]const u8, count); const dir = libc.opendir(dir_z) orelse fatal("no snapshots/ dir at {s}", .{dir_path}); @@ -1583,7 +1583,7 @@ fn countSnapEntries(dir_z: [:0]const u8, dir_path: []const u8) usize { } fn readFileAlloc(arena: std.mem.Allocator, path: []const u8) ![]u8 { - const path_z = try arena.dupeZ(u8, path); + const path_z = try arena.dupeSentinel(u8, path, 0); const fd = libc.open(path_z, .{ .ACCMODE = .RDONLY }); if (fd < 0) return error.OpenFailed; defer _ = libc.close(fd); @@ -1611,7 +1611,7 @@ fn readFileAlloc(arena: std.mem.Allocator, path: []const u8) ![]u8 { } fn mkdir(arena: std.mem.Allocator, path: []const u8, exist_ok: bool) !void { - const path_z = try arena.dupeZ(u8, path); + const path_z = try arena.dupeSentinel(u8, path, 0); const rc = libc.mkdir(path_z, 0o755); if (rc != 0) { if (exist_ok and libc.errno(rc) == .EXIST) return; diff --git a/test/snapshots/exec.golden b/test/snapshots/exec.golden index df49336c..30473c9e 100644 --- a/test/snapshots/exec.golden +++ b/test/snapshots/exec.golden @@ -22,15 +22,17 @@ == snap kept grid=140x31 cursor=6,3 |3: ZZARG ls |4: ./c.sh e.txt +|8: |9: == snap chord grid=140x31 cursor=6,3 |3: ZZARG Exec ls -|9: CHORDARG:ZZARG +|5: ./c.sh ZZARG +|6: CHORDARG:ZZARG == snap deleted grid=140x31 cursor=4,5 |3: ls ls |4: e.txt e.txt -|8: -|9: +|5: +|6: |17: |18: |19: diff --git a/test/snapshots/tinywin.golden b/test/snapshots/tinywin.golden deleted file mode 100644 index 787a9d8f..00000000 --- a/test/snapshots/tinywin.golden +++ /dev/null @@ -1,83 +0,0 @@ -== snap stacked grid=100x31 cursor=14,3 -| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol -|$ /tmp/pardes-snap/tinywin/cwd Tty+bash Save Mode Filter Collapse Del -| $ :^[n^[n^[n -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| /tmp/pardes-snap/tinywin/cwd/+New Save Tty Collapse Del -| 1 -== snap shrunk grid=60x4 cursor=59,3 -| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes -| New Tty Find Grep Joincol Delcol -|$ /tmp/pardes-snap/tinywin/cwd Tty+bash Save Mode Filter Col -| /tmp/pardes-snap/tinywin/cwd/+New Save Tty Collapse Del -== snap columns grid=100x31 cursor=23,3 -| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol -|$ /tmp/pardes-snap/tinywin/cwd Tty+bash Save Mode Filter Collapse Del -| $ :^[n^[n^[n cn cn cn -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| /tmp/pardes-snap/tinywin/cwd/+New Save Tty Collapse Del -| 1 -== snap narrow grid=4x31 cursor=2,20 -| Ne -| Ne -|$ /t -| mp -| /p -| ar -| de -| s- -| sn -| ap -| $ -| ^[ -| n^ -| [n -| ^[ -| n -| cn -| c -| n -| cn -| -| /t -| mp -| /p -| ar -| de -| s- -| sn -| ap diff --git a/test/snapshots/tinywin.snap b/test/snapshots/tinywin.snap deleted file mode 100644 index 3d22d583..00000000 --- a/test/snapshots/tinywin.snap +++ /dev/null @@ -1,31 +0,0 @@ -# Shrinking the window past "one row per pane" used to panic: computeGeom gave -# every pane in a column at least one row, so `y` walked off the bottom and -# renderPane got a rect outside the surface (assert). Panes that no longer fit -# now get h = 0 and simply do not render until the window grows back. -start 31 100 -wait 8000 $ -key a-n -stable 400 8000 -key a-n -stable 400 8000 -key a-n -stable 400 8000 -key a-n -stable 700 15000 -snap stacked -resize 4 60 -stable 700 10000 -snap shrunk -# ...and the same sideways: more columns than the window is wide -resize 31 100 -stable 700 10000 -key space c n -stable 600 8000 -key space c n -stable 600 8000 -key space c n -stable 700 15000 -snap columns -resize 31 4 -stable 700 10000 -snap narrow diff --git a/test/unit_profile_test.zig b/test/unit_profile_test.zig index 721f1212..a4cdd09e 100644 --- a/test/unit_profile_test.zig +++ b/test/unit_profile_test.zig @@ -149,11 +149,8 @@ fn fixture(init: std.process.Init) !void { var write_buffer: [1024]u8 = undefined; var reader = std.Io.File.stdin().readerStreaming(io, &read_buffer); var writer = std.Io.File.stdout().writerStreaming(io, &write_buffer); - var server = try std.zig.Server.init(.{ - .in = &reader.interface, - .out = &writer.interface, - .zig_version = if (std.mem.eql(u8, mode, "version")) "wrong-version" else builtin.zig_version_string, - }); + var server: std.zig.Server = .{ .in = &reader.interface, .out = &writer.interface }; + try server.serveStringMessage(.zig_version, if (std.mem.eql(u8, mode, "version")) "wrong-version" else builtin.zig_version_string); while (true) { const request = try server.receiveMessage(); switch (request.tag) { diff --git a/tools/gen_themes.zig b/tools/gen_themes.zig index 65e85d1c..be5fde2f 100644 --- a/tools/gen_themes.zig +++ b/tools/gen_themes.zig @@ -152,13 +152,14 @@ fn byName(_: void, a: Theme, b: Theme) bool { fn emit(w: *std.Io.Writer, t: Theme) !void { try w.writeAll("// Generated by tools/gen_themes.zig. Do not edit.\npub const theme = .{\n"); try w.print(" .name = \"{s}\",\n", .{t.name}); - inline for (@typeInfo(Theme).@"struct".fields) |f| { - if (comptime std.mem.eql(u8, f.name, "name")) continue; - if (comptime std.mem.eql(u8, f.name, "palette")) continue; - try w.print(" .{s} = ", .{f.name}); - if (comptime @typeInfo(f.type) == .optional) { - if (@field(t, f.name)) |c| try rgb(w, c) else try w.writeAll("null"); - } else try rgb(w, @field(t, f.name)); + const info = @typeInfo(Theme).@"struct"; + inline for (info.field_names, info.field_types) |name, T| { + if (comptime std.mem.eql(u8, name, "name")) continue; + if (comptime std.mem.eql(u8, name, "palette")) continue; + try w.print(" .{s} = ", .{name}); + if (comptime @typeInfo(T) == .optional) { + if (@field(t, name)) |c| try rgb(w, c) else try w.writeAll("null"); + } else try rgb(w, @field(t, name)); try w.writeAll(",\n"); } if (t.palette) |p| { -- cgit v1.3 From 23518c9d7c061f8a06f6632da8b64b37801b514f Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Wed, 21 Oct 2026 17:25:52 -0300 Subject: zig fmt for Zig 0.17 --- build.zig | 15 +- src/9p_io.zig | 2 +- src/Dir.zig | 4 +- src/File.zig | 12 +- src/Messages.zig | 2 +- src/Presentation.zig | 6 +- src/animation.zig | 11 +- src/builtins.zig | 22 +- src/detached/client.zig | 2 +- src/detached/server.zig | 4 +- src/detached/wire.zig | 82 +-- src/diff.zig | 4 +- src/draw.zig | 4 +- src/dump.zig | 4 +- src/edit_cmd.zig | 2 +- src/esp32p4.zig | 34 +- src/esp32p4/app.zig | 6 +- src/esp32p4_9p.zig | 2 +- src/fonts.zig | 2 +- src/gui/Post.zig | 19 +- src/gui/gui.zig | 32 +- src/host_io.zig | 20 +- src/linux/v9fs.zig | 6 +- src/look.zig | 2 +- src/macos.zig | 98 ++-- src/main.zig | 2 +- src/mini.zig | 10 +- src/mouse.zig | 18 +- src/ninep/addr.zig | 6 +- src/ninep/cols.zig | 54 +- src/ninep/ctl.zig | 168 +++--- src/ninep/events.zig | 30 +- src/ninep/pane.zig | 8 +- src/ninep/pty.zig | 5 +- src/ninep/screen.zig | 4 +- src/ninep/testing.zig | 4 +- src/ninep/tree.zig | 120 ++-- src/pager.zig | 4 +- src/pardes.zig | 10 +- src/pdf_view.zig | 2 +- src/syntax.zig | 82 +-- src/terminal.zig | 2 +- src/web.zig | 32 +- test/deck/buttons.zon | 158 ++--- test/deck/lpad-swipe.zon | 322 +++++------ test/deck/replay.zig | 36 +- test/deck/rpad-drag.zon | 442 +++++++------- test/deck/triggers.zon | 1148 ++++++++++++++++++------------------- test/fs_bench.zig | 6 +- test/lspfixture/broken.zig | 4 +- test/output.zig | 10 +- test/panes.zig | 2 +- test/pdf.zig | 6 +- test/pdf_scroll_bench.zig | 2 +- test/perf-baseline-gui-debug.json | 2 +- test/perf-baseline-tty-debug.json | 2 +- test/perf-baseline-tty-fast.json | 2 +- test/perf.zig | 6 +- test/unit_profile.zig | 4 +- 59 files changed, 1556 insertions(+), 1554 deletions(-) (limited to 'src/gui/gui.zig') diff --git a/build.zig b/build.zig index ddd41a03..ca7b26af 100644 --- a/build.zig +++ b/build.zig @@ -39,10 +39,13 @@ pub const macos_min_version: std.SemanticVersion = .{ .major = 13, .minor = 0, . pub const TreeSitterGrammars = enum { disabled, zig, minimal, full }; const gui_shaders = [_][]const u8{ - "ui.vert", "ui.frag", + "ui.vert", + "ui.frag", "decor.frag", - "overlay.vert", "overlay.frag", - "image.vert", "image.frag", + "overlay.vert", + "overlay.frag", + "image.vert", + "image.frag", "post.vert", // The bundled post passes: shaders/post/.glsl behind the // Shadertoy prefix (shaderSource). @@ -843,7 +846,7 @@ pub fn build(b: *std.Build) void { const render_anchor = \\ if ((!self.refresh and \\ last.eql(cell) and - ; + ; if (std.mem.count(u8, render_src, render_anchor) != 1) std.debug.panic("vaxis's Vaxis.zig changed at `{s}`: redo its patch in build.zig", .{render_anchor}); render_src = std.mem.replaceOwned(u8, b.allocator, render_src, render_anchor, \\ if ((!self.refresh and @@ -924,7 +927,6 @@ pub fn build(b: *std.Build) void { .uucode = uucode_mod, }); - const iso_off = b.addOptions(); iso_off.addOption(bool, "isolated", false); const iso_on = b.addOptions(); @@ -1401,7 +1403,6 @@ pub fn build(b: *std.Build) void { const lspbench_check_step = b.step("lspbench-check", "require every configured language probe to complete correctly"); lspbench_check_step.dependOn(&run_lspbench_check.step); - const locations_bench_step = b.step("locations-bench", "measure cold/warm result formatting (-Doptimize=ReleaseFast; CSV on stderr)"); if (optimize != .fast) { locations_bench_step.dependOn(&b.addFail("locations-bench requires -Doptimize=ReleaseFast").step); @@ -2016,6 +2017,6 @@ fn wireCore(m: *std.Build.Module, d: struct { /// helper because `cpu_features_add` wants a set and there is no literal syntax for one. fn riscvFeatures(comptime features: []const std.Target.riscv.Feature) std.Target.Cpu.Feature.Set { var set = std.Target.Cpu.Feature.Set.empty; - for (features) |f| set.addFeature(@intFromEnum(f)); + for (features) |f| set.addFeature(@backingInt(f)); return set; } diff --git a/src/9p_io.zig b/src/9p_io.zig index 27d79b93..446c24de 100644 --- a/src/9p_io.zig +++ b/src/9p_io.zig @@ -1015,7 +1015,7 @@ pub fn sweepDeadSockets(io: std.Io, dir: [:0]const u8) void { i += 1 + name.len; const pid = deadSocketPid(name).?; if (pid == libc.getpid()) continue; - if (std.posix.errno(std.c.kill(pid, @enumFromInt(0))) != .SRCH) continue; + if (std.posix.errno(std.c.kill(pid, @fromBackingInt(@intCast(0)))) != .SRCH) continue; var path_buf: [sun_path_len:0]u8 = undefined; const path = std.fmt.bufPrintSentinel(&path_buf, "{s}/{s}", .{ dir, name }, 0) catch continue; const facts = statNoFollow(path) orelse continue; diff --git a/src/Dir.zig b/src/Dir.zig index 36895bda..b994bc06 100644 --- a/src/Dir.zig +++ b/src/Dir.zig @@ -463,10 +463,10 @@ test "over 9P a directory pane is a text pane whose name ends in /, its body the defer s.p.deinit(); const p = s.p; var line_buf: [4200]u8 = undefined; - _ = th.wr(p, @intFromEnum(tree.TopFile.look), try std.fmt.bufPrint(&line_buf, "{s}\n", .{s.dir})); + _ = th.wr(p, @backingInt(tree.TopFile.look), try std.fmt.bufPrint(&line_buf, "{s}\n", .{s.dir})); p.sync(); const pane = p.panes[p.active].?; - const index = th.rd(p, @intFromEnum(tree.TopFile.index), 0, 8192).bytes; + const index = th.rd(p, @backingInt(tree.TopFile.index), 0, 8192).bytes; try testing.expect(std.mem.indexOf(u8, index, try std.fmt.bufPrint(&line_buf, "{d} text 0 {s}/ ", .{ pane.serial, s.dir })) != null); try testing.expectEqualStrings(".dot sub/ top.txt\n", th.rd(p, tree.Node.of(pane.serial, .body), 0, 4096).bytes); var fields = std.mem.tokenizeScalar(u8, th.rd(p, tree.Node.of(pane.serial, .ctl), 0, 4096).bytes, ' '); diff --git a/src/File.zig b/src/File.zig index c42e39ec..59b04e3f 100644 --- a/src/File.zig +++ b/src/File.zig @@ -251,7 +251,7 @@ pub fn dumpPane( fn dumpLocationRows(arena: std.mem.Allocator, rows: []const locations.Row) ![]const dump.LocationRow { const saved = try arena.alloc(dump.LocationRow, rows.len); for (rows, saved) |row, *out| out.* = .{ - .kind = @enumFromInt(@intFromEnum(row.kind)), + .kind = @fromBackingInt(@intCast(@backingInt(row.kind))), .declaration = row.declaration, .mark_occurrence = row.mark_occurrence, .source_column = row.source_column, @@ -336,10 +336,10 @@ fn restoreOutputLocationRows(gpa: std.mem.Allocator, content: []const u8, saved: const colors = try dump.decodeBytes(gpa, row.colors_b64); errdefer gpa.free(colors); if (colors.len != 0 and colors.len != code_len) return error.InvalidLocationRows; - for (colors) |color| if (color > @intFromEnum(syntax.Syn.comment)) return error.InvalidLocationRows; + for (colors) |color| if (color > @backingInt(syntax.Syn.comment)) return error.InvalidLocationRows; const path = try gpa.dupe(u8, row.path); out.* = .{ - .kind = @enumFromInt(@intFromEnum(row.kind)), + .kind = @fromBackingInt(@intCast(@backingInt(row.kind))), .declaration = row.declaration, .mark_occurrence = row.mark_occurrence, .source_column = row.source_column, @@ -1028,7 +1028,7 @@ pub fn restore(p: *Pardes, id: usize, src: dump.Pane) !*Pane { const colors = try dump.decodeBytes(p.gpa, saved.mini_colors_b64); errdefer p.gpa.free(colors); if (colors.len != content.len or colors.len > Mini.max_output_bytes) return error.InvalidMini; - for (colors) |color| if (color > @intFromEnum(syntax.Syn.comment)) return error.InvalidMini; + for (colors) |color| if (color > @backingInt(syntax.Syn.comment)) return error.InvalidMini; mini = .{ .source = source, .colors = colors }; } else if (saved.mini_colors_b64.len > 0) return error.InvalidMini; @@ -1984,7 +1984,7 @@ pub fn recolorSyntax(p: *Pardes, s: *Surface, pane: *Pane, f: *State, r: pardes. if (if (tint != null and hs + c == 0) SynStyle{ .fg = tint.?.fg, .bold = true } else - synStyle(p, @enumFromInt(highlights[hidx] & syntax.syn_bits))) |ss| + synStyle(p, @fromBackingInt(@intCast(highlights[hidx] & syntax.syn_bits)))) |ss| { var fill: usize = 0; while (fill < cells and prefix_width + screen_c + fill < tw) : (fill += 1) { @@ -2189,7 +2189,7 @@ pub fn recolorDiffOutput(p: *Pardes, s: *Surface, pane: *Pane, r: pardes.Rect, t // green is the tint's to say now: its code takes the page's ink. const paint: ?SynStyle = if (tint != null and prefix) .{ .fg = tint.?.fg, .bold = true } - else if (synStyle(p, @enumFromInt(style & syntax.syn_bits))) |ss| + else if (synStyle(p, @fromBackingInt(@intCast(style & syntax.syn_bits)))) |ss| ss else if (tint != null) .{ .fg = ink, .bold = false } diff --git a/src/Messages.zig b/src/Messages.zig index b67a8402..6d064c93 100644 --- a/src/Messages.zig +++ b/src/Messages.zig @@ -721,7 +721,7 @@ test "with no frontend attached a message goes once it has lingered, on the cloc // line above it with it. p.unattended = true; // A read served meanwhile changes nothing; the session's loop expires. - _ = p.serveFs(.{ .tag = 1, .op = .read, .node = @intFromEnum(ctlfs.TopFile.index), .size = 64 }); + _ = p.serveFs(.{ .tag = 1, .op = .read, .node = @backingInt(ctlfs.TopFile.index), .size = 64 }); try std.testing.expect(pane.msg_len > 0); expireUnattended(p); try std.testing.expectEqual(@as(u16, 0), pane.msg_len); diff --git a/src/Presentation.zig b/src/Presentation.zig index 5cec73e0..2a75b66d 100644 --- a/src/Presentation.zig +++ b/src/Presentation.zig @@ -226,7 +226,7 @@ fn stamp(p: *const Pardes, track: Track) Track { switch (track.effect) { .slide, .zoom, .vertical => { const motion = animation.Motion.of(p.settings.motion); - stamped.motion = @intFromEnum(p.settings.motion) + 1; + stamped.motion = @backingInt(p.settings.motion) + 1; stamped.frame_count = @intFromFloat(@max(2, @round(@as(f32, @floatFromInt(track.effect.frames())) * motion.span))); }, else => {}, @@ -741,7 +741,7 @@ test "a pane past its mark never takes a neighbour's click" { // Bouncy, at its peak: pane 0 slides right to 0..40 and swings past it, // over the neighbour at 40..80. var presentation: Presentation = .{}; - var track: Track = .{ .serial = 7, .effect = .slide, .motion = @intFromEnum(animation.Motion.Flavour.bouncy) + 1, .frame_count = 20, .from = .{ .x = -40, .y = 0, .w = 40, .h = 20 }, .to = .{ .x = 0, .y = 0, .w = 40, .h = 20 } }; + var track: Track = .{ .serial = 7, .effect = .slide, .motion = @backingInt(animation.Motion.Flavour.bouncy) + 1, .frame_count = 20, .from = .{ .x = -40, .y = 0, .w = 40, .h = 20 }, .to = .{ .x = 0, .y = 0, .w = 40, .h = 20 } }; var peak: u16 = 0; var furthest: f32 = -1e9; while (track.frame < track.frames()) : (track.frame += 1) { @@ -807,7 +807,7 @@ test "presentation snapshots own compact body and tag rows across later edits" { } test "a move retargeted mid-way carries its speed into the new one" { - const smooth = @intFromEnum(animation.Motion.Flavour.smooth) + 1; + const smooth = @backingInt(animation.Motion.Flavour.smooth) + 1; const first: Track = .{ .serial = 1, .phase = .moving, .effect = .slide, .motion = smooth, .frame = 4, .frame_count = 14, .from = .{ .x = 0, .y = 1, .w = 40, .h = 20 }, .to = .{ .x = 40, .y = 1, .w = 40, .h = 20 } }; const was = first.velocity(); try std.testing.expect(was.x > 0.5); diff --git a/src/animation.zig b/src/animation.zig index 19f7ce0b..547b9201 100644 --- a/src/animation.zig +++ b/src/animation.zig @@ -897,7 +897,7 @@ test "each flavour is its own motion: off lands at once, bouncy overshoots, play last = now; } try std.testing.expect(t < 1600 * ms); - settle[@intFromEnum(flavour)] = t; + settle[@backingInt(flavour)] = t; switch (flavour) { .crisp, .smooth => try std.testing.expect(peak <= 1.0005 and low >= 0), // Clearly past the mark, not a hint of it. @@ -909,8 +909,8 @@ test "each flavour is its own motion: off lands at once, bouncy overshoots, play // Smooth takes twice crisp's time and more: a character, not a tuning. // Yet as the default a pane's arrival (a slide's 12 frames, scaled) is // inside §8.1's 220 ms, and a lift is still before 300 ms. - try std.testing.expect(settle[@intFromEnum(Motion.Flavour.smooth)] > 2 * settle[@intFromEnum(Motion.Flavour.crisp)]); - try std.testing.expect(settle[@intFromEnum(Motion.Flavour.smooth)] <= 300 * ms); + try std.testing.expect(settle[@backingInt(Motion.Flavour.smooth)] > 2 * settle[@backingInt(Motion.Flavour.crisp)]); + try std.testing.expect(settle[@backingInt(Motion.Flavour.smooth)] <= 300 * ms); try std.testing.expect(@round(@as(f32, 12) * Motion.of(.smooth).span) * frame_ms <= 220); // A fixed-length move lands exactly on its mark, whatever the flavour. for (std.enums.values(Motion.Flavour)) |flavour| try std.testing.expectEqual(@as(f32, 1), Motion.of(flavour).ease(1)); @@ -920,7 +920,7 @@ test "a flavour's stretched pane lands exactly on its box, and a click finds the const from: Box = .{ .x = 0, .y = 2, .w = 30, .h = 10 }; const to: Box = .{ .x = 37.3, .y = 2, .w = 30, .h = 10 }; for (std.enums.values(Motion.Flavour)) |flavour| { - var track: Track = .{ .effect = .slide, .motion = @intFromEnum(flavour) + 1, .frame_count = 20, .from = from, .to = to }; + var track: Track = .{ .effect = .slide, .motion = @backingInt(flavour) + 1, .frame_count = 20, .from = from, .to = to }; track.frame = track.frames() - 1; const landed = track.presented(); // Bit for bit: no stretch or float residue once it lands. @@ -929,7 +929,7 @@ test "a flavour's stretched pane lands exactly on its box, and a click finds the // Playful at its most stretched: the pane is drawn wider than its box, // and the drawn place of a cell maps back to that cell (the pointer // inverts the same box: target + (x - shown.x) / shown.w * target.w). - var track: Track = .{ .effect = .slide, .motion = @intFromEnum(Motion.Flavour.playful) + 1, .frame_count = 20, .from = from, .to = to }; + var track: Track = .{ .effect = .slide, .motion = @backingInt(Motion.Flavour.playful) + 1, .frame_count = 20, .from = from, .to = to }; var most: u16 = 0; var widest: f32 = 0; while (track.frame < track.frames()) : (track.frame += 1) { @@ -1309,4 +1309,3 @@ test "retarget starts at the currently displayed value" { for (0..transition_steps) |_| tween.advance(); try std.testing.expectEqual(third, tween.displayed); } - diff --git a/src/builtins.zig b/src/builtins.zig index d9cef8c9..83966228 100644 --- a/src/builtins.zig +++ b/src/builtins.zig @@ -199,7 +199,7 @@ pub const registry = struct { pub fn takesArg(b: Builtin()) bool { inline for (manualBuiltinList(), 0..) |T, i| - if (@intFromEnum(b) == i) return @hasDecl(T, "takes_arg") and T.takes_arg; + if (@backingInt(b) == i) return @hasDecl(T, "takes_arg") and T.takes_arg; // Every setting takes its value, and a switch flips when bare. return true; } @@ -210,7 +210,7 @@ pub const registry = struct { /// may be in (`Dump+2024.zon` is a name, not Dump's argument). pub fn plusArg(b: Builtin()) bool { inline for (manualBuiltinList(), 0..) |T, i| - if (@intFromEnum(b) == i) return @hasDecl(T, "plus_arg") and T.plus_arg; + if (@backingInt(b) == i) return @hasDecl(T, "plus_arg") and T.plus_arg; return false; } @@ -223,15 +223,15 @@ pub const registry = struct { /// pane it is refused (exec.runBuiltinFrom), as Repl and Edit are. pub fn needs(b: Builtin()) ?PaneKind { inline for (manualBuiltinList(), 0..) |T, i| - if (@intFromEnum(b) == i) return if (@hasDecl(T, "needs")) T.needs else null; + if (@backingInt(b) == i) return if (@hasDecl(T, "needs")) T.needs else null; return null; } pub fn requiresArg(b: Builtin()) bool { inline for (manualBuiltinList(), 0..) |T, i| - if (@intFromEnum(b) == i) return @hasDecl(T, "requires_arg") and T.requires_arg; + if (@backingInt(b) == i) return @hasDecl(T, "requires_arg") and T.requires_arg; inline for (comptime settingList(), manualBuiltinCount()..) |setting, i| - if (@intFromEnum(b) == i) return switch (setting.action) { + if (@backingInt(b) == i) return switch (setting.action) { // a switch flips bare, a choice steps, and DumpDir and Shell bare // are the default .toggle, .transition, .scene, .dump_dir, .choice, .lift, .shader_animation, .motion, .shell => false, @@ -244,15 +244,15 @@ pub const registry = struct { pub fn scope(b: Builtin()) Scope { inline for (manualBuiltinList(), 0..) |T, i| - if (@intFromEnum(b) == i) return if (@hasDecl(T, "scope")) T.scope else .pane; + if (@backingInt(b) == i) return if (@hasDecl(T, "scope")) T.scope else .pane; return .session; // a setting } pub fn outputTraits(b: Builtin()) ?OutputTraits { inline for (manualBuiltinList(), 0..) |T, i| - if (@intFromEnum(b) == i) return if (@hasDecl(T, "output")) T.output else null; + if (@backingInt(b) == i) return if (@hasDecl(T, "output")) T.output else null; inline for (comptime settingList(), manualBuiltinCount()..) |_, i| - if (@intFromEnum(b) == i) return null; + if (@backingInt(b) == i) return null; unreachable; } @@ -260,15 +260,15 @@ pub const registry = struct { /// The ones that own that row themselves declare `quiet` and do not. pub fn announces(b: Builtin()) bool { inline for (manualBuiltinList(), 0..) |T, i| - if (@intFromEnum(b) == i) return !(@hasDecl(T, "quiet") and T.quiet); + if (@backingInt(b) == i) return !(@hasDecl(T, "quiet") and T.quiet); return true; // a setting builtin changes something invisible; say so } pub fn dispatch(b: Builtin(), c: Ctx) void { inline for (manualBuiltinList(), 0..) |T, i| - if (@intFromEnum(b) == i) return T.run(c); + if (@backingInt(b) == i) return T.run(c); inline for (comptime settingList(), manualBuiltinCount()..) |setting, i| - if (@intFromEnum(b) == i) return exec.applySettingBuiltin(c.p, setting, c.arg); + if (@backingInt(b) == i) return exec.applySettingBuiltin(c.p, setting, c.arg); unreachable; } }; diff --git a/src/detached/client.zig b/src/detached/client.zig index cf1842d9..60950208 100644 --- a/src/detached/client.zig +++ b/src/detached/client.zig @@ -1209,7 +1209,7 @@ test "detached session: a frontend is never asked to fork, write, or watch" { } const named = for (allowed) |ok| { const want = std.meta.stringToEnum(wire.ServerTag, ok).?; - if (@intFromEnum(want) == tag) break true; + if (@backingInt(want) == tag) break true; } else false; if (!named) { std.debug.print("tag 0x{x:0>2} is decodable by a frontend and is not one of the nine\n", .{tag}); diff --git a/src/detached/server.zig b/src/detached/server.zig index 79d1189a..41bc054f 100644 --- a/src/detached/server.zig +++ b/src/detached/server.zig @@ -1049,7 +1049,7 @@ pub const Session = struct { } fn apply(s: *Session, c: *Client, slot: u8, tag: u8, payload: []const u8) wire.Error!void { - if (tag == @intFromEnum(wire.ClientTag.hello)) { + if (tag == @backingInt(wire.ClientTag.hello)) { if (c.attached) return error.BadValue; const claimed = try wire.helloVersion(payload); if (claimed != wire.version) { @@ -1124,7 +1124,7 @@ pub const Session = struct { if (entry.scene == null) break true; } else false; const compiled = s.shaders.sync(s.gpa, s.io, s.core, if (files) s.inotify() else s.inotify_fd, &s.watches, .{ .ctx = &s.mailbox, .call = wakeForExit }); - const key = @as(u64, s.shaders.revision) << 8 | @intFromEnum(s.core.settings.shader_animation); + const key = @as(u64, s.shaders.revision) << 8 | @backingInt(s.core.settings.shader_animation); var chain: wire.Post = .{ .animation = s.core.settings.shader_animation, .len = s.core.settings.post.len }; _ = s.shaders.view(&s.core.settings.post, &chain.passes); for (&s.clients) |*c| { diff --git a/src/detached/wire.zig b/src/detached/wire.zig index f1b7a1b3..d57a28be 100644 --- a/src/detached/wire.zig +++ b/src/detached/wire.zig @@ -569,13 +569,13 @@ pub fn framed(buf: []const u8) Error!?Framed { fn putColor(w: *Writer, c: pardes.Color) Error!void { switch (c) { - .default => try w.putByte(@intFromEnum(ColorTag.default)), + .default => try w.putByte(@backingInt(ColorTag.default)), .index => |i| { - try w.putByte(@intFromEnum(ColorTag.index)); + try w.putByte(@backingInt(ColorTag.index)); try w.putByte(i); }, .rgb => |v| { - try w.putByte(@intFromEnum(ColorTag.rgb)); + try w.putByte(@backingInt(ColorTag.rgb)); try w.putBytes(&v); }, } @@ -606,7 +606,7 @@ const Ul = @FieldType(pardes.CellStyle, "ul"); /// the `inline else`, exactly as `clientTag` keeps the machine-local reports. fn putUl(w: *Writer, u: Ul) Error!void { try w.putByte(switch (u) { - inline else => |t| @intFromEnum(@field(UlTag, @tagName(t))), + inline else => |t| @backingInt(@field(UlTag, @tagName(t))), }); } @@ -618,7 +618,7 @@ fn getUl(r: *Reader) Error!Ul { fn putFont(w: *Writer, f: pardes.FontRole) Error!void { try w.putByte(switch (f) { - inline else => |t| @intFromEnum(@field(FontTag, @tagName(t))), + inline else => |t| @backingInt(@field(FontTag, @tagName(t))), }); } @@ -795,12 +795,12 @@ pub fn encodeFrameLayers(out: []u8, cols: u16, rows: u16, cursor: ?Cursor, point std.debug.assert(cells.len == @as(usize, cols) * @as(usize, rows)); const full = prev.len != cells.len; var w: Writer = .init(out); - const at = try beginMessage(&w, @intFromEnum(ServerTag.frame)); + const at = try beginMessage(&w, @backingInt(ServerTag.frame)); const header: FrameHeader = if (pointer_shape == .link) (if (full) .full_link else .diff_link) else (if (full) .full else .diff); - try w.putByte(@intFromEnum(header)); + try w.putByte(@backingInt(header)); try w.putU16(cols); try w.putU16(rows); try putCursor(&w, cursor, cols, rows); @@ -837,7 +837,7 @@ pub fn encodeFrameLayers(out: []u8, cols: u16, rows: u16, cursor: ?Cursor, point for (tags) |layer| { if (layer.rows == 0) continue; if (layer.cells.len != @as(usize, layer.cols) * layer.rows) return error.BadValue; - try w.putByte(@intFromEnum(layer.kind)); + try w.putByte(@backingInt(layer.kind)); try w.putU16(layer.id); try w.putU32(layer.serial); try w.putU16(layer.viewport.x); @@ -852,7 +852,7 @@ pub fn encodeFrameLayers(out: []u8, cols: u16, rows: u16, cursor: ?Cursor, point } try w.putU16(@intCast(regions.len)); for (regions) |region| { - try w.putByte(@intFromEnum(region.kind)); + try w.putByte(@backingInt(region.kind)); try w.putByte(region.owner); try w.putU32(region.serial); try w.putU16(region.rect.x); @@ -1003,7 +1003,7 @@ fn getBodyHit(r: *Reader) Error!?pardes.Mouse.BodyHit { fn putTagHit(w: *Writer, hit: ?pardes.TagHit) Error!void { try w.putBool(hit != null); if (hit) |h| { - try w.putByte(@intFromEnum(h.kind)); + try w.putByte(@backingInt(h.kind)); try w.putU16(h.id); try w.putU32(h.serial); try w.putU16(h.col); @@ -1030,7 +1030,7 @@ fn getTagHit(r: *Reader) Error!?pardes.TagHit { pub fn encodeClient(out: []u8, msg: ClientMsg) Error![]const u8 { var w: Writer = .init(out); - const at = try beginMessage(&w, @intFromEnum(clientTag(msg))); + const at = try beginMessage(&w, @backingInt(clientTag(msg))); switch (msg) { .hello => |h| { try w.putU16(h.version); @@ -1048,10 +1048,10 @@ pub fn encodeClient(out: []u8, msg: ClientMsg) Error![]const u8 { }, .mouse => |m| { try w.putByte(switch (m.button) { - inline else => |t| @intFromEnum(@field(ButtonTag, @tagName(t))), + inline else => |t| @backingInt(@field(ButtonTag, @tagName(t))), }); try w.putByte(switch (m.kind) { - inline else => |t| @intFromEnum(@field(KindTag, @tagName(t))), + inline else => |t| @backingInt(@field(KindTag, @tagName(t))), }); try w.putU16(m.col); try w.putU16(m.row); @@ -1164,7 +1164,7 @@ fn serverTag(msg: ServerMsg) ServerTag { /// payload is a walk of two grids rather than a value (see `encodeFrame`). pub fn encodeServer(out: []u8, msg: ServerMsg) Error![]const u8 { var w: Writer = .init(out); - const at = try beginMessage(&w, @intFromEnum(serverTag(msg))); + const at = try beginMessage(&w, @backingInt(serverTag(msg))); switch (msg) { .welcome => |v| { try w.putU16(v.version); @@ -1172,7 +1172,7 @@ pub fn encodeServer(out: []u8, msg: ServerMsg) Error![]const u8 { try w.putU16(v.cols); try w.putU16(v.rows); }, - .refuse => |why| try w.putByte(@intFromEnum(why)), + .refuse => |why| try w.putByte(@backingInt(why)), // A frame's runs are not a value this union can hold; the server calls // encodeFrame directly and this arm exists so the switch stays // exhaustive over ServerMsg. @@ -1182,11 +1182,11 @@ pub fn encodeServer(out: []u8, msg: ServerMsg) Error![]const u8 { .read_clipboard => {}, .open_link => |u| try w.putSlice16(u), .post => |p| { - try w.putByte(@intFromEnum(p.animation)); + try w.putByte(@backingInt(p.animation)); try w.putByte(p.len); for (p.list()) |pass| { // 0 a file, else a bundled scene and one. - try w.putByte(if (pass.scene) |scene| @as(u8, @intFromEnum(scene)) + 1 else 0); + try w.putByte(if (pass.scene) |scene| @as(u8, @backingInt(scene)) + 1 else 0); try w.putByte(pass.level); try w.putByte(@intFromBool(pass.animated)); try w.putU32(pass.revision); @@ -1341,9 +1341,9 @@ test "detached wire: every Event variant round-trips" { // The tag space is the protocol's own, so assert the numbers themselves: // a renumbering here breaks every deployed frontend and must be a diff // somebody reads, not a silent change. - try testing.expectEqual(@as(u8, 0x01), @intFromEnum(ClientTag.hello)); - try testing.expectEqual(@as(u8, 0x10), @intFromEnum(ClientTag.key)); - try testing.expectEqual(@as(u8, 0x1d), @intFromEnum(ClientTag.pointer_leave)); + try testing.expectEqual(@as(u8, 0x01), @backingInt(ClientTag.hello)); + try testing.expectEqual(@as(u8, 0x10), @backingInt(ClientTag.key)); + try testing.expectEqual(@as(u8, 0x1d), @backingInt(ClientTag.pointer_leave)); { const got = try roundClient(&buf, .{ .hello = .{ .cols = 80, .rows = 24 } }); @@ -1506,7 +1506,7 @@ test "detached wire: a session is never told to do a frontend's remembering" { } const named = for (allowed) |ok| { const want = std.meta.stringToEnum(ClientTag, ok).?; - if (@intFromEnum(want) == tag) break true; + if (@backingInt(want) == tag) break true; } else false; if (!named) { std.debug.print("tag 0x{x:0>2} is decodable by a session and is not something a human did\n", .{tag}); @@ -1752,8 +1752,8 @@ test "detached wire: a truncated frame is refused at every length" { for (0..header_len + 1) |cut| try testing.expectEqual(@as(?Framed, null), try framed(copy[0..cut])); // A payload with bytes LEFT OVER is refused too: it is not this message. - try testing.expectError(error.Trailing, decodeClient(@intFromEnum(ClientTag.pointer_leave), "x")); - try testing.expectError(error.Trailing, decodeServer(@intFromEnum(ServerTag.quit), "x")); + try testing.expectError(error.Trailing, decodeClient(@backingInt(ClientTag.pointer_leave), "x")); + try testing.expectError(error.Trailing, decodeServer(@backingInt(ServerTag.quit), "x")); } test "detached wire: an unknown tag is refused, never guessed" { @@ -1765,9 +1765,9 @@ test "detached wire: an unknown tag is refused, never guessed" { } // A tag NESTED in a payload gets the same treatment: a color, an // underline style, a mouse button, a refusal reason. - try testing.expectError(error.BadTag, decodeServer(@intFromEnum(ServerTag.refuse), &.{0x7f})); + try testing.expectError(error.BadTag, decodeServer(@backingInt(ServerTag.refuse), &.{0x7f})); try testing.expectError(error.BadTag, decodeClient( - @intFromEnum(ClientTag.mouse), + @backingInt(ClientTag.mouse), &.{ 0xff, 0x00, 0, 0, 0, 0, 0 }, )); } @@ -1775,7 +1775,7 @@ test "detached wire: an unknown tag is refused, never guessed" { test "detached wire: an over-long length prefix is refused before it is believed" { // The prefix a hostile or corrupt peer sends to make the receiver allocate // or index by it. `framed` must refuse rather than wait for 4 GiB. - var head: [header_len]u8 = .{ @intFromEnum(ClientTag.paste), 0, 0, 0, 0 }; + var head: [header_len]u8 = .{ @backingInt(ClientTag.paste), 0, 0, 0, 0 }; std.mem.writeInt(u32, head[1..5], max_payload + 1, .little); try testing.expectError(error.Overlong, framed(&head)); std.mem.writeInt(u32, head[1..5], std.math.maxInt(u32), .little); @@ -1789,10 +1789,10 @@ test "detached wire: an over-long length prefix is refused before it is believed var paste: [8]u8 = undefined; std.mem.writeInt(u32, paste[0..4], 4096, .little); @memcpy(paste[4..8], "abcd"); - try testing.expectError(error.Truncated, decodeClient(@intFromEnum(ClientTag.paste), &paste)); + try testing.expectError(error.Truncated, decodeClient(@backingInt(ClientTag.paste), &paste)); // ...and past the cap, which is refused rather than read. std.mem.writeInt(u32, paste[0..4], max_payload + 1, .little); - try testing.expectError(error.Overlong, decodeClient(@intFromEnum(ClientTag.paste), &paste)); + try testing.expectError(error.Overlong, decodeClient(@backingInt(ClientTag.paste), &paste)); } test "detached wire: a frame that lies about its runs cannot walk out of the grid" { @@ -1837,13 +1837,13 @@ test "detached wire: a frame that lies about its runs cannot walk out of the gri // it is used to bound the walk. var head: [frame_head]u8 = undefined; var w: Writer = .init(&head); - try w.putByte(@intFromEnum(FrameKind.diff)); + try w.putByte(@backingInt(FrameKind.diff)); try w.putU16(cols); try w.putU16(rows); try putCursor(&w, null, cols, rows); try w.putU32(0); // no body layers try w.putU32(9); - try testing.expectError(error.Overlong, decodeServer(@intFromEnum(ServerTag.frame), w.written())); + try testing.expectError(error.Overlong, decodeServer(@backingInt(ServerTag.frame), w.written())); // ...and a grid of the wrong size is the receiver's own bug, not a frame // it should paint half of. @@ -1885,7 +1885,7 @@ test "detached wire: a cursor outside the grid is refused, not painted" { var head: [frame_head]u8 = undefined; for ([_][2]u16{ .{ cols, 0 }, .{ 0, rows }, .{ 0xffff, 0xffff } }) |xy| { var w: Writer = .init(&head); - try w.putByte(@intFromEnum(FrameKind.diff)); + try w.putByte(@backingInt(FrameKind.diff)); try w.putU16(cols); try w.putU16(rows); // Written by hand: `putCursor` now refuses this too, which is the @@ -1897,19 +1897,19 @@ test "detached wire: a cursor outside the grid is refused, not painted" { try w.putU32(0); try testing.expectError( error.BadValue, - decodeServer(@intFromEnum(ServerTag.frame), w.written()), + decodeServer(@backingInt(ServerTag.frame), w.written()), ); } // The last cell IS in the grid, and a frame carrying it decodes. { var w: Writer = .init(&head); - try w.putByte(@intFromEnum(FrameKind.diff)); + try w.putByte(@backingInt(FrameKind.diff)); try w.putU16(cols); try w.putU16(rows); try putCursor(&w, .{ .x = cols - 1, .y = rows - 1, .bar = true }, cols, rows); try w.putU32(0); // no body layers try w.putU32(0); - const got = (try decodeServer(@intFromEnum(ServerTag.frame), w.written())).frame; + const got = (try decodeServer(@backingInt(ServerTag.frame), w.written())).frame; try testing.expectEqual(@as(u16, cols - 1), got.cursor.?.x); try testing.expectEqual(@as(u16, rows - 1), got.cursor.?.y); } @@ -1933,25 +1933,25 @@ test "detached wire: values a field cannot mean are refused" { // A bool is 0 or 1. `2` used to be "true" in every hand-written codec that // ever silently accepted a corrupt stream. try testing.expectError(error.BadValue, decodeClient( - @intFromEnum(ClientTag.key), + @backingInt(ClientTag.key), &.{ 'a', 0, 0, 0, 0, 0, 2, 0, 0 }, )); // A codepoint past Unicode's last: @intCast into Key.cp's u21 would panic. try testing.expectError(error.BadValue, decodeClient( - @intFromEnum(ClientTag.key), + @backingInt(ClientTag.key), &.{ 0x00, 0x00, 0x11, 0x00, 0, 0, 0, 0, 0 }, )); // A pane the core cannot index. `pdf_scroll` reads its pane byte before the // f32 that follows, so a one-byte payload reaches the check this is about // rather than tripping `Truncated` first. try testing.expectError(error.BadValue, decodeClient( - @intFromEnum(ClientTag.pdf_scroll), + @backingInt(ClientTag.pdf_scroll), &.{pardes.MAX_PANES}, )); // A zero-column grid would collapse a shared session; an over-wide one is // past what this protocol carries. try testing.expectError(error.BadValue, decodeClient( - @intFromEnum(ClientTag.hello), + @backingInt(ClientTag.hello), &.{ 1, 0, 0, 0, 24, 0 }, )); { @@ -1959,15 +1959,15 @@ test "detached wire: values a field cannot mean are refused" { std.mem.writeInt(u16, hello[0..2], version, .little); std.mem.writeInt(u16, hello[2..4], max_cols + 1, .little); std.mem.writeInt(u16, hello[4..6], 24, .little); - try testing.expectError(error.BadValue, decodeClient(@intFromEnum(ClientTag.hello), &hello)); + try testing.expectError(error.BadValue, decodeClient(@backingInt(ClientTag.hello), &hello)); } // A NaN scroll distance. `pinch` multiplies into a zoom the pane keeps. { var pinch: [4]u8 = undefined; std.mem.writeInt(u32, &pinch, @bitCast(std.math.nan(f32)), .little); - try testing.expectError(error.BadValue, decodeClient(@intFromEnum(ClientTag.pinch), &pinch)); + try testing.expectError(error.BadValue, decodeClient(@backingInt(ClientTag.pinch), &pinch)); std.mem.writeInt(u32, &pinch, @bitCast(std.math.inf(f32)), .little); - try testing.expectError(error.BadValue, decodeClient(@intFromEnum(ClientTag.touch_scroll), &pinch)); + try testing.expectError(error.BadValue, decodeClient(@backingInt(ClientTag.touch_scroll), &pinch)); } // A cell with the reserved attribute bit set, and one with an impossible // grapheme length. Both are bytes this protocol has no meaning for. diff --git a/src/diff.zig b/src/diff.zig index 362695d5..842a6b41 100644 --- a/src/diff.zig +++ b/src/diff.zig @@ -163,8 +163,8 @@ pub const Walk = struct { }; const meta_words = [_][]const u8{ - "index ", "new file mode ", "deleted file mode ", "old mode ", "new mode ", - "similarity index ", "rename from ", "rename to ", "copy from ", "copy to ", + "index ", "new file mode ", "deleted file mode ", "old mode ", "new mode ", + "similarity index ", "rename from ", "rename to ", "copy from ", "copy to ", "Binary files ", "dissimilarity ", }; diff --git a/src/draw.zig b/src/draw.zig index e6420ed4..22a8dc2a 100644 --- a/src/draw.zig +++ b/src/draw.zig @@ -564,7 +564,7 @@ pub fn render(p: *Pardes, arena: std.mem.Allocator) !*Surface { .accent = chrome.box, .sel_fg = p.theme().sel_fg, .sel_bg = p.theme().sel_bg, - .lift_style = @intFromEnum(liftStyle(p)), + .lift_style = @backingInt(liftStyle(p)), .rule_px = p.theme().rule_px orelse 2, .grip_border = boxBorder(p), .grip_focus_ring = chrome.box, @@ -1167,7 +1167,7 @@ fn renderHeaderLayer(p: *Pardes, arena: std.mem.Allocator, layer: *pardes.Layer, const start = modal.lineStartOffset(text, index + top); const end = start + shown.len; if (mine and swept.lo < swept.hi and swept.hi > start and swept.lo < end) { - const button = @intFromEnum(sweep.button); + const button = @backingInt(sweep.button); var col = panes.File.rawDisplayCol(shown, @max(swept.lo, start) - start) -| scroll; const stop = panes.File.rawDisplayCol(shown, @min(swept.hi, end) - start) -| scroll; while (col < stop and col < columns) : (col += 1) { diff --git a/src/dump.zig b/src/dump.zig index 545d09ec..76a6de85 100644 --- a/src/dump.zig +++ b/src/dump.zig @@ -1100,7 +1100,7 @@ test "a restored session's column and workspace tags take more than one selectio try std.testing.expect(restored.col_tags[0].reserveSels()); try std.testing.expect(restored.global_tag.reserveSels()); try std.testing.expect(restored.fs.started != 0); - const stat = th.call(restored, .{ .tag = 1, .op = .getattr, .node = @intFromEnum(pardes.ctlfs.TopFile.index) }); + const stat = th.call(restored, .{ .tag = 1, .op = .getattr, .node = @backingInt(pardes.ctlfs.TopFile.index) }); try std.testing.expect(stat.reply.attr.mtime != 0); } @@ -1146,7 +1146,7 @@ test "a pane restored with unsaved text is asked about by Exit, Restore, Del and const node = if (std.mem.eql(u8, word, "Del") or std.mem.eql(u8, word, "get")) ctlfs.Node.of(restored.panes[id].?.serial, .ctl) else - @intFromEnum(ctlfs.TopFile.ctl); + @backingInt(ctlfs.TopFile.ctl); const line = if (std.mem.eql(u8, word, "Restore")) try std.fmt.bufPrint(&restore_line, "Restore {s}/d.zon\n", .{dir}) else if (std.mem.eql(u8, word, "Exit")) "Exit\n" else if (std.mem.eql(u8, word, "Del")) "Del\n" else "get\n"; const answer = th.wr(restored, node, line); try std.testing.expectEqual(ctlfs.Status.err, answer.reply.status); diff --git a/src/edit_cmd.zig b/src/edit_cmd.zig index d3377e09..447ea66b 100644 --- a/src/edit_cmd.zig +++ b/src/edit_cmd.zig @@ -495,7 +495,7 @@ test "Edit , | sort runs off the loop, through the session's shell in the file's try testing.expectEqualStrings(@import("ninep/ctl.zig").e_after_edit, after.reply.ename); try testing.expect(p.pipe.edit_run == null and !th.logHas(p, "before")); } - try testing.expectEqual(tree.E.INVAL, th.wr(p, @intFromEnum(tree.TopFile.exec), "Msg before\nEdit , | sort\n").errno()); + try testing.expectEqual(tree.E.INVAL, th.wr(p, @backingInt(tree.TopFile.exec), "Msg before\nEdit , | sort\n").errno()); } test "the held write asked again is parked again, then answered once, and a flush stops the Edit" { diff --git a/src/esp32p4.zig b/src/esp32p4.zig index ed18efd9..683d19e1 100644 --- a/src/esp32p4.zig +++ b/src/esp32p4.zig @@ -134,19 +134,19 @@ pub const GpioFn = *const fn (ctx: ?*anyopaque, pin: u16, was: *u8, now: *u8) ca var host_alloc: Allocator = undefined; fn hostAlloc(_: *anyopaque, len: usize, alignment: std.mem.Alignment, _: usize) ?[*]u8 { - return host_alloc.alloc(host_alloc.ctx, len, @intFromEnum(alignment)); + return host_alloc.alloc(host_alloc.ctx, len, @backingInt(alignment)); } fn hostResize(_: *anyopaque, mem: []u8, alignment: std.mem.Alignment, new_len: usize, _: usize) bool { - return host_alloc.resize(host_alloc.ctx, mem.ptr, mem.len, @intFromEnum(alignment), new_len); + return host_alloc.resize(host_alloc.ctx, mem.ptr, mem.len, @backingInt(alignment), new_len); } fn hostRemap(_: *anyopaque, mem: []u8, alignment: std.mem.Alignment, new_len: usize, _: usize) ?[*]u8 { - return if (host_alloc.resize(host_alloc.ctx, mem.ptr, mem.len, @intFromEnum(alignment), new_len)) mem.ptr else null; + return if (host_alloc.resize(host_alloc.ctx, mem.ptr, mem.len, @backingInt(alignment), new_len)) mem.ptr else null; } fn hostFree(_: *anyopaque, mem: []u8, alignment: std.mem.Alignment, _: usize) void { - host_alloc.free(host_alloc.ctx, mem.ptr, mem.len, @intFromEnum(alignment)); + host_alloc.free(host_alloc.ctx, mem.ptr, mem.len, @backingInt(alignment)); } const host_vtable: std.mem.Allocator.VTable = .{ @@ -447,19 +447,21 @@ fn apply(c: *pardes.Pardes, ev: vaxis.Event) void { else => null, }; if (button) |b| { - c.update(.{ .mouse = .{ - .button = b, - .kind = switch (m.type) { - .press => .press, - .release => .release, - .motion => .motion, - .drag => .drag, + c.update(.{ + .mouse = .{ + .button = b, + .kind = switch (m.type) { + .press => .press, + .release => .release, + .motion => .motion, + .drag => .drag, + }, + // Before the first cell (a drag past the edge): the edge. + .col = @intCast(@max(0, m.col)), + .row = @intCast(@max(0, m.row)), + .ctrl = m.mods.ctrl, }, - // Before the first cell (a drag past the edge): the edge. - .col = @intCast(@max(0, m.col)), - .row = @intCast(@max(0, m.row)), - .ctrl = m.mods.ctrl, - } }); + }); dirty = true; } }, diff --git a/src/esp32p4/app.zig b/src/esp32p4/app.zig index 4ee131ec..800e7597 100644 --- a/src/esp32p4/app.zig +++ b/src/esp32p4/app.zig @@ -235,17 +235,17 @@ var gpa_heap: heapmod.Heap = undefined; fn cAlloc(_: ?*anyopaque, len: usize, log2_align: u8) callconv(.c) ?[*]u8 { const a = gpa_heap.allocator(); - return a.vtable.alloc(a.ptr, len, @enumFromInt(log2_align), @returnAddress()); + return a.vtable.alloc(a.ptr, len, @fromBackingInt(@intCast(log2_align)), @returnAddress()); } fn cResize(_: ?*anyopaque, ptr: [*]u8, len: usize, log2_align: u8, new_len: usize) callconv(.c) bool { const a = gpa_heap.allocator(); - return a.vtable.resize(a.ptr, ptr[0..len], @enumFromInt(log2_align), new_len, @returnAddress()); + return a.vtable.resize(a.ptr, ptr[0..len], @fromBackingInt(@intCast(log2_align)), new_len, @returnAddress()); } fn cFree(_: ?*anyopaque, ptr: [*]u8, len: usize, log2_align: u8) callconv(.c) void { const a = gpa_heap.allocator(); - a.vtable.free(a.ptr, ptr[0..len], @enumFromInt(log2_align), @returnAddress()); + a.vtable.free(a.ptr, ptr[0..len], @fromBackingInt(@intCast(log2_align)), @returnAddress()); } const editor_allocator: Allocator = .{ diff --git a/src/esp32p4_9p.zig b/src/esp32p4_9p.zig index cd59b9df..5fcab85b 100644 --- a/src/esp32p4_9p.zig +++ b/src/esp32p4_9p.zig @@ -103,7 +103,7 @@ fn die(msg: []const u8) noreturn { .{ .rerror = .{ .ename = msg[0..@min(msg.len, ninep.errmax)] } }, ninep.notag, &buf, - // unreachable: the message is cut to errmax and buf is sized to it + // unreachable: the message is cut to errmax and buf is sized to it ) catch unreachable; uart.write(bytes); while (true) {} diff --git a/src/fonts.zig b/src/fonts.zig index 098bf36f..88cde63a 100644 --- a/src/fonts.zig +++ b/src/fonts.zig @@ -324,7 +324,7 @@ fn sfntBase(head: []const u8) ?usize { fn scratchFont(buf: *[64:0]u8, ext: []const u8) [:0]const u8 { return std.fmt.bufPrintSentinel(buf, "/tmp/pardes-fonts-test-{d}{s}", .{ @as(u32, @intCast(libc.getpid())), ext, - // unreachable: 23 bytes, a u32 pid (10) and a short extension fit 64 + // unreachable: 23 bytes, a u32 pid (10) and a short extension fit 64 }, 0) catch unreachable; } diff --git a/src/gui/Post.zig b/src/gui/Post.zig index 8d0e14d9..17e8d7e9 100644 --- a/src/gui/Post.zig +++ b/src/gui/Post.zig @@ -623,15 +623,15 @@ test "the uniform block is ghostty's, offset for offset, and the prefix names it try std.testing.expectEqual(@offsetOf(GhosttyUniforms, "selection_background_color"), @offsetOf(Uniforms, "selection_foreground_color")); // The prefix's block, member by member, in ghostty's GLSL names and types. const glsl = [_]struct { []const u8, []const u8 }{ - .{ "vec3", "iResolution" }, .{ "float", "iTime" }, .{ "float", "iTimeDelta" }, - .{ "float", "iFrameRate" }, .{ "int", "iFrame" }, .{ "float", "iChannelTime[4]" }, - .{ "vec3", "iChannelResolution[4]" }, .{ "vec4", "iMouse" }, .{ "vec4", "iDate" }, - .{ "float", "iSampleRate" }, .{ "vec4", "iCurrentCursor" }, .{ "vec4", "iPreviousCursor" }, - .{ "vec4", "iCurrentCursorColor" }, .{ "vec4", "iPreviousCursorColor" }, .{ "int", "iCurrentCursorStyle" }, - .{ "int", "iPreviousCursorStyle" }, .{ "int", "iCursorVisible" }, .{ "float", "iTimeCursorChange" }, - .{ "float", "iTimeFocus" }, .{ "int", "iFocus" }, .{ "vec3", "iPalette[256]" }, - .{ "vec3", "iBackgroundColor" }, .{ "vec3", "iForegroundColor" }, .{ "vec3", "iCursorColor" }, - .{ "vec3", "iCursorText" }, .{ "vec3", "iSelectionForegroundColor" }, .{ "vec3", "iSelectionBackgroundColor" }, + .{ "vec3", "iResolution" }, .{ "float", "iTime" }, .{ "float", "iTimeDelta" }, + .{ "float", "iFrameRate" }, .{ "int", "iFrame" }, .{ "float", "iChannelTime[4]" }, + .{ "vec3", "iChannelResolution[4]" }, .{ "vec4", "iMouse" }, .{ "vec4", "iDate" }, + .{ "float", "iSampleRate" }, .{ "vec4", "iCurrentCursor" }, .{ "vec4", "iPreviousCursor" }, + .{ "vec4", "iCurrentCursorColor" }, .{ "vec4", "iPreviousCursorColor" }, .{ "int", "iCurrentCursorStyle" }, + .{ "int", "iPreviousCursorStyle" }, .{ "int", "iCursorVisible" }, .{ "float", "iTimeCursorChange" }, + .{ "float", "iTimeFocus" }, .{ "int", "iFocus" }, .{ "vec3", "iPalette[256]" }, + .{ "vec3", "iBackgroundColor" }, .{ "vec3", "iForegroundColor" }, .{ "vec3", "iCursorColor" }, + .{ "vec3", "iCursorText" }, .{ "vec3", "iSelectionForegroundColor" }, .{ "vec3", "iSelectionBackgroundColor" }, }; try std.testing.expectEqual(ours.field_names.len, glsl.len); // Its three blocks (Globals, Palette, Colors) read as one, in order. @@ -673,7 +673,6 @@ test "a moved cursor becomes the previous one, stamped with the time of the move try std.testing.expectEqual([4]f32{ 1.0 / 255.0, 2.0 / 255.0, 3.0 / 255.0, 1 }, post.uniforms.selection_foreground_color); } - test "a still pass asks for no idle frames; one that reads the clock does" { var post: Post = .{}; const fake: *Pipeline = @ptrFromInt(0x1000); diff --git a/src/gui/gui.zig b/src/gui/gui.zig index b8687fd3..f0dd0682 100644 --- a/src/gui/gui.zig +++ b/src/gui/gui.zig @@ -1888,7 +1888,6 @@ const Gui = struct { sel_glow: SelGlow = .{}, hover_glow: SelGlow = .{}, /// G14: the cells last drawn and when each last changed. - /// The cursor's blink (blinkNow): when the frame drawn last arrived, /// a redraw owed for an edge, and this frame's cursor mode and alpha. frame_arrival_ns: u64 = 0, @@ -2291,7 +2290,7 @@ fn setTransitionFields( instance.present_y0 = presented[1]; instance.present_x1 = presented[2]; instance.present_y1 = presented[3]; - instance.effect = @intFromEnum(active.effect); + instance.effect = @backingInt(active.effect); instance.progress_bits = @bitCast(active.amount()); instance.serial = active.serial; instance.cell_coord = cell_coord; @@ -3356,8 +3355,8 @@ fn setStdinRaw() !void { term.lflag.ICANON = false; term.lflag.IEXTEN = false; term.lflag.ISIG = false; - term.cc[@intFromEnum(posix.V.MIN)] = 1; - term.cc[@intFromEnum(posix.V.TIME)] = 0; + term.cc[@backingInt(posix.V.MIN)] = 1; + term.cc[@backingInt(posix.V.TIME)] = 0; try posix.tcsetattr(0, .NOW, term); } @@ -5484,7 +5483,6 @@ test "a notch scrolls the core at once and the picture glides after it, a wrappe try std.testing.expect(!g.glide.pending and !g.glide.moving()); } - fn resetScroll(g: *Gui) void { g.scroll_pane = null; g.scroll_delta = 0; @@ -5519,13 +5517,15 @@ fn stepScroll(g: *Gui, core: *pardes.Pardes, gpa: std.mem.Allocator) void { const down = left > 0; left += if (down) -1 else 1; const was = pane.scroll(); - core.update(.{ .mouse = .{ - .button = if (down) .wheel_down else .wheel_up, - .kind = .press, - .col = g.scroll_col, - .row = g.scroll_row, - .shift = true, // pardes's own scroll, never a program's wheel - } }); + core.update(.{ + .mouse = .{ + .button = if (down) .wheel_down else .wheel_up, + .kind = .press, + .col = g.scroll_col, + .row = g.scroll_row, + .shift = true, // pardes's own scroll, never a program's wheel + }, + }); if (pane.scroll() == was) { resetScroll(g); return; @@ -7251,7 +7251,7 @@ test "a rising pane past its mark stays inside its box" { var g: Gui = undefined; g.cell_w = 10; g.cell_h = 20; - var track: pardes.animation.Track = .{ .serial = 3, .phase = .opening, .effect = .vertical, .motion = @intFromEnum(pardes.animation.Motion.Flavour.bouncy) + 1, .frame_count = 20, .from = .{ .x = 0, .y = 10, .w = 40, .h = 10 }, .to = .{ .x = 0, .y = 0, .w = 40, .h = 10 } }; + var track: pardes.animation.Track = .{ .serial = 3, .phase = .opening, .effect = .vertical, .motion = @backingInt(pardes.animation.Motion.Flavour.bouncy) + 1, .frame_count = 20, .from = .{ .x = 0, .y = 10, .w = 40, .h = 10 }, .to = .{ .x = 0, .y = 0, .w = 40, .h = 10 } }; var peak: u16 = 0; var highest: f32 = 1e9; while (track.frame < track.frames()) : (track.frame += 1) { @@ -8788,7 +8788,6 @@ fn addPattern(g: *Gui, gpa: std.mem.Allocator, x0: f32, y0: f32, x1: f32, y1: f3 instance.effect |= checker_bit; } - /// How a lift of 0 to 1 stands off the page: the shadow's blur and offset /// in cell heights, and its darkest, where it leaves the caster's edge. /// Within §8.2's budget: sigma 0.4-0.8 cell, at most 30% darker at the edge. @@ -8926,7 +8925,6 @@ fn clipToBodies(g: *Gui, gpa: std.mem.Allocator, first: usize, bodies: []const [ }; } - /// Like shadowCeiling for a light colour laid over at `a` (sRGB blend, as /// the decor pipeline blends a colour that is not black): the largest `a` /// that keeps text and page apart by min(their contrast, 4.5). @@ -10099,7 +10097,7 @@ test "decor is read from the regions, each pane's in its own group" { try std.testing.expect(tracked.decor_count >= 4); try std.testing.expectEqual(still, groups.items[0].decor_count + tracked.decor_count); for (g.decor.items[tracked.decor_start..][0..tracked.decor_count]) |item| - try std.testing.expectEqual(@as(u32, @intFromEnum(pardes.animation.Transition.slide)), item.effect); + try std.testing.expectEqual(@as(u32, @backingInt(pardes.animation.Transition.slide)), item.effect); // Cursors stand still while panes move. try std.testing.expectEqual(@as(u32, 0), groups.items[groups.ink].decor_count); } @@ -10468,7 +10466,7 @@ fn appendCursorGlide(g: *Gui, surface: *const pardes.Surface, builder: *OverlayB fn appendWorkspacePet(g: *Gui, core: ?*const pardes.Pardes, surface: *const pardes.Surface, builder: *OverlayBuilder) void { const p = core orelse return; - const kind: pet.Kind = @enumFromInt(@intFromEnum(p.settings.pet)); + const kind: pet.Kind = @fromBackingInt(@intCast(@backingInt(p.settings.pet))); if (kind == .off or surface.rows == 0 or surface.cols == 0) { g.pet_state = .{}; return; diff --git a/src/host_io.zig b/src/host_io.zig index d789a77d..bef88172 100644 --- a/src/host_io.zig +++ b/src/host_io.zig @@ -572,7 +572,7 @@ pub const Shell = struct { const name = std.mem.sliceTo(@as([*:0]const u8, @ptrCast(&ent.name)), 0); const pid = rcPid(name) orelse continue; if (pid == std.c.getpid()) continue; - if (std.posix.errno(std.c.kill(pid, @enumFromInt(0))) != .SRCH) continue; + if (std.posix.errno(std.c.kill(pid, @fromBackingInt(@intCast(0)))) != .SRCH) continue; if (name.len >= 64 or n == dead.len) continue; @memcpy(dead[n][0..name.len], name); dead_len[n] = name.len; @@ -1236,8 +1236,8 @@ pub fn resetChildSignals() void { const default: posix.Sigaction = .{ .handler = .{ .handler = posix.SIG.DFL }, .mask = posix.sigemptyset(), .flags = 0 }; var sig: u8 = 1; while (sig < 65) : (sig += 1) { - if (sig == @intFromEnum(posix.SIG.KILL) or sig == @intFromEnum(posix.SIG.STOP)) continue; - _ = std.c.sigaction(@enumFromInt(sig), &default, null); + if (sig == @backingInt(posix.SIG.KILL) or sig == @backingInt(posix.SIG.STOP)) continue; + _ = std.c.sigaction(@fromBackingInt(@intCast(sig)), &default, null); } const none = posix.sigemptyset(); posix.sigprocmask(posix.SIG.SETMASK, &none, null); @@ -1620,13 +1620,13 @@ pub fn forkShell( if (pid == 0) { resetChildSignals(); if (cwd_z) |path| if (chdir(path.ptr) != 0) { - const why = [_]u8{ 'c', @truncate(@intFromEnum(libc.errno(@as(c_int, -1)))) }; + const why = [_]u8{ 'c', @truncate(@backingInt(libc.errno(@as(c_int, -1)))) }; _ = libc.write(told[1], &why, why.len); _exit(126); }; if (envp) |env| _ = execve(spawn.path, &spawn.argv, env); _ = execv(spawn.path, &spawn.argv); - const why = [_]u8{ 'x', @truncate(@intFromEnum(libc.errno(@as(c_int, -1)))) }; + const why = [_]u8{ 'x', @truncate(@backingInt(libc.errno(@as(c_int, -1)))) }; _ = libc.write(told[1], &why, why.len); _exit(127); } @@ -1643,7 +1643,7 @@ pub fn forkShell( if (failed) |why| { _ = libc.close(master); _ = libc.waitpid(pid, null, 0); - const e: libc.E = @enumFromInt(why[1]); + const e: libc.E = @fromBackingInt(@intCast(why[1])); if (why[0] == 'c') return if (e == .NOENT or e == .NOTDIR) error.FileNotFound else error.AccessDenied; return switch (e) { // Itself, or its script's interpreter: told apart by whether it @@ -2167,7 +2167,7 @@ pub fn reapExited(pid: libc.pid_t) ?struct { status: ?u8 } { if (got != pid) return .{ .status = null }; const s: u32 = @bitCast(status); if (libc.W.IFEXITED(s)) return .{ .status = @truncate(libc.W.EXITSTATUS(s)) }; - if (libc.W.IFSIGNALED(s)) return .{ .status = @truncate(128 + @as(u32, @intFromEnum(libc.W.TERMSIG(s)))) }; + if (libc.W.IFSIGNALED(s)) return .{ .status = @truncate(128 + @as(u32, @backingInt(libc.W.TERMSIG(s)))) }; return .{ .status = null }; } @@ -2194,7 +2194,7 @@ pub fn exitStatus(pid: libc.pid_t, wait_ms: u32) ?u8 { if (got == pid) { const s: u32 = @bitCast(status); if (libc.W.IFEXITED(s)) return @truncate(libc.W.EXITSTATUS(s)); - if (libc.W.IFSIGNALED(s)) return @truncate(128 + @as(u32, @intFromEnum(libc.W.TERMSIG(s)))); + if (libc.W.IFSIGNALED(s)) return @truncate(128 + @as(u32, @backingInt(libc.W.TERMSIG(s)))); return null; } if (got < 0 or waited >= wait_ms) return null; @@ -2722,8 +2722,8 @@ test "a retired shell that ignores the hangup is killed and reaped, not left a z retireShell(pid); // A zombie still answers kill(pid, 0); only a reaped pid is gone. var waited: i64 = 0; - while (libc.kill(pid, @enumFromInt(0)) == 0 and waited < 2000) : (waited += 10) sleepMs(10); - try std.testing.expect(libc.kill(pid, @enumFromInt(0)) != 0); + while (libc.kill(pid, @fromBackingInt(@intCast(0))) == 0 and waited < 2000) : (waited += 10) sleepMs(10); + try std.testing.expect(libc.kill(pid, @fromBackingInt(@intCast(0))) != 0); try std.testing.expect(waited >= 90); // it did ignore the hangup } diff --git a/src/linux/v9fs.zig b/src/linux/v9fs.zig index 15945e7b..0d1e2e33 100644 --- a/src/linux/v9fs.zig +++ b/src/linux/v9fs.zig @@ -89,7 +89,7 @@ var sudo_pid: std.atomic.Value(c_int) = .init(-1); fn forwardSignal(sig: std.posix.SIG) callconv(.c) void { const pid = sudo_pid.load(.monotonic); - if (pid > 0) _ = kill(pid, @intCast(@intFromEnum(sig))); + if (pid > 0) _ = kill(pid, @intCast(@backingInt(sig))); } fn launch(arena: std.mem.Allocator, args: []const [:0]const u8) !u8 { @@ -123,8 +123,8 @@ fn launch(arena: std.mem.Allocator, args: []const [:0]const u8) !u8 { const default: std.posix.Sigaction = .{ .handler = .{ .handler = std.posix.SIG.DFL }, .mask = std.posix.sigemptyset(), .flags = 0 }; var sig: u8 = 1; while (sig < 65) : (sig += 1) { - if (sig == @intFromEnum(std.posix.SIG.KILL) or sig == @intFromEnum(std.posix.SIG.STOP)) continue; - _ = std.c.sigaction(@enumFromInt(sig), &default, null); + if (sig == @backingInt(std.posix.SIG.KILL) or sig == @backingInt(std.posix.SIG.STOP)) continue; + _ = std.c.sigaction(@fromBackingInt(@intCast(sig)), &default, null); } const none = std.posix.sigemptyset(); std.posix.sigprocmask(std.posix.SIG.SETMASK, &none, null); diff --git a/src/look.zig b/src/look.zig index f9c470cf..f4fbe52e 100644 --- a/src/look.zig +++ b/src/look.zig @@ -2555,7 +2555,7 @@ test "every entry point to Look takes one expansion: a diff line and a file:12:5 const line = modal.lineSlice(case.text, case.row); // A diff line written whole; a place, as a script writes it. const written = if (std.mem.eql(u8, case.name, "change.diff")) line else line[case.sweep[0] .. case.sweep[1] + 1]; - _ = th.wr(p, @intFromEnum(pardes.ctlfs.TopFile.look), written); + _ = th.wr(p, @backingInt(pardes.ctlfs.TopFile.look), written); }, .event_write_back => { const body = pane.file.?.content; diff --git a/src/macos.zig b/src/macos.zig index 37db0abd..21af41ae 100644 --- a/src/macos.zig +++ b/src/macos.zig @@ -1717,18 +1717,20 @@ fn mouseWithHit(button_arg: c_int, kind_arg: c_int, col: u16, row: u16, mods: u3 3 => .drag, else => return, }; - st.core.update(.{ .mouse = .{ - .body_hit = hit, - .tag_hit = tag_hit, - .button = button, - .kind = kind, - .col = col, - .row = row, - .ctrl = mods & 1 != 0, - // Option-click is B2 and Cmd-click B3 (mouse.emulateButton). - .alt = mods & 2 != 0, - .super = mods & 8 != 0, - } }); + st.core.update(.{ + .mouse = .{ + .body_hit = hit, + .tag_hit = tag_hit, + .button = button, + .kind = kind, + .col = col, + .row = row, + .ctrl = mods & 1 != 0, + // Option-click is B2 and Cmd-click B3 (mouse.emulateButton). + .alt = mods & 2 != 0, + .super = mods & 8 != 0, + }, + }); } export fn pardes_pointer_leave() void { @@ -2156,7 +2158,7 @@ export fn pardes_tag_layer_value(index: u32, field: u32) u32 { const layer = &st.core.surface.tag_layers[index]; return switch (field) { 0 => layer.cols, - 1 => @intFromEnum(layer.kind), + 1 => @backingInt(layer.kind), 2 => layer.id, 3 => layer.serial, 4 => layer.viewport.x, @@ -2238,7 +2240,7 @@ export fn pardes_pointer_shape() u32 { pardes.turn.wake(); defer pardes.turn.rest(); const st = &(state orelse return 0); - return @intFromEnum(st.core.surface.pointer_shape); + return @backingInt(st.core.surface.pointer_shape); } export fn pardes_cursor_y() i32 { @@ -2646,7 +2648,7 @@ fn encodeAttrs(style: pardes.CellStyle) u16 { attrs |= @as(u16, @intFromBool(style.reverse)) << 4; attrs |= @as(u16, @intFromBool(style.invisible)) << 5; attrs |= @as(u16, @intFromBool(style.strikethrough)) << 6; - attrs |= @as(u16, @intFromEnum(style.ul)) << 8; + attrs |= @as(u16, @backingInt(style.ul)) << 8; return attrs; } @@ -2896,21 +2898,21 @@ test "pardes.h matches the Zig boundary" { try expectEqual(@as(u8, c.PARDES_CELL_HOVER), cell_flag_hover); try expectEqual(@as(u16, c.PARDES_TOPBAR_H), pardes.TOPBAR_H); try expectEqual(@as(u32, c.PARDES_SCENE_CRT), scene_flag_crt); - try expectEqual(@as(u8, c.PARDES_PANEL_OPENING), @intFromEnum(animation.Phase.opening)); - try expectEqual(@as(u8, c.PARDES_PANEL_MOVING), @intFromEnum(animation.Phase.moving)); - try expectEqual(@as(u8, c.PARDES_PANEL_CLOSING), @intFromEnum(animation.Phase.closing)); - try expectEqual(@as(u8, c.PARDES_PANEL_OFF), @intFromEnum(animation.Transition.off)); - try expectEqual(@as(u8, c.PARDES_PANEL_SLIDE), @intFromEnum(animation.Transition.slide)); - try expectEqual(@as(u8, c.PARDES_PANEL_ZOOM), @intFromEnum(animation.Transition.zoom)); - try expectEqual(@as(u8, c.PARDES_PANEL_DISSOLVE), @intFromEnum(animation.Transition.dissolve)); - try expectEqual(@as(u8, c.PARDES_PANEL_ASCII), @intFromEnum(animation.Transition.ascii)); - try expectEqual(@as(u8, c.PARDES_PANEL_VERTICAL), @intFromEnum(animation.Transition.vertical)); - try expectEqual(@as(u8, c.PARDES_PANEL_EDGES), @intFromEnum(animation.Transition.edges)); - try expectEqual(@as(u8, c.PARDES_PANEL_FALL), @intFromEnum(animation.Transition.fall)); - try expectEqual(@as(u8, c.PARDES_PANEL_WAVE), @intFromEnum(animation.Transition.wave)); - try expectEqual(@as(u8, c.PARDES_PANEL_CURTAIN), @intFromEnum(animation.Transition.curtain)); - try expectEqual(@as(u8, c.PARDES_PANEL_SCRAMBLE), @intFromEnum(animation.Transition.scramble)); - try expectEqual(@as(u8, c.PARDES_PANEL_TYPEWRITER), @intFromEnum(animation.Transition.typewriter)); + try expectEqual(@as(u8, c.PARDES_PANEL_OPENING), @backingInt(animation.Phase.opening)); + try expectEqual(@as(u8, c.PARDES_PANEL_MOVING), @backingInt(animation.Phase.moving)); + try expectEqual(@as(u8, c.PARDES_PANEL_CLOSING), @backingInt(animation.Phase.closing)); + try expectEqual(@as(u8, c.PARDES_PANEL_OFF), @backingInt(animation.Transition.off)); + try expectEqual(@as(u8, c.PARDES_PANEL_SLIDE), @backingInt(animation.Transition.slide)); + try expectEqual(@as(u8, c.PARDES_PANEL_ZOOM), @backingInt(animation.Transition.zoom)); + try expectEqual(@as(u8, c.PARDES_PANEL_DISSOLVE), @backingInt(animation.Transition.dissolve)); + try expectEqual(@as(u8, c.PARDES_PANEL_ASCII), @backingInt(animation.Transition.ascii)); + try expectEqual(@as(u8, c.PARDES_PANEL_VERTICAL), @backingInt(animation.Transition.vertical)); + try expectEqual(@as(u8, c.PARDES_PANEL_EDGES), @backingInt(animation.Transition.edges)); + try expectEqual(@as(u8, c.PARDES_PANEL_FALL), @backingInt(animation.Transition.fall)); + try expectEqual(@as(u8, c.PARDES_PANEL_WAVE), @backingInt(animation.Transition.wave)); + try expectEqual(@as(u8, c.PARDES_PANEL_CURTAIN), @backingInt(animation.Transition.curtain)); + try expectEqual(@as(u8, c.PARDES_PANEL_SCRAMBLE), @backingInt(animation.Transition.scramble)); + try expectEqual(@as(u8, c.PARDES_PANEL_TYPEWRITER), @backingInt(animation.Transition.typewriter)); try expectEqual(@as(u21, c.PARDES_KEY_ENTER), pardes.Key.enter); try expectEqual(@as(u21, c.PARDES_KEY_ESCAPE), pardes.Key.escape); @@ -2926,24 +2928,24 @@ test "pardes.h matches the Zig boundary" { try expectEqual(@as(u21, c.PARDES_KEY_PAGE_DOWN), pardes.Key.page_down); try expectEqual(@as(u21, c.PARDES_KEY_DELETE), pardes.Key.delete); - try expectEqual(c.PARDES_MOUSE_LEFT, @intFromEnum(pardes.Mouse.Button.left)); - try expectEqual(c.PARDES_MOUSE_MIDDLE, @intFromEnum(pardes.Mouse.Button.middle)); - try expectEqual(c.PARDES_MOUSE_RIGHT, @intFromEnum(pardes.Mouse.Button.right)); - try expectEqual(c.PARDES_MOUSE_WHEEL_UP, @intFromEnum(pardes.Mouse.Button.wheel_up)); - try expectEqual(c.PARDES_MOUSE_WHEEL_DOWN, @intFromEnum(pardes.Mouse.Button.wheel_down)); - try expectEqual(c.PARDES_MOUSE_WHEEL_LEFT, @intFromEnum(pardes.Mouse.Button.wheel_left)); - try expectEqual(c.PARDES_MOUSE_WHEEL_RIGHT, @intFromEnum(pardes.Mouse.Button.wheel_right)); - try expectEqual(c.PARDES_MOUSE_NONE, @intFromEnum(pardes.Mouse.Button.none)); - try expectEqual(c.PARDES_MOUSE_BACK, @intFromEnum(pardes.Mouse.Button.back)); - try expectEqual(c.PARDES_MOUSE_FORWARD, @intFromEnum(pardes.Mouse.Button.forward)); - try expectEqual(c.PARDES_MOUSE_PRESS, @intFromEnum(pardes.Mouse.Kind.press)); - try expectEqual(c.PARDES_MOUSE_RELEASE, @intFromEnum(pardes.Mouse.Kind.release)); - try expectEqual(c.PARDES_MOUSE_MOTION, @intFromEnum(pardes.Mouse.Kind.motion)); - try expectEqual(c.PARDES_MOUSE_DRAG, @intFromEnum(pardes.Mouse.Kind.drag)); - - try expectEqual(c.PARDES_HAPTIC_NONE, @intFromEnum(pardes.Haptic.none)); - try expectEqual(c.PARDES_HAPTIC_EXEC, @intFromEnum(pardes.Haptic.exec)); - try expectEqual(c.PARDES_HAPTIC_LOOK, @intFromEnum(pardes.Haptic.look)); + try expectEqual(c.PARDES_MOUSE_LEFT, @backingInt(pardes.Mouse.Button.left)); + try expectEqual(c.PARDES_MOUSE_MIDDLE, @backingInt(pardes.Mouse.Button.middle)); + try expectEqual(c.PARDES_MOUSE_RIGHT, @backingInt(pardes.Mouse.Button.right)); + try expectEqual(c.PARDES_MOUSE_WHEEL_UP, @backingInt(pardes.Mouse.Button.wheel_up)); + try expectEqual(c.PARDES_MOUSE_WHEEL_DOWN, @backingInt(pardes.Mouse.Button.wheel_down)); + try expectEqual(c.PARDES_MOUSE_WHEEL_LEFT, @backingInt(pardes.Mouse.Button.wheel_left)); + try expectEqual(c.PARDES_MOUSE_WHEEL_RIGHT, @backingInt(pardes.Mouse.Button.wheel_right)); + try expectEqual(c.PARDES_MOUSE_NONE, @backingInt(pardes.Mouse.Button.none)); + try expectEqual(c.PARDES_MOUSE_BACK, @backingInt(pardes.Mouse.Button.back)); + try expectEqual(c.PARDES_MOUSE_FORWARD, @backingInt(pardes.Mouse.Button.forward)); + try expectEqual(c.PARDES_MOUSE_PRESS, @backingInt(pardes.Mouse.Kind.press)); + try expectEqual(c.PARDES_MOUSE_RELEASE, @backingInt(pardes.Mouse.Kind.release)); + try expectEqual(c.PARDES_MOUSE_MOTION, @backingInt(pardes.Mouse.Kind.motion)); + try expectEqual(c.PARDES_MOUSE_DRAG, @backingInt(pardes.Mouse.Kind.drag)); + + try expectEqual(c.PARDES_HAPTIC_NONE, @backingInt(pardes.Haptic.none)); + try expectEqual(c.PARDES_HAPTIC_EXEC, @backingInt(pardes.Haptic.exec)); + try expectEqual(c.PARDES_HAPTIC_LOOK, @backingInt(pardes.Haptic.look)); try expectEqual(@as(u16, c.PARDES_ATTR_BOLD), encodeAttrs(.{ .bold = true })); try expectEqual(@as(u16, c.PARDES_ATTR_DIM), encodeAttrs(.{ .dim = true })); diff --git a/src/main.zig b/src/main.zig index e3bae75f..64614daa 100644 --- a/src/main.zig +++ b/src/main.zig @@ -499,7 +499,7 @@ fn nativeMain(init: std.process.Init) !void { if (!outside) { const owner = std.mem.span(std.c.getenv("PARDES_PID") orelse break :forwarding); const pid = std.fmt.parseInt(std.c.pid_t, owner, 10) catch break :forwarding; - if (pid <= 0 or std.c.kill(pid, @enumFromInt(0)) != 0) break :forwarding; + if (pid <= 0 or std.c.kill(pid, @fromBackingInt(@intCast(0))) != 0) break :forwarding; } // Can I reach it? That is the other two, and it is a separate answer. diff --git a/src/mini.zig b/src/mini.zig index 8af64201..ce291c99 100644 --- a/src/mini.zig +++ b/src/mini.zig @@ -130,7 +130,7 @@ pub fn generate(gpa: std.mem.Allocator, source: []const u8, styles: []const u8) if (source.len > max_input_bytes) return error.MiniTooLarge; if (!std.unicode.utf8ValidateSlice(source)) return error.InvalidUtf8; if (styles.len != 0 and styles.len != source.len) return error.InvalidMiniColors; - for (styles) |color| if (color > @intFromEnum(syntax.Syn.comment)) return error.InvalidMiniColors; + for (styles) |color| if (color > @backingInt(syntax.Syn.comment)) return error.InvalidMiniColors; const len = try render(null, source, styles); const content = try gpa.alloc(u8, len); errdefer gpa.free(content); @@ -248,17 +248,17 @@ test "Mini chooses highlighted dots over plain ink with stable color ties" { const gpa = std.testing.allocator; const source = "xx\nxx\nxx\nxx\n"; var styles: [source.len]u8 = @splat(0); - styles[0] = @intFromEnum(syntax.Syn.keyword); + styles[0] = @backingInt(syntax.Syn.keyword); const rare = try generate(gpa, source, &styles); defer rare.deinit(gpa); try std.testing.expectEqualStrings("⣿\n", rare.content); try std.testing.expectEqualSlices(u8, &.{ 1, 1, 1, 0 }, rare.colors); - styles[0] = @intFromEnum(syntax.Syn.string); - styles[1] = @intFromEnum(syntax.Syn.number); + styles[0] = @backingInt(syntax.Syn.string); + styles[1] = @backingInt(syntax.Syn.number); const tied = try generate(gpa, source, &styles); defer tied.deinit(gpa); try std.testing.expectEqualSlices(u8, &.{ 2, 2, 2, 0 }, tied.colors); - styles[3] = @intFromEnum(syntax.Syn.number); + styles[3] = @backingInt(syntax.Syn.number); const majority = try generate(gpa, source, &styles); defer majority.deinit(gpa); try std.testing.expectEqualSlices(u8, &.{ 3, 3, 3, 0 }, majority.colors); diff --git a/src/mouse.zig b/src/mouse.zig index 536a4fdb..43323f9a 100644 --- a/src/mouse.zig +++ b/src/mouse.zig @@ -379,7 +379,7 @@ fn programMouse(p: *Pardes, m: Mouse) bool { .none => null, else => return false, }; - const bit: u3 = if (button) |b| @as(u3, 1) << @intCast(@intFromEnum(b)) else 0; + const bit: u3 = if (button) |b| @as(u3, 1) << @intCast(@backingInt(b)) else 0; const at = p.presentation.pointer(p.screen_w, p.screen_h, @min(m.col, p.screen_w -| 1), @min(m.row, p.screen_h -| 1)); var mods: panes.terminal.MouseMods = .{ .shift = m.shift, .alt = m.alt, .ctrl = m.ctrl }; var buf: [64]u8 = undefined; @@ -701,7 +701,7 @@ pub fn handleMouse(p: *Pardes, event: Mouse) void { // look; the rest of the gesture is inert if (p.drag == .select and p.drag.select.button == config.look_button) { if (p.panes[p.drag.select.id]) |t| { - t.sel[@intFromEnum(config.look_button)].state = .none; + t.sel[@backingInt(config.look_button)].state = .none; if (comptime pdf_enabled) panes.Pdf.pointerCancel(t, p.drag.select.pdf); } @@ -812,7 +812,7 @@ pub fn handleMouse(p: *Pardes, event: Mouse) void { // an execute or look drag cancels it (textselect23's mask) if (p.drag == .select) { if (p.panes[p.drag.select.id]) |t| { - t.sel[@intFromEnum(p.drag.select.button)].state = .none; + t.sel[@backingInt(p.drag.select.button)].state = .none; if (comptime pdf_enabled) panes.Pdf.pointerCancel(t, p.drag.select.pdf); } @@ -833,8 +833,8 @@ pub fn handleMouse(p: *Pardes, event: Mouse) void { pane.scrollBy(if (m.button == config.look_button) local else -local); } else if (edit.pointerTextSelection(p, id, mcol, mrow, m.body_hit, p.pointer_tag_hit)) |pointed| { if (m.button == config.look_button) p.active = id; - pane.clearPointerSelection(@intFromEnum(m.button)); - pane.sel[@intFromEnum(m.button)] = pointed.sel; + pane.clearPointerSelection(@backingInt(m.button)); + pane.sel[@backingInt(m.button)] = pointed.sel; p.drag = .{ .select = .{ .id = id, @@ -906,7 +906,7 @@ pub fn dragUpdate(p: *Pardes, mcol: u16, mrow: u16, body_hit: ?Mouse.BodyHit) vo .select => |*s| { if (p.panes[s.id]) |pane| { const r = p.rects[s.id]; - const b = @intFromEnum(s.button); + const b = @backingInt(s.button); const tag_rows: i32 = pane.tag_rows; if (pane.body_rows > 0 and pane.sel[b].r0 >= tag_rows) if (body_hit) |supplied| { const mapped_hit = bodyHitForPane(p, s.id, supplied, true) orelse return; @@ -1235,10 +1235,10 @@ fn dragRelease(p: *Pardes, button: Mouse.Button) void { } if (s.chorded) { // a cut/paste chord consumed this drag; the release is inert - pane.sel[@intFromEnum(s.button)].state = .none; + pane.sel[@backingInt(s.button)].state = .none; return; } - const b = @intFromEnum(s.button); + const b = @backingInt(s.button); pane.sel[b].state = .done; if (s.button == config.select_button) { const sl = pane.sel[sel_slot]; @@ -1501,7 +1501,7 @@ test "plain left click clears explicit modal selection" { try std.testing.expectEqual(@as(i32, 3), pane.body.cur_col); try std.testing.expect(!pane.body.vsel.active); try std.testing.expect(!pane.body.msel.active); - try std.testing.expectEqual(.none, pane.sel[@intFromEnum(config.select_button)].state); + try std.testing.expectEqual(.none, pane.sel[@backingInt(config.select_button)].state); } test "selection drag and queued release do not enter panel pending state" { diff --git a/src/ninep/addr.zig b/src/ninep/addr.zig index 3feda5a2..86d2d49e 100644 --- a/src/ninep/addr.zig +++ b/src/ninep/addr.zig @@ -638,9 +638,9 @@ test "the address language, form by form" { } // Each failure says which it is. for ([_][2][]const u8{ - .{ "zzz", e_syntax }, .{ "/nomatch/", e_no_match }, .{ "99", e_range }, - .{ "#999", e_range }, .{ "/a[/", e_regexp }, .{ "/(a/", e_regexp }, - .{ "/*a/", e_regexp }, .{ "99:1", e_range }, .{ "2:0", e_col_zero }, + .{ "zzz", e_syntax }, .{ "/nomatch/", e_no_match }, .{ "99", e_range }, + .{ "#999", e_range }, .{ "/a[/", e_regexp }, .{ "/(a/", e_regexp }, + .{ "/*a/", e_regexp }, .{ "99:1", e_range }, .{ "2:0", e_col_zero }, }) |c| { _ = th.wr(p, addr, "#0"); try testing.expectEqualStrings(c[1], th.wr(p, addr, c[0]).reply.ename); diff --git a/src/ninep/cols.zig b/src/ninep/cols.zig index 59f6ae42..6f5bee23 100644 --- a/src/ninep/cols.zig +++ b/src/ninep/cols.zig @@ -34,7 +34,7 @@ pub fn writeLayout(p: *Pardes, w: *std.Io.Writer) !void { const active = activeColumn(p); for (0..p.ncol) |c| { try w.print("{d} {d} {d} {d} {s} {s}", .{ - layout.columnSerial(p, c), c, p.col_x[c], p.col_w[c], + layout.columnSerial(p, c), c, p.col_x[c], p.col_w[c], if (active == c) "current" else "notcurrent", if (p.col_n[c] == 0) "empty" else "full", }); for (p.col_panes[c][0..p.col_n[c]]) |id| if (p.panes[id]) |pane| try w.print(" {d}", .{pane.serial}); @@ -229,8 +229,8 @@ test "Joincol is refused when the joined column cannot give each pane its tag an const p = try pardes.Pardes.init(testing.allocator, .{ .tty_only = true, .cols = 160, .rows = 12 }); defer p.deinit(); while (p.nextEffect()) |_| {} - const ctl = @intFromEnum(tree.TopFile.ctl); - const focus = @intFromEnum(tree.TopFile.focus); + const ctl = @backingInt(tree.TopFile.ctl); + const focus = @backingInt(tree.TopFile.focus); // Two panes in the first column, then a second column of two. const a = try th.newPane(p); _ = a; @@ -257,10 +257,10 @@ test "pane/new takes rows from a pane in another column before refusing ENOSPC" while (p.nextEffect()) |_| {} const first = p.panes[p.active].?.serial; // A second column holding one tall pane. - try testing.expectEqual(tree.Status.ok, th.wr(p, @intFromEnum(tree.TopFile.ctl), "Newcol\n").reply.status); + try testing.expectEqual(tree.Status.ok, th.wr(p, @backingInt(tree.TopFile.ctl), "Newcol\n").reply.status); const tall = try th.newPane(p); const tall_col = layout.findPane(p, p.paneBySerial(tall).?).?.col; - const focus = @intFromEnum(tree.TopFile.focus); + const focus = @backingInt(tree.TopFile.focus); var digits: [16]u8 = undefined; // From the first column, until pane/new is refused. var moved = false; @@ -289,7 +289,7 @@ test "exactly 4096 bytes written with echo's newline after a truncation fit ever defer p.deinit(); const serial = th.serialOf(p); const text = &@as([4096]u8, @splat('w')) ++ "\n"; - for ([_]u64{ tree.Node.of(serial, .tag), tree.Node.ofCol(layout.columnSerial(p, 0), .tag), @intFromEnum(tree.TopFile.tag) }) |node| { + for ([_]u64{ tree.Node.of(serial, .tag), tree.Node.ofCol(layout.columnSerial(p, 0), .tag), @backingInt(tree.TopFile.tag) }) |node| { _ = th.call(p, .{ .tag = 1, .op = .setattr, .node = node, .truncate = true }); const h = th.call(p, .{ .tag = 2, .op = .open, .node = node, .omode = 1 }).reply.handle; const r = th.call(p, .{ .tag = 3, .op = .write, .node = node, .handle = h, .data = text }); @@ -320,8 +320,8 @@ test "a Newcol refused because the tags would not fit logs its err alone and spe } try testing.expect(p.col_n[col] >= 2); p.sync(); - const ctl = @intFromEnum(tree.TopFile.ctl); - const focus = @intFromEnum(tree.TopFile.focus); + const ctl = @backingInt(tree.TopFile.ctl); + const focus = @backingInt(tree.TopFile.focus); var digits: [16]u8 = undefined; const own = try std.fmt.bufPrint(&digits, "{d}\n", .{pane.serial}); var refused = false; @@ -349,7 +349,7 @@ test "a Newcol refused because the tags would not fit logs its err alone and spe test "a tagexec word that makes, acts on and focuses no pane reads back nothing" { const p = try th.withFile(testing.allocator, "x\n"); defer p.deinit(); - const tagexec = @intFromEnum(tree.TopFile.tagexec); + const tagexec = @backingInt(tree.TopFile.tagexec); try testing.expectEqual(tree.Status.ok, th.wr(p, tagexec, "Newcol\n").reply.status); try testing.expectEqualStrings("", th.rd(p, tagexec, 0, 64).bytes); // A column's New makes one, and answers it. @@ -362,7 +362,7 @@ test "a tagexec word that makes, acts on and focuses no pane reads back nothing" test "New written to a column's ctl reads back the new pane alone, as its exec does" { const p = try th.withFile(testing.allocator, "x\n"); defer p.deinit(); - const root_exec = @intFromEnum(tree.TopFile.exec); + const root_exec = @backingInt(tree.TopFile.exec); _ = th.wr(p, root_exec, "Msg before\n"); const ctl_node = tree.Node.ofCol(layout.columnSerial(p, 0), .ctl); try testing.expectEqual(tree.Status.ok, th.wr(p, ctl_node, "New\n").reply.status); @@ -390,7 +390,7 @@ test "a pane's word written to /tagexec or a column's exec is refused, and acts const p = try th.withFile(testing.allocator, "x\n"); defer p.deinit(); const col_exec = tree.Node.ofCol(layout.columnSerial(p, 0), .exec); - for ([_]u64{ @intFromEnum(tree.TopFile.tagexec), col_exec }) |node| { + for ([_]u64{ @backingInt(tree.TopFile.tagexec), col_exec }) |node| { for ([_][]const u8{ "Undo\n", "Msg hi\n", "Redo\n" }) |line| { const refused = th.wr(p, node, line); try testing.expectEqual(E.INVAL, refused.errno()); @@ -411,7 +411,7 @@ test "Help and Find at /tagexec act in the session's directory, not the keyboard const session = buf[0..try tmp.dir.realPath(testing.io, &buf)]; @memcpy(p.session_dir[0..session.len], session); p.session_dir_len = @intCast(session.len); - const tagexec = @intFromEnum(tree.TopFile.tagexec); + const tagexec = @backingInt(tree.TopFile.tagexec); for ([_][]const u8{ "Help\n", "Find needle\n" }) |line| { try testing.expectEqual(tree.Status.ok, th.wr(p, tagexec, line).reply.status); const made = p.panes[p.active].?.file.?.path; @@ -427,7 +427,7 @@ test "a shell command at /tagexec or a column's exec is a command pane in the se const term = p.panes[p.active].?; try testing.expect(pardes.exec.takesCommandLine(p, p.active)); const col_exec = tree.Node.ofCol(layout.columnSerial(p, 0), .exec); - for ([_]u64{ @intFromEnum(tree.TopFile.tagexec), col_exec }) |node| { + for ([_]u64{ @backingInt(tree.TopFile.tagexec), col_exec }) |node| { p.active = p.paneBySerial(term.serial).?; const before = p.next_serial; const r = th.wr(p, node, "echo from-the-tag\n"); @@ -443,7 +443,7 @@ test "a shell command at /tagexec or a column's exec is a command pane in the se test "New and Tty run at /tagexec and a column's exec, with no pane at all too" { const p = try th.withFile(testing.allocator, "x\n"); defer p.deinit(); - const tagexec = @intFromEnum(tree.TopFile.tagexec); + const tagexec = @backingInt(tree.TopFile.tagexec); const col_exec = tree.Node.ofCol(layout.columnSerial(p, 0), .exec); for ([_]u64{ tagexec, col_exec }) |node| for ([_][]const u8{ "New\n", "Tty\n" }) |line| { const before = p.next_serial; @@ -469,7 +469,7 @@ test "every pane word a tag no pane owns does not hold is refused there, Edit in const Builtin = pardes.builtins.registry.Builtin(); const col_exec = tree.Node.ofCol(layout.columnSerial(p, 0), .exec); for ([_]struct { node: u64, own: []const u8 }{ - .{ .node = @intFromEnum(tree.TopFile.tagexec), .own = pardes.config.topbar_str }, + .{ .node = @backingInt(tree.TopFile.tagexec), .own = pardes.config.topbar_str }, .{ .node = col_exec, .own = tagline.column_tag_default }, }) |tag_file| { var checked: usize = 0; @@ -517,7 +517,7 @@ test "layout lists each column's place, panes and state, and the active one" { const first_serial = layout.columnSerial(p, 0); const new_serial = layout.columnSerial(p, 1); try testing.expect(first_serial != new_serial); - const layout_node = @intFromEnum(tree.TopFile.layout); + const layout_node = @backingInt(tree.TopFile.layout); const text = th.rd(p, layout_node, 0, 4096).bytes; var want: [256]u8 = undefined; const first = try std.fmt.bufPrint(&want, "{d} 0 {d} {d} notcurrent full {d}\n", .{ first_serial, p.col_x[0], p.col_w[0], p.panes[0].?.serial }); @@ -528,19 +528,19 @@ test "layout lists each column's place, panes and state, and the active one" { try testing.expect(text.len > 0); try testing.expectEqual(@as(u64, 0), th.call(p, .{ .tag = 1, .op = .getattr, .node = layout_node }).reply.attr.size); // generated by each read // /index says which column each pane is in, by its serial, last. - try testing.expect(std.mem.endsWith(u8, th.rd(p, @intFromEnum(tree.TopFile.index), 0, 4096).bytes, try std.fmt.bufPrint(&want, " {d}\n", .{first_serial}))); + try testing.expect(std.mem.endsWith(u8, th.rd(p, @backingInt(tree.TopFile.index), 0, 4096).bytes, try std.fmt.bufPrint(&want, " {d}\n", .{first_serial}))); try testing.expect(th.logHas(p, try std.fmt.bufPrint(&want, "newcol {d}\n", .{new_serial}))); // A column that closes takes its name with it; the others keep theirs. try p.removeColumn(1); try testing.expect(th.logHas(p, try std.fmt.bufPrint(&want, "delcol {d}\n", .{new_serial}))); - try testing.expectEqual(E.NOENT, th.look_up(p, @intFromEnum(tree.TopFile.col), try std.fmt.bufPrint(&want, "{d}", .{new_serial})).errno()); + try testing.expectEqual(E.NOENT, th.look_up(p, @backingInt(tree.TopFile.col), try std.fmt.bufPrint(&want, "{d}", .{new_serial})).errno()); try testing.expectEqual(first_serial, layout.columnSerial(p, 0)); } test "a column's tag and the workspace's read, replace and append as a pane tag does, on one line" { const p = try th.withFile(testing.allocator, "x\n"); defer p.deinit(); - const col_dir = @intFromEnum(tree.TopFile.col); + const col_dir = @backingInt(tree.TopFile.col); const serial = layout.columnSerial(p, 0); var name: [16]u8 = undefined; try testing.expectEqual(tree.Status.ok, th.look_up(p, col_dir, try std.fmt.bufPrint(&name, "{d}", .{serial})).reply.status); @@ -557,7 +557,7 @@ test "a column's tag and the workspace's read, replace and append as a pane tag // `>>` appends; a newline in a one-line tag is a space. _ = th.wr(p, tag, " Lint\nNow"); try testing.expectEqualStrings("Make Lint Now", th.rd(p, tag, 0, 4096).bytes); - const top = @intFromEnum(tree.TopFile.tag); + const top = @backingInt(tree.TopFile.tag); _ = th.call(p, .{ .tag = 3, .op = .setattr, .node = top, .truncate = true }); _ = th.wr(p, top, "Newcol Exit\n"); try testing.expectEqualStrings("Newcol Exit", tagline.topbar(p)); @@ -574,11 +574,11 @@ test "a focus write makes its pane's column the active one: layout says so and p p.sync(); try testing.expectEqual(@as(usize, 1), layout.findPane(p, p.active).?.col); var digits: [16]u8 = undefined; - _ = th.wr(p, @intFromEnum(tree.TopFile.focus), try std.fmt.bufPrint(&digits, "{d}\n", .{left})); + _ = th.wr(p, @backingInt(tree.TopFile.focus), try std.fmt.bufPrint(&digits, "{d}\n", .{left})); var want: [32]u8 = undefined; - const text = th.rd(p, @intFromEnum(tree.TopFile.layout), 0, 4096).bytes; + const text = th.rd(p, @backingInt(tree.TopFile.layout), 0, 4096).bytes; try testing.expect(std.mem.endsWith(u8, text, try std.fmt.bufPrint(&want, "active {d}\n", .{layout.columnSerial(p, 0)}))); - const made = th.call(p, .{ .tag = 1, .op = .open, .node = @intFromEnum(tree.TopFile.new) }).reply.handle; + const made = th.call(p, .{ .tag = 1, .op = .open, .node = @backingInt(tree.TopFile.new) }).reply.handle; try testing.expectEqual(@as(usize, 0), layout.findPane(p, p.paneBySerial(made).?).?.col); } } @@ -590,7 +590,7 @@ test "a refused write after a truncation leaves every kind of tag as it was, and const col = layout.columnSerial(p, 0); const big = &@as([limits.max_tag_tail + 1]u8, @splat('w')); // Each tag: a truncating open, then a write too long: nothing changes. - for ([_]u64{ Node.of(serial, .tag), Node.ofCol(col, .tag), @intFromEnum(tree.TopFile.tag) }) |node| { + for ([_]u64{ Node.of(serial, .tag), Node.ofCol(col, .tag), @backingInt(tree.TopFile.tag) }) |node| { _ = th.wr(p, node, " Mine"); const before = try testing.allocator.dupe(u8, th.rd(p, node, 0, 1 << 16).bytes); defer testing.allocator.free(before); @@ -651,13 +651,13 @@ test "a column's ctl and exec act on it as its tag would, and rmdir closes it on try testing.expectEqual(@as(?usize, 0), layout.columnBySerial(p, right)); try testing.expect(std.mem.endsWith(u8, headerText(p, right).?, " Mine")); // The root's ctl points a column word at the column's own. - try testing.expect(std.mem.endsWith(u8, th.wr(p, @intFromEnum(tree.TopFile.ctl), "Delcol\n").reply.ename, "write it to col//ctl")); + try testing.expect(std.mem.endsWith(u8, th.wr(p, @backingInt(tree.TopFile.ctl), "Delcol\n").reply.ename, "write it to col//ctl")); } test "tagexec runs a word as a click in the workspace tag; exec files read back what they touched; their messages are the session's" { const p = try th.withFile(testing.allocator, "x\n"); defer p.deinit(); - const tagexec = @intFromEnum(tree.TopFile.tagexec); + const tagexec = @backingInt(tree.TopFile.tagexec); try testing.expectEqual(tree.Status.ok, th.look_up(p, tree.root, "tagexec").reply.status); try testing.expectEqual(tree.Status.ok, th.wr(p, tagexec, "Newcol\n").reply.status); try testing.expectEqual(@as(usize, 2), p.ncol); @@ -680,7 +680,7 @@ test "a word run from the workspace's or a column's tag runs in the session's di defer p.deinit(); const session = p.sessionDir(); try testing.expect(!std.mem.eql(u8, session, pardes.Pardes.paneDir(p.panes[0].?))); // the file is elsewhere - const dirs = [_]u64{ @intFromEnum(tree.TopFile.tagexec), Node.ofCol(layout.columnSerial(p, 0), .exec) }; + const dirs = [_]u64{ @backingInt(tree.TopFile.tagexec), Node.ofCol(layout.columnSerial(p, 0), .exec) }; for (dirs) |node| { try testing.expectEqual(tree.Status.ok, th.wr(p, node, "true\n").reply.status); const made = p.paneBySerial(p.fs.results[0]).?; diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig index 6b4bbafb..3e7c367b 100644 --- a/src/ninep/ctl.zig +++ b/src/ninep/ctl.zig @@ -1277,15 +1277,15 @@ const withFile = th.withFile; const serialOf = th.serialOf; const Node = tree.Node; const Status = tree.Status; -const root_status = @intFromEnum(tree.TopFile.status); -const root_look = @intFromEnum(tree.TopFile.look); -const root_exec = @intFromEnum(tree.TopFile.exec); +const root_status = @backingInt(tree.TopFile.status); +const root_look = @backingInt(tree.TopFile.look); +const root_exec = @backingInt(tree.TopFile.exec); test "a control character in a write to any ctl refuses the whole write, and a quoted line shows a tab as a blank" { const p = try withFile(testing.allocator, "x\n"); defer p.deinit(); const col = layout.columnSerial(p, 0); - for ([_]u64{ @intFromEnum(tree.TopFile.ctl), Node.of(serialOf(p), .ctl), Node.ofCol(col, .ctl) }) |node| { + for ([_]u64{ @backingInt(tree.TopFile.ctl), Node.of(serialOf(p), .ctl), Node.ofCol(col, .ctl) }) |node| { const r = wr(p, node, "Wrap off\nbo\x01gus\n"); try testing.expectEqual(E.INVAL, r.errno()); try testing.expectEqualStrings(e_control, r.reply.ename); @@ -1325,7 +1325,7 @@ test "pane ctl read is acme's fields -- index's five, width in cells, font, tab test "commands lists every builtin with its argument and the ctl that takes it" { const p = try withFile(testing.allocator, "x\n"); defer p.deinit(); - const node = @intFromEnum(tree.TopFile.commands); + const node = @backingInt(tree.TopFile.commands); const listed = rd(p, node, 0, 1 << 16); try testing.expectEqual(@as(u64, listed.bytes.len), call(p, .{ .tag = 1, .op = .getattr, .node = node }).reply.attr.size); try testing.expectEqual(E.PERM, wr(p, node, "Del\n").errno()); @@ -1372,7 +1372,7 @@ test "focus reads the pane with the keyboard, and a serial written to it moves t defer p.deinit(); const first = serialOf(p); const second = try th.newPane(p); - const focus = @intFromEnum(tree.TopFile.focus); + const focus = @backingInt(tree.TopFile.focus); var line: [16]u8 = undefined; try testing.expectEqualStrings(try std.fmt.bufPrint(&line, "{d}\n", .{second}), rd(p, focus, 0, 64).bytes); try testing.expectEqual(@as(u64, rd(p, focus, 0, 64).bytes.len), call(p, .{ .tag = 1, .op = .getattr, .node = focus }).reply.attr.size); @@ -1447,7 +1447,7 @@ test "the root ctl reads the settings as a write takes them, and takes the sessi const gpa = testing.allocator; const p = try withFile(gpa, "x\n"); defer p.deinit(); - const root_ctl = @intFromEnum(tree.TopFile.ctl); + const root_ctl = @backingInt(tree.TopFile.ctl); const first = rd(p, root_ctl, 0, 1 << 16); try testing.expectEqual(Status.ok, first.reply.status); const settings = try gpa.dupe(u8, first.bytes); @@ -1575,7 +1575,7 @@ test "a write of an Edit block carries it whole, to a pane's ctl, the root's ctl try testing.expectEqual(Status.ok, wr(p, Node.of(serial, .ctl), "Edit ,x/foo/{\ni/[/\na/]/\n}\n").reply.status); try testing.expectEqualStrings("[foo] x\n[foo] y\n", rd(p, body, 0, 64).bytes); p.active = p.paneBySerial(serial).?; - try testing.expectEqual(Status.ok, wr(p, @intFromEnum(tree.TopFile.ctl), "Edit ,x/\\[/{\nc/ 0); - try testing.expectEqual(@as(u64, 0), call(p, .{ .tag = 1, .op = .getattr, .node = @intFromEnum(tree.TopFile.index) }).reply.attr.size); + try testing.expectEqual(@as(u64, 0), call(p, .{ .tag = 1, .op = .getattr, .node = @backingInt(tree.TopFile.index) }).reply.attr.size); // Its tag never carries the raw newline either. const tag = rd(p, Node.of(serialOf(p), .tag), 0, 4096).bytes; try testing.expect(std.mem.indexOf(u8, tag, "/tmp/two\\nlines") != null); // A backslash of the name's own is doubled: `\n` written in a name // reads back unlike a newline. p.setCwd(term, "/tmp/back\\nslash"); - try testing.expect(std.mem.indexOf(u8, rd(p, @intFromEnum(tree.TopFile.index), 0, 4096).bytes, "/tmp/back\\\\nslash") != null); + try testing.expect(std.mem.indexOf(u8, rd(p, @backingInt(tree.TopFile.index), 0, 4096).bytes, "/tmp/back\\\\nslash") != null); } test "a look at a ./ or ../ name that is not there is a miss naming the file; a plain one is looked for as text" { @@ -3766,7 +3766,7 @@ test "a served-tree pane spoils no Grep, and Look . from a gone directory is ENO test "a tag write refuses NUL and the other control characters" { const p = try withFile(testing.allocator, "x\n"); defer p.deinit(); - for ([_]u64{ @intFromEnum(tree.TopFile.tag), tree.Node.ofCol(pardes.layout.columnSerial(p, 0), .tag), Node.of(serialOf(p), .tag) }) |node| { + for ([_]u64{ @backingInt(tree.TopFile.tag), tree.Node.ofCol(pardes.layout.columnSerial(p, 0), .tag), Node.of(serialOf(p), .tag) }) |node| { const refused = wr(p, node, " a\x00b"); try testing.expectEqual(E.INVAL, refused.errno()); try testing.expectStringStartsWith(refused.reply.ename, "invalid tag text"); @@ -3815,7 +3815,7 @@ test "a column takes panes until their documented minimums fill it, not until no const p = try Pardes.init(testing.allocator, .{ .tty_only = true, .cols = 160, .rows = 50 }); defer p.deinit(); while (p.nextEffect()) |_| {} - const new = @intFromEnum(tree.TopFile.new); + const new = @backingInt(tree.TopFile.new); while (call(p, .{ .tag = 1, .op = .open, .node = new }).reply.status == .ok) p.sync(); p.sync(); const avail = p.screen_h - (p.topBarHeight() + p.columnBarHeight()); @@ -3913,13 +3913,13 @@ test "a closed file is found again: Recent and /recent list it closed, a look at const opened = p.active; try testing.expectEqualStrings(a, p.panes[opened].?.file.?.path); var want: [4300]u8 = undefined; - try testing.expect(std.mem.indexOf(u8, rd(p, @intFromEnum(tree.TopFile.recent), 0, 8192).bytes, try std.fmt.bufPrint(&want, "open {s}\n", .{a})) != null); + try testing.expect(std.mem.indexOf(u8, rd(p, @backingInt(tree.TopFile.recent), 0, 8192).bytes, try std.fmt.bufPrint(&want, "open {s}\n", .{a})) != null); // Another file, so the jumplist has somewhere to come back from. try testing.expectEqual(Status.ok, wr(p, root_look, try std.fmt.bufPrint(&line, "{s}/b.txt\n", .{dir})).reply.status); p.sync(); try testing.expectEqual(Status.ok, wr(p, Node.of(p.panes[opened].?.serial, .ctl), "Del\n").reply.status); p.sync(); - try testing.expect(std.mem.indexOf(u8, rd(p, @intFromEnum(tree.TopFile.recent), 0, 8192).bytes, try std.fmt.bufPrint(&want, "closed {s}\n", .{a})) != null); + try testing.expect(std.mem.indexOf(u8, rd(p, @backingInt(tree.TopFile.recent), 0, 8192).bytes, try std.fmt.bufPrint(&want, "closed {s}\n", .{a})) != null); // Recent lists it, closed, at its dot; a look at the row opens it there. try testing.expectEqual(Status.ok, wr(p, root_exec, "Recent\n").reply.status); const rows = p.panes[p.paneBySerial(try std.fmt.parseInt(u32, std.mem.trimEnd(u8, rd(p, root_exec, 0, 64).bytes, "\n"), 10)).?].?; @@ -4045,8 +4045,8 @@ test "Back and Forward written to exec keep to the focused file, and JumpScope a .{ .word = "Forward", .file = "/b.txt", .line = 80 }, .{ .word = "Forward", .file = "/a.txt", .line = 80 }, }); - try testing.expectEqual(Status.ok, wr(p, @intFromEnum(tree.TopFile.ctl), "JumpScope all\n").reply.status); - try testing.expect(std.mem.indexOf(u8, rd(p, @intFromEnum(tree.TopFile.ctl), 0, 8192).bytes, "JumpScope all\n") != null); + try testing.expectEqual(Status.ok, wr(p, @backingInt(tree.TopFile.ctl), "JumpScope all\n").reply.status); + try testing.expect(std.mem.indexOf(u8, rd(p, @backingInt(tree.TopFile.ctl), 0, 8192).bytes, "JumpScope all\n") != null); try walk(p, &.{ .{ .word = "Back", .file = "/b.txt", .line = 80 }, .{ .word = "Back", .file = "/a.txt", .line = 40 }, @@ -4102,14 +4102,14 @@ test "a new file saved shows in /recent, open, while it is" { try testing.expectEqual(Status.ok, wr(p, Node.of(made, .ctl), "Save\n").reply.status); p.perform(.{ .save_file = .{ .pane = @intCast(p.paneBySerial(made).?) } }); var want: [4300]u8 = undefined; - try testing.expect(std.mem.indexOf(u8, rd(p, @intFromEnum(tree.TopFile.recent), 0, 8192).bytes, try std.fmt.bufPrint(&want, "open {s}\n", .{path})) != null); + try testing.expect(std.mem.indexOf(u8, rd(p, @backingInt(tree.TopFile.recent), 0, 8192).bytes, try std.fmt.bufPrint(&want, "open {s}\n", .{path})) != null); } test "/recent shows a name as /index does, a newline in it escaped" { const p = try withFile(testing.allocator, "x\n"); defer p.deinit(); p.recent.opened(p.recentGpa(), "/tmp/a\nb\\c"); - const text = rd(p, @intFromEnum(tree.TopFile.recent), 0, 8192).bytes; + const text = rd(p, @backingInt(tree.TopFile.recent), 0, 8192).bytes; try testing.expect(std.mem.indexOf(u8, text, "closed /tmp/a\\nb\\\\c\n") != null); } @@ -4191,8 +4191,8 @@ test "size is monotonic: growing is never refused, and a size once taken is take defer p.deinit(); while (p.nextEffect()) |_| {} p.unattended = true; - const root_ctl = @intFromEnum(tree.TopFile.ctl); - const new = @intFromEnum(tree.TopFile.new); + const root_ctl = @backingInt(tree.TopFile.ctl); + const new = @backingInt(tree.TopFile.new); // The dogfood's repro: Newcol, three pane/new, a Tty, then pane/new // until a column has no room (ENOSPC). try testing.expectEqual(Status.ok, wr(p, root_ctl, "Newcol\n").reply.status); @@ -4283,7 +4283,7 @@ test "a file changed on disk under unsaved edits is not reloaded: it says so, ge var want: [32]u8 = undefined; try testing.expect(th.logHas(p, try std.fmt.bufPrint(&want, "changed {d}\n", .{serial}))); // Exit and get still ask about the edits. - try testing.expectEqual(Status.err, wr(p, @intFromEnum(tree.TopFile.ctl), "Exit\n").reply.status); + try testing.expectEqual(Status.err, wr(p, @backingInt(tree.TopFile.ctl), "Exit\n").reply.status); try testing.expect(std.mem.indexOf(u8, wr(p, Node.of(serial, .ctl), "get\n").reply.ename, "Modified") != null); // Save warns once before overwriting the newer file, then writes. const first = wr(p, Node.of(serial, .ctl), "Save\n"); @@ -4328,7 +4328,7 @@ test "a looked word is found in its own pane, next place after the dot, wrapping test "every word's /commands description is its own doc comment's first sentence, no citation" { const p = try withFile(testing.allocator, "x\n"); defer p.deinit(); - const listed = rd(p, @intFromEnum(tree.TopFile.commands), 0, 1 << 16).bytes; + const listed = rd(p, @backingInt(tree.TopFile.commands), 0, 1 << 16).bytes; for ([_][]const u8{ "\nRepl arg pane -- Binds this terminal as a language's REPL, so an exec on that language's files is typed into it instead of run.\n", "\nJoincol root -- Fold the active pane's column into the one on its right, keeping its panes.\n", @@ -4374,7 +4374,7 @@ test "Newcol at the column cap fails the write and says the cap" { const p = try withFile(testing.allocator, "x\n"); defer p.deinit(); p.update(.{ .resize = .{ .cols = 4000, .rows = 30 } }); - const root_ctl = @intFromEnum(tree.TopFile.ctl); + const root_ctl = @backingInt(tree.TopFile.ctl); while (p.ncol < pardes.MAX_COLS) { // From the widest column's tag, so no column gets too narrow first. p.sync(); @@ -4403,7 +4403,7 @@ test "Save on a terminal asked over 9P is an ask in the log, answered with a pat try testing.expect(p.panes[id].?.prompt == .save); // Again: the one open stands, one ask in the log. _ = wr(p, Node.of(serial, .tagexec), "Save\n"); - const log = @intFromEnum(tree.TopFile.log); + const log = @backingInt(tree.TopFile.log); const h = call(p, .{ .tag = 1, .op = .open, .node = log }).reply.handle; try testing.expectEqual(@as(usize, 1), std.mem.count(u8, call(p, .{ .tag = 2, .op = .read, .node = log, .handle = h, .size = 1 << 16 }).bytes, "save path\n")); _ = call(p, .{ .tag = 3, .op = .release, .node = log, .handle = h }); @@ -4429,7 +4429,7 @@ test "get names the path it could not read, logs the edits it threw away, and a pardes.panes.File.deleted(p, 0); pardes.panes.File.deleted(p, 0); var rec: [32]u8 = undefined; - const log = @intFromEnum(tree.TopFile.log); + const log = @backingInt(tree.TopFile.log); const h = call(p, .{ .tag = 1, .op = .open, .node = log }).reply.handle; try testing.expectEqual(@as(usize, 1), std.mem.count(u8, call(p, .{ .tag = 2, .op = .read, .node = log, .handle = h, .size = 1 << 16 }).bytes, try std.fmt.bufPrint(&rec, "changed {d} deleted\n", .{serial}))); _ = call(p, .{ .tag = 3, .op = .release, .node = log, .handle = h }); @@ -4441,12 +4441,12 @@ test "a builtin that fails through exec, tagexec or a column's exec fails the wr p.update(.tick); // the pane's `new` is logged first while (p.nextEffect()) |_| {} const serial = serialOf(p); - for ([_]u64{ root_exec, Node.of(serial, .exec), @intFromEnum(tree.TopFile.tagexec), Node.ofCol(pardes.layout.columnSerial(p, 0), .exec) }) |node| { + for ([_]u64{ root_exec, Node.of(serial, .exec), @backingInt(tree.TopFile.tagexec), Node.ofCol(pardes.layout.columnSerial(p, 0), .exec) }) |node| { const failed = wr(p, node, "Unmount zzz\n"); try testing.expectEqual(Status.err, failed.reply.status); try testing.expect(std.mem.indexOf(u8, failed.reply.ename, "Unmount: no such mount zzz") != null); } - const log = @intFromEnum(tree.TopFile.log); + const log = @backingInt(tree.TopFile.log); const h = call(p, .{ .tag = 1, .op = .open, .node = log }).reply.handle; const text = call(p, .{ .tag = 2, .op = .read, .node = log, .handle = h, .size = 1 << 16 }).bytes; try testing.expect(std.mem.indexOf(u8, text, "msg ") == null); @@ -4458,11 +4458,11 @@ test "a builtin that fails through exec, tagexec or a column's exec fails the wr // A control character is refused with its reason. try testing.expectEqualStrings(e_control, wr(p, root_exec, "Msg a\x01b\n").reply.ename); // A look miss: one err, no msg. - _ = wr(p, @intFromEnum(tree.TopFile.look), "zzqqnotthere\n"); + _ = wr(p, @backingInt(tree.TopFile.look), "zzqqnotthere\n"); try testing.expect(th.logHas(p, "look: no match for \"zzqqnotthere\"")); try testing.expect(!th.logHas(p, "msg 1 Look: no match")); // The same miss again is that record counted, as any repeated err is. - _ = wr(p, @intFromEnum(tree.TopFile.look), "zzqqnotthere\n"); + _ = wr(p, @backingInt(tree.TopFile.look), "zzqqnotthere\n"); try testing.expect(th.logHas(p, "look: no match for \"zzqqnotthere\" (x2)\n")); } @@ -4483,7 +4483,7 @@ test "@p:
takes any sam address; a miss and an unknown serial a const p = try withFile(testing.allocator, "foo x foo y\nbar\n"); defer p.deinit(); const serial = serialOf(p); - const root = @intFromEnum(tree.TopFile.look); + const root = @backingInt(tree.TopFile.look); const dot = Node.of(serial, .dot); const Case = struct { addr: []const u8, want: []const u8 }; for ([_]Case{ @@ -4544,7 +4544,7 @@ test "@p:
takes any address over the terminal's lines, select const id = p.paneBySerial(serial).?; p.update(.{ .output = .{ .pane = @intCast(id), .bytes = "one\r\ntwo MARK three\r\n" } }); const pane = p.panes[id].?; - const root = @intFromEnum(tree.TopFile.look); + const root = @backingInt(tree.TopFile.look); var line: [64]u8 = undefined; try testing.expectEqual(Status.ok, wr(p, root, try std.fmt.bufPrint(&line, "@p{d}:0/MARK/\n", .{serial})).reply.status); try testing.expectEqual(@as(i32, 1), pane.body.cur_row); @@ -4576,7 +4576,7 @@ test "a bad command inside an Edit block written whole is named, not the } after test "a refused Delcol changes nothing: no pane, no focus" { const p = try withFile(testing.allocator, "x\n"); defer p.deinit(); - _ = wr(p, @intFromEnum(tree.TopFile.ctl), "Newcol\n"); + _ = wr(p, @backingInt(tree.TopFile.ctl), "Newcol\n"); const made = try th.newPane(p); _ = wr(p, Node.of(made, .name), "/tmp/pardes-delcol-refused.txt\n"); _ = wr(p, Node.of(made, .body), "edit\n"); @@ -4599,8 +4599,8 @@ test "a refused Delcol changes nothing: no pane, no focus" { test "pager answers its +Pager on the open that asked, whatever another client exec'd meanwhile" { const p = try withFile(testing.allocator, "x\n"); defer p.deinit(); - const pager = @intFromEnum(tree.TopFile.pager); - const exec = @intFromEnum(tree.TopFile.exec); + const pager = @backingInt(tree.TopFile.pager); + const exec = @backingInt(tree.TopFile.exec); const asked = call(p, .{ .tag = 1, .op = .open, .node = pager, .omode = 2 }).reply.handle; try testing.expectEqual(Status.ok, call(p, .{ .tag = 2, .op = .write, .node = pager, .handle = asked, .data = "/tmp\n" }).reply.status); const paged = for (p.panes) |slot| { @@ -4653,7 +4653,7 @@ test "pager answers its +Pager on the open that asked, whatever another client e test "what a /pager open writes after its directory is the text: plain in the body, its colours the pane's, clean, in by the read" { const p = try withFile(testing.allocator, "x\n"); defer p.deinit(); - const pager = @intFromEnum(tree.TopFile.pager); + const pager = @backingInt(tree.TopFile.pager); const asked = call(p, .{ .tag = 1, .op = .open, .node = pager, .omode = 2 }).reply.handle; // The directory and the text's start in one write, escapes and all, a // second line no directory; the rest in writes after it. @@ -4812,7 +4812,7 @@ test "a second LookWord list look in a directory refills its +Search rather than const path = try std.fmt.bufPrint(&path_buf, "{s}/words.txt", .{dir}); const p = try Pardes.init(gpa, .{ .file = path, .tty_only = true, .cols = 80, .rows = 30 }); defer p.deinit(); - _ = wr(p, @intFromEnum(tree.TopFile.ctl), "LookWord list\n"); + _ = wr(p, @backingInt(tree.TopFile.ctl), "LookWord list\n"); pardes.look.lookAt(p, 0, "alpha"); pardes.look.lookAt(p, 0, "beta"); var searches: usize = 0; @@ -4986,7 +4986,7 @@ test "DumpDir refuses a relative directory and one that may not be written, up f if (comptime !pardes.hosted) return; const p = try withFile(testing.allocator, "x\n"); defer p.deinit(); - const root_ctl = @intFromEnum(tree.TopFile.ctl); + const root_ctl = @backingInt(tree.TopFile.ctl); try testing.expectEqual(E.INVAL, wr(p, root_ctl, "DumpDir dumps\n").errno()); try testing.expectEqual(E.INVAL, wr(p, root_ctl, "DumpDir /proc/1/root/dumps\n").errno()); try testing.expectEqual(Status.ok, wr(p, root_ctl, "DumpDir /tmp/pardes-dumps-test\n").reply.status); @@ -4998,7 +4998,7 @@ test "DumpDir refuses a relative directory and one that may not be written, up f test "a Mount dial with a network it does not know is a bad dial address, EINVAL" { const p = try withFile(testing.allocator, "x\n"); defer p.deinit(); - const r = wr(p, @intFromEnum(tree.TopFile.ctl), "Mount peer nowhere!x\n"); + const r = wr(p, @backingInt(tree.TopFile.ctl), "Mount peer nowhere!x\n"); try testing.expectEqual(E.INVAL, r.errno()); try testing.expectStringStartsWith(r.reply.ename, "Mount: bad dial address: nowhere!x"); } @@ -5056,11 +5056,11 @@ test "a Mount of a socket path that is not there says no such socket, ENOENT" { if (comptime !pardes.hosted) return; const p = try withFile(testing.allocator, "x\n"); defer p.deinit(); - const r = wr(p, @intFromEnum(tree.TopFile.ctl), "Mount peer unix!/tmp/pardes-surely-no-socket\n"); + const r = wr(p, @backingInt(tree.TopFile.ctl), "Mount peer unix!/tmp/pardes-surely-no-socket\n"); try testing.expectEqual(E.NOENT, r.errno()); try testing.expect(std.mem.indexOf(u8, r.reply.ename, "no such socket") != null); try testing.expectEqual(@as(usize, 0), p.fs.mounts.items.len); - try testing.expectEqual(E.INVAL, wr(p, @intFromEnum(tree.TopFile.ctl), "Mount peer rel/x.sock\n").errno()); + try testing.expectEqual(E.INVAL, wr(p, @backingInt(tree.TopFile.ctl), "Mount peer rel/x.sock\n").errno()); } test "the init file reads past a BOM, and every line it fails is a notice and an err, never silent" { diff --git a/src/ninep/events.zig b/src/ninep/events.zig index 7b73dc0e..78788c3c 100644 --- a/src/ninep/events.zig +++ b/src/ninep/events.zig @@ -542,7 +542,7 @@ pub const Action = enum(u8) { tag_exec = 'x', pub fn char(a: Action) u8 { - return @intFromEnum(a); + return @backingInt(a); } pub fn fromChar(c: u8) ?Action { @@ -550,7 +550,7 @@ pub const Action = enum(u8) { } pub fn onTag(a: Action) bool { - return @intFromEnum(a) >= 'a'; + return @backingInt(a) >= 'a'; } }; @@ -889,7 +889,7 @@ test "a stream read at an offset inside its last answer gets the rest of it agai defer p.deinit(); p.update(.tick); while (p.nextEffect()) |_| {} - const log = @intFromEnum(tree.TopFile.log); + const log = @backingInt(tree.TopFile.log); const f = call(p, .{ .tag = 1, .op = .open, .node = log }).reply.handle; const frozen: u64 = call(p, .{ .tag = 2, .op = .read, .node = log, .handle = f, .size = 8192 }).bytes.len; _ = call(p, .{ .tag = 3, .op = .write, .node = log, .handle = f, .data = "follow" }); @@ -897,7 +897,7 @@ test "a stream read at an offset inside its last answer gets the rest of it agai notePath(p, "dump", "/b"); const Read = struct { fn at(pp: *Pardes, h: u32, off: u64) []const u8 { - return call(pp, .{ .tag = 4, .op = .read, .node = @intFromEnum(tree.TopFile.log), .handle = h, .off = off, .size = 128 }).bytes; + return call(pp, .{ .tag = 4, .op = .read, .node = @backingInt(tree.TopFile.log), .handle = h, .off = off, .size = 128 }).bytes; } }; try testing.expectEqualStrings("dump /a\n", Read.at(p, f, frozen)); @@ -1130,7 +1130,7 @@ test "writing an event record back performs the action it names" { // A look written back sets what look reads back. _ = wr(p, event, "FL0 3\n"); var want_serial: [16]u8 = undefined; - try testing.expectEqualStrings(try std.fmt.bufPrint(&want_serial, "{d}\n", .{serial}), rd(p, @intFromEnum(tree.TopFile.look), 0, 64).bytes); + try testing.expectEqualStrings(try std.fmt.bufPrint(&want_serial, "{d}\n", .{serial}), rd(p, @backingInt(tree.TopFile.look), 0, 64).bytes); // Well formed but past the text: said so, not "bad event syntax". try testing.expectEqualStrings("range past end of body", wr(p, event, "MX0 999\n").reply.ename); @@ -1144,7 +1144,7 @@ test "the log records whether or not anyone reads, and an open that follows wait const gpa = testing.allocator; const p = try withFile(gpa, "logged\n"); defer p.deinit(); - const log = @intFromEnum(tree.TopFile.log); + const log = @backingInt(tree.TopFile.log); var expected: [4200]u8 = undefined; // Nobody holds /log open, and the pane is recorded anyway. @@ -1256,21 +1256,21 @@ test "a refused or failed write is an err record in the log, saying which file a p.update(.tick); // the pane's `new` is logged before the log is opened while (p.nextEffect()) |_| {} const serial = serialOf(p); - const log = @intFromEnum(tree.TopFile.log); + const log = @backingInt(tree.TopFile.log); const f = call(p, .{ .tag = 1, .op = .open, .node = log }).reply.handle; const frozen = call(p, .{ .tag = 2, .op = .read, .node = log, .handle = f, .size = 1 << 16 }).bytes.len; _ = call(p, .{ .tag = 3, .op = .write, .node = log, .handle = f, .data = "follow" }); var want: [128]u8 = undefined; const next = struct { fn record(pp: *Pardes, h: u32, off: usize) []const u8 { - return call(pp, .{ .tag = 4, .op = .read, .node = @intFromEnum(tree.TopFile.log), .handle = h, .off = off, .size = 4096 }).bytes; + return call(pp, .{ .tag = 4, .op = .read, .node = @backingInt(tree.TopFile.log), .handle = h, .off = off, .size = 4096 }).bytes; } }; _ = wr(p, Node.of(serial, .addr), "/nowhere/"); try testing.expectEqualStrings(try std.fmt.bufPrint(&want, "err {d} addr: no match for regexp\n", .{serial}), next.record(p, f, frozen)); - _ = wr(p, @intFromEnum(tree.TopFile.ctl), "Bogus"); + _ = wr(p, @backingInt(tree.TopFile.ctl), "Bogus"); try testing.expectEqualStrings("err - ctl: unknown control message \"Bogus\"\n", next.record(p, f, frozen)); - _ = wr(p, @intFromEnum(tree.TopFile.focus), "99999"); + _ = wr(p, @backingInt(tree.TopFile.focus), "99999"); try testing.expectEqualStrings("err - focus: no such pane\n", next.record(p, f, frozen)); // A write that succeeds says nothing. _ = wr(p, Node.of(serial, .addr), "#0"); @@ -1373,7 +1373,7 @@ test "opens of the log share the open records, and a closed one frees its record const gpa = testing.allocator; const p = try withFile(gpa, "x\n"); defer p.deinit(); - const log = @intFromEnum(tree.TopFile.log); + const log = @backingInt(tree.TopFile.log); var handles: [tree.open_slots]u32 = undefined; for (&handles) |*h| h.* = call(p, .{ .tag = 1, .op = .open, .node = log }).reply.handle; try testing.expectEqual(E.NFILE, call(p, .{ .tag = 2, .op = .open, .node = log }).errno()); @@ -1447,7 +1447,7 @@ test "follow new skips what the log held and waits for what comes after" { p.update(.tick); // the pane's `new` is logged first while (p.nextEffect()) |_| {} p.setMessage(0, "before the open"); - const log = @intFromEnum(tree.TopFile.log); + const log = @backingInt(tree.TopFile.log); const h = call(p, .{ .tag = 1, .op = .open, .node = log }).reply.handle; try testing.expectEqual(Status.ok, call(p, .{ .tag = 2, .op = .write, .node = log, .handle = h, .data = "follow new\n" }).reply.status); try testing.expectEqual(Status.again, call(p, .{ .tag = 3, .op = .read, .node = log, .handle = h, .size = 4096 }).reply.status); @@ -1461,7 +1461,7 @@ test "a long msg record is cut between words at its cap, with an ellipsis" { defer p.deinit(); const long = std.mem.asBytes(&@as([60][5]u8, @splat("word ".*))); // 300 bytes _ = wr(p, Node.of(serialOf(p), .ctl), "Msg " ++ long ++ "\n"); - const log = @intFromEnum(tree.TopFile.log); + const log = @backingInt(tree.TopFile.log); const h = call(p, .{ .tag = 1, .op = .open, .node = log }).reply.handle; const text = call(p, .{ .tag = 2, .op = .read, .node = log, .handle = h, .size = 1 << 16 }).bytes; const at = std.mem.lastIndexOf(u8, text, "msg ").?; @@ -1485,8 +1485,8 @@ test "a record is one line of UTF-8: DEL and C1 are spaces, bytes not UTF-8 are test "a long err record keeps its end, its middle given up to an ellipsis" { const p = try withFile(testing.allocator, "x\n"); defer p.deinit(); - _ = wr(p, @intFromEnum(tree.TopFile.ctl), "Bogus" ++ std.mem.asBytes(&@as([40][8]u8, @splat("abcdefgh".*))) ++ "\n"); - const log = @intFromEnum(tree.TopFile.log); + _ = wr(p, @backingInt(tree.TopFile.ctl), "Bogus" ++ std.mem.asBytes(&@as([40][8]u8, @splat("abcdefgh".*))) ++ "\n"); + const log = @backingInt(tree.TopFile.log); const h = call(p, .{ .tag = 1, .op = .open, .node = log }).reply.handle; const text = call(p, .{ .tag = 2, .op = .read, .node = log, .handle = h, .size = 1 << 16 }).bytes; const at = std.mem.lastIndexOf(u8, text, "err - ctl: ").?; diff --git a/src/ninep/pane.zig b/src/ninep/pane.zig index 8605cab8..dc104e4b 100644 --- a/src/ninep/pane.zig +++ b/src/ninep/pane.zig @@ -1104,7 +1104,7 @@ test "index lists serial kind dirty flag and name, and stats 0, a view generated const p = try withFile(gpa, "hello\nthere\n"); defer p.deinit(); const pane = p.panes[0].?; - const index = @intFromEnum(tree.TopFile.index); + const index = @backingInt(tree.TopFile.index); const a = rd(p, index, 0, 4096); try testing.expectEqual(Status.ok, a.reply.status); @@ -1138,7 +1138,7 @@ test "a terminal is listed as term with its directory as name" { var want: [64]u8 = undefined; try testing.expect(std.mem.indexOf( u8, - rd(p, @intFromEnum(tree.TopFile.index), 0, 4096).bytes, + rd(p, @backingInt(tree.TopFile.index), 0, 4096).bytes, try std.fmt.bufPrint(&want, "{d} term 0 /work/dir {d}\n", .{ pane.serial, columnOf(p, 0) }), ) != null); try testing.expectEqualStrings("/work/dir\n", rd(p, Node.of(pane.serial, .name), 0, 4096).bytes); @@ -1751,8 +1751,8 @@ test "name refreshes cached syntax for unchanged contents" { try testing.expectEqual(Status.ok, wr(p, Node.of(pane.serial, .name), "renamed.zig\n").reply.status); panes.File.refreshHighlights(p); try testing.expect(pane.file.?.highlights.len >= 2); - try testing.expectEqual(@intFromEnum(pardes.syntax.Syn.keyword), pane.file.?.highlights[0]); - try testing.expectEqual(@intFromEnum(pardes.syntax.Syn.keyword), pane.file.?.highlights[1]); + try testing.expectEqual(@backingInt(pardes.syntax.Syn.keyword), pane.file.?.highlights[0]); + try testing.expectEqual(@backingInt(pardes.syntax.Syn.keyword), pane.file.?.highlights[1]); try testing.expectEqualStrings("fn check() void {}\n", pane.file.?.content); } diff --git a/src/ninep/pty.zig b/src/ninep/pty.zig index aeb57a00..d80f7175 100644 --- a/src/ninep/pty.zig +++ b/src/ninep/pty.zig @@ -893,7 +893,7 @@ test "a shell that exits under a run answers its status, and the log says exit b const prompt = "\x1b]133;A;cl=line;aid=pardes\x07$ \x1b]133;B;aid=pardes\x07"; p.update(.{ .output = .{ .pane = 0, .bytes = prompt } }); while (p.nextEffect()) |_| {} - const log = @intFromEnum(tree.TopFile.log); + const log = @backingInt(tree.TopFile.log); const f = call(p, .{ .tag = 1, .op = .open, .node = log }).reply.handle; const frozen = call(p, .{ .tag = 2, .op = .read, .node = log, .handle = f, .size = 1 << 16 }).bytes.len; _ = call(p, .{ .tag = 3, .op = .write, .node = log, .handle = f, .data = "follow" }); @@ -984,7 +984,6 @@ test "a run's answer says cut when its output's start is gone, and reads a bound var got = sh.answered(p, node, h, into); try testing.expectEqualStrings("exit 0\nafter\n", got); - // A resize between its start and end reflows the pins with the text. h = sh.send(p, node); sh.put(p, c ++ "one\r\ntwo\r\n"); @@ -1092,7 +1091,7 @@ test "a terminal's ctl counts its body, and a new directory is a rename in the l _ = fields.next(); try testing.expectEqual(body_len, try std.fmt.parseInt(usize, fields.next().?, 10)); - const log = @intFromEnum(tree.TopFile.log); + const log = @backingInt(tree.TopFile.log); const f = call(p, .{ .tag = 4, .op = .open, .node = log }).reply.handle; const frozen = call(p, .{ .tag = 5, .op = .read, .node = log, .handle = f, .size = 1 << 16 }).bytes.len; _ = call(p, .{ .tag = 6, .op = .write, .node = log, .handle = f, .data = "follow" }); diff --git a/src/ninep/screen.zig b/src/ninep/screen.zig index 8d4707e0..ba676ded 100644 --- a/src/ninep/screen.zig +++ b/src/ninep/screen.zig @@ -95,7 +95,7 @@ const withTerm = th.withTerm; const serialOf = th.serialOf; const Node = tree.Node; const Status = tree.Status; -const screen_node = @intFromEnum(tree.TopFile.screen); +const screen_node = @backingInt(tree.TopFile.screen); test "listener addresses are readable canonical dials with bounded partial reads" { const gpa = testing.allocator; @@ -111,7 +111,7 @@ test "listener addresses are readable canonical dials with bounded partial reads try testing.expectEqualStrings(expected, bytes); try testing.expectError(error.ReadOnlyFilesystem, fs.write(p, path, "")); } - const node = @intFromEnum(tree.TopFile.listeners); + const node = @backingInt(tree.TopFile.listeners); var off: usize = 0; while (off < expected.len) { const part = rd(p, node, off, 3); diff --git a/src/ninep/testing.zig b/src/ninep/testing.zig index a35a9cf0..ec665130 100644 --- a/src/ninep/testing.zig +++ b/src/ninep/testing.zig @@ -71,7 +71,7 @@ pub fn logHas(p: *Pardes, needle: []const u8) bool { /// How many times the log, read whole from a fresh open, holds `needle`. pub fn logCount(p: *Pardes, needle: []const u8) usize { - const log = @intFromEnum(tree.TopFile.log); + const log = @backingInt(tree.TopFile.log); const h = call(p, .{ .tag = 1, .op = .open, .node = log }).reply.handle; defer _ = call(p, .{ .tag = 3, .op = .release, .node = log, .handle = h }); const text = call(p, .{ .tag = 2, .op = .read, .node = log, .handle = h, .size = 1 << 16 }).bytes; @@ -95,7 +95,7 @@ pub fn look_up(p: *Pardes, dir: u64, name: []const u8) Answer { /// The open is what makes the pane; the handle it answers is the serial, which /// is also what a read of that fid reports. pub fn newPane(p: *Pardes) !u32 { - const made = call(p, .{ .tag = 8, .op = .open, .node = @intFromEnum(tree.TopFile.new) }); + const made = call(p, .{ .tag = 8, .op = .open, .node = @backingInt(tree.TopFile.new) }); if (made.reply.status != .ok or made.reply.handle == 0) return error.NoPane; return made.reply.handle; } diff --git a/src/ninep/tree.zig b/src/ninep/tree.zig index 5678832b..9aa0225a 100644 --- a/src/ninep/tree.zig +++ b/src/ninep/tree.zig @@ -115,7 +115,7 @@ pub fn changesPane(p: *Pardes, req: Req) bool { return switch (req.op) { .write => true, .setattr => truncates(req), - .open => req.node == @intFromEnum(TopFile.new), + .open => req.node == @backingInt(TopFile.new), .release => req.remove or holdsLines(p, req) or holdsPage(p, req), .read => holdsPage(p, req), .lookup, .getattr, .readdir => false, @@ -279,7 +279,7 @@ pub const TopFile = enum(u5) { } }; -pub const root: u64 = @intFromEnum(TopFile.root); +pub const root: u64 = @backingInt(TopFile.root); /// Declaration order is readdir order. pub const PaneFile = enum(u5) { @@ -363,11 +363,11 @@ pub const Node = packed struct(u64) { pub fn of(serial: u32, file: PaneFile) u64 { std.debug.assert(serial != 0); - return @bitCast(Node{ .file = @intFromEnum(file), .serial = serial }); + return @bitCast(Node{ .file = @backingInt(file), .serial = serial }); } pub fn ofCol(serial: u32, file: ColFile) u64 { - return @bitCast(Node{ .file = @intFromEnum(file), .serial = col_bit | @as(u59, serial) }); + return @bitCast(Node{ .file = @backingInt(file), .serial = col_bit | @as(u59, serial) }); } pub fn target(node: u64) ?Target { @@ -424,9 +424,9 @@ pub fn resolveSelf(p: *Pardes, path: []const u8) ?u64 { // `new` is reached in /pane, where the panes it makes are. const top = std.meta.stringToEnum(TopFile, first) orelse return sources.node(normalized); if (top == .root or top == .new or top == .pane or parts.next() != null) return null; - return @intFromEnum(top); + return @backingInt(top); } - const next = parts.next() orelse return @intFromEnum(TopFile.pane); + const next = parts.next() orelse return @backingInt(TopFile.pane); // `new` is served on the wire but deliberately unreachable from an editor // path: this resolves Look targets and hover previews, and a preview that // opened `new` to see what was there would make a pane per hover. @@ -606,7 +606,7 @@ fn attrOf(p: *Pardes, target: Target) ?Reply.Attr { switch (target) { .top => |f| return .{ .name = f.fileName(), - .node = @intFromEnum(f), + .node = @backingInt(f), .dir = f.dir(), .mode = f.mode(), .size = topSize(p, f), @@ -695,11 +695,11 @@ fn lookup(p: *Pardes, req: Req, target: Target) Reply { const parent: u64 = switch (target) { .top => |top| if (top.dir()) root else return Reply.fail(req.tag, E.NOTDIR), .pane => |t| switch (t.file) { - .dir => @intFromEnum(TopFile.pane), + .dir => @backingInt(TopFile.pane), .pty => Node.of(t.serial, .dir), else => return Reply.fail(req.tag, E.NOTDIR), }, - .col => |c| if (c.file == .dir) @intFromEnum(TopFile.col) else return Reply.fail(req.tag, E.NOTDIR), + .col => |c| if (c.file == .dir) @backingInt(TopFile.col) else return Reply.fail(req.tag, E.NOTDIR), }; return handle(p, .{ .tag = req.tag, .op = .getattr, .node = parent }); } @@ -709,12 +709,12 @@ fn lookup(p: *Pardes, req: Req, target: Target) Reply { .root => root: { if (std.mem.eql(u8, name, "os")) return fs.osHandle(p, .{ .tag = req.tag, .op = .getattr, .node = fs.os_root }); // `new` is reached in /pane, where the panes it makes are. - if (std.meta.stringToEnum(TopFile, name)) |t| if (t != .root and t != .new) break :root @intFromEnum(t); + if (std.meta.stringToEnum(TopFile, name)) |t| if (t != .root and t != .new) break :root @backingInt(t); if (sources.node(name)) |n| return sources.handle(p, .{ .tag = req.tag, .op = .getattr, .node = n }); return Reply.fail(req.tag, E.NOENT); }, .pane => pane: { - if (std.mem.eql(u8, name, new_pane)) break :pane @intFromEnum(TopFile.new); + if (std.mem.eql(u8, name, new_pane)) break :pane @backingInt(TopFile.new); // A pane directory is its serial, in decimal digits and never 0. if (name.len > 10) return Reply.fail(req.tag, E.NOENT); for (name) |c| if (c < '0' or c > '9') return Reply.fail(req.tag, E.NOENT); @@ -778,13 +778,13 @@ fn readdir(p: *Pardes, req: Req, target: Target) Reply { // The guide, then what describes the session, then the // files that act, then the directories. inline for (.{ TopFile.README, TopFile.index, TopFile.status, TopFile.focus, TopFile.ctl, TopFile.commands, TopFile.recent, TopFile.look, TopFile.exec, TopFile.pager, TopFile.log, TopFile.screen, TopFile.listeners, TopFile.layout, TopFile.tag, TopFile.tagexec, TopFile.pane, TopFile.col }) |t| { - if (skip > 0) skip -= 1 else stageDirent(out, p.gpa, @intFromEnum(t), t.dir(), t.fileName()); + if (skip > 0) skip -= 1 else stageDirent(out, p.gpa, @backingInt(t), t.dir(), t.fileName()); } if (skip > 0) skip -= 1 else stageDirent(out, p.gpa, fs.os_root, true, "os"); sources.stage(p, out, "", &skip); }, .pane => { - if (skip > 0) skip -= 1 else stageDirent(out, p.gpa, @intFromEnum(TopFile.new), false, TopFile.new.fileName()); + if (skip > 0) skip -= 1 else stageDirent(out, p.gpa, @backingInt(TopFile.new), false, TopFile.new.fileName()); var last: u32 = 0; while (nextSerialAfter(p, last)) |serial| { last = serial; @@ -1378,7 +1378,7 @@ test "a listing read in chunks is what it was at the open, however the panes cha const p = try th.withFile(testing.allocator, "x\n"); defer p.deinit(); for ([_]TopFile{ .index, .layout, .recent, .ctl }) |file| { - const node = @intFromEnum(file); + const node = @backingInt(file); const whole = try testing.allocator.dupe(u8, th.rd(p, node, 0, 1 << 16).bytes); defer testing.allocator.free(whole); const h = th.call(p, .{ .tag = 1, .op = .open, .node = node }).reply.handle; @@ -1389,7 +1389,7 @@ test "a listing read in chunks is what it was at the open, however the panes cha // Something changes between the chunks. const made = try th.newPane(p); _ = th.wr(p, Node.of(made, .name), "/tmp/pardes-frozen-listing.txt\n"); - _ = th.wr(p, @intFromEnum(TopFile.ctl), "Verbose off\n"); + _ = th.wr(p, @backingInt(TopFile.ctl), "Verbose off\n"); while (true) { const more = th.call(p, .{ .tag = 2, .op = .read, .node = node, .handle = h, .off = got.items.len, .size = 7 }).bytes; if (more.len == 0) break; @@ -1397,7 +1397,7 @@ test "a listing read in chunks is what it was at the open, however the panes cha } _ = th.call(p, .{ .tag = 3, .op = .release, .node = node, .handle = h, .opened = true }); try testing.expectEqualStrings(whole, got.items); - _ = th.wr(p, @intFromEnum(TopFile.ctl), "Verbose on\n"); + _ = th.wr(p, @backingInt(TopFile.ctl), "Verbose on\n"); } } @@ -1418,7 +1418,7 @@ test "filesystem inspection preserves pending and displayed Look hover" { } }); try testing.expect(p.look_hover_wait != null); const body = Node.of(serialOf(p), .body); - const screen_node = @intFromEnum(TopFile.screen); + const screen_node = @backingInt(TopFile.screen); for (0..2) |phase| { if (phase == 1) { for (0..delay) |_| p.update(.tick); @@ -1429,7 +1429,7 @@ test "filesystem inspection preserves pending and displayed Look hover" { const requests = [_]Req{ .{ .tag = 1, .op = .lookup, .node = root, .data = "screen" }, .{ .tag = 1, .op = .lookup, .node = root, .data = "status" }, - .{ .tag = 1, .op = .getattr, .node = @intFromEnum(TopFile.pane) }, + .{ .tag = 1, .op = .getattr, .node = @backingInt(TopFile.pane) }, .{ .tag = 2, .op = .getattr, .node = body }, .{ .tag = 3, .op = .open, .node = body }, .{ .tag = 4, .op = .read, .node = body, .size = 5 }, @@ -1458,14 +1458,14 @@ test "log stats 0 however much it holds, a stream as acme's generated files are" defer p.deinit(); _ = th.wr(p, Node.of(th.serialOf(p), .exec), "Msg a record for the log\n"); try testing.expect(th.logHas(p, "a record for the log")); - try testing.expectEqual(@as(u64, 0), call(p, .{ .tag = 1, .op = .getattr, .node = @intFromEnum(TopFile.log) }).reply.attr.size); + try testing.expectEqual(@as(u64, 0), call(p, .{ .tag = 1, .op = .getattr, .node = @backingInt(TopFile.log) }).reply.attr.size); } test "filesystem pane creation and truncation cancel Look hover" { const requests = [_]Req{ // Opening `new` is what makes a pane now; walking to it makes none, // and so must leave a pending hover alone. - .{ .tag = 2, .op = .open, .node = @intFromEnum(TopFile.new) }, + .{ .tag = 2, .op = .open, .node = @backingInt(TopFile.new) }, .{ .tag = 3, .op = .setattr, .node = 0, .truncate = true }, }; for (requests) |request| { @@ -1493,16 +1493,16 @@ test "README names every file the tree serves" { } }; inline for (@typeInfo(TopFile).@"enum".field_values) |value| { - const t: TopFile = @enumFromInt(value); + const t: TopFile = @fromBackingInt(@intCast(value)); if (t != .root and !words.has(t.fileName())) { std.debug.print("README does not mention /{s}\n", .{t.fileName()}); return error.Undocumented; } } inline for (@typeInfo(PaneFile).@"enum".field_values) |value| { - const t: PaneFile = @enumFromInt(value); + const t: PaneFile = @fromBackingInt(@intCast(value)); const ok = if (t == .dir) true else if (t.inPty() and t != .pty) - std.mem.indexOf(u8, fs.help, "pty/" ++ comptime @as(PaneFile, @enumFromInt(value)).fileName()) != null + std.mem.indexOf(u8, fs.help, "pty/" ++ comptime @as(PaneFile, @fromBackingInt(@intCast(value))).fileName()) != null else words.has(t.fileName()); if (!ok) { @@ -1530,8 +1530,8 @@ test "readdir lists the root and a pane directory without creating anything" { try testing.expectEqualStrings(name, top[i].name); try testing.expectEqual(i >= 16, top[i].dir); } - try testing.expectEqual(@intFromEnum(TopFile.pane), top[16].node); - try testing.expectEqual(@intFromEnum(TopFile.col), top[17].node); + try testing.expectEqual(@backingInt(TopFile.pane), top[16].node); + try testing.expectEqual(@backingInt(TopFile.col), top[17].node); try testing.expectEqual(fs.os_root, top[18].node); var idbuf: [16]u8 = undefined; try testing.expect(th.nameAt(top, try std.fmt.bufPrint(&idbuf, "{d}", .{serial})) == null); @@ -1554,7 +1554,7 @@ test "readdir lists the root and a pane directory without creating anything" { try testing.expectEqual(Status.ok, call(p, .{ .tag = 1, .op = .getattr, .node = entry.node }).reply.status); try testing.expectEqual(before, p.next_serial); } - const panes_dir = rdir(p, @intFromEnum(TopFile.pane), 0); + const panes_dir = rdir(p, @backingInt(TopFile.pane), 0); const listed = th.dirents(panes_dir.bytes, &buf); var idname: [16]u8 = undefined; const own = th.nameAt(listed, try std.fmt.bufPrint(&idname, "{d}", .{serial})).?; @@ -1565,16 +1565,16 @@ test "readdir lists the root and a pane directory without creating anything" { // client that stats every name a listing gave it inert. const shown = th.nameAt(listed, new_pane).?; try testing.expect(!shown.dir); - try testing.expectEqual(Status.ok, look_up(p, @intFromEnum(TopFile.pane), new_pane).reply.status); - try testing.expectEqual(Status.ok, call(p, .{ .tag = 1, .op = .getattr, .node = @intFromEnum(TopFile.new) }).reply.status); + try testing.expectEqual(Status.ok, look_up(p, @backingInt(TopFile.pane), new_pane).reply.status); + try testing.expectEqual(Status.ok, call(p, .{ .tag = 1, .op = .getattr, .node = @backingInt(TopFile.new) }).reply.status); try testing.expectEqual(before, p.next_serial); const dir = rdir(p, Node.of(serial, .dir), 0); const files = th.dirents(dir.bytes, &buf); try testing.expectEqual(@as(usize, 18), files.len); for ([_][]const u8{ - "name", "body", "tag", "ctl", "addr", "dot", "limit", "data", "xdata", - "sel", "dirty", "mark", "scroll", "errors", "event", "look", "exec", "tagexec", + "name", "body", "tag", "ctl", "addr", "dot", "limit", "data", "xdata", + "sel", "dirty", "mark", "scroll", "errors", "event", "look", "exec", "tagexec", }, 0..) |name, i| try testing.expectEqualStrings(name, files[i].name); try testing.expect(th.nameAt(files, ".") == null); @@ -1588,7 +1588,7 @@ test "readdir lists the root and a pane directory without creating anything" { try testing.expectEqual(before, p.next_serial); try testing.expectEqual(E.NOTDIR, rdir(p, Node.of(serial, .body), 0).errno()); - try testing.expectEqual(E.NOTDIR, rdir(p, @intFromEnum(TopFile.index), 0).errno()); + try testing.expectEqual(E.NOTDIR, rdir(p, @backingInt(TopFile.index), 0).errno()); } test "lookup resolves top files, pane serials and pane files" { @@ -1597,7 +1597,7 @@ test "lookup resolves top files, pane serials and pane files" { defer p.deinit(); const serial = serialOf(p); - try testing.expectEqual(@as(u64, @intFromEnum(TopFile.index)), look_up(p, root, "index").reply.attr.node); + try testing.expectEqual(@as(u64, @backingInt(TopFile.index)), look_up(p, root, "index").reply.attr.node); try testing.expect(!look_up(p, root, "status").reply.attr.dir); try testing.expectEqual(@as(u16, 0o444), look_up(p, root, "status").reply.attr.mode); try testing.expectEqual(@as(u16, 0o666), look_up(p, root, "look").reply.attr.mode); @@ -1607,17 +1607,17 @@ test "lookup resolves top files, pane serials and pane files" { try testing.expectEqual(E.NOENT, look_up(p, root, "nosuchthing").errno()); try testing.expectEqual(E.NOENT, look_up(p, root, "self").errno()); try testing.expectEqual(E.NOENT, look_up(p, root, "cons").errno()); - try testing.expectEqual(E.NOTDIR, look_up(p, @intFromEnum(TopFile.index), "x").errno()); + try testing.expectEqual(E.NOTDIR, look_up(p, @backingInt(TopFile.index), "x").errno()); var idbuf: [16]u8 = undefined; const serial_name = try std.fmt.bufPrint(&idbuf, "{d}", .{serial}); try testing.expectEqual(E.NOENT, look_up(p, root, serial_name).errno()); - const dir = look_up(p, @intFromEnum(TopFile.pane), serial_name); + const dir = look_up(p, @backingInt(TopFile.pane), serial_name); try testing.expectEqual(Node.of(serial, .dir), dir.reply.attr.node); try testing.expect(dir.reply.attr.dir); try testing.expectEqualStrings(serial_name, dir.reply.attr.name); - try testing.expectEqual(E.NOENT, look_up(p, @intFromEnum(TopFile.pane), "99999").errno()); - try testing.expectEqual(E.NOENT, look_up(p, @intFromEnum(TopFile.pane), "0").errno()); + try testing.expectEqual(E.NOENT, look_up(p, @backingInt(TopFile.pane), "99999").errno()); + try testing.expectEqual(E.NOENT, look_up(p, @backingInt(TopFile.pane), "0").errno()); const body = look_up(p, Node.of(serial, .dir), "body"); try testing.expectEqual(Node.of(serial, .body), body.reply.attr.node); @@ -1634,19 +1634,19 @@ test "opening /pane/new makes a pane and removing one closes it" { const p = try withFile(gpa, "first\n"); defer p.deinit(); const before = p.next_serial; - const panes_dir = @intFromEnum(TopFile.pane); + const panes_dir = @backingInt(TopFile.pane); // Browsing /pane creates nothing, and neither does walking or stat-ing // `new` itself: only an open does. That is what lets `new` be listed at // all, since `ls -l` stats every name a listing handed it. try testing.expectEqual(Status.ok, rdir(p, panes_dir, 0).reply.status); try testing.expectEqual(Status.ok, look_up(p, panes_dir, new_pane).reply.status); - try testing.expectEqual(Status.ok, call(p, .{ .tag = 1, .op = .getattr, .node = @intFromEnum(TopFile.new) }).reply.status); + try testing.expectEqual(Status.ok, call(p, .{ .tag = 1, .op = .getattr, .node = @backingInt(TopFile.new) }).reply.status); try testing.expectEqual(before, p.next_serial); // The open makes the pane and hands back its serial; the read only // observes, so two reads of one fid answer the same pane. - const made = call(p, .{ .tag = 2, .op = .open, .node = @intFromEnum(TopFile.new) }); + const made = call(p, .{ .tag = 2, .op = .open, .node = @backingInt(TopFile.new) }); try testing.expectEqual(Status.ok, made.reply.status); try testing.expectEqual(before + 1, p.next_serial); const serial = before + 1; @@ -1654,7 +1654,7 @@ test "opening /pane/new makes a pane and removing one closes it" { var expected: [16]u8 = undefined; const want = try std.fmt.bufPrint(&expected, "{d}\n", .{serial}); for (0..2) |_| { - const answer = call(p, .{ .tag = 3, .op = .read, .node = @intFromEnum(TopFile.new), .handle = made.reply.handle, .size = 64 }); + const answer = call(p, .{ .tag = 3, .op = .read, .node = @backingInt(TopFile.new), .handle = made.reply.handle, .size = 64 }); try testing.expectEqualStrings(want, answer.bytes); } @@ -1668,10 +1668,10 @@ test "opening /pane/new makes a pane and removing one closes it" { // A second open is a second pane, and releasing a clone fid leaves the // pane it made standing. - const second = call(p, .{ .tag = 4, .op = .open, .node = @intFromEnum(TopFile.new) }); + const second = call(p, .{ .tag = 4, .op = .open, .node = @backingInt(TopFile.new) }); try testing.expectEqual(Status.ok, second.reply.status); try testing.expect(second.reply.handle != made.reply.handle); - _ = call(p, .{ .tag = 5, .op = .release, .node = @intFromEnum(TopFile.new), .handle = made.reply.handle, .opened = true }); + _ = call(p, .{ .tag = 5, .op = .release, .node = @backingInt(TopFile.new), .handle = made.reply.handle, .opened = true }); try testing.expect(p.paneBySerial(serial) != null); try testing.expectEqualStrings("hi", p.panes[id].?.file.?.content); @@ -1689,7 +1689,7 @@ test "opening /pane/new makes a pane and removing one closes it" { // Tremove closes the pane it names, and nothing else in the tree. try testing.expectEqual(E.PERM, th.rmdir(p, Node.of(serial, .body)).errno()); - try testing.expectEqual(E.PERM, th.rmdir(p, @intFromEnum(TopFile.index)).errno()); + try testing.expectEqual(E.PERM, th.rmdir(p, @backingInt(TopFile.index)).errno()); try testing.expect(p.paneBySerial(serial) != null); try testing.expectEqual(Status.ok, th.rmdir(p, Node.of(serial, .dir)).reply.status); try testing.expect(p.paneBySerial(serial) == null); @@ -1700,7 +1700,7 @@ test "every open that holds something is one record, named by its handle only on const p = try th.withTerm(testing.allocator); defer p.deinit(); const serial = serialOf(p); - const log = @intFromEnum(TopFile.log); + const log = @backingInt(TopFile.log); const event = Node.of(serial, .event); const run = Node.of(serial, .pty_run); const logged = call(p, .{ .tag = 1, .op = .open, .node = log }).reply.handle; @@ -1729,15 +1729,15 @@ test "directories walk to their parents" { defer p.deinit(); for ([_]struct { node: u64, parent: u64 }{ .{ .node = root, .parent = root }, - .{ .node = @intFromEnum(TopFile.pane), .parent = root }, - .{ .node = Node.of(serialOf(p), .dir), .parent = @intFromEnum(TopFile.pane) }, + .{ .node = @backingInt(TopFile.pane), .parent = root }, + .{ .node = Node.of(serialOf(p), .dir), .parent = @backingInt(TopFile.pane) }, .{ .node = fs.os_root, .parent = root }, }) |case| { const result = look_up(p, case.node, ".."); try testing.expectEqual(Status.ok, result.reply.status); try testing.expectEqual(case.parent, result.reply.attr.node); } - try testing.expectEqual(E.NOTDIR, look_up(p, @intFromEnum(TopFile.index), "..").errno()); + try testing.expectEqual(E.NOTDIR, look_up(p, @backingInt(TopFile.index), "..").errno()); try testing.expectEqual(E.NOTDIR, look_up(p, Node.of(serialOf(p), .body), "..").errno()); } @@ -1748,10 +1748,10 @@ test "editor paths resolve to the same nodes the wire serves" { var path: [64]u8 = undefined; try testing.expectEqual(root, resolveSelf(p, "").?); try testing.expectEqual(root, resolveSelf(p, "/./pane/../").?); - try testing.expectEqual(@intFromEnum(TopFile.index), resolveSelf(p, "index").?); - try testing.expectEqual(@intFromEnum(TopFile.status), resolveSelf(p, "status").?); + try testing.expectEqual(@backingInt(TopFile.index), resolveSelf(p, "index").?); + try testing.expectEqual(@backingInt(TopFile.status), resolveSelf(p, "status").?); try testing.expect(resolveSelf(p, "new") == null); - try testing.expectEqual(@intFromEnum(TopFile.pane), resolveSelf(p, "pane").?); + try testing.expectEqual(@backingInt(TopFile.pane), resolveSelf(p, "pane").?); try testing.expectEqual(Node.of(serial, .dir), resolveSelf(p, try std.fmt.bufPrint(&path, "pane/{d}", .{serial})).?); try testing.expectEqual(Node.of(serial, .sel), resolveSelf(p, try std.fmt.bufPrint(&path, "pane/{d}/sel", .{serial})).?); try testing.expect(resolveSelf(p, try std.fmt.bufPrint(&path, "pane/{d}/pty/ctl", .{serial})) == null); @@ -1800,7 +1800,7 @@ test "random placements, refused or not, leave no pane under its tag and two row const action = r.uintLessThan(u8, 8); switch (action) { 0 => _ = th.wr(p, Node.of(at, .exec), "New\n"), - 1 => _ = call(p, .{ .tag = 1, .op = .open, .node = @intFromEnum(TopFile.new) }), + 1 => _ = call(p, .{ .tag = 1, .op = .open, .node = @backingInt(TopFile.new) }), 2 => _ = th.wr(p, Node.of(at, .exec), "Newcol\n"), 3 => _ = th.wr(p, Node.of(at, .exec), "Edit =\n"), 4 => _ = th.wr(p, Node.of(at, .exec), "Tty\n"), @@ -1823,7 +1823,7 @@ test "at the pane cap, pane/new, look and New each say so, and look reads back e // Tall enough that the column holds every pane at its tag and two rows, // and wide enough that each tag, the session directory's +New, is one. p.update(.{ .resize = .{ .cols = 400, .rows = pardes.MAX_PANES * 4 } }); - const new = @intFromEnum(TopFile.new); + const new = @backingInt(TopFile.new); while (p.freeSlot() != null) try testing.expectEqual(Status.ok, call(p, .{ .tag = 1, .op = .open, .node = new }).reply.status); var want: [64]u8 = undefined; const said = try std.fmt.bufPrint(&want, "no space for a pane: {d} max", .{pardes.MAX_PANES}); @@ -1840,7 +1840,7 @@ test "at the pane cap, pane/new, look and New each say so, and look reads back e var dir_buf: [4096]u8 = undefined; const dir = dir_buf[0..try tmp.dir.realPath(testing.io, &dir_buf)]; var line: [4200]u8 = undefined; - const look_node = @intFromEnum(TopFile.look); + const look_node = @backingInt(TopFile.look); const looked = th.wr(p, look_node, try std.fmt.bufPrint(&line, "{s}/f.txt\n", .{dir})); try testing.expect(looked.errno() != 0); try testing.expect(std.mem.indexOf(u8, looked.reply.ename, said) != null); @@ -1857,7 +1857,7 @@ test "at the pane cap, pane/new, look and New each say so, and look reads back e test "nothing a mount's close or a no-op truncate sends waits on the editor: a held line runs at its next step" { const p = try withFile(testing.allocator, "x\n"); defer p.deinit(); - const exec = @intFromEnum(TopFile.exec); + const exec = @backingInt(TopFile.exec); // `> exec` truncates nothing; `> body` does. try testing.expect(!needsQuiet(p, .{ .tag = 1, .op = .setattr, .node = exec, .truncate = true })); try testing.expect(!changesPane(p, .{ .tag = 1, .op = .setattr, .node = exec, .truncate = true })); @@ -1875,7 +1875,7 @@ test "nothing a mount's close or a no-op truncate sends waits on the editor: a h test "a command line cut across writes runs once whole, and the last runs at release; an Edit block waits for its end" { const p = try th.withFile(testing.allocator, "x\n"); defer p.deinit(); - const exec = @intFromEnum(TopFile.exec); + const exec = @backingInt(TopFile.exec); const h = call(p, .{ .tag = 1, .op = .open, .node = exec, .omode = 1 }).reply.handle; try testing.expect(h != 0); // Each piece fills its Twrite (a client's one write cut at msize). @@ -1906,12 +1906,12 @@ test "a refused open, create or remove says why in words and logs no err; a refu const serial = serialOf(p); // pane/new is read, never written: a write is refused, and is no // failure the log tells of. - const new = th.wr(p, @intFromEnum(TopFile.new), "x\n"); + const new = th.wr(p, @backingInt(TopFile.new), "x\n"); try testing.expectEqual(Status.err, new.reply.status); try testing.expectEqualStrings("permission denied", new.reply.ename); const made = call(p, .{ .tag = 2, .op = .open, .node = Node.of(serial, .body), .create = true }); try testing.expectEqualStrings("permission denied", made.reply.ename); - const gone = th.rmdir(p, @intFromEnum(TopFile.index)); + const gone = th.rmdir(p, @backingInt(TopFile.index)); try testing.expectEqual(Status.err, gone.reply.status); try testing.expect(gone.reply.ename.len > 0 and !std.ascii.isUpper(gone.reply.ename[0])); // An OTRUNC open's truncation of data after a failed addr: refused, no err. @@ -1961,7 +1961,7 @@ test "a write with no newline waits for its newline or the close, whatever its s test "look and exec read back what their own open's write touched; a fresh open reads the session's last" { const p = try th.withFile(testing.allocator, "x\n"); defer p.deinit(); - const exec = @intFromEnum(TopFile.exec); + const exec = @backingInt(TopFile.exec); const first = p.panes[0].?.serial; const mine = call(p, .{ .tag = 1, .op = .open, .node = exec, .omode = 2 }).reply.handle; const theirs = call(p, .{ .tag = 2, .op = .open, .node = exec, .omode = 2 }).reply.handle; @@ -2013,7 +2013,7 @@ test "a rename of a pane's directory or file is refused as not permitted" { test "no placement leaves a pane shorter than its tag and two rows; a full column refuses the next" { const p = try th.withFile(testing.allocator, "x\n"); defer p.deinit(); - const new = @intFromEnum(TopFile.new); + const new = @backingInt(TopFile.new); var made: usize = 1; const refused = while (made < pardes.MAX_PANES) : (made += 1) { const a = call(p, .{ .tag = 1, .op = .open, .node = new }); @@ -2078,7 +2078,7 @@ test "a pane made from pane/new goes last in its column, even when the last pane const p = try th.withFile(testing.allocator, "x\n"); defer p.deinit(); for (0..3) |_| { - const made = call(p, .{ .tag = 1, .op = .open, .node = @intFromEnum(TopFile.new) }).reply.handle; + const made = call(p, .{ .tag = 1, .op = .open, .node = @backingInt(TopFile.new) }).reply.handle; p.sync(); try testing.expectEqual(made, p.panes[p.col_panes[0][p.col_n[0] - 1]].?.serial); } diff --git a/src/pager.zig b/src/pager.zig index feabd194..aba73d43 100644 --- a/src/pager.zig +++ b/src/pager.zig @@ -240,8 +240,8 @@ const Handler = struct { .reset_strikethrough => s.strikethrough = false, .direct_color_fg => |c| s.fg = .{ .rgb = .{ c.r, c.g, c.b } }, .direct_color_bg => |c| s.bg = .{ .rgb = .{ c.r, c.g, c.b } }, - .@"8_fg", .@"8_bright_fg" => |name| s.fg = .{ .index = @intFromEnum(name) }, - .@"8_bg", .@"8_bright_bg" => |name| s.bg = .{ .index = @intFromEnum(name) }, + .@"8_fg", .@"8_bright_fg" => |name| s.fg = .{ .index = @backingInt(name) }, + .@"8_bg", .@"8_bright_bg" => |name| s.bg = .{ .index = @backingInt(name) }, .@"256_fg" => |i| s.fg = .{ .index = i }, .@"256_bg" => |i| s.bg = .{ .index = i }, .reset_fg => s.fg = .default, diff --git a/src/pardes.zig b/src/pardes.zig index 8da0922d..7e166847 100644 --- a/src/pardes.zig +++ b/src/pardes.zig @@ -924,7 +924,7 @@ test "Filter is ordered after Del and toggles only its terminal or +Pager pane" const testing = std.testing; const del = std.meta.stringToEnum(Builtin, "Del") orelse return error.MissingDelBuiltin; const filter = std.meta.stringToEnum(Builtin, "Filter") orelse return error.MissingFilterBuiltin; - try testing.expectEqual(@intFromEnum(del) + 1, @intFromEnum(filter)); + try testing.expectEqual(@backingInt(del) + 1, @backingInt(filter)); const p = try Pardes.init(testing.allocator, .{ .tty_only = true }); defer p.deinit(); @@ -3308,8 +3308,8 @@ test "tabbed file aligns syntax cursor and mouse at the nearest insertion gap" { const pane = try p.setTestFile("\treturn x\n"); const f = &pane.file.?; f.highlights = try p.tree_sitter_gpa.alloc(u8, f.content.len); - @memset(f.highlights, @intFromEnum(syntax.Syn.none)); - @memset(f.highlights[1..7], @intFromEnum(syntax.Syn.keyword)); + @memset(f.highlights, @backingInt(syntax.Syn.none)); + @memset(f.highlights[1..7], @backingInt(syntax.Syn.keyword)); f.syntax_dirty = false; pane.body.cur_row = 0; pane.body.cur_col = 1; @@ -3721,7 +3721,7 @@ pub fn hit(key: Key, binding: []const config.Chord) bool { return false; } -pub const sel_slot = @intFromEnum(config.select_button); +pub const sel_slot = @backingInt(config.select_button); /// Pixel dimensions are meaningful only to the native PDF placement path. /// Keep resize events layout-only when that path is not part of the build. @@ -6040,7 +6040,7 @@ pub const Pardes = struct { // The one-failure rule is a write's: a refused open (its OTRUNC's // truncation, a setattr, too), create or remove is its Rerror alone, // no err, as is a write to pane/new, which is only ever read. - const ruled = req.op == .write and req.node != @intFromEnum(ctlfs.TopFile.new); + const ruled = req.op == .write and req.node != @backingInt(ctlfs.TopFile.new); if (reply.status == .err and ruled) ctlfs.events.noteError(p, req, reply); // The request was a whole step of its own, so it settles the way a // step does: the cursor and scroll reconciled, the scripted panes diff --git a/src/pdf_view.zig b/src/pdf_view.zig index 567117bb..500f05f3 100644 --- a/src/pdf_view.zig +++ b/src/pdf_view.zig @@ -2604,7 +2604,7 @@ pub fn pointerRelease( ) PointerRelease { if (comptime !enabled) return .{}; const state = &(pane.pdf orelse return .{}); - const slot = @intFromEnum(button); + const slot = @backingInt(button); const grid_selection = pane.sel[slot]; pane.sel[slot].state = .none; // native quads, not projected text cells diff --git a/src/syntax.zig b/src/syntax.zig index fa212ca7..1c09c9f3 100644 --- a/src/syntax.zig +++ b/src/syntax.zig @@ -214,7 +214,7 @@ fn ensure(spec: *Spec) !Selected { const capture_styles = spec.capture_styles[0..query.captureCount()]; for (capture_styles, 0..) |*style, id| { const name = query.captureNameForId(@intCast(id)) orelse ""; - style.* = @intFromEnum(synFor(name)); + style.* = @backingInt(synFor(name)); if (style.* == 0) query.disableCapture(name); } const parser = ts.Parser.create(); @@ -965,11 +965,11 @@ test "syntax formatted locations color hidden context and preserve multiline sou const styles = try highlightLocationRows(gpa, content, &rows); defer gpa.free(styles); const body = std.mem.indexOf(u8, content, "comment body").?; - try std.testing.expectEqual(@intFromEnum(Syn.comment), styles[body]); - try std.testing.expectEqual(@intFromEnum(Syn.none), styles[body - 1]); + try std.testing.expectEqual(@backingInt(Syn.comment), styles[body]); + try std.testing.expectEqual(@backingInt(Syn.none), styles[body - 1]); const number = std.mem.indexOf(u8, content, "42").?; - try std.testing.expectEqual(@intFromEnum(Syn.number), styles[number]); - try std.testing.expectEqual(@intFromEnum(Syn.none), styles[0]); + try std.testing.expectEqual(@backingInt(Syn.number), styles[number]); + try std.testing.expectEqual(@backingInt(Syn.none), styles[0]); } test "syntax formatted locations separate alignment from Markdown indentation" { @@ -985,8 +985,8 @@ test "syntax formatted locations separate alignment from Markdown indentation" { }; const styles = try highlightLocationRows(gpa, content, &rows); defer gpa.free(styles); - try std.testing.expectEqual(@intFromEnum(Syn.keyword), styles[std.mem.indexOf(u8, content, "Heading").?]); - try std.testing.expectEqual(@intFromEnum(Syn.string), styles[std.mem.indexOf(u8, content, "Code").?]); + try std.testing.expectEqual(@backingInt(Syn.keyword), styles[std.mem.indexOf(u8, content, "Heading").?]); + try std.testing.expectEqual(@backingInt(Syn.string), styles[std.mem.indexOf(u8, content, "Code").?]); } fn inject(styles: []u8, source: []const u8, node: ts.Node, markdown: bool) void { const kind = node.kind(); @@ -1149,7 +1149,7 @@ pub fn highlightDiffRows(gpa: std.mem.Allocator, content: []const u8, start_raw: .meta, .old_path, .new_path => .comment, else => .none, }; - if (style != .none) window.fill(at, nl - at, @intFromEnum(style)); + if (style != .none) window.fill(at, nl - at, @backingInt(style)); } if (nl >= content.len) break; at = nl + 1; @@ -1192,10 +1192,10 @@ fn paintDiffPiece(gpa: std.mem.Allocator, window: anytype, bytes: []const u8, at for (kinds) |kind| { const line = lines.next() orelse break; const style: u8 = switch (kind) { - .added => @intFromEnum(Syn.string) | diff_added, - .removed => @intFromEnum(Syn.number) | diff_removed, - .no_newline => @intFromEnum(Syn.comment), - .hunk => @intFromEnum(Syn.keyword), + .added => @backingInt(Syn.string) | diff_added, + .removed => @backingInt(Syn.number) | diff_removed, + .no_newline => @backingInt(Syn.comment), + .hunk => @backingInt(Syn.keyword), else => 0, }; if (style != 0) window.fill(at + offset, line.len, style); @@ -1273,8 +1273,8 @@ fn paintHunk(gpa: std.mem.Allocator, out: []u8, bytes: []const u8, kinds: []cons .removed => @memcpy(dst, old_colors[old_at..][0..code_len]), .added => @memcpy(dst, new_colors[new_at..][0..code_len]), .context => @memcpy(dst, if (context_new) new_colors[new_at..][0..code_len] else old_colors[old_at..][0..code_len]), - .no_newline => @memset(out[offset..][0..line.len], @intFromEnum(Syn.comment)), - .hunk => @memset(out[offset..][0..line.len], @intFromEnum(Syn.keyword)), + .no_newline => @memset(out[offset..][0..line.len], @backingInt(Syn.comment)), + .hunk => @memset(out[offset..][0..line.len], @backingInt(Syn.keyword)), else => {}, } if (kind == .context or kind == .removed) old_at += code_len + 1; @@ -1322,8 +1322,8 @@ test "syntax a results row is coloured by the file its location names" { try std.testing.expectEqual(content.len, styles.len); for (styles[0.."src/a.zig:1:1".len]) |b| try std.testing.expectEqual(@as(u8, 0), b); const zig_kw = std.mem.indexOf(u8, content, "struct").?; - try std.testing.expectEqual(@intFromEnum(Syn.keyword), styles[zig_kw]); - try std.testing.expectEqual(@intFromEnum(Syn.keyword), styles[zig_kw + 5]); + try std.testing.expectEqual(@backingInt(Syn.keyword), styles[zig_kw]); + try std.testing.expectEqual(@backingInt(Syn.keyword), styles[zig_kw + 5]); const prose = std.mem.indexOf(u8, content, "just some prose").?; for (styles[prose .. prose + 14]) |b| try std.testing.expectEqual(@as(u8, 0), b); const bare = std.mem.indexOf(u8, content, "src/c.zig").?; @@ -1371,14 +1371,14 @@ test "syntax default full grammar set highlights Typst source" { const keyword_at = std.mem.indexOf(u8, source, "let").?; const number_at = std.mem.indexOf(u8, source, "42").?; const string_at = std.mem.indexOf(u8, source, "\"hello\"").?; - try std.testing.expectEqual(Syn.comment, @as(Syn, @enumFromInt(styles[comment_at]))); - try std.testing.expectEqual(Syn.keyword, @as(Syn, @enumFromInt(styles[keyword_at]))); - try std.testing.expectEqual(Syn.number, @as(Syn, @enumFromInt(styles[number_at]))); - try std.testing.expectEqual(Syn.string, @as(Syn, @enumFromInt(styles[string_at]))); + try std.testing.expectEqual(Syn.comment, @as(Syn, @fromBackingInt(@intCast(styles[comment_at])))); + try std.testing.expectEqual(Syn.keyword, @as(Syn, @fromBackingInt(@intCast(styles[keyword_at])))); + try std.testing.expectEqual(Syn.number, @as(Syn, @fromBackingInt(@intCast(styles[number_at])))); + try std.testing.expectEqual(Syn.string, @as(Syn, @fromBackingInt(@intCast(styles[string_at])))); const short_ext = try highlightFileRange(std.testing.allocator, "paper.typ", source, 0, source.len); defer std.testing.allocator.free(short_ext); - try std.testing.expectEqual(Syn.keyword, @as(Syn, @enumFromInt(short_ext[keyword_at]))); + try std.testing.expectEqual(Syn.keyword, @as(Syn, @fromBackingInt(@intCast(short_ext[keyword_at])))); } test "syntax Typst markup constructs paint and raw blocks inject their language" { @@ -1403,7 +1403,7 @@ test "syntax Typst markup constructs paint and raw blocks inject their language" const synAt = struct { fn f(s: []const u8, src: []const u8, needle: []const u8, offset: usize) Syn { - return @enumFromInt(s[std.mem.indexOf(u8, src, needle).? + offset]); + return @fromBackingInt(@intCast(s[std.mem.indexOf(u8, src, needle).? + offset])); } }.f; try std.testing.expectEqual(Syn.keyword, synAt(styles, source, "= Heading", 0)); @@ -1443,7 +1443,7 @@ test "syntax markdown highlights markup, injects inline spans and fenced code bl const synAt = struct { fn f(s: []const u8, src: []const u8, needle: []const u8, offset: usize) Syn { - return @enumFromInt(s[std.mem.indexOf(u8, src, needle).? + offset]); + return @fromBackingInt(@intCast(s[std.mem.indexOf(u8, src, needle).? + offset])); } }.f; try std.testing.expectEqual(Syn.keyword, synAt(styles, source, "Title", 0)); @@ -1471,8 +1471,8 @@ test "syntax inline fast path agrees with full Markdown query" { const actual = try std.testing.allocator.alloc(u8, source.len); defer std.testing.allocator.free(actual); for ([_]Syn{ .none, .keyword }) |background| { - @memset(expected, @intFromEnum(background)); - @memset(actual, @intFromEnum(background)); + @memset(expected, @backingInt(background)); + @memset(actual, @backingInt(background)); runQuery(expected, sel, tree, 0); inject(actual, source, tree.rootNode(), true); if (!std.mem.eql(u8, expected, actual)) std.debug.print("inline mismatch: {s}\n", .{source}); @@ -1511,9 +1511,9 @@ test "syntax plain Markdown keeps block styles without starting the inline parse const source = "# Heading\n\nPlain prose.\n\n indented code\n"; const styles = try highlightFileRange(std.testing.allocator, "a.md", source, 0, source.len); defer std.testing.allocator.free(styles); - try std.testing.expectEqual(@intFromEnum(Syn.keyword), styles[2]); - try std.testing.expectEqual(@intFromEnum(Syn.none), styles[std.mem.indexOf(u8, source, "Plain").?]); - try std.testing.expectEqual(@intFromEnum(Syn.string), styles[std.mem.indexOf(u8, source, "indented").?]); + try std.testing.expectEqual(@backingInt(Syn.keyword), styles[2]); + try std.testing.expectEqual(@backingInt(Syn.none), styles[std.mem.indexOf(u8, source, "Plain").?]); + try std.testing.expectEqual(@backingInt(Syn.string), styles[std.mem.indexOf(u8, source, "indented").?]); for (specs) |spec| { if (std.mem.eql(u8, spec.name, "markdown_inline")) try std.testing.expect(spec.selected == null); } @@ -1544,7 +1544,7 @@ test "syntax highlightDiff colors unified diff lines by prefix" { } fn diffSynAt(styles: []const u8, text: []const u8, needle: []const u8, offset: usize) Syn { - return @enumFromInt(styles[std.mem.indexOf(u8, text, needle).? + offset] & syn_bits); + return @fromBackingInt(@intCast(styles[std.mem.indexOf(u8, text, needle).? + offset] & syn_bits)); } test "syntax a Zig hunk is coloured as Zig, each side parsed whole" { @@ -1715,7 +1715,7 @@ test "syntax a hunk painted once is kept, and a long one is parsed in pieces" { const at = std.mem.indexOf(u8, content, "+const v1000 ").?; const window = try highlightDiff(gpa, content, at, at + 200); defer gpa.free(window); - try std.testing.expectEqual(Syn.number, @as(Syn, @enumFromInt(window["+const v1000 = ".len] & syn_bits))); + try std.testing.expectEqual(Syn.number, @as(Syn, @fromBackingInt(@intCast(window["+const v1000 = ".len] & syn_bits)))); var cached: usize = 0; for (diff_pieces) |slot| if (slot) |piece| { cached += 1; @@ -1780,7 +1780,7 @@ test "syntax query filtering preserves upstream colors" { reference.query = raw_query; reference.capture_styles = try std.testing.allocator.alloc(u8, raw_query.captureCount()); defer std.testing.allocator.free(reference.capture_styles); - for (reference.capture_styles, 0..) |*style, id| style.* = @intFromEnum(synFor(raw_query.captureNameForId(@intCast(id)) orelse "")); + for (reference.capture_styles, 0..) |*style, id| style.* = @backingInt(synFor(raw_query.captureNameForId(@intCast(id)) orelse "")); const tree = selected.parser.parseString(source, null) orelse return error.ParseFailed; defer tree.destroy(); var expected: [source.len]u8 = @splat(0); @@ -1806,8 +1806,8 @@ test "syntax Zig keyword captures cover both bytes beyond line ten thousand" { defer std.testing.allocator.free(styles); for ([_][]const u8{ "fn", "if" }) |keyword| { const at = std.mem.indexOf(u8, code, keyword).?; - try std.testing.expectEqual(@intFromEnum(Syn.keyword), styles[at]); - try std.testing.expectEqual(@intFromEnum(Syn.keyword), styles[at + 1]); + try std.testing.expectEqual(@backingInt(Syn.keyword), styles[at]); + try std.testing.expectEqual(@backingInt(Syn.keyword), styles[at + 1]); } } @@ -1823,8 +1823,8 @@ test "syntax allocator switching clears default-runtime caches" { const restored = try highlightFileRange(std.testing.allocator, "a.zig", source, 0, source.len); defer std.testing.allocator.free(restored); defer stop(); - try std.testing.expectEqual(@intFromEnum(Syn.keyword), restored[0]); - try std.testing.expectEqual(@intFromEnum(Syn.keyword), restored[1]); + try std.testing.expectEqual(@backingInt(Syn.keyword), restored[0]); + try std.testing.expectEqual(@backingInt(Syn.keyword), restored[1]); } test "syntax location context snapshots retain omitted multiline comment scope" { @@ -1848,8 +1848,8 @@ test "syntax location context snapshots retain omitted multiline comment scope" const styles = try highlightLocationRows(gpa, content, &rows); defer gpa.free(styles); for (styles[rows[0].code_start..][0..code.len]) |style| - try std.testing.expectEqual(@intFromEnum(Syn.comment), style); - try std.testing.expectEqual(@intFromEnum(Syn.none), styles[0]); + try std.testing.expectEqual(@backingInt(Syn.comment), style); + try std.testing.expectEqual(@backingInt(Syn.none), styles[0]); } test "syntax declaration locations clear snapshots without muting ordinary context" { @@ -1875,7 +1875,7 @@ test "syntax declaration locations clear snapshots without muting ordinary conte const styles = try highlightLocationRows(gpa, content, &rows); defer gpa.free(styles); for (styles[3..][0..header.len]) |style| try std.testing.expectEqual(@as(u8, 0), style); - try std.testing.expectEqual(@intFromEnum(Syn.number), styles[std.mem.indexOf(u8, content, "42").?]); + try std.testing.expectEqual(@backingInt(Syn.number), styles[std.mem.indexOf(u8, content, "42").?]); } test "syntax stacked addresses do not split multiline source groups" { @@ -1895,11 +1895,11 @@ test "syntax stacked addresses do not split multiline source groups" { }; const styles = try highlightLocationRows(gpa, content, &rows); defer gpa.free(styles); - try std.testing.expectEqual(@intFromEnum(Syn.comment), styles[std.mem.indexOf(u8, content, "42").?]); - try std.testing.expectEqual(@intFromEnum(Syn.number), styles[std.mem.indexOf(u8, content, "7;").?]); + try std.testing.expectEqual(@backingInt(Syn.comment), styles[std.mem.indexOf(u8, content, "42").?]); + try std.testing.expectEqual(@backingInt(Syn.number), styles[std.mem.indexOf(u8, content, "7;").?]); for ([_][]const u8{ "a.c:1:1", "a.c:2:1", "a.c:3:1" }) |label| { const at = std.mem.indexOf(u8, content, label).?; - for (styles[at..][0..label.len]) |style| try std.testing.expectEqual(@intFromEnum(Syn.none), style); + for (styles[at..][0..label.len]) |style| try std.testing.expectEqual(@backingInt(Syn.none), style); } } diff --git a/src/terminal.zig b/src/terminal.zig index a8e7931c..33ad22e6 100644 --- a/src/terminal.zig +++ b/src/terminal.zig @@ -1347,7 +1347,7 @@ pub fn forwardKey(p: *Pardes, id: usize, key: Key) void { pub fn enterTty(p: *Pardes, id: usize) void { const pane = p.panes[id] orelse return; - const selected = pane.rawPointerText(pane.sel[@intFromEnum(config.select_button)]) != null; + const selected = pane.rawPointerText(pane.sel[@backingInt(config.select_button)]) != null; if (comptime enabled) if (!selected and pane.terminal != null and pane.body.cur_pinned and pane.terminal.?.vt.cursorIsAtPrompt()) handoff: { const screen = pane.terminal.?.vt.screens.active; const goff: i32 = @intCast(screen.pages.scrollbar().offset); diff --git a/src/web.zig b/src/web.zig index fed2ba5a..f89aa7e9 100644 --- a/src/web.zig +++ b/src/web.zig @@ -258,18 +258,20 @@ fn mouseWithHit(button_arg: u32, kind_arg: u32, col_arg: u32, row_arg: u32, mods 3 => .drag, else => return, }; - s.core.update(.{ .mouse = .{ - .body_hit = hit, - .tag_hit = tag_hit, - .button = button, - .kind = kind, - .col = @intCast(@min(col_arg, std.math.maxInt(u16))), - .row = @intCast(@min(row_arg, std.math.maxInt(u16))), - .ctrl = mods & 1 != 0, - // Alt-click is B2 and Cmd/Super-click B3 (mouse.emulateButton). - .alt = mods & 2 != 0, - .super = mods & 8 != 0, - } }); + s.core.update(.{ + .mouse = .{ + .body_hit = hit, + .tag_hit = tag_hit, + .button = button, + .kind = kind, + .col = @intCast(@min(col_arg, std.math.maxInt(u16))), + .row = @intCast(@min(row_arg, std.math.maxInt(u16))), + .ctrl = mods & 1 != 0, + // Alt-click is B2 and Cmd/Super-click B3 (mouse.emulateButton). + .alt = mods & 2 != 0, + .super = mods & 8 != 0, + }, + }); } export fn pardes_touch_scroll(delta: f32) void { @@ -347,7 +349,7 @@ export fn pardes_tag_layer_value(index: u32, field: u32) u32 { if (layer.rows == 0) return 0; return switch (field) { 0 => layer.cols, - 1 => @intFromEnum(layer.kind), + 1 => @backingInt(layer.kind), 2 => layer.id, 3 => layer.serial, 4 => layer.viewport.x, @@ -421,7 +423,7 @@ export fn pardes_row_metrics(body_w: u16, body_h: u16, tagline_w: u16, tagline_h export fn pardes_pointer_shape() u32 { const s = &(state orelse return 0); - return @intFromEnum(s.core.surface.pointer_shape); + return @backingInt(s.core.surface.pointer_shape); } export fn pardes_cursor_y() i32 { @@ -557,6 +559,6 @@ fn encodeAttrs(style: pardes.CellStyle) u16 { attrs |= @as(u16, @intFromBool(style.invisible)) << 5; attrs |= @as(u16, @intFromBool(style.strikethrough)) << 6; attrs |= @as(u16, @intFromBool(style.font_role == .tagline)) * attr_tagline; - attrs |= @as(u16, @intFromEnum(style.ul)) << 8; + attrs |= @as(u16, @backingInt(style.ul)) << 8; return attrs; } diff --git a/test/deck/buttons.zon b/test/deck/buttons.zon index 8b3ae7f8..50d9c70c 100644 --- a/test/deck/buttons.zon +++ b/test/deck/buttons.zon @@ -1,81 +1,81 @@ .{ .version = 1, .events = .{ -.{.t=3700753450,.pad=2,.ev=.{.button=.{.idx=10,.down=true}}}, -.{.t=3900818994,.pad=2,.ev=.{.button=.{.idx=10,.down=false}}}, -.{.t=3956546622,.pad=2,.ev=.{.button=.{.idx=9,.down=true}}}, -.{.t=4123264775,.pad=2,.ev=.{.button=.{.idx=9,.down=false}}}, -.{.t=4930702402,.pad=2,.ev=.{.button=.{.idx=8,.down=true}}}, -.{.t=5145495294,.pad=2,.ev=.{.button=.{.idx=8,.down=false}}}, -.{.t=5256748340,.pad=2,.ev=.{.button=.{.idx=7,.down=true}}}, -.{.t=5467530268,.pad=2,.ev=.{.button=.{.idx=7,.down=false}}}, -.{.t=6756403713,.pad=2,.ev=.{.button=.{.idx=2,.down=true}}}, -.{.t=6911854483,.pad=2,.ev=.{.button=.{.idx=2,.down=false}}}, -.{.t=7211860980,.pad=2,.ev=.{.button=.{.idx=3,.down=true}}}, -.{.t=7389532087,.pad=2,.ev=.{.button=.{.idx=3,.down=false}}}, -.{.t=8133944867,.pad=2,.ev=.{.button=.{.idx=3,.down=true}}}, -.{.t=8289426557,.pad=2,.ev=.{.button=.{.idx=3,.down=false}}}, -.{.t=9089438184,.pad=2,.ev=.{.button=.{.idx=5,.down=true}}}, -.{.t=9234016011,.pad=2,.ev=.{.button=.{.idx=2,.down=true}}}, -.{.t=9356447170,.pad=2,.ev=.{.button=.{.idx=2,.down=false}}}, -.{.t=9500690066,.pad=2,.ev=.{.button=.{.idx=5,.down=false}}}, -.{.t=10234132592,.pad=2,.ev=.{.button=.{.idx=5,.down=true}}}, -.{.t=10389693142,.pad=2,.ev=.{.button=.{.idx=2,.down=true}}}, -.{.t=10500635738,.pad=2,.ev=.{.button=.{.idx=2,.down=false}}}, -.{.t=10600562571,.pad=2,.ev=.{.button=.{.idx=5,.down=false}}}, -.{.t=11211884827,.pad=2,.ev=.{.button=.{.idx=3,.down=true}}}, -.{.t=11333789807,.pad=2,.ev=.{.button=.{.idx=3,.down=false}}}, -.{.t=11622673840,.pad=2,.ev=.{.button=.{.idx=3,.down=true}}}, -.{.t=11778210450,.pad=2,.ev=.{.button=.{.idx=3,.down=false}}}, -.{.t=12056066449,.pad=2,.ev=.{.button=.{.idx=0,.down=true}}}, -.{.t=12200470216,.pad=2,.ev=.{.button=.{.idx=0,.down=false}}}, -.{.t=13122626673,.pad=2,.ev=.{.button=.{.idx=1,.down=true}}}, -.{.t=13256318175,.pad=2,.ev=.{.button=.{.idx=1,.down=false}}}, -.{.t=30877608417,.pad=2,.ev=.{.button=.{.idx=13,.down=true}}}, -.{.t=30932947265,.pad=2,.ev=.{.button=.{.idx=13,.down=false}}}, -.{.t=31188916557,.pad=2,.ev=.{.button=.{.idx=14,.down=true}}}, -.{.t=31344392047,.pad=2,.ev=.{.button=.{.idx=14,.down=false}}}, -.{.t=31355303161,.pad=2,.ev=.{.button=.{.idx=11,.down=true}}}, -.{.t=31377574308,.pad=2,.ev=.{.button=.{.idx=11,.down=false}}}, -.{.t=31377580618,.pad=2,.ev=.{.button=.{.idx=11,.down=true}}}, -.{.t=31533158438,.pad=2,.ev=.{.button=.{.idx=11,.down=false}}}, -.{.t=31599806330,.pad=2,.ev=.{.button=.{.idx=12,.down=true}}}, -.{.t=31699701622,.pad=2,.ev=.{.button=.{.idx=14,.down=true}}}, -.{.t=31699711442,.pad=2,.ev=.{.button=.{.idx=12,.down=false}}}, -.{.t=31833163995,.pad=2,.ev=.{.button=.{.idx=14,.down=false}}}, -.{.t=31844214668,.pad=2,.ev=.{.button=.{.idx=11,.down=true}}}, -.{.t=31933218167,.pad=2,.ev=.{.button=.{.idx=11,.down=false}}}, -.{.t=31944106321,.pad=2,.ev=.{.button=.{.idx=13,.down=true}}}, -.{.t=31944118861,.pad=2,.ev=.{.button=.{.idx=13,.down=false}}}, -.{.t=32577585424,.pad=2,.ev=.{.button=.{.idx=7,.down=true}}}, -.{.t=32777404849,.pad=2,.ev=.{.button=.{.idx=7,.down=false}}}, -.{.t=32932893939,.pad=2,.ev=.{.button=.{.idx=8,.down=true}}}, -.{.t=33122371409,.pad=2,.ev=.{.button=.{.idx=8,.down=false}}}, -.{.t=34899667922,.pad=2,.ev=.{.button=.{.idx=10,.down=true}}}, -.{.t=35143908581,.pad=2,.ev=.{.button=.{.idx=10,.down=false}}}, -.{.t=35143918751,.pad=2,.ev=.{.button=.{.idx=9,.down=true}}}, -.{.t=35299532711,.pad=2,.ev=.{.button=.{.idx=9,.down=false}}}, -.{.t=36188307687,.pad=2,.ev=.{.button=.{.idx=10,.down=true}}}, -.{.t=36351697335,.pad=2,.ev=.{.button=.{.idx=9,.down=true}}}, -.{.t=36399712574,.pad=2,.ev=.{.button=.{.idx=10,.down=false}}}, -.{.t=36521680424,.pad=2,.ev=.{.button=.{.idx=10,.down=true}}}, -.{.t=36543814231,.pad=2,.ev=.{.button=.{.idx=9,.down=false}}}, -.{.t=36688528867,.pad=2,.ev=.{.button=.{.idx=10,.down=false}}}, -.{.t=38810548641,.pad=2,.ev=.{.button=.{.idx=8,.down=true}}}, -.{.t=38988265258,.pad=2,.ev=.{.button=.{.idx=8,.down=false}}}, -.{.t=39421485428,.pad=2,.ev=.{.button=.{.idx=7,.down=true}}}, -.{.t=39521563760,.pad=2,.ev=.{.button=.{.idx=8,.down=true}}}, -.{.t=39543869347,.pad=2,.ev=.{.button=.{.idx=7,.down=false}}}, -.{.t=39654975672,.pad=2,.ev=.{.button=.{.idx=8,.down=false}}}, -.{.t=40199575307,.pad=2,.ev=.{.button=.{.idx=0,.down=true}}}, -.{.t=40388115109,.pad=2,.ev=.{.button=.{.idx=0,.down=false}}}, -.{.t=40810375225,.pad=2,.ev=.{.button=.{.idx=2,.down=true}}}, -.{.t=40976868838,.pad=2,.ev=.{.button=.{.idx=2,.down=false}}}, -.{.t=41032455046,.pad=2,.ev=.{.button=.{.idx=3,.down=true}}}, -.{.t=41243668724,.pad=2,.ev=.{.button=.{.idx=3,.down=false}}}, -.{.t=42565700760,.pad=2,.ev=.{.button=.{.idx=2,.down=true}}}, -.{.t=42743538487,.pad=2,.ev=.{.button=.{.idx=2,.down=false}}}, -.{.t=43676697498,.pad=2,.ev=.{.button=.{.idx=5,.down=true}}}, -.{.t=43932510879,.pad=2,.ev=.{.button=.{.idx=5,.down=false}}}, -.{.t=43943745523,.pad=2,.ev=.{.button=.{.idx=1,.down=true}}}, -.{.t=44021582808,.pad=2,.ev=.{.button=.{.idx=1,.down=false}}}, -.{.t=44599100514,.pad=2,.ev=.{.button=.{.idx=1,.down=true}}}, + .{ .t = 3700753450, .pad = 2, .ev = .{ .button = .{ .idx = 10, .down = true } } }, + .{ .t = 3900818994, .pad = 2, .ev = .{ .button = .{ .idx = 10, .down = false } } }, + .{ .t = 3956546622, .pad = 2, .ev = .{ .button = .{ .idx = 9, .down = true } } }, + .{ .t = 4123264775, .pad = 2, .ev = .{ .button = .{ .idx = 9, .down = false } } }, + .{ .t = 4930702402, .pad = 2, .ev = .{ .button = .{ .idx = 8, .down = true } } }, + .{ .t = 5145495294, .pad = 2, .ev = .{ .button = .{ .idx = 8, .down = false } } }, + .{ .t = 5256748340, .pad = 2, .ev = .{ .button = .{ .idx = 7, .down = true } } }, + .{ .t = 5467530268, .pad = 2, .ev = .{ .button = .{ .idx = 7, .down = false } } }, + .{ .t = 6756403713, .pad = 2, .ev = .{ .button = .{ .idx = 2, .down = true } } }, + .{ .t = 6911854483, .pad = 2, .ev = .{ .button = .{ .idx = 2, .down = false } } }, + .{ .t = 7211860980, .pad = 2, .ev = .{ .button = .{ .idx = 3, .down = true } } }, + .{ .t = 7389532087, .pad = 2, .ev = .{ .button = .{ .idx = 3, .down = false } } }, + .{ .t = 8133944867, .pad = 2, .ev = .{ .button = .{ .idx = 3, .down = true } } }, + .{ .t = 8289426557, .pad = 2, .ev = .{ .button = .{ .idx = 3, .down = false } } }, + .{ .t = 9089438184, .pad = 2, .ev = .{ .button = .{ .idx = 5, .down = true } } }, + .{ .t = 9234016011, .pad = 2, .ev = .{ .button = .{ .idx = 2, .down = true } } }, + .{ .t = 9356447170, .pad = 2, .ev = .{ .button = .{ .idx = 2, .down = false } } }, + .{ .t = 9500690066, .pad = 2, .ev = .{ .button = .{ .idx = 5, .down = false } } }, + .{ .t = 10234132592, .pad = 2, .ev = .{ .button = .{ .idx = 5, .down = true } } }, + .{ .t = 10389693142, .pad = 2, .ev = .{ .button = .{ .idx = 2, .down = true } } }, + .{ .t = 10500635738, .pad = 2, .ev = .{ .button = .{ .idx = 2, .down = false } } }, + .{ .t = 10600562571, .pad = 2, .ev = .{ .button = .{ .idx = 5, .down = false } } }, + .{ .t = 11211884827, .pad = 2, .ev = .{ .button = .{ .idx = 3, .down = true } } }, + .{ .t = 11333789807, .pad = 2, .ev = .{ .button = .{ .idx = 3, .down = false } } }, + .{ .t = 11622673840, .pad = 2, .ev = .{ .button = .{ .idx = 3, .down = true } } }, + .{ .t = 11778210450, .pad = 2, .ev = .{ .button = .{ .idx = 3, .down = false } } }, + .{ .t = 12056066449, .pad = 2, .ev = .{ .button = .{ .idx = 0, .down = true } } }, + .{ .t = 12200470216, .pad = 2, .ev = .{ .button = .{ .idx = 0, .down = false } } }, + .{ .t = 13122626673, .pad = 2, .ev = .{ .button = .{ .idx = 1, .down = true } } }, + .{ .t = 13256318175, .pad = 2, .ev = .{ .button = .{ .idx = 1, .down = false } } }, + .{ .t = 30877608417, .pad = 2, .ev = .{ .button = .{ .idx = 13, .down = true } } }, + .{ .t = 30932947265, .pad = 2, .ev = .{ .button = .{ .idx = 13, .down = false } } }, + .{ .t = 31188916557, .pad = 2, .ev = .{ .button = .{ .idx = 14, .down = true } } }, + .{ .t = 31344392047, .pad = 2, .ev = .{ .button = .{ .idx = 14, .down = false } } }, + .{ .t = 31355303161, .pad = 2, .ev = .{ .button = .{ .idx = 11, .down = true } } }, + .{ .t = 31377574308, .pad = 2, .ev = .{ .button = .{ .idx = 11, .down = false } } }, + .{ .t = 31377580618, .pad = 2, .ev = .{ .button = .{ .idx = 11, .down = true } } }, + .{ .t = 31533158438, .pad = 2, .ev = .{ .button = .{ .idx = 11, .down = false } } }, + .{ .t = 31599806330, .pad = 2, .ev = .{ .button = .{ .idx = 12, .down = true } } }, + .{ .t = 31699701622, .pad = 2, .ev = .{ .button = .{ .idx = 14, .down = true } } }, + .{ .t = 31699711442, .pad = 2, .ev = .{ .button = .{ .idx = 12, .down = false } } }, + .{ .t = 31833163995, .pad = 2, .ev = .{ .button = .{ .idx = 14, .down = false } } }, + .{ .t = 31844214668, .pad = 2, .ev = .{ .button = .{ .idx = 11, .down = true } } }, + .{ .t = 31933218167, .pad = 2, .ev = .{ .button = .{ .idx = 11, .down = false } } }, + .{ .t = 31944106321, .pad = 2, .ev = .{ .button = .{ .idx = 13, .down = true } } }, + .{ .t = 31944118861, .pad = 2, .ev = .{ .button = .{ .idx = 13, .down = false } } }, + .{ .t = 32577585424, .pad = 2, .ev = .{ .button = .{ .idx = 7, .down = true } } }, + .{ .t = 32777404849, .pad = 2, .ev = .{ .button = .{ .idx = 7, .down = false } } }, + .{ .t = 32932893939, .pad = 2, .ev = .{ .button = .{ .idx = 8, .down = true } } }, + .{ .t = 33122371409, .pad = 2, .ev = .{ .button = .{ .idx = 8, .down = false } } }, + .{ .t = 34899667922, .pad = 2, .ev = .{ .button = .{ .idx = 10, .down = true } } }, + .{ .t = 35143908581, .pad = 2, .ev = .{ .button = .{ .idx = 10, .down = false } } }, + .{ .t = 35143918751, .pad = 2, .ev = .{ .button = .{ .idx = 9, .down = true } } }, + .{ .t = 35299532711, .pad = 2, .ev = .{ .button = .{ .idx = 9, .down = false } } }, + .{ .t = 36188307687, .pad = 2, .ev = .{ .button = .{ .idx = 10, .down = true } } }, + .{ .t = 36351697335, .pad = 2, .ev = .{ .button = .{ .idx = 9, .down = true } } }, + .{ .t = 36399712574, .pad = 2, .ev = .{ .button = .{ .idx = 10, .down = false } } }, + .{ .t = 36521680424, .pad = 2, .ev = .{ .button = .{ .idx = 10, .down = true } } }, + .{ .t = 36543814231, .pad = 2, .ev = .{ .button = .{ .idx = 9, .down = false } } }, + .{ .t = 36688528867, .pad = 2, .ev = .{ .button = .{ .idx = 10, .down = false } } }, + .{ .t = 38810548641, .pad = 2, .ev = .{ .button = .{ .idx = 8, .down = true } } }, + .{ .t = 38988265258, .pad = 2, .ev = .{ .button = .{ .idx = 8, .down = false } } }, + .{ .t = 39421485428, .pad = 2, .ev = .{ .button = .{ .idx = 7, .down = true } } }, + .{ .t = 39521563760, .pad = 2, .ev = .{ .button = .{ .idx = 8, .down = true } } }, + .{ .t = 39543869347, .pad = 2, .ev = .{ .button = .{ .idx = 7, .down = false } } }, + .{ .t = 39654975672, .pad = 2, .ev = .{ .button = .{ .idx = 8, .down = false } } }, + .{ .t = 40199575307, .pad = 2, .ev = .{ .button = .{ .idx = 0, .down = true } } }, + .{ .t = 40388115109, .pad = 2, .ev = .{ .button = .{ .idx = 0, .down = false } } }, + .{ .t = 40810375225, .pad = 2, .ev = .{ .button = .{ .idx = 2, .down = true } } }, + .{ .t = 40976868838, .pad = 2, .ev = .{ .button = .{ .idx = 2, .down = false } } }, + .{ .t = 41032455046, .pad = 2, .ev = .{ .button = .{ .idx = 3, .down = true } } }, + .{ .t = 41243668724, .pad = 2, .ev = .{ .button = .{ .idx = 3, .down = false } } }, + .{ .t = 42565700760, .pad = 2, .ev = .{ .button = .{ .idx = 2, .down = true } } }, + .{ .t = 42743538487, .pad = 2, .ev = .{ .button = .{ .idx = 2, .down = false } } }, + .{ .t = 43676697498, .pad = 2, .ev = .{ .button = .{ .idx = 5, .down = true } } }, + .{ .t = 43932510879, .pad = 2, .ev = .{ .button = .{ .idx = 5, .down = false } } }, + .{ .t = 43943745523, .pad = 2, .ev = .{ .button = .{ .idx = 1, .down = true } } }, + .{ .t = 44021582808, .pad = 2, .ev = .{ .button = .{ .idx = 1, .down = false } } }, + .{ .t = 44599100514, .pad = 2, .ev = .{ .button = .{ .idx = 1, .down = true } } }, } } diff --git a/test/deck/lpad-swipe.zon b/test/deck/lpad-swipe.zon index 33a17751..d5b5049a 100644 --- a/test/deck/lpad-swipe.zon +++ b/test/deck/lpad-swipe.zon @@ -1,163 +1,163 @@ .{ .version = 1, .events = .{ -.{.t=28555347100,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.29483032,.y=0.24435425,.pressure=0.0022583008}}}, -.{.t=28555355490,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.2937622,.y=0.24847412,.pressure=0.0015563965}}}, -.{.t=28566662333,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.2920227,.y=0.25350952,.pressure=0.00048828125}}}, -.{.t=28566669273,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.up,.x=0.28912354,.y=0.25863647,.pressure=0}}}, -.{.t=28633190705,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.down,.x=0.26437378,.y=0.44036865,.pressure=0.0008239746}}}, -.{.t=28644226129,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.2635193,.y=0.44857788,.pressure=0.0008239746}}}, -.{.t=28644235079,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.26348877,.y=0.4538269,.pressure=0.0015563965}}}, -.{.t=28644241049,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.26272583,.y=0.45950317,.pressure=0.003692627}}}, -.{.t=28655363472,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.26229858,.y=0.46218872,.pressure=0.0047912598}}}, -.{.t=28655373032,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.26153564,.y=0.46594238,.pressure=0.005493164}}}, -.{.t=28666533886,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.2607727,.y=0.46810913,.pressure=0.008026123}}}, -.{.t=28666541736,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.26037598,.y=0.46969604,.pressure=0.00982666}}}, -.{.t=28666544986,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.26004028,.y=0.47079468,.pressure=0.010894775}}}, -.{.t=28677510399,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.25985718,.y=0.47192383,.pressure=0.011962891}}}, -.{.t=28677516759,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.25924683,.y=0.47277832,.pressure=0.013061523}}}, -.{.t=28677520229,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.25894165,.y=0.47366333,.pressure=0.01449585}}}, -.{.t=28688736483,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.25906372,.y=0.47409058,.pressure=0.015197754}}}, -.{.t=28688747523,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.25872803,.y=0.47351074,.pressure=0.013061523}}}, -.{.t=28688752063,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.25827026,.y=0.4732666,.pressure=0.013397217}}}, -.{.t=28699780696,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.2581787,.y=0.47317505,.pressure=0.014129639}}}, -.{.t=28699788576,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.25759888,.y=0.47305298,.pressure=0.014831543}}}, -.{.t=28699792416,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.25787354,.y=0.47280884,.pressure=0.01449585}}}, -.{.t=28711058720,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.25784302,.y=0.47225952,.pressure=0.013763428}}}, -.{.t=28711073040,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.25738525,.y=0.472229,.pressure=0.014129639}}}, -.{.t=28722312593,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.25720215,.y=0.4717102,.pressure=0.013763428}}}, -.{.t=28722328533,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.2572937,.y=0.47213745,.pressure=0.012329102}}}, -.{.t=28722335123,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.2576294,.y=0.4721985,.pressure=0.01449585}}}, -.{.t=28733104547,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.25784302,.y=0.4718933,.pressure=0.013763428}}}, -.{.t=28733113157,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.2571411,.y=0.472229,.pressure=0.013763428}}}, -.{.t=28733116517,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.256958,.y=0.47235107,.pressure=0.010894775}}}, -.{.t=28744542840,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.25598145,.y=0.47323608,.pressure=0.011962891}}}, -.{.t=28744554360,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.25558472,.y=0.47372437,.pressure=0.012329102}}}, -.{.t=28744558310,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.25463867,.y=0.47329712,.pressure=0.013061523}}}, -.{.t=28755164615,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.2541809,.y=0.4736023,.pressure=0.013397217}}}, -.{.t=28755173055,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.2536316,.y=0.47485352,.pressure=0.013397217}}}, -.{.t=28766369408,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.2527771,.y=0.4749756,.pressure=0.011962891}}}, -.{.t=28766376998,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.2524109,.y=0.47543335,.pressure=0.011962891}}}, -.{.t=28766380848,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.2518921,.y=0.4761963,.pressure=0.011962891}}}, -.{.t=28777479342,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.25073242,.y=0.4764099,.pressure=0.013397217}}}, -.{.t=28777487702,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.24984741,.y=0.4772644,.pressure=0.015197754}}}, -.{.t=28777491542,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.24942017,.y=0.47872925,.pressure=0.015563965}}}, -.{.t=28788858885,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.24816895,.y=0.47982788,.pressure=0.016296387}}}, -.{.t=28788869705,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.247406,.y=0.48181152,.pressure=0.016998291}}}, -.{.t=28788873665,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.24645996,.y=0.48260498,.pressure=0.015563965}}}, -.{.t=28800073548,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.2456665,.y=0.48516846,.pressure=0.01663208}}}, -.{.t=28800082148,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.24414062,.y=0.48757935,.pressure=0.018432617}}}, -.{.t=28800086718,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.2437439,.y=0.48986816,.pressure=0.019165039}}}, -.{.t=28810881362,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.2432251,.y=0.49273682,.pressure=0.017730713}}}, -.{.t=28810890602,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.24337769,.y=0.4951172,.pressure=0.018432617}}}, -.{.t=28822223135,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.24224854,.y=0.49868774,.pressure=0.018066406}}}, -.{.t=28822236725,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.2409668,.y=0.5030823,.pressure=0.018432617}}}, -.{.t=28822243035,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.24002075,.y=0.5093689,.pressure=0.017364502}}}, -.{.t=28833221849,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.23800659,.y=0.52023315,.pressure=0.017364502}}}, -.{.t=28833234799,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.23648071,.y=0.5312195,.pressure=0.018066406}}}, -.{.t=28833241859,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.23449707,.y=0.54260254,.pressure=0.018432617}}}, -.{.t=28844533292,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.23208618,.y=0.5539551,.pressure=0.019165039}}}, -.{.t=28844544902,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.22930908,.y=0.5640869,.pressure=0.020599365}}}, -.{.t=28844549012,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.22769165,.y=0.5701294,.pressure=0.022399902}}}, -.{.t=28855315576,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.22613525,.y=0.57528687,.pressure=0.023468018}}}, -.{.t=28855325516,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.22503662,.y=0.5812073,.pressure=0.02420044}}}, -.{.t=28866614540,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.22335815,.y=0.5848694,.pressure=0.02420044}}}, -.{.t=28866626480,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.22390747,.y=0.5887146,.pressure=0.024536133}}}, -.{.t=28866629910,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.22283936,.y=0.59265137,.pressure=0.024536133}}}, -.{.t=28877415724,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.22262573,.y=0.59625244,.pressure=0.025268555}}}, -.{.t=28877428004,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.22128296,.y=0.6008606,.pressure=0.025268555}}}, -.{.t=28888551597,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.2204895,.y=0.60409546,.pressure=0.025268555}}}, -.{.t=28888564767,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.21896362,.y=0.61083984,.pressure=0.025634766}}}, -.{.t=28888571967,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.21774292,.y=0.6156006,.pressure=0.025970459}}}, -.{.t=28899744701,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.21542358,.y=0.62112427,.pressure=0.02633667}}}, -.{.t=28899757861,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.21438599,.y=0.62576294,.pressure=0.027435303}}}, -.{.t=28899764601,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.21298218,.y=0.63223267,.pressure=0.027069092}}}, -.{.t=28910731865,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.21209717,.y=0.63708496,.pressure=0.02633667}}}, -.{.t=28910746485,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.21133423,.y=0.6419983,.pressure=0.02670288}}}, -.{.t=28921990138,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.21032715,.y=0.64730835,.pressure=0.027435303}}}, -.{.t=28922004158,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.2090149,.y=0.65237427,.pressure=0.027069092}}}, -.{.t=28922010498,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.20770264,.y=0.6588135,.pressure=0.02670288}}}, -.{.t=28932967412,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.20559692,.y=0.6654968,.pressure=0.025970459}}}, -.{.t=28932979792,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.20404053,.y=0.67285156,.pressure=0.025634766}}}, -.{.t=28932983492,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.20187378,.y=0.6821594,.pressure=0.024536133}}}, -.{.t=28944345285,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.19940186,.y=0.6911926,.pressure=0.02420044}}}, -.{.t=28944363135,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.19662476,.y=0.703949,.pressure=0.022033691}}}, -.{.t=28944369185,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.19250488,.y=0.71707153,.pressure=0.02130127}}}, -.{.t=28955070939,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.18859863,.y=0.7327881,.pressure=0.020599365}}}, -.{.t=28955080209,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.18469238,.y=0.7469177,.pressure=0.018798828}}}, -.{.t=28966644072,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.1803894,.y=0.76065063,.pressure=0.018066406}}}, -.{.t=28966660132,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.17681885,.y=0.7729492,.pressure=0.019165039}}}, -.{.t=28966666102,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.17303467,.y=0.78430176,.pressure=0.01953125}}}, -.{.t=28977523276,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.17047119,.y=0.79385376,.pressure=0.019165039}}}, -.{.t=28977533506,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.16790771,.y=0.8000183,.pressure=0.019866943}}}, -.{.t=28977538756,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.16583252,.y=0.8055115,.pressure=0.018798828}}}, -.{.t=28988801809,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.16448975,.y=0.8109131,.pressure=0.01953125}}}, -.{.t=28988815059,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.16299438,.y=0.81552124,.pressure=0.02130127}}}, -.{.t=28988820159,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.16275024,.y=0.8183899,.pressure=0.02166748}}}, -.{.t=29000005933,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.16235352,.y=0.8191223,.pressure=0.022399902}}}, -.{.t=29000020133,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.16220093,.y=0.820343,.pressure=0.023468018}}}, -.{.t=29000023943,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.16268921,.y=0.8208618,.pressure=0.023834229}}}, -.{.t=29010879647,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.1618042,.y=0.82214355,.pressure=0.025634766}}}, -.{.t=29010893477,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.16238403,.y=0.82196045,.pressure=0.02633667}}}, -.{.t=29022239700,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.16329956,.y=0.82180786,.pressure=0.027069092}}}, -.{.t=29022255010,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.16305542,.y=0.8227539,.pressure=0.027069092}}}, -.{.t=29022260530,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.16360474,.y=0.8215027,.pressure=0.02670288}}}, -.{.t=29033423863,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.16390991,.y=0.8215637,.pressure=0.02670288}}}, -.{.t=29033439393,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.16513062,.y=0.820282,.pressure=0.02633667}}}, -.{.t=29033446553,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.16571045,.y=0.82003784,.pressure=0.027069092}}}, -.{.t=29044100787,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.16552734,.y=0.81985474,.pressure=0.024536133}}}, -.{.t=29044110747,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.16653442,.y=0.8192444,.pressure=0.023468018}}}, -.{.t=29044114927,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.16690063,.y=0.81710815,.pressure=0.023101807}}}, -.{.t=29055305531,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.16772461,.y=0.81536865,.pressure=0.022766113}}}, -.{.t=29055315751,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.16854858,.y=0.81365967,.pressure=0.022399902}}}, -.{.t=29066613054,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.16940308,.y=0.811615,.pressure=0.02166748}}}, -.{.t=29066629614,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.17041016,.y=0.80908203,.pressure=0.02130127}}}, -.{.t=29066636804,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.17147827,.y=0.8067322,.pressure=0.02130127}}}, -.{.t=29077513018,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.17288208,.y=0.8036804,.pressure=0.019165039}}}, -.{.t=29077525768,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.17391968,.y=0.8003235,.pressure=0.015197754}}}, -.{.t=29077531158,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.17553711,.y=0.7965088,.pressure=0.014831543}}}, -.{.t=29088910511,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.17697144,.y=0.7913208,.pressure=0.015563965}}}, -.{.t=29088924801,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.17819214,.y=0.78622437,.pressure=0.01449585}}}, -.{.t=29088930391,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.17999268,.y=0.7813721,.pressure=0.013397217}}}, -.{.t=29100047575,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.18148804,.y=0.7752991,.pressure=0.014129639}}}, -.{.t=29100061535,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.1831665,.y=0.76898193,.pressure=0.014129639}}}, -.{.t=29100068045,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.184906,.y=0.7624817,.pressure=0.013763428}}}, -.{.t=29111067488,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.18692017,.y=0.7561035,.pressure=0.013061523}}}, -.{.t=29111083948,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.18884277,.y=0.7487488,.pressure=0.01449585}}}, -.{.t=29122288972,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.19082642,.y=0.7409973,.pressure=0.01449585}}}, -.{.t=29122305542,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.19223022,.y=0.73428345,.pressure=0.014831543}}}, -.{.t=29122313342,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.19274902,.y=0.7257385,.pressure=0.014831543}}}, -.{.t=29133328146,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.19299316,.y=0.714447,.pressure=0.015197754}}}, -.{.t=29133345356,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.1928711,.y=0.7018738,.pressure=0.01449585}}}, -.{.t=29133350306,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.19335938,.y=0.6808777,.pressure=0.014831543}}}, -.{.t=29144200749,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.19464111,.y=0.65582275,.pressure=0.014831543}}}, -.{.t=29144216579,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.19668579,.y=0.63186646,.pressure=0.01449585}}}, -.{.t=29144223419,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.19927979,.y=0.6045227,.pressure=0.013763428}}}, -.{.t=29154998954,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.20211792,.y=0.57891846,.pressure=0.0126953125}}}, -.{.t=29155006203,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.20501709,.y=0.551239,.pressure=0.0126953125}}}, -.{.t=29166393667,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.20880127,.y=0.5248718,.pressure=0.012329102}}}, -.{.t=29166404147,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.21270752,.y=0.499115,.pressure=0.013397217}}}, -.{.t=29166409197,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.21655273,.y=0.47366333,.pressure=0.013763428}}}, -.{.t=29177500380,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.2204895,.y=0.45114136,.pressure=0.0101623535}}}, -.{.t=29177510970,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.22451782,.y=0.4290161,.pressure=0.0101623535}}}, -.{.t=29177516230,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.2286377,.y=0.40975952,.pressure=0.0101623535}}}, -.{.t=29188832983,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.23208618,.y=0.39212036,.pressure=0.010528564}}}, -.{.t=29188846483,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.23532104,.y=0.375885,.pressure=0.007293701}}}, -.{.t=29188851103,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.23809814,.y=0.35943604,.pressure=0.009460449}}}, -.{.t=29200021967,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.24072266,.y=0.34292603,.pressure=0.011260986}}}, -.{.t=29200037067,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.24298096,.y=0.32809448,.pressure=0.011962891}}}, -.{.t=29200042877,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.24493408,.y=0.3138733,.pressure=0.010528564}}}, -.{.t=29210884631,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.24728394,.y=0.29989624,.pressure=0.012329102}}}, -.{.t=29221881625,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.24908447,.y=0.2866516,.pressure=0.011962891}}}, -.{.t=29221891355,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.250885,.y=0.2755432,.pressure=0.010528564}}}, -.{.t=29221896615,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.252594,.y=0.26571655,.pressure=0.011962891}}}, -.{.t=29233293918,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.25378418,.y=0.2571106,.pressure=0.0126953125}}}, -.{.t=29233306418,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.25476074,.y=0.24942017,.pressure=0.0126953125}}}, -.{.t=29233312238,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.25534058,.y=0.24307251,.pressure=0.011260986}}}, -.{.t=29244359261,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.25610352,.y=0.23760986,.pressure=0.0101623535}}}, -.{.t=29244375081,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.25680542,.y=0.23291016,.pressure=0.0101623535}}}, -.{.t=29244383211,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.25750732,.y=0.22824097,.pressure=0.0101623535}}}, -.{.t=29255381715,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.25823975,.y=0.22570801,.pressure=0.007659912}}}, -.{.t=29255392615,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.25909424,.y=0.2234497,.pressure=0.007293701}}}, -.{.t=29266740458,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.2599182,.y=0.22180176,.pressure=0.006225586}}}, -.{.t=29266753748,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.26089478,.y=0.22140503,.pressure=0.0051574707}}}, -.{.t=29266758978,.pad=2,.ev=.{.touch=.{.touchpad=0,.finger=0,.phase=.motion,.x=0.26275635,.y=0.22149658,.pressure=0.0033569336}}}, + .{ .t = 28555347100, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.29483032, .y = 0.24435425, .pressure = 0.0022583008 } } }, + .{ .t = 28555355490, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.2937622, .y = 0.24847412, .pressure = 0.0015563965 } } }, + .{ .t = 28566662333, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.2920227, .y = 0.25350952, .pressure = 0.00048828125 } } }, + .{ .t = 28566669273, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .up, .x = 0.28912354, .y = 0.25863647, .pressure = 0 } } }, + .{ .t = 28633190705, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .down, .x = 0.26437378, .y = 0.44036865, .pressure = 0.0008239746 } } }, + .{ .t = 28644226129, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.2635193, .y = 0.44857788, .pressure = 0.0008239746 } } }, + .{ .t = 28644235079, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.26348877, .y = 0.4538269, .pressure = 0.0015563965 } } }, + .{ .t = 28644241049, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.26272583, .y = 0.45950317, .pressure = 0.003692627 } } }, + .{ .t = 28655363472, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.26229858, .y = 0.46218872, .pressure = 0.0047912598 } } }, + .{ .t = 28655373032, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.26153564, .y = 0.46594238, .pressure = 0.005493164 } } }, + .{ .t = 28666533886, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.2607727, .y = 0.46810913, .pressure = 0.008026123 } } }, + .{ .t = 28666541736, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.26037598, .y = 0.46969604, .pressure = 0.00982666 } } }, + .{ .t = 28666544986, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.26004028, .y = 0.47079468, .pressure = 0.010894775 } } }, + .{ .t = 28677510399, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.25985718, .y = 0.47192383, .pressure = 0.011962891 } } }, + .{ .t = 28677516759, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.25924683, .y = 0.47277832, .pressure = 0.013061523 } } }, + .{ .t = 28677520229, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.25894165, .y = 0.47366333, .pressure = 0.01449585 } } }, + .{ .t = 28688736483, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.25906372, .y = 0.47409058, .pressure = 0.015197754 } } }, + .{ .t = 28688747523, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.25872803, .y = 0.47351074, .pressure = 0.013061523 } } }, + .{ .t = 28688752063, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.25827026, .y = 0.4732666, .pressure = 0.013397217 } } }, + .{ .t = 28699780696, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.2581787, .y = 0.47317505, .pressure = 0.014129639 } } }, + .{ .t = 28699788576, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.25759888, .y = 0.47305298, .pressure = 0.014831543 } } }, + .{ .t = 28699792416, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.25787354, .y = 0.47280884, .pressure = 0.01449585 } } }, + .{ .t = 28711058720, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.25784302, .y = 0.47225952, .pressure = 0.013763428 } } }, + .{ .t = 28711073040, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.25738525, .y = 0.472229, .pressure = 0.014129639 } } }, + .{ .t = 28722312593, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.25720215, .y = 0.4717102, .pressure = 0.013763428 } } }, + .{ .t = 28722328533, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.2572937, .y = 0.47213745, .pressure = 0.012329102 } } }, + .{ .t = 28722335123, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.2576294, .y = 0.4721985, .pressure = 0.01449585 } } }, + .{ .t = 28733104547, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.25784302, .y = 0.4718933, .pressure = 0.013763428 } } }, + .{ .t = 28733113157, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.2571411, .y = 0.472229, .pressure = 0.013763428 } } }, + .{ .t = 28733116517, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.256958, .y = 0.47235107, .pressure = 0.010894775 } } }, + .{ .t = 28744542840, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.25598145, .y = 0.47323608, .pressure = 0.011962891 } } }, + .{ .t = 28744554360, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.25558472, .y = 0.47372437, .pressure = 0.012329102 } } }, + .{ .t = 28744558310, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.25463867, .y = 0.47329712, .pressure = 0.013061523 } } }, + .{ .t = 28755164615, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.2541809, .y = 0.4736023, .pressure = 0.013397217 } } }, + .{ .t = 28755173055, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.2536316, .y = 0.47485352, .pressure = 0.013397217 } } }, + .{ .t = 28766369408, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.2527771, .y = 0.4749756, .pressure = 0.011962891 } } }, + .{ .t = 28766376998, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.2524109, .y = 0.47543335, .pressure = 0.011962891 } } }, + .{ .t = 28766380848, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.2518921, .y = 0.4761963, .pressure = 0.011962891 } } }, + .{ .t = 28777479342, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.25073242, .y = 0.4764099, .pressure = 0.013397217 } } }, + .{ .t = 28777487702, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.24984741, .y = 0.4772644, .pressure = 0.015197754 } } }, + .{ .t = 28777491542, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.24942017, .y = 0.47872925, .pressure = 0.015563965 } } }, + .{ .t = 28788858885, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.24816895, .y = 0.47982788, .pressure = 0.016296387 } } }, + .{ .t = 28788869705, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.247406, .y = 0.48181152, .pressure = 0.016998291 } } }, + .{ .t = 28788873665, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.24645996, .y = 0.48260498, .pressure = 0.015563965 } } }, + .{ .t = 28800073548, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.2456665, .y = 0.48516846, .pressure = 0.01663208 } } }, + .{ .t = 28800082148, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.24414062, .y = 0.48757935, .pressure = 0.018432617 } } }, + .{ .t = 28800086718, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.2437439, .y = 0.48986816, .pressure = 0.019165039 } } }, + .{ .t = 28810881362, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.2432251, .y = 0.49273682, .pressure = 0.017730713 } } }, + .{ .t = 28810890602, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.24337769, .y = 0.4951172, .pressure = 0.018432617 } } }, + .{ .t = 28822223135, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.24224854, .y = 0.49868774, .pressure = 0.018066406 } } }, + .{ .t = 28822236725, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.2409668, .y = 0.5030823, .pressure = 0.018432617 } } }, + .{ .t = 28822243035, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.24002075, .y = 0.5093689, .pressure = 0.017364502 } } }, + .{ .t = 28833221849, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.23800659, .y = 0.52023315, .pressure = 0.017364502 } } }, + .{ .t = 28833234799, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.23648071, .y = 0.5312195, .pressure = 0.018066406 } } }, + .{ .t = 28833241859, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.23449707, .y = 0.54260254, .pressure = 0.018432617 } } }, + .{ .t = 28844533292, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.23208618, .y = 0.5539551, .pressure = 0.019165039 } } }, + .{ .t = 28844544902, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.22930908, .y = 0.5640869, .pressure = 0.020599365 } } }, + .{ .t = 28844549012, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.22769165, .y = 0.5701294, .pressure = 0.022399902 } } }, + .{ .t = 28855315576, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.22613525, .y = 0.57528687, .pressure = 0.023468018 } } }, + .{ .t = 28855325516, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.22503662, .y = 0.5812073, .pressure = 0.02420044 } } }, + .{ .t = 28866614540, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.22335815, .y = 0.5848694, .pressure = 0.02420044 } } }, + .{ .t = 28866626480, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.22390747, .y = 0.5887146, .pressure = 0.024536133 } } }, + .{ .t = 28866629910, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.22283936, .y = 0.59265137, .pressure = 0.024536133 } } }, + .{ .t = 28877415724, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.22262573, .y = 0.59625244, .pressure = 0.025268555 } } }, + .{ .t = 28877428004, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.22128296, .y = 0.6008606, .pressure = 0.025268555 } } }, + .{ .t = 28888551597, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.2204895, .y = 0.60409546, .pressure = 0.025268555 } } }, + .{ .t = 28888564767, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.21896362, .y = 0.61083984, .pressure = 0.025634766 } } }, + .{ .t = 28888571967, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.21774292, .y = 0.6156006, .pressure = 0.025970459 } } }, + .{ .t = 28899744701, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.21542358, .y = 0.62112427, .pressure = 0.02633667 } } }, + .{ .t = 28899757861, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.21438599, .y = 0.62576294, .pressure = 0.027435303 } } }, + .{ .t = 28899764601, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.21298218, .y = 0.63223267, .pressure = 0.027069092 } } }, + .{ .t = 28910731865, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.21209717, .y = 0.63708496, .pressure = 0.02633667 } } }, + .{ .t = 28910746485, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.21133423, .y = 0.6419983, .pressure = 0.02670288 } } }, + .{ .t = 28921990138, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.21032715, .y = 0.64730835, .pressure = 0.027435303 } } }, + .{ .t = 28922004158, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.2090149, .y = 0.65237427, .pressure = 0.027069092 } } }, + .{ .t = 28922010498, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.20770264, .y = 0.6588135, .pressure = 0.02670288 } } }, + .{ .t = 28932967412, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.20559692, .y = 0.6654968, .pressure = 0.025970459 } } }, + .{ .t = 28932979792, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.20404053, .y = 0.67285156, .pressure = 0.025634766 } } }, + .{ .t = 28932983492, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.20187378, .y = 0.6821594, .pressure = 0.024536133 } } }, + .{ .t = 28944345285, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.19940186, .y = 0.6911926, .pressure = 0.02420044 } } }, + .{ .t = 28944363135, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.19662476, .y = 0.703949, .pressure = 0.022033691 } } }, + .{ .t = 28944369185, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.19250488, .y = 0.71707153, .pressure = 0.02130127 } } }, + .{ .t = 28955070939, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.18859863, .y = 0.7327881, .pressure = 0.020599365 } } }, + .{ .t = 28955080209, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.18469238, .y = 0.7469177, .pressure = 0.018798828 } } }, + .{ .t = 28966644072, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.1803894, .y = 0.76065063, .pressure = 0.018066406 } } }, + .{ .t = 28966660132, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.17681885, .y = 0.7729492, .pressure = 0.019165039 } } }, + .{ .t = 28966666102, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.17303467, .y = 0.78430176, .pressure = 0.01953125 } } }, + .{ .t = 28977523276, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.17047119, .y = 0.79385376, .pressure = 0.019165039 } } }, + .{ .t = 28977533506, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.16790771, .y = 0.8000183, .pressure = 0.019866943 } } }, + .{ .t = 28977538756, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.16583252, .y = 0.8055115, .pressure = 0.018798828 } } }, + .{ .t = 28988801809, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.16448975, .y = 0.8109131, .pressure = 0.01953125 } } }, + .{ .t = 28988815059, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.16299438, .y = 0.81552124, .pressure = 0.02130127 } } }, + .{ .t = 28988820159, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.16275024, .y = 0.8183899, .pressure = 0.02166748 } } }, + .{ .t = 29000005933, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.16235352, .y = 0.8191223, .pressure = 0.022399902 } } }, + .{ .t = 29000020133, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.16220093, .y = 0.820343, .pressure = 0.023468018 } } }, + .{ .t = 29000023943, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.16268921, .y = 0.8208618, .pressure = 0.023834229 } } }, + .{ .t = 29010879647, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.1618042, .y = 0.82214355, .pressure = 0.025634766 } } }, + .{ .t = 29010893477, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.16238403, .y = 0.82196045, .pressure = 0.02633667 } } }, + .{ .t = 29022239700, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.16329956, .y = 0.82180786, .pressure = 0.027069092 } } }, + .{ .t = 29022255010, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.16305542, .y = 0.8227539, .pressure = 0.027069092 } } }, + .{ .t = 29022260530, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.16360474, .y = 0.8215027, .pressure = 0.02670288 } } }, + .{ .t = 29033423863, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.16390991, .y = 0.8215637, .pressure = 0.02670288 } } }, + .{ .t = 29033439393, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.16513062, .y = 0.820282, .pressure = 0.02633667 } } }, + .{ .t = 29033446553, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.16571045, .y = 0.82003784, .pressure = 0.027069092 } } }, + .{ .t = 29044100787, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.16552734, .y = 0.81985474, .pressure = 0.024536133 } } }, + .{ .t = 29044110747, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.16653442, .y = 0.8192444, .pressure = 0.023468018 } } }, + .{ .t = 29044114927, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.16690063, .y = 0.81710815, .pressure = 0.023101807 } } }, + .{ .t = 29055305531, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.16772461, .y = 0.81536865, .pressure = 0.022766113 } } }, + .{ .t = 29055315751, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.16854858, .y = 0.81365967, .pressure = 0.022399902 } } }, + .{ .t = 29066613054, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.16940308, .y = 0.811615, .pressure = 0.02166748 } } }, + .{ .t = 29066629614, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.17041016, .y = 0.80908203, .pressure = 0.02130127 } } }, + .{ .t = 29066636804, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.17147827, .y = 0.8067322, .pressure = 0.02130127 } } }, + .{ .t = 29077513018, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.17288208, .y = 0.8036804, .pressure = 0.019165039 } } }, + .{ .t = 29077525768, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.17391968, .y = 0.8003235, .pressure = 0.015197754 } } }, + .{ .t = 29077531158, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.17553711, .y = 0.7965088, .pressure = 0.014831543 } } }, + .{ .t = 29088910511, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.17697144, .y = 0.7913208, .pressure = 0.015563965 } } }, + .{ .t = 29088924801, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.17819214, .y = 0.78622437, .pressure = 0.01449585 } } }, + .{ .t = 29088930391, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.17999268, .y = 0.7813721, .pressure = 0.013397217 } } }, + .{ .t = 29100047575, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.18148804, .y = 0.7752991, .pressure = 0.014129639 } } }, + .{ .t = 29100061535, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.1831665, .y = 0.76898193, .pressure = 0.014129639 } } }, + .{ .t = 29100068045, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.184906, .y = 0.7624817, .pressure = 0.013763428 } } }, + .{ .t = 29111067488, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.18692017, .y = 0.7561035, .pressure = 0.013061523 } } }, + .{ .t = 29111083948, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.18884277, .y = 0.7487488, .pressure = 0.01449585 } } }, + .{ .t = 29122288972, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.19082642, .y = 0.7409973, .pressure = 0.01449585 } } }, + .{ .t = 29122305542, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.19223022, .y = 0.73428345, .pressure = 0.014831543 } } }, + .{ .t = 29122313342, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.19274902, .y = 0.7257385, .pressure = 0.014831543 } } }, + .{ .t = 29133328146, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.19299316, .y = 0.714447, .pressure = 0.015197754 } } }, + .{ .t = 29133345356, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.1928711, .y = 0.7018738, .pressure = 0.01449585 } } }, + .{ .t = 29133350306, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.19335938, .y = 0.6808777, .pressure = 0.014831543 } } }, + .{ .t = 29144200749, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.19464111, .y = 0.65582275, .pressure = 0.014831543 } } }, + .{ .t = 29144216579, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.19668579, .y = 0.63186646, .pressure = 0.01449585 } } }, + .{ .t = 29144223419, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.19927979, .y = 0.6045227, .pressure = 0.013763428 } } }, + .{ .t = 29154998954, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.20211792, .y = 0.57891846, .pressure = 0.0126953125 } } }, + .{ .t = 29155006203, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.20501709, .y = 0.551239, .pressure = 0.0126953125 } } }, + .{ .t = 29166393667, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.20880127, .y = 0.5248718, .pressure = 0.012329102 } } }, + .{ .t = 29166404147, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.21270752, .y = 0.499115, .pressure = 0.013397217 } } }, + .{ .t = 29166409197, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.21655273, .y = 0.47366333, .pressure = 0.013763428 } } }, + .{ .t = 29177500380, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.2204895, .y = 0.45114136, .pressure = 0.0101623535 } } }, + .{ .t = 29177510970, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.22451782, .y = 0.4290161, .pressure = 0.0101623535 } } }, + .{ .t = 29177516230, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.2286377, .y = 0.40975952, .pressure = 0.0101623535 } } }, + .{ .t = 29188832983, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.23208618, .y = 0.39212036, .pressure = 0.010528564 } } }, + .{ .t = 29188846483, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.23532104, .y = 0.375885, .pressure = 0.007293701 } } }, + .{ .t = 29188851103, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.23809814, .y = 0.35943604, .pressure = 0.009460449 } } }, + .{ .t = 29200021967, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.24072266, .y = 0.34292603, .pressure = 0.011260986 } } }, + .{ .t = 29200037067, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.24298096, .y = 0.32809448, .pressure = 0.011962891 } } }, + .{ .t = 29200042877, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.24493408, .y = 0.3138733, .pressure = 0.010528564 } } }, + .{ .t = 29210884631, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.24728394, .y = 0.29989624, .pressure = 0.012329102 } } }, + .{ .t = 29221881625, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.24908447, .y = 0.2866516, .pressure = 0.011962891 } } }, + .{ .t = 29221891355, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.250885, .y = 0.2755432, .pressure = 0.010528564 } } }, + .{ .t = 29221896615, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.252594, .y = 0.26571655, .pressure = 0.011962891 } } }, + .{ .t = 29233293918, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.25378418, .y = 0.2571106, .pressure = 0.0126953125 } } }, + .{ .t = 29233306418, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.25476074, .y = 0.24942017, .pressure = 0.0126953125 } } }, + .{ .t = 29233312238, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.25534058, .y = 0.24307251, .pressure = 0.011260986 } } }, + .{ .t = 29244359261, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.25610352, .y = 0.23760986, .pressure = 0.0101623535 } } }, + .{ .t = 29244375081, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.25680542, .y = 0.23291016, .pressure = 0.0101623535 } } }, + .{ .t = 29244383211, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.25750732, .y = 0.22824097, .pressure = 0.0101623535 } } }, + .{ .t = 29255381715, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.25823975, .y = 0.22570801, .pressure = 0.007659912 } } }, + .{ .t = 29255392615, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.25909424, .y = 0.2234497, .pressure = 0.007293701 } } }, + .{ .t = 29266740458, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.2599182, .y = 0.22180176, .pressure = 0.006225586 } } }, + .{ .t = 29266753748, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.26089478, .y = 0.22140503, .pressure = 0.0051574707 } } }, + .{ .t = 29266758978, .pad = 2, .ev = .{ .touch = .{ .touchpad = 0, .finger = 0, .phase = .motion, .x = 0.26275635, .y = 0.22149658, .pressure = 0.0033569336 } } }, } } diff --git a/test/deck/replay.zig b/test/deck/replay.zig index 49614b46..778f4191 100644 --- a/test/deck/replay.zig +++ b/test/deck/replay.zig @@ -45,12 +45,12 @@ fn replay(src: [:0]const u8) !Tally { tally.max_step = @max(tally.max_step, @max(@abs(mv.dx), @abs(mv.dy))); }, .click => |ck| if (ck.down) { - tally.click_down[@intFromEnum(ck.which)] += 1; + tally.click_down[@backingInt(ck.which)] += 1; } else { - tally.click_up[@intFromEnum(ck.which)] += 1; + tally.click_up[@backingInt(ck.which)] += 1; }, .wheel => |ticks| tally.wheel += ticks, - .key => |k| tally.keys[@intFromEnum(k)] += 1, + .key => |k| tally.keys[@backingInt(k)] += 1, .rumble => tally.rumbles += 1, }; } @@ -72,7 +72,7 @@ test "right-pad drag moves the pointer, fresh touches don't jump" { try std.testing.expectEqual(0, t.wheel); // a light-touch drag stays well under the click threshold — no phantom // select clicks (nor their rumble) - try std.testing.expectEqual(0, t.click_down[@intFromEnum(deck.Click.select)]); + try std.testing.expectEqual(0, t.click_down[@backingInt(deck.Click.select)]); try std.testing.expectEqual(0, t.rumbles); } @@ -82,11 +82,11 @@ test "trigger pull+release clicks exactly once each" { // through dozens of intermediate values, interleaved with ~500 stick // axis events: hysteresis must yield exactly one click apiece, only // the execute pull rumbles, and the sticks produce nothing - try std.testing.expectEqual(1, t.click_down[@intFromEnum(deck.Click.select)]); - try std.testing.expectEqual(1, t.click_up[@intFromEnum(deck.Click.select)]); - try std.testing.expectEqual(1, t.click_down[@intFromEnum(deck.Click.execute)]); - try std.testing.expectEqual(1, t.click_up[@intFromEnum(deck.Click.execute)]); - try std.testing.expectEqual(0, t.click_down[@intFromEnum(deck.Click.look)]); + try std.testing.expectEqual(1, t.click_down[@backingInt(deck.Click.select)]); + try std.testing.expectEqual(1, t.click_up[@backingInt(deck.Click.select)]); + try std.testing.expectEqual(1, t.click_down[@backingInt(deck.Click.execute)]); + try std.testing.expectEqual(1, t.click_up[@backingInt(deck.Click.execute)]); + try std.testing.expectEqual(0, t.click_down[@backingInt(deck.Click.look)]); try std.testing.expectEqual(1, t.rumbles); try std.testing.expectEqual(0, t.moves); } @@ -100,7 +100,7 @@ test "left-pad swipe scrolls" { try std.testing.expectEqual(5, t.wheel); try std.testing.expectEqual(0, t.moves); // the swipe presses lightly — no phantom look clicks - try std.testing.expectEqual(0, t.click_down[@intFromEnum(deck.Click.look)]); + try std.testing.expectEqual(0, t.click_down[@backingInt(deck.Click.look)]); try std.testing.expectEqual(0, t.rumbles); } @@ -166,15 +166,15 @@ test "buttons: dpad n/N, A Enter, Y Tab, L1 look + rumble" { const t = try replay(@embedFile("buttons.zon")); // every button press of a real all-buttons sweep: dpad-down x1, // dpad-up x3, A x2, Y x5, L1 x3; the other buttons map to nothing - try std.testing.expectEqual(1, t.keys[@intFromEnum(deck.Keytap.n)]); - try std.testing.expectEqual(3, t.keys[@intFromEnum(deck.Keytap.cap_n)]); - try std.testing.expectEqual(2, t.keys[@intFromEnum(deck.Keytap.enter)]); - try std.testing.expectEqual(5, t.keys[@intFromEnum(deck.Keytap.tab)]); - try std.testing.expectEqual(3, t.click_down[@intFromEnum(deck.Click.look)]); - try std.testing.expectEqual(3, t.click_up[@intFromEnum(deck.Click.look)]); + try std.testing.expectEqual(1, t.keys[@backingInt(deck.Keytap.n)]); + try std.testing.expectEqual(3, t.keys[@backingInt(deck.Keytap.cap_n)]); + try std.testing.expectEqual(2, t.keys[@backingInt(deck.Keytap.enter)]); + try std.testing.expectEqual(5, t.keys[@backingInt(deck.Keytap.tab)]); + try std.testing.expectEqual(3, t.click_down[@backingInt(deck.Click.look)]); + try std.testing.expectEqual(3, t.click_up[@backingInt(deck.Click.look)]); try std.testing.expectEqual(3, t.rumbles); - try std.testing.expectEqual(0, t.click_down[@intFromEnum(deck.Click.select)]); - try std.testing.expectEqual(0, t.click_down[@intFromEnum(deck.Click.execute)]); + try std.testing.expectEqual(0, t.click_down[@backingInt(deck.Click.select)]); + try std.testing.expectEqual(0, t.click_down[@backingInt(deck.Click.execute)]); try std.testing.expectEqual(0, t.moves); try std.testing.expectEqual(0, t.wheel); } diff --git a/test/deck/rpad-drag.zon b/test/deck/rpad-drag.zon index 20dea6ef..c7a82db9 100644 --- a/test/deck/rpad-drag.zon +++ b/test/deck/rpad-drag.zon @@ -1,223 +1,223 @@ .{ .version = 1, .events = .{ -.{.t=1557743788,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.down,.x=0.48794556,.y=0.3156128,.pressure=0.0004272461}}}, -.{.t=1557747308,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.49105835,.y=0.31570435,.pressure=0.0015563965}}}, -.{.t=1568667061,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.49325562,.y=0.31576538,.pressure=0.004638672}}}, -.{.t=1568677161,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.49591064,.y=0.31585693,.pressure=0.0035095215}}}, -.{.t=1568682171,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.4988098,.y=0.31588745,.pressure=0.0026855469}}}, -.{.t=1579851545,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.50076294,.y=0.31607056,.pressure=0.004638672}}}, -.{.t=1579859265,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.50289917,.y=0.31637573,.pressure=0.0063171387}}}, -.{.t=1579863375,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.5050354,.y=0.31655884,.pressure=0.008026123}}}, -.{.t=1590959349,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.50717163,.y=0.31655884,.pressure=0.0063171387}}}, -.{.t=1590970369,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.50927734,.y=0.31698608,.pressure=0.0040893555}}}, -.{.t=1590975739,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.5108948,.y=0.31750488,.pressure=0.0038146973}}}, -.{.t=1601902982,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.5126953,.y=0.31808472,.pressure=0.005218506}}}, -.{.t=1601911482,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.51400757,.y=0.318573,.pressure=0.0066223145}}}, -.{.t=1613345665,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.51571655,.y=0.31878662,.pressure=0.007171631}}}, -.{.t=1613352235,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.51660156,.y=0.31936646,.pressure=0.0068969727}}}, -.{.t=1613356725,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.5178528,.y=0.3199463,.pressure=0.0066223145}}}, -.{.t=1624412039,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.5187378,.y=0.3206787,.pressure=0.0057678223}}}, -.{.t=1624425589,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.52023315,.y=0.32138062,.pressure=0.0043640137}}}, -.{.t=1624432009,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.5215454,.y=0.3218689,.pressure=0.0040893555}}}, -.{.t=1635289123,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.5227356,.y=0.3222351,.pressure=0.0018310547}}}, -.{.t=1635297503,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.52371216,.y=0.3229065,.pressure=0.0026855469}}}, -.{.t=1635301553,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.5246887,.y=0.3234558,.pressure=0.002105713}}}, -.{.t=1646425097,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.52545166,.y=0.323761,.pressure=0.0007019043}}}, -.{.t=1646433957,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.up,.x=0.5263977,.y=0.3241577,.pressure=0}}}, -.{.t=1657611170,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.down,.x=0.52749634,.y=0.32489014,.pressure=0.0004272461}}}, -.{.t=1657620700,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.up,.x=0.52893066,.y=0.32543945,.pressure=0}}}, -.{.t=2568455904,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.down,.x=0.71746826,.y=0.4960022,.pressure=0.0026855469}}}, -.{.t=2568464274,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.72143555,.y=0.49996948,.pressure=0.0032348633}}}, -.{.t=2568468384,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.72436523,.y=0.5033264,.pressure=0.004638672}}}, -.{.t=2579442397,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.7271118,.y=0.5065918,.pressure=0.0066223145}}}, -.{.t=2579450697,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.73065186,.y=0.51031494,.pressure=0.008850098}}}, -.{.t=2579455357,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.7350464,.y=0.5145569,.pressure=0.010253906}}}, -.{.t=2590631621,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.74017334,.y=0.51916504,.pressure=0.012512207}}}, -.{.t=2590639051,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.7455139,.y=0.52420044,.pressure=0.014190674}}}, -.{.t=2601728264,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.7537842,.y=0.5307617,.pressure=0.01727295}}}, -.{.t=2601737594,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.76501465,.y=0.5390625,.pressure=0.017852783}}}, -.{.t=2601745184,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.7758789,.y=0.54782104,.pressure=0.017578125}}}, -.{.t=2612868798,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.78726196,.y=0.55740356,.pressure=0.018676758}}}, -.{.t=2612877548,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.79766846,.y=0.56655884,.pressure=0.016998291}}}, -.{.t=2612881858,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.8077698,.y=0.57421875,.pressure=0.016174316}}}, -.{.t=2624096121,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.81689453,.y=0.5804138,.pressure=0.0184021}}}, -.{.t=2624103861,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.8230896,.y=0.58462524,.pressure=0.017578125}}}, -.{.t=2624108371,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.8291321,.y=0.58810425,.pressure=0.016448975}}}, -.{.t=2635100225,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.8328247,.y=0.5901184,.pressure=0.015594482}}}, -.{.t=2635107345,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.835022,.y=0.59017944,.pressure=0.016174316}}}, -.{.t=2635111905,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.83724976,.y=0.5899353,.pressure=0.016174316}}}, -.{.t=2646151229,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.8390808,.y=0.5890198,.pressure=0.014770508}}}, -.{.t=2646160149,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.8404541,.y=0.58709717,.pressure=0.014190674}}}, -.{.t=2657358812,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.8408203,.y=0.58535767,.pressure=0.016448975}}}, -.{.t=2657364952,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.8411865,.y=0.5831604,.pressure=0.015045166}}}, -.{.t=2657368602,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.84106445,.y=0.5809021,.pressure=0.0184021}}}, -.{.t=2668497496,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.84155273,.y=0.5791321,.pressure=0.018676758}}}, -.{.t=2668503176,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.84198,.y=0.5767517,.pressure=0.0184021}}}, -.{.t=2679574619,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.8413696,.y=0.5749817,.pressure=0.01727295}}}, -.{.t=2679583429,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.8410034,.y=0.57302856,.pressure=0.015594482}}}, -.{.t=2679588959,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.8402405,.y=0.57077026,.pressure=0.016998291}}}, -.{.t=2690585493,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.83987427,.y=0.5680237,.pressure=0.017578125}}}, -.{.t=2690591573,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.8392639,.y=0.5658264,.pressure=0.016998291}}}, -.{.t=2701710277,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.8384094,.y=0.56329346,.pressure=0.015045166}}}, -.{.t=2701715427,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.8366089,.y=0.5602722,.pressure=0.012512207}}}, -.{.t=2701719287,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.8343506,.y=0.55578613,.pressure=0.013641357}}}, -.{.t=2712932260,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.8309326,.y=0.5510254,.pressure=0.012512207}}}, -.{.t=2712941600,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.8270569,.y=0.54504395,.pressure=0.013641357}}}, -.{.t=2712946870,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.82263184,.y=0.53845215,.pressure=0.012786865}}}, -.{.t=2724074464,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.8186035,.y=0.5309448,.pressure=0.012237549}}}, -.{.t=2724081034,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.8176575,.y=0.5210266,.pressure=0.011383057}}}, -.{.t=2724085114,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.8161926,.y=0.5109863,.pressure=0.010253906}}}, -.{.t=2735041467,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.81481934,.y=0.49887085,.pressure=0.008575439}}}, -.{.t=2735049697,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.8135681,.y=0.48706055,.pressure=0.0066223145}}}, -.{.t=2735053437,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.8110962,.y=0.47451782,.pressure=0.0066223145}}}, -.{.t=2746200461,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.8079529,.y=0.46011353,.pressure=0.008300781}}}, -.{.t=2746207531,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.8046875,.y=0.44818115,.pressure=0.008850098}}}, -.{.t=2757301144,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.8004761,.y=0.4363098,.pressure=0.010253906}}}, -.{.t=2757308574,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.796051,.y=0.4248352,.pressure=0.009979248}}}, -.{.t=2757312724,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.79104614,.y=0.4133911,.pressure=0.013366699}}}, -.{.t=2775948317,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.78637695,.y=0.4032898,.pressure=0.012237549}}}, -.{.t=2775958817,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.78131104,.y=0.39471436,.pressure=0.015045166}}}, -.{.t=2775962507,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.7763977,.y=0.38796997,.pressure=0.016723633}}}, -.{.t=2775966007,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.77178955,.y=0.38198853,.pressure=0.018127441}}}, -.{.t=2775969667,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.76724243,.y=0.37753296,.pressure=0.019805908}}}, -.{.t=2779448262,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.7628784,.y=0.37338257,.pressure=0.018127441}}}, -.{.t=2790559265,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.75909424,.y=0.36990356,.pressure=0.020935059}}}, -.{.t=2790566225,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.75512695,.y=0.36654663,.pressure=0.021484375}}}, -.{.t=2801688299,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.7513733,.y=0.36395264,.pressure=0.020385742}}}, -.{.t=2801695099,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.7475891,.y=0.36190796,.pressure=0.020385742}}}, -.{.t=2801697739,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.74487305,.y=0.35958862,.pressure=0.020385742}}}, -.{.t=2812906962,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.74191284,.y=0.3572998,.pressure=0.022888184}}}, -.{.t=2812918202,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.7388611,.y=0.35458374,.pressure=0.022338867}}}, -.{.t=2812924662,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.7357178,.y=0.35250854,.pressure=0.021209717}}}, -.{.t=2824054786,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.7324829,.y=0.3503418,.pressure=0.021484375}}}, -.{.t=2824059786,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.7289429,.y=0.3484497,.pressure=0.022888184}}}, -.{.t=2824063716,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.72506714,.y=0.34591675,.pressure=0.022613525}}}, -.{.t=2835063039,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.7218323,.y=0.34277344,.pressure=0.02319336}}}, -.{.t=2835070099,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.7174072,.y=0.34020996,.pressure=0.020080566}}}, -.{.t=2835075929,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.71273804,.y=0.33743286,.pressure=0.020080566}}}, -.{.t=2846116163,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.7079773,.y=0.3343506,.pressure=0.018676758}}}, -.{.t=2846123943,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.7023926,.y=0.33081055,.pressure=0.019805908}}}, -.{.t=2857453356,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.6963806,.y=0.32598877,.pressure=0.019805908}}}, -.{.t=2857460036,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.6892395,.y=0.32144165,.pressure=0.020935059}}}, -.{.t=2857466116,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.6821289,.y=0.31661987,.pressure=0.018127441}}}, -.{.t=2868624580,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.6739197,.y=0.31192017,.pressure=0.018676758}}}, -.{.t=2868632160,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.6664429,.y=0.3072815,.pressure=0.018981934}}}, -.{.t=2868637550,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.6587219,.y=0.30307007,.pressure=0.017578125}}}, -.{.t=2879637654,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.65133667,.y=0.29888916,.pressure=0.017852783}}}, -.{.t=2879646144,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.6444702,.y=0.29452515,.pressure=0.017852783}}}, -.{.t=2879653574,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.6372986,.y=0.29092407,.pressure=0.016174316}}}, -.{.t=2890493398,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.6305542,.y=0.28729248,.pressure=0.016448975}}}, -.{.t=2890500368,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.62493896,.y=0.28427124,.pressure=0.016448975}}}, -.{.t=2901904031,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.6192627,.y=0.28234863,.pressure=0.015594482}}}, -.{.t=2901913451,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.61428833,.y=0.27990723,.pressure=0.014190674}}}, -.{.t=2901920201,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.6097412,.y=0.277771,.pressure=0.013641357}}}, -.{.t=2913077524,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.6056824,.y=0.27627563,.pressure=0.013641357}}}, -.{.t=2913084054,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.6019287,.y=0.27560425,.pressure=0.012512207}}}, -.{.t=2913088274,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.5984192,.y=0.27441406,.pressure=0.011657715}}}, -.{.t=2924138128,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.59536743,.y=0.27404785,.pressure=0.011962891}}}, -.{.t=2924146018,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.5923767,.y=0.27398682,.pressure=0.013641357}}}, -.{.t=2924151648,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.5900574,.y=0.2736206,.pressure=0.013366699}}}, -.{.t=2935179332,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.5883484,.y=0.27407837,.pressure=0.014465332}}}, -.{.t=2935187861,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.5866394,.y=0.27478027,.pressure=0.01586914}}}, -.{.t=2935191171,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.58551025,.y=0.2756958,.pressure=0.015045166}}}, -.{.t=2946370475,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.5841675,.y=0.27648926,.pressure=0.01727295}}}, -.{.t=2946379375,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.5830078,.y=0.27764893,.pressure=0.0184021}}}, -.{.t=2957467849,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.5821533,.y=0.278656,.pressure=0.01953125}}}, -.{.t=2957477449,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.5817566,.y=0.28030396,.pressure=0.016998291}}}, -.{.t=2957483529,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.58148193,.y=0.28225708,.pressure=0.015319824}}}, -.{.t=2968627182,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.5809021,.y=0.2843933,.pressure=0.01586914}}}, -.{.t=2968643772,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.580719,.y=0.28659058,.pressure=0.014190674}}}, -.{.t=2979684996,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.5805969,.y=0.28967285,.pressure=0.013641357}}}, -.{.t=2979694336,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.58026123,.y=0.29241943,.pressure=0.010559082}}}, -.{.t=2979699086,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.57995605,.y=0.29571533,.pressure=0.008575439}}}, -.{.t=2990715289,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.57958984,.y=0.29934692,.pressure=0.010253906}}}, -.{.t=2990723719,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.5793457,.y=0.30322266,.pressure=0.008300781}}}, -.{.t=3002153093,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.5791931,.y=0.30700684,.pressure=0.0060424805}}}, -.{.t=3002161152,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.5791931,.y=0.3117981,.pressure=0.0060424805}}}, -.{.t=3002165632,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.57958984,.y=0.3164673,.pressure=0.00491333}}}, -.{.t=3012982186,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.5806885,.y=0.3215027,.pressure=0.0068969727}}}, -.{.t=3012991236,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.5819702,.y=0.32669067,.pressure=0.0057678223}}}, -.{.t=3012998166,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.5845032,.y=0.3322754,.pressure=0.007446289}}}, -.{.t=3024201460,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.5869446,.y=0.33740234,.pressure=0.008026123}}}, -.{.t=3024208990,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.59017944,.y=0.34225464,.pressure=0.009155273}}}, -.{.t=3024211980,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.5932617,.y=0.34698486,.pressure=0.012237549}}}, -.{.t=3035025244,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.59643555,.y=0.3517456,.pressure=0.013366699}}}, -.{.t=3035031374,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.6001282,.y=0.35601807,.pressure=0.016998291}}}, -.{.t=3035034874,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.60409546,.y=0.3600464,.pressure=0.019805908}}}, -.{.t=3046541367,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.60775757,.y=0.36398315,.pressure=0.022338867}}}, -.{.t=3046548887,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.61169434,.y=0.36740112,.pressure=0.022613525}}}, -.{.t=3057532891,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.6154785,.y=0.37051392,.pressure=0.025146484}}}, -.{.t=3057540471,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.6194763,.y=0.37329102,.pressure=0.025421143}}}, -.{.t=3057545781,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.6232605,.y=0.3761902,.pressure=0.026000977}}}, -.{.t=3068735374,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.62753296,.y=0.3789673,.pressure=0.025421143}}}, -.{.t=3068748304,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.6313782,.y=0.3816223,.pressure=0.024017334}}}, -.{.t=3068754594,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.63513184,.y=0.38391113,.pressure=0.023742676}}}, -.{.t=3079554878,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.6390991,.y=0.38616943,.pressure=0.023468018}}}, -.{.t=3079563518,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.6433716,.y=0.38833618,.pressure=0.02178955}}}, -.{.t=3079568338,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.64767456,.y=0.39031982,.pressure=0.02319336}}}, -.{.t=3090741042,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.65234375,.y=0.3919983,.pressure=0.02319336}}}, -.{.t=3090749882,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.65689087,.y=0.39379883,.pressure=0.021209717}}}, -.{.t=3101724975,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.6610718,.y=0.39520264,.pressure=0.022888184}}}, -.{.t=3101732005,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.66574097,.y=0.39642334,.pressure=0.021484375}}}, -.{.t=3101735255,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.6701355,.y=0.3973999,.pressure=0.019805908}}}, -.{.t=3113361458,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.6748352,.y=0.39767456,.pressure=0.0206604}}}, -.{.t=3113368498,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.67944336,.y=0.39797974,.pressure=0.022613525}}}, -.{.t=3113372028,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.6838379,.y=0.39785767,.pressure=0.022338867}}}, -.{.t=3123796833,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.6879883,.y=0.3970642,.pressure=0.01953125}}}, -.{.t=3123803053,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.69177246,.y=0.39624023,.pressure=0.018127441}}}, -.{.t=3123806563,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.69555664,.y=0.39569092,.pressure=0.016998291}}}, -.{.t=3134998596,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.69888306,.y=0.3942871,.pressure=0.016998291}}}, -.{.t=3135007066,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.7023926,.y=0.39257812,.pressure=0.017578125}}}, -.{.t=3135011336,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.7060852,.y=0.39056396,.pressure=0.017578125}}}, -.{.t=3146195970,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.7102051,.y=0.38861084,.pressure=0.015594482}}}, -.{.t=3146202620,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.715271,.y=0.386261,.pressure=0.014190674}}}, -.{.t=3157408853,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.7234802,.y=0.38327026,.pressure=0.01586914}}}, -.{.t=3157418073,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.730896,.y=0.38006592,.pressure=0.01586914}}}, -.{.t=3157423313,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.73880005,.y=0.37652588,.pressure=0.016448975}}}, -.{.t=3168334437,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.74557495,.y=0.37350464,.pressure=0.017578125}}}, -.{.t=3168341357,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.75097656,.y=0.37020874,.pressure=0.016723633}}}, -.{.t=3168344697,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.7561035,.y=0.36791992,.pressure=0.013916016}}}, -.{.t=3179518520,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.75982666,.y=0.36517334,.pressure=0.013061523}}}, -.{.t=3179524910,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.7633362,.y=0.3623352,.pressure=0.013061523}}}, -.{.t=3179530860,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.765625,.y=0.35949707,.pressure=0.013641357}}}, -.{.t=3190702424,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.7669678,.y=0.3564453,.pressure=0.012786865}}}, -.{.t=3190710904,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.76849365,.y=0.3536682,.pressure=0.011383057}}}, -.{.t=3201886237,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.7687378,.y=0.35095215,.pressure=0.010559082}}}, -.{.t=3201895897,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.7681885,.y=0.34838867,.pressure=0.009155273}}}, -.{.t=3201900097,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.7668457,.y=0.34570312,.pressure=0.009155273}}}, -.{.t=3212919591,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.7654724,.y=0.34277344,.pressure=0.008850098}}}, -.{.t=3212927311,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.7631836,.y=0.34002686,.pressure=0.0066223145}}}, -.{.t=3212932591,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.7612915,.y=0.3373413,.pressure=0.0040893555}}}, -.{.t=3224127654,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.7590027,.y=0.33529663,.pressure=0.0043640137}}}, -.{.t=3224134564,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.7567444,.y=0.33319092,.pressure=0.0024108887}}}, -.{.t=3224138834,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.7541809,.y=0.3307495,.pressure=0.00491333}}}, -.{.t=3234961798,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.75216675,.y=0.32843018,.pressure=0.0038146973}}}, -.{.t=3234967628,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.7489929,.y=0.32583618,.pressure=0.0038146973}}}, -.{.t=3234971398,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.7467346,.y=0.32296753,.pressure=0.005218506}}}, -.{.t=3246367272,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.7436218,.y=0.32019043,.pressure=0.0043640137}}}, -.{.t=3246376701,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.7402649,.y=0.3173523,.pressure=0.0038146973}}}, -.{.t=3257870675,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.73721313,.y=0.31466675,.pressure=0.0018310547}}}, -.{.t=3257881104,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.7336731,.y=0.31219482,.pressure=0.0024108887}}}, -.{.t=3257886264,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.73062134,.y=0.3100891,.pressure=0.0015563965}}}, -.{.t=3268291019,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.72720337,.y=0.30807495,.pressure=0.0007019043}}}, -.{.t=3268298969,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.7241516,.y=0.30593872,.pressure=0.0015563965}}}, -.{.t=3268303569,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.7213135,.y=0.30371094,.pressure=0.0035095215}}}, -.{.t=3279746522,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.71810913,.y=0.302063,.pressure=0.002960205}}}, -.{.t=3279757542,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.7147217,.y=0.30056763,.pressure=0.00491333}}}, -.{.t=3279762862,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.71087646,.y=0.29907227,.pressure=0.00491333}}}, -.{.t=3290574016,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.70751953,.y=0.29745483,.pressure=0.0040893555}}}, -.{.t=3290581596,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.70376587,.y=0.29592896,.pressure=0.0040893555}}}, -.{.t=3301750300,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.6994934,.y=0.2951355,.pressure=0.0038146973}}}, -.{.t=3301760370,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.6951904,.y=0.29397583,.pressure=0.005218506}}}, -.{.t=3301767410,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.6905823,.y=0.29284668,.pressure=0.00491333}}}, -.{.t=3312951293,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.685791,.y=0.29266357,.pressure=0.0068969727}}}, -.{.t=3312959893,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.68136597,.y=0.29257202,.pressure=0.005493164}}}, -.{.t=3312965373,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.6772461,.y=0.29229736,.pressure=0.0068969727}}}, -.{.t=3324079267,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.672699,.y=0.29318237,.pressure=0.004638672}}}, -.{.t=3324090337,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.66882324,.y=0.294281,.pressure=0.004638672}}}, -.{.t=3324095997,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.66537476,.y=0.29525757,.pressure=0.004638672}}}, -.{.t=3335061800,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.6620178,.y=0.2966919,.pressure=0.002960205}}}, -.{.t=3335068160,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.6590576,.y=0.29788208,.pressure=0.0007019043}}}, -.{.t=3335073750,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.up,.x=0.6562805,.y=0.29956055,.pressure=0}}}, -.{.t=3390587188,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.down,.x=0.6447449,.y=0.33596802,.pressure=0.0007019043}}}, -.{.t=3390593138,.pad=2,.ev=.{.touch=.{.touchpad=1,.finger=0,.phase=.motion,.x=0.6447754,.y=0.3406067,.pressure=0.0035095215}}}, + .{ .t = 1557743788, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .down, .x = 0.48794556, .y = 0.3156128, .pressure = 0.0004272461 } } }, + .{ .t = 1557747308, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.49105835, .y = 0.31570435, .pressure = 0.0015563965 } } }, + .{ .t = 1568667061, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.49325562, .y = 0.31576538, .pressure = 0.004638672 } } }, + .{ .t = 1568677161, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.49591064, .y = 0.31585693, .pressure = 0.0035095215 } } }, + .{ .t = 1568682171, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.4988098, .y = 0.31588745, .pressure = 0.0026855469 } } }, + .{ .t = 1579851545, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.50076294, .y = 0.31607056, .pressure = 0.004638672 } } }, + .{ .t = 1579859265, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.50289917, .y = 0.31637573, .pressure = 0.0063171387 } } }, + .{ .t = 1579863375, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.5050354, .y = 0.31655884, .pressure = 0.008026123 } } }, + .{ .t = 1590959349, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.50717163, .y = 0.31655884, .pressure = 0.0063171387 } } }, + .{ .t = 1590970369, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.50927734, .y = 0.31698608, .pressure = 0.0040893555 } } }, + .{ .t = 1590975739, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.5108948, .y = 0.31750488, .pressure = 0.0038146973 } } }, + .{ .t = 1601902982, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.5126953, .y = 0.31808472, .pressure = 0.005218506 } } }, + .{ .t = 1601911482, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.51400757, .y = 0.318573, .pressure = 0.0066223145 } } }, + .{ .t = 1613345665, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.51571655, .y = 0.31878662, .pressure = 0.007171631 } } }, + .{ .t = 1613352235, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.51660156, .y = 0.31936646, .pressure = 0.0068969727 } } }, + .{ .t = 1613356725, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.5178528, .y = 0.3199463, .pressure = 0.0066223145 } } }, + .{ .t = 1624412039, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.5187378, .y = 0.3206787, .pressure = 0.0057678223 } } }, + .{ .t = 1624425589, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.52023315, .y = 0.32138062, .pressure = 0.0043640137 } } }, + .{ .t = 1624432009, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.5215454, .y = 0.3218689, .pressure = 0.0040893555 } } }, + .{ .t = 1635289123, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.5227356, .y = 0.3222351, .pressure = 0.0018310547 } } }, + .{ .t = 1635297503, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.52371216, .y = 0.3229065, .pressure = 0.0026855469 } } }, + .{ .t = 1635301553, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.5246887, .y = 0.3234558, .pressure = 0.002105713 } } }, + .{ .t = 1646425097, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.52545166, .y = 0.323761, .pressure = 0.0007019043 } } }, + .{ .t = 1646433957, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .up, .x = 0.5263977, .y = 0.3241577, .pressure = 0 } } }, + .{ .t = 1657611170, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .down, .x = 0.52749634, .y = 0.32489014, .pressure = 0.0004272461 } } }, + .{ .t = 1657620700, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .up, .x = 0.52893066, .y = 0.32543945, .pressure = 0 } } }, + .{ .t = 2568455904, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .down, .x = 0.71746826, .y = 0.4960022, .pressure = 0.0026855469 } } }, + .{ .t = 2568464274, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.72143555, .y = 0.49996948, .pressure = 0.0032348633 } } }, + .{ .t = 2568468384, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.72436523, .y = 0.5033264, .pressure = 0.004638672 } } }, + .{ .t = 2579442397, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.7271118, .y = 0.5065918, .pressure = 0.0066223145 } } }, + .{ .t = 2579450697, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.73065186, .y = 0.51031494, .pressure = 0.008850098 } } }, + .{ .t = 2579455357, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.7350464, .y = 0.5145569, .pressure = 0.010253906 } } }, + .{ .t = 2590631621, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.74017334, .y = 0.51916504, .pressure = 0.012512207 } } }, + .{ .t = 2590639051, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.7455139, .y = 0.52420044, .pressure = 0.014190674 } } }, + .{ .t = 2601728264, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.7537842, .y = 0.5307617, .pressure = 0.01727295 } } }, + .{ .t = 2601737594, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.76501465, .y = 0.5390625, .pressure = 0.017852783 } } }, + .{ .t = 2601745184, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.7758789, .y = 0.54782104, .pressure = 0.017578125 } } }, + .{ .t = 2612868798, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.78726196, .y = 0.55740356, .pressure = 0.018676758 } } }, + .{ .t = 2612877548, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.79766846, .y = 0.56655884, .pressure = 0.016998291 } } }, + .{ .t = 2612881858, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.8077698, .y = 0.57421875, .pressure = 0.016174316 } } }, + .{ .t = 2624096121, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.81689453, .y = 0.5804138, .pressure = 0.0184021 } } }, + .{ .t = 2624103861, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.8230896, .y = 0.58462524, .pressure = 0.017578125 } } }, + .{ .t = 2624108371, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.8291321, .y = 0.58810425, .pressure = 0.016448975 } } }, + .{ .t = 2635100225, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.8328247, .y = 0.5901184, .pressure = 0.015594482 } } }, + .{ .t = 2635107345, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.835022, .y = 0.59017944, .pressure = 0.016174316 } } }, + .{ .t = 2635111905, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.83724976, .y = 0.5899353, .pressure = 0.016174316 } } }, + .{ .t = 2646151229, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.8390808, .y = 0.5890198, .pressure = 0.014770508 } } }, + .{ .t = 2646160149, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.8404541, .y = 0.58709717, .pressure = 0.014190674 } } }, + .{ .t = 2657358812, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.8408203, .y = 0.58535767, .pressure = 0.016448975 } } }, + .{ .t = 2657364952, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.8411865, .y = 0.5831604, .pressure = 0.015045166 } } }, + .{ .t = 2657368602, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.84106445, .y = 0.5809021, .pressure = 0.0184021 } } }, + .{ .t = 2668497496, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.84155273, .y = 0.5791321, .pressure = 0.018676758 } } }, + .{ .t = 2668503176, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.84198, .y = 0.5767517, .pressure = 0.0184021 } } }, + .{ .t = 2679574619, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.8413696, .y = 0.5749817, .pressure = 0.01727295 } } }, + .{ .t = 2679583429, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.8410034, .y = 0.57302856, .pressure = 0.015594482 } } }, + .{ .t = 2679588959, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.8402405, .y = 0.57077026, .pressure = 0.016998291 } } }, + .{ .t = 2690585493, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.83987427, .y = 0.5680237, .pressure = 0.017578125 } } }, + .{ .t = 2690591573, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.8392639, .y = 0.5658264, .pressure = 0.016998291 } } }, + .{ .t = 2701710277, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.8384094, .y = 0.56329346, .pressure = 0.015045166 } } }, + .{ .t = 2701715427, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.8366089, .y = 0.5602722, .pressure = 0.012512207 } } }, + .{ .t = 2701719287, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.8343506, .y = 0.55578613, .pressure = 0.013641357 } } }, + .{ .t = 2712932260, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.8309326, .y = 0.5510254, .pressure = 0.012512207 } } }, + .{ .t = 2712941600, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.8270569, .y = 0.54504395, .pressure = 0.013641357 } } }, + .{ .t = 2712946870, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.82263184, .y = 0.53845215, .pressure = 0.012786865 } } }, + .{ .t = 2724074464, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.8186035, .y = 0.5309448, .pressure = 0.012237549 } } }, + .{ .t = 2724081034, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.8176575, .y = 0.5210266, .pressure = 0.011383057 } } }, + .{ .t = 2724085114, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.8161926, .y = 0.5109863, .pressure = 0.010253906 } } }, + .{ .t = 2735041467, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.81481934, .y = 0.49887085, .pressure = 0.008575439 } } }, + .{ .t = 2735049697, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.8135681, .y = 0.48706055, .pressure = 0.0066223145 } } }, + .{ .t = 2735053437, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.8110962, .y = 0.47451782, .pressure = 0.0066223145 } } }, + .{ .t = 2746200461, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.8079529, .y = 0.46011353, .pressure = 0.008300781 } } }, + .{ .t = 2746207531, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.8046875, .y = 0.44818115, .pressure = 0.008850098 } } }, + .{ .t = 2757301144, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.8004761, .y = 0.4363098, .pressure = 0.010253906 } } }, + .{ .t = 2757308574, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.796051, .y = 0.4248352, .pressure = 0.009979248 } } }, + .{ .t = 2757312724, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.79104614, .y = 0.4133911, .pressure = 0.013366699 } } }, + .{ .t = 2775948317, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.78637695, .y = 0.4032898, .pressure = 0.012237549 } } }, + .{ .t = 2775958817, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.78131104, .y = 0.39471436, .pressure = 0.015045166 } } }, + .{ .t = 2775962507, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.7763977, .y = 0.38796997, .pressure = 0.016723633 } } }, + .{ .t = 2775966007, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.77178955, .y = 0.38198853, .pressure = 0.018127441 } } }, + .{ .t = 2775969667, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.76724243, .y = 0.37753296, .pressure = 0.019805908 } } }, + .{ .t = 2779448262, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.7628784, .y = 0.37338257, .pressure = 0.018127441 } } }, + .{ .t = 2790559265, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.75909424, .y = 0.36990356, .pressure = 0.020935059 } } }, + .{ .t = 2790566225, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.75512695, .y = 0.36654663, .pressure = 0.021484375 } } }, + .{ .t = 2801688299, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.7513733, .y = 0.36395264, .pressure = 0.020385742 } } }, + .{ .t = 2801695099, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.7475891, .y = 0.36190796, .pressure = 0.020385742 } } }, + .{ .t = 2801697739, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.74487305, .y = 0.35958862, .pressure = 0.020385742 } } }, + .{ .t = 2812906962, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.74191284, .y = 0.3572998, .pressure = 0.022888184 } } }, + .{ .t = 2812918202, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.7388611, .y = 0.35458374, .pressure = 0.022338867 } } }, + .{ .t = 2812924662, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.7357178, .y = 0.35250854, .pressure = 0.021209717 } } }, + .{ .t = 2824054786, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.7324829, .y = 0.3503418, .pressure = 0.021484375 } } }, + .{ .t = 2824059786, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.7289429, .y = 0.3484497, .pressure = 0.022888184 } } }, + .{ .t = 2824063716, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.72506714, .y = 0.34591675, .pressure = 0.022613525 } } }, + .{ .t = 2835063039, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.7218323, .y = 0.34277344, .pressure = 0.02319336 } } }, + .{ .t = 2835070099, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.7174072, .y = 0.34020996, .pressure = 0.020080566 } } }, + .{ .t = 2835075929, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.71273804, .y = 0.33743286, .pressure = 0.020080566 } } }, + .{ .t = 2846116163, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.7079773, .y = 0.3343506, .pressure = 0.018676758 } } }, + .{ .t = 2846123943, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.7023926, .y = 0.33081055, .pressure = 0.019805908 } } }, + .{ .t = 2857453356, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.6963806, .y = 0.32598877, .pressure = 0.019805908 } } }, + .{ .t = 2857460036, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.6892395, .y = 0.32144165, .pressure = 0.020935059 } } }, + .{ .t = 2857466116, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.6821289, .y = 0.31661987, .pressure = 0.018127441 } } }, + .{ .t = 2868624580, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.6739197, .y = 0.31192017, .pressure = 0.018676758 } } }, + .{ .t = 2868632160, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.6664429, .y = 0.3072815, .pressure = 0.018981934 } } }, + .{ .t = 2868637550, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.6587219, .y = 0.30307007, .pressure = 0.017578125 } } }, + .{ .t = 2879637654, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.65133667, .y = 0.29888916, .pressure = 0.017852783 } } }, + .{ .t = 2879646144, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.6444702, .y = 0.29452515, .pressure = 0.017852783 } } }, + .{ .t = 2879653574, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.6372986, .y = 0.29092407, .pressure = 0.016174316 } } }, + .{ .t = 2890493398, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.6305542, .y = 0.28729248, .pressure = 0.016448975 } } }, + .{ .t = 2890500368, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.62493896, .y = 0.28427124, .pressure = 0.016448975 } } }, + .{ .t = 2901904031, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.6192627, .y = 0.28234863, .pressure = 0.015594482 } } }, + .{ .t = 2901913451, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.61428833, .y = 0.27990723, .pressure = 0.014190674 } } }, + .{ .t = 2901920201, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.6097412, .y = 0.277771, .pressure = 0.013641357 } } }, + .{ .t = 2913077524, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.6056824, .y = 0.27627563, .pressure = 0.013641357 } } }, + .{ .t = 2913084054, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.6019287, .y = 0.27560425, .pressure = 0.012512207 } } }, + .{ .t = 2913088274, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.5984192, .y = 0.27441406, .pressure = 0.011657715 } } }, + .{ .t = 2924138128, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.59536743, .y = 0.27404785, .pressure = 0.011962891 } } }, + .{ .t = 2924146018, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.5923767, .y = 0.27398682, .pressure = 0.013641357 } } }, + .{ .t = 2924151648, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.5900574, .y = 0.2736206, .pressure = 0.013366699 } } }, + .{ .t = 2935179332, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.5883484, .y = 0.27407837, .pressure = 0.014465332 } } }, + .{ .t = 2935187861, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.5866394, .y = 0.27478027, .pressure = 0.01586914 } } }, + .{ .t = 2935191171, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.58551025, .y = 0.2756958, .pressure = 0.015045166 } } }, + .{ .t = 2946370475, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.5841675, .y = 0.27648926, .pressure = 0.01727295 } } }, + .{ .t = 2946379375, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.5830078, .y = 0.27764893, .pressure = 0.0184021 } } }, + .{ .t = 2957467849, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.5821533, .y = 0.278656, .pressure = 0.01953125 } } }, + .{ .t = 2957477449, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.5817566, .y = 0.28030396, .pressure = 0.016998291 } } }, + .{ .t = 2957483529, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.58148193, .y = 0.28225708, .pressure = 0.015319824 } } }, + .{ .t = 2968627182, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.5809021, .y = 0.2843933, .pressure = 0.01586914 } } }, + .{ .t = 2968643772, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.580719, .y = 0.28659058, .pressure = 0.014190674 } } }, + .{ .t = 2979684996, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.5805969, .y = 0.28967285, .pressure = 0.013641357 } } }, + .{ .t = 2979694336, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.58026123, .y = 0.29241943, .pressure = 0.010559082 } } }, + .{ .t = 2979699086, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.57995605, .y = 0.29571533, .pressure = 0.008575439 } } }, + .{ .t = 2990715289, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.57958984, .y = 0.29934692, .pressure = 0.010253906 } } }, + .{ .t = 2990723719, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.5793457, .y = 0.30322266, .pressure = 0.008300781 } } }, + .{ .t = 3002153093, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.5791931, .y = 0.30700684, .pressure = 0.0060424805 } } }, + .{ .t = 3002161152, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.5791931, .y = 0.3117981, .pressure = 0.0060424805 } } }, + .{ .t = 3002165632, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.57958984, .y = 0.3164673, .pressure = 0.00491333 } } }, + .{ .t = 3012982186, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.5806885, .y = 0.3215027, .pressure = 0.0068969727 } } }, + .{ .t = 3012991236, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.5819702, .y = 0.32669067, .pressure = 0.0057678223 } } }, + .{ .t = 3012998166, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.5845032, .y = 0.3322754, .pressure = 0.007446289 } } }, + .{ .t = 3024201460, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.5869446, .y = 0.33740234, .pressure = 0.008026123 } } }, + .{ .t = 3024208990, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.59017944, .y = 0.34225464, .pressure = 0.009155273 } } }, + .{ .t = 3024211980, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.5932617, .y = 0.34698486, .pressure = 0.012237549 } } }, + .{ .t = 3035025244, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.59643555, .y = 0.3517456, .pressure = 0.013366699 } } }, + .{ .t = 3035031374, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.6001282, .y = 0.35601807, .pressure = 0.016998291 } } }, + .{ .t = 3035034874, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.60409546, .y = 0.3600464, .pressure = 0.019805908 } } }, + .{ .t = 3046541367, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.60775757, .y = 0.36398315, .pressure = 0.022338867 } } }, + .{ .t = 3046548887, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.61169434, .y = 0.36740112, .pressure = 0.022613525 } } }, + .{ .t = 3057532891, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.6154785, .y = 0.37051392, .pressure = 0.025146484 } } }, + .{ .t = 3057540471, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.6194763, .y = 0.37329102, .pressure = 0.025421143 } } }, + .{ .t = 3057545781, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.6232605, .y = 0.3761902, .pressure = 0.026000977 } } }, + .{ .t = 3068735374, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.62753296, .y = 0.3789673, .pressure = 0.025421143 } } }, + .{ .t = 3068748304, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.6313782, .y = 0.3816223, .pressure = 0.024017334 } } }, + .{ .t = 3068754594, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.63513184, .y = 0.38391113, .pressure = 0.023742676 } } }, + .{ .t = 3079554878, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.6390991, .y = 0.38616943, .pressure = 0.023468018 } } }, + .{ .t = 3079563518, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.6433716, .y = 0.38833618, .pressure = 0.02178955 } } }, + .{ .t = 3079568338, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.64767456, .y = 0.39031982, .pressure = 0.02319336 } } }, + .{ .t = 3090741042, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.65234375, .y = 0.3919983, .pressure = 0.02319336 } } }, + .{ .t = 3090749882, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.65689087, .y = 0.39379883, .pressure = 0.021209717 } } }, + .{ .t = 3101724975, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.6610718, .y = 0.39520264, .pressure = 0.022888184 } } }, + .{ .t = 3101732005, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.66574097, .y = 0.39642334, .pressure = 0.021484375 } } }, + .{ .t = 3101735255, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.6701355, .y = 0.3973999, .pressure = 0.019805908 } } }, + .{ .t = 3113361458, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.6748352, .y = 0.39767456, .pressure = 0.0206604 } } }, + .{ .t = 3113368498, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.67944336, .y = 0.39797974, .pressure = 0.022613525 } } }, + .{ .t = 3113372028, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.6838379, .y = 0.39785767, .pressure = 0.022338867 } } }, + .{ .t = 3123796833, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.6879883, .y = 0.3970642, .pressure = 0.01953125 } } }, + .{ .t = 3123803053, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.69177246, .y = 0.39624023, .pressure = 0.018127441 } } }, + .{ .t = 3123806563, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.69555664, .y = 0.39569092, .pressure = 0.016998291 } } }, + .{ .t = 3134998596, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.69888306, .y = 0.3942871, .pressure = 0.016998291 } } }, + .{ .t = 3135007066, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.7023926, .y = 0.39257812, .pressure = 0.017578125 } } }, + .{ .t = 3135011336, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.7060852, .y = 0.39056396, .pressure = 0.017578125 } } }, + .{ .t = 3146195970, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.7102051, .y = 0.38861084, .pressure = 0.015594482 } } }, + .{ .t = 3146202620, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.715271, .y = 0.386261, .pressure = 0.014190674 } } }, + .{ .t = 3157408853, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.7234802, .y = 0.38327026, .pressure = 0.01586914 } } }, + .{ .t = 3157418073, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.730896, .y = 0.38006592, .pressure = 0.01586914 } } }, + .{ .t = 3157423313, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.73880005, .y = 0.37652588, .pressure = 0.016448975 } } }, + .{ .t = 3168334437, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.74557495, .y = 0.37350464, .pressure = 0.017578125 } } }, + .{ .t = 3168341357, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.75097656, .y = 0.37020874, .pressure = 0.016723633 } } }, + .{ .t = 3168344697, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.7561035, .y = 0.36791992, .pressure = 0.013916016 } } }, + .{ .t = 3179518520, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.75982666, .y = 0.36517334, .pressure = 0.013061523 } } }, + .{ .t = 3179524910, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.7633362, .y = 0.3623352, .pressure = 0.013061523 } } }, + .{ .t = 3179530860, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.765625, .y = 0.35949707, .pressure = 0.013641357 } } }, + .{ .t = 3190702424, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.7669678, .y = 0.3564453, .pressure = 0.012786865 } } }, + .{ .t = 3190710904, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.76849365, .y = 0.3536682, .pressure = 0.011383057 } } }, + .{ .t = 3201886237, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.7687378, .y = 0.35095215, .pressure = 0.010559082 } } }, + .{ .t = 3201895897, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.7681885, .y = 0.34838867, .pressure = 0.009155273 } } }, + .{ .t = 3201900097, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.7668457, .y = 0.34570312, .pressure = 0.009155273 } } }, + .{ .t = 3212919591, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.7654724, .y = 0.34277344, .pressure = 0.008850098 } } }, + .{ .t = 3212927311, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.7631836, .y = 0.34002686, .pressure = 0.0066223145 } } }, + .{ .t = 3212932591, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.7612915, .y = 0.3373413, .pressure = 0.0040893555 } } }, + .{ .t = 3224127654, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.7590027, .y = 0.33529663, .pressure = 0.0043640137 } } }, + .{ .t = 3224134564, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.7567444, .y = 0.33319092, .pressure = 0.0024108887 } } }, + .{ .t = 3224138834, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.7541809, .y = 0.3307495, .pressure = 0.00491333 } } }, + .{ .t = 3234961798, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.75216675, .y = 0.32843018, .pressure = 0.0038146973 } } }, + .{ .t = 3234967628, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.7489929, .y = 0.32583618, .pressure = 0.0038146973 } } }, + .{ .t = 3234971398, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.7467346, .y = 0.32296753, .pressure = 0.005218506 } } }, + .{ .t = 3246367272, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.7436218, .y = 0.32019043, .pressure = 0.0043640137 } } }, + .{ .t = 3246376701, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.7402649, .y = 0.3173523, .pressure = 0.0038146973 } } }, + .{ .t = 3257870675, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.73721313, .y = 0.31466675, .pressure = 0.0018310547 } } }, + .{ .t = 3257881104, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.7336731, .y = 0.31219482, .pressure = 0.0024108887 } } }, + .{ .t = 3257886264, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.73062134, .y = 0.3100891, .pressure = 0.0015563965 } } }, + .{ .t = 3268291019, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.72720337, .y = 0.30807495, .pressure = 0.0007019043 } } }, + .{ .t = 3268298969, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.7241516, .y = 0.30593872, .pressure = 0.0015563965 } } }, + .{ .t = 3268303569, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.7213135, .y = 0.30371094, .pressure = 0.0035095215 } } }, + .{ .t = 3279746522, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.71810913, .y = 0.302063, .pressure = 0.002960205 } } }, + .{ .t = 3279757542, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.7147217, .y = 0.30056763, .pressure = 0.00491333 } } }, + .{ .t = 3279762862, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.71087646, .y = 0.29907227, .pressure = 0.00491333 } } }, + .{ .t = 3290574016, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.70751953, .y = 0.29745483, .pressure = 0.0040893555 } } }, + .{ .t = 3290581596, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.70376587, .y = 0.29592896, .pressure = 0.0040893555 } } }, + .{ .t = 3301750300, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.6994934, .y = 0.2951355, .pressure = 0.0038146973 } } }, + .{ .t = 3301760370, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.6951904, .y = 0.29397583, .pressure = 0.005218506 } } }, + .{ .t = 3301767410, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.6905823, .y = 0.29284668, .pressure = 0.00491333 } } }, + .{ .t = 3312951293, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.685791, .y = 0.29266357, .pressure = 0.0068969727 } } }, + .{ .t = 3312959893, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.68136597, .y = 0.29257202, .pressure = 0.005493164 } } }, + .{ .t = 3312965373, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.6772461, .y = 0.29229736, .pressure = 0.0068969727 } } }, + .{ .t = 3324079267, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.672699, .y = 0.29318237, .pressure = 0.004638672 } } }, + .{ .t = 3324090337, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.66882324, .y = 0.294281, .pressure = 0.004638672 } } }, + .{ .t = 3324095997, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.66537476, .y = 0.29525757, .pressure = 0.004638672 } } }, + .{ .t = 3335061800, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.6620178, .y = 0.2966919, .pressure = 0.002960205 } } }, + .{ .t = 3335068160, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.6590576, .y = 0.29788208, .pressure = 0.0007019043 } } }, + .{ .t = 3335073750, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .up, .x = 0.6562805, .y = 0.29956055, .pressure = 0 } } }, + .{ .t = 3390587188, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .down, .x = 0.6447449, .y = 0.33596802, .pressure = 0.0007019043 } } }, + .{ .t = 3390593138, .pad = 2, .ev = .{ .touch = .{ .touchpad = 1, .finger = 0, .phase = .motion, .x = 0.6447754, .y = 0.3406067, .pressure = 0.0035095215 } } }, } } diff --git a/test/deck/triggers.zon b/test/deck/triggers.zon index ad5f7656..8cac4b66 100644 --- a/test/deck/triggers.zon +++ b/test/deck/triggers.zon @@ -1,576 +1,576 @@ .{ .version = 1, .events = .{ -.{.t=3100837937,.pad=2,.ev=.{.axis=.{.idx=3,.value=997}}}, -.{.t=3100845387,.pad=2,.ev=.{.axis=.{.idx=0,.value=-829}}}, -.{.t=3100845387,.pad=2,.ev=.{.axis=.{.idx=1,.value=-1441}}}, -.{.t=3100845387,.pad=2,.ev=.{.axis=.{.idx=3,.value=1027}}}, -.{.t=3100849157,.pad=2,.ev=.{.axis=.{.idx=0,.value=-802}}}, -.{.t=3100849157,.pad=2,.ev=.{.axis=.{.idx=1,.value=-1411}}}, -.{.t=3100849157,.pad=2,.ev=.{.axis=.{.idx=3,.value=1057}}}, -.{.t=3111923010,.pad=2,.ev=.{.axis=.{.idx=0,.value=-829}}}, -.{.t=3111923010,.pad=2,.ev=.{.axis=.{.idx=1,.value=-1529}}}, -.{.t=3111923010,.pad=2,.ev=.{.axis=.{.idx=3,.value=1027}}}, -.{.t=3111936310,.pad=2,.ev=.{.axis=.{.idx=0,.value=-802}}}, -.{.t=3111936310,.pad=2,.ev=.{.axis=.{.idx=1,.value=-1323}}}, -.{.t=3111941850,.pad=2,.ev=.{.axis=.{.idx=1,.value=-1558}}}, -.{.t=3111941850,.pad=2,.ev=.{.axis=.{.idx=3,.value=997}}}, -.{.t=3123013224,.pad=2,.ev=.{.axis=.{.idx=0,.value=-829}}}, -.{.t=3123013224,.pad=2,.ev=.{.axis=.{.idx=1,.value=-1294}}}, -.{.t=3123013224,.pad=2,.ev=.{.axis=.{.idx=3,.value=1027}}}, -.{.t=3123021794,.pad=2,.ev=.{.axis=.{.idx=0,.value=-802}}}, -.{.t=3123021794,.pad=2,.ev=.{.axis=.{.idx=1,.value=-941}}}, -.{.t=3123021794,.pad=2,.ev=.{.axis=.{.idx=3,.value=997}}}, -.{.t=3134267607,.pad=2,.ev=.{.axis=.{.idx=5,.value=0}}}, -.{.t=3134267607,.pad=2,.ev=.{.axis=.{.idx=5,.value=214}}}, -.{.t=3134267607,.pad=2,.ev=.{.axis=.{.idx=0,.value=-829}}}, -.{.t=3134267607,.pad=2,.ev=.{.axis=.{.idx=1,.value=-647}}}, -.{.t=3134277137,.pad=2,.ev=.{.axis=.{.idx=5,.value=2674}}}, -.{.t=3134277137,.pad=2,.ev=.{.axis=.{.idx=0,.value=-802}}}, -.{.t=3134277137,.pad=2,.ev=.{.axis=.{.idx=1,.value=-500}}}, -.{.t=3134280727,.pad=2,.ev=.{.axis=.{.idx=5,.value=5436}}}, -.{.t=3134280727,.pad=2,.ev=.{.axis=.{.idx=0,.value=-829}}}, -.{.t=3134280727,.pad=2,.ev=.{.axis=.{.idx=1,.value=-206}}}, -.{.t=3134280727,.pad=2,.ev=.{.axis=.{.idx=3,.value=1027}}}, -.{.t=3146260210,.pad=2,.ev=.{.axis=.{.idx=5,.value=8198}}}, -.{.t=3146260210,.pad=2,.ev=.{.axis=.{.idx=0,.value=-774}}}, -.{.t=3146260210,.pad=2,.ev=.{.axis=.{.idx=1,.value=-176}}}, -.{.t=3146260210,.pad=2,.ev=.{.axis=.{.idx=3,.value=997}}}, -.{.t=3146270520,.pad=2,.ev=.{.axis=.{.idx=5,.value=11211}}}, -.{.t=3146270520,.pad=2,.ev=.{.axis=.{.idx=0,.value=-802}}}, -.{.t=3146270520,.pad=2,.ev=.{.axis=.{.idx=1,.value=-29}}}, -.{.t=3146274870,.pad=2,.ev=.{.axis=.{.idx=5,.value=13671}}}, -.{.t=3146274870,.pad=2,.ev=.{.axis=.{.idx=1,.value=86}}}, -.{.t=3146274870,.pad=2,.ev=.{.axis=.{.idx=3,.value=1027}}}, -.{.t=3156416215,.pad=2,.ev=.{.axis=.{.idx=5,.value=16432}}}, -.{.t=3156416215,.pad=2,.ev=.{.axis=.{.idx=0,.value=-829}}}, -.{.t=3156416215,.pad=2,.ev=.{.axis=.{.idx=1,.value=288}}}, -.{.t=3156416215,.pad=2,.ev=.{.axis=.{.idx=3,.value=997}}}, -.{.t=3156435465,.pad=2,.ev=.{.axis=.{.idx=5,.value=18893}}}, -.{.t=3156435465,.pad=2,.ev=.{.axis=.{.idx=0,.value=-802}}}, -.{.t=3156435465,.pad=2,.ev=.{.axis=.{.idx=1,.value=462}}}, -.{.t=3156441825,.pad=2,.ev=.{.axis=.{.idx=5,.value=21504}}}, -.{.t=3156441825,.pad=2,.ev=.{.axis=.{.idx=1,.value=491}}}, -.{.t=3156441825,.pad=2,.ev=.{.axis=.{.idx=3,.value=1057}}}, -.{.t=3167440508,.pad=2,.ev=.{.axis=.{.idx=5,.value=23915}}}, -.{.t=3167440508,.pad=2,.ev=.{.axis=.{.idx=1,.value=664}}}, -.{.t=3167440508,.pad=2,.ev=.{.axis=.{.idx=3,.value=1027}}}, -.{.t=3167449678,.pad=2,.ev=.{.axis=.{.idx=5,.value=26224}}}, -.{.t=3167449678,.pad=2,.ev=.{.axis=.{.idx=0,.value=-829}}}, -.{.t=3167449678,.pad=2,.ev=.{.axis=.{.idx=1,.value=779}}}, -.{.t=3167449678,.pad=2,.ev=.{.axis=.{.idx=3,.value=997}}}, -.{.t=3178634312,.pad=2,.ev=.{.axis=.{.idx=5,.value=28384}}}, -.{.t=3178634312,.pad=2,.ev=.{.axis=.{.idx=0,.value=-802}}}, -.{.t=3178634312,.pad=2,.ev=.{.axis=.{.idx=1,.value=837}}}, -.{.t=3178634312,.pad=2,.ev=.{.axis=.{.idx=3,.value=1027}}}, -.{.t=3178646332,.pad=2,.ev=.{.axis=.{.idx=5,.value=30593}}}, -.{.t=3178646332,.pad=2,.ev=.{.axis=.{.idx=0,.value=-829}}}, -.{.t=3178646332,.pad=2,.ev=.{.axis=.{.idx=3,.value=997}}}, -.{.t=3178651472,.pad=2,.ev=.{.axis=.{.idx=5,.value=32702}}}, -.{.t=3178651472,.pad=2,.ev=.{.axis=.{.idx=0,.value=-802}}}, -.{.t=3189737565,.pad=2,.ev=.{.axis=.{.idx=5,.value=32766}}}, -.{.t=3189737565,.pad=2,.ev=.{.axis=.{.idx=1,.value=924}}}, -.{.t=3189737565,.pad=2,.ev=.{.axis=.{.idx=3,.value=1027}}}, -.{.t=3189748175,.pad=2,.ev=.{.axis=.{.idx=3,.value=1057}}}, -.{.t=3189751215,.pad=2,.ev=.{.axis=.{.idx=1,.value=953}}}, -.{.t=3189751215,.pad=2,.ev=.{.axis=.{.idx=3,.value=1027}}}, -.{.t=3200899959,.pad=2,.ev=.{.axis=.{.idx=3,.value=997}}}, -.{.t=3200909349,.pad=2,.ev=.{.axis=.{.idx=0,.value=-774}}}, -.{.t=3200909349,.pad=2,.ev=.{.axis=.{.idx=1,.value=924}}}, -.{.t=3200914229,.pad=2,.ev=.{.axis=.{.idx=0,.value=-802}}}, -.{.t=3200914229,.pad=2,.ev=.{.axis=.{.idx=1,.value=953}}}, -.{.t=3200914229,.pad=2,.ev=.{.axis=.{.idx=3,.value=1027}}}, -.{.t=3212027402,.pad=2,.ev=.{.axis=.{.idx=0,.value=-829}}}, -.{.t=3212027402,.pad=2,.ev=.{.axis=.{.idx=1,.value=1010}}}, -.{.t=3212027402,.pad=2,.ev=.{.axis=.{.idx=3,.value=997}}}, -.{.t=3212033902,.pad=2,.ev=.{.axis=.{.idx=3,.value=1027}}}, -.{.t=3222960156,.pad=2,.ev=.{.axis=.{.idx=1,.value=981}}}, -.{.t=3222960156,.pad=2,.ev=.{.axis=.{.idx=3,.value=997}}}, -.{.t=3222967916,.pad=2,.ev=.{.axis=.{.idx=0,.value=-802}}}, -.{.t=3222967916,.pad=2,.ev=.{.axis=.{.idx=1,.value=953}}}, -.{.t=3222967916,.pad=2,.ev=.{.axis=.{.idx=3,.value=1087}}}, -.{.t=3234186130,.pad=2,.ev=.{.axis=.{.idx=0,.value=-857}}}, -.{.t=3234186130,.pad=2,.ev=.{.axis=.{.idx=1,.value=981}}}, -.{.t=3234186130,.pad=2,.ev=.{.axis=.{.idx=3,.value=1027}}}, -.{.t=3234194710,.pad=2,.ev=.{.axis=.{.idx=0,.value=-802}}}, -.{.t=3234194710,.pad=2,.ev=.{.axis=.{.idx=1,.value=953}}}, -.{.t=3234194710,.pad=2,.ev=.{.axis=.{.idx=3,.value=997}}}, -.{.t=3234198480,.pad=2,.ev=.{.axis=.{.idx=0,.value=-829}}}, -.{.t=3234198480,.pad=2,.ev=.{.axis=.{.idx=1,.value=1097}}}, -.{.t=3245272663,.pad=2,.ev=.{.axis=.{.idx=1,.value=1126}}}, -.{.t=3245272663,.pad=2,.ev=.{.axis=.{.idx=3,.value=1057}}}, -.{.t=3245280873,.pad=2,.ev=.{.axis=.{.idx=0,.value=-802}}}, -.{.t=3245280873,.pad=2,.ev=.{.axis=.{.idx=3,.value=997}}}, -.{.t=3245284263,.pad=2,.ev=.{.axis=.{.idx=1,.value=1097}}}, -.{.t=3245284263,.pad=2,.ev=.{.axis=.{.idx=3,.value=1027}}}, -.{.t=3256351647,.pad=2,.ev=.{.axis=.{.idx=0,.value=-829}}}, -.{.t=3256351647,.pad=2,.ev=.{.axis=.{.idx=3,.value=997}}}, -.{.t=3256361897,.pad=2,.ev=.{.axis=.{.idx=1,.value=1126}}}, -.{.t=3256361897,.pad=2,.ev=.{.axis=.{.idx=3,.value=1027}}}, -.{.t=3256366557,.pad=2,.ev=.{.axis=.{.idx=0,.value=-857}}}, -.{.t=3267453910,.pad=2,.ev=.{.axis=.{.idx=0,.value=-829}}}, -.{.t=3267461450,.pad=2,.ev=.{.axis=.{.idx=0,.value=-802}}}, -.{.t=3267461450,.pad=2,.ev=.{.axis=.{.idx=1,.value=1097}}}, -.{.t=3267461450,.pad=2,.ev=.{.axis=.{.idx=3,.value=1057}}}, -.{.t=3278671394,.pad=2,.ev=.{.axis=.{.idx=3,.value=1027}}}, -.{.t=3278679494,.pad=2,.ev=.{.axis=.{.idx=0,.value=-829}}}, -.{.t=3278679494,.pad=2,.ev=.{.axis=.{.idx=1,.value=1126}}}, -.{.t=3278679494,.pad=2,.ev=.{.axis=.{.idx=3,.value=997}}}, -.{.t=3278684284,.pad=2,.ev=.{.axis=.{.idx=1,.value=1097}}}, -.{.t=3289747017,.pad=2,.ev=.{.axis=.{.idx=0,.value=-802}}}, -.{.t=3289757957,.pad=2,.ev=.{.axis=.{.idx=0,.value=-774}}}, -.{.t=3289757957,.pad=2,.ev=.{.axis=.{.idx=1,.value=1068}}}, -.{.t=3289757957,.pad=2,.ev=.{.axis=.{.idx=3,.value=1057}}}, -.{.t=3289764977,.pad=2,.ev=.{.axis=.{.idx=0,.value=-829}}}, -.{.t=3289764977,.pad=2,.ev=.{.axis=.{.idx=3,.value=1027}}}, -.{.t=3300894251,.pad=2,.ev=.{.axis=.{.idx=0,.value=-802}}}, -.{.t=3300894251,.pad=2,.ev=.{.axis=.{.idx=3,.value=1057}}}, -.{.t=3300904161,.pad=2,.ev=.{.axis=.{.idx=0,.value=-829}}}, -.{.t=3300904161,.pad=2,.ev=.{.axis=.{.idx=3,.value=1027}}}, -.{.t=3300908771,.pad=2,.ev=.{.axis=.{.idx=3,.value=1057}}}, -.{.t=3312130554,.pad=2,.ev=.{.axis=.{.idx=0,.value=-802}}}, -.{.t=3312130554,.pad=2,.ev=.{.axis=.{.idx=1,.value=1039}}}, -.{.t=3312130554,.pad=2,.ev=.{.axis=.{.idx=3,.value=1027}}}, -.{.t=3312142164,.pad=2,.ev=.{.axis=.{.idx=3,.value=1057}}}, -.{.t=3312145624,.pad=2,.ev=.{.axis=.{.idx=0,.value=-829}}}, -.{.t=3312145624,.pad=2,.ev=.{.axis=.{.idx=1,.value=1068}}}, -.{.t=3312145624,.pad=2,.ev=.{.axis=.{.idx=3,.value=1027}}}, -.{.t=3323185928,.pad=2,.ev=.{.axis=.{.idx=0,.value=-802}}}, -.{.t=3323185928,.pad=2,.ev=.{.axis=.{.idx=1,.value=1039}}}, -.{.t=3323197438,.pad=2,.ev=.{.axis=.{.idx=1,.value=1010}}}, -.{.t=3334415941,.pad=2,.ev=.{.axis=.{.idx=0,.value=-829}}}, -.{.t=3334415941,.pad=2,.ev=.{.axis=.{.idx=3,.value=1057}}}, -.{.t=3334428191,.pad=2,.ev=.{.axis=.{.idx=0,.value=-802}}}, -.{.t=3334428191,.pad=2,.ev=.{.axis=.{.idx=3,.value=1027}}}, -.{.t=3334433441,.pad=2,.ev=.{.axis=.{.idx=0,.value=-829}}}, -.{.t=3345319335,.pad=2,.ev=.{.axis=.{.idx=0,.value=-802}}}, -.{.t=3345319335,.pad=2,.ev=.{.axis=.{.idx=1,.value=1039}}}, -.{.t=3345329665,.pad=2,.ev=.{.axis=.{.idx=0,.value=-774}}}, -.{.t=3345329665,.pad=2,.ev=.{.axis=.{.idx=1,.value=1010}}}, -.{.t=3345329665,.pad=2,.ev=.{.axis=.{.idx=3,.value=997}}}, -.{.t=3345334835,.pad=2,.ev=.{.axis=.{.idx=0,.value=-802}}}, -.{.t=3356434069,.pad=2,.ev=.{.axis=.{.idx=0,.value=-829}}}, -.{.t=3356434069,.pad=2,.ev=.{.axis=.{.idx=1,.value=1039}}}, -.{.t=3356434069,.pad=2,.ev=.{.axis=.{.idx=3,.value=1027}}}, -.{.t=3356449919,.pad=2,.ev=.{.axis=.{.idx=0,.value=-802}}}, -.{.t=3356449919,.pad=2,.ev=.{.axis=.{.idx=1,.value=1010}}}, -.{.t=3356449919,.pad=2,.ev=.{.axis=.{.idx=3,.value=997}}}, -.{.t=3367716072,.pad=2,.ev=.{.axis=.{.idx=0,.value=-857}}}, -.{.t=3367716072,.pad=2,.ev=.{.axis=.{.idx=1,.value=1068}}}, -.{.t=3367728332,.pad=2,.ev=.{.axis=.{.idx=0,.value=-829}}}, -.{.t=3367728332,.pad=2,.ev=.{.axis=.{.idx=1,.value=1039}}}, -.{.t=3367728332,.pad=2,.ev=.{.axis=.{.idx=3,.value=1027}}}, -.{.t=3367733692,.pad=2,.ev=.{.axis=.{.idx=0,.value=-802}}}, -.{.t=3367733692,.pad=2,.ev=.{.axis=.{.idx=1,.value=1010}}}, -.{.t=3367733692,.pad=2,.ev=.{.axis=.{.idx=3,.value=1057}}}, -.{.t=3378615526,.pad=2,.ev=.{.axis=.{.idx=3,.value=997}}}, -.{.t=3389836929,.pad=2,.ev=.{.axis=.{.idx=0,.value=-774}}}, -.{.t=3389836929,.pad=2,.ev=.{.axis=.{.idx=1,.value=981}}}, -.{.t=3389836929,.pad=2,.ev=.{.axis=.{.idx=3,.value=1027}}}, -.{.t=3389847129,.pad=2,.ev=.{.axis=.{.idx=5,.value=31648}}}, -.{.t=3389847129,.pad=2,.ev=.{.axis=.{.idx=0,.value=-802}}}, -.{.t=3389847129,.pad=2,.ev=.{.axis=.{.idx=1,.value=1010}}}, -.{.t=3389852719,.pad=2,.ev=.{.axis=.{.idx=5,.value=29137}}}, -.{.t=3389852719,.pad=2,.ev=.{.axis=.{.idx=1,.value=1039}}}, -.{.t=3401186593,.pad=2,.ev=.{.axis=.{.idx=5,.value=26074}}}, -.{.t=3401186593,.pad=2,.ev=.{.axis=.{.idx=0,.value=-829}}}, -.{.t=3401194003,.pad=2,.ev=.{.axis=.{.idx=5,.value=23262}}}, -.{.t=3401194003,.pad=2,.ev=.{.axis=.{.idx=0,.value=-802}}}, -.{.t=3401194003,.pad=2,.ev=.{.axis=.{.idx=1,.value=1010}}}, -.{.t=3401194003,.pad=2,.ev=.{.axis=.{.idx=3,.value=1057}}}, -.{.t=3401198713,.pad=2,.ev=.{.axis=.{.idx=5,.value=20349}}}, -.{.t=3401198713,.pad=2,.ev=.{.axis=.{.idx=3,.value=997}}}, -.{.t=3411932407,.pad=2,.ev=.{.axis=.{.idx=5,.value=17587}}}, -.{.t=3411932407,.pad=2,.ev=.{.axis=.{.idx=0,.value=-829}}}, -.{.t=3411932407,.pad=2,.ev=.{.axis=.{.idx=1,.value=1039}}}, -.{.t=3411941077,.pad=2,.ev=.{.axis=.{.idx=5,.value=15127}}}, -.{.t=3411941077,.pad=2,.ev=.{.axis=.{.idx=0,.value=-802}}}, -.{.t=3411941077,.pad=2,.ev=.{.axis=.{.idx=3,.value=1027}}}, -.{.t=3411944947,.pad=2,.ev=.{.axis=.{.idx=5,.value=12617}}}, -.{.t=3411944947,.pad=2,.ev=.{.axis=.{.idx=0,.value=-829}}}, -.{.t=3411944947,.pad=2,.ev=.{.axis=.{.idx=1,.value=953}}}, -.{.t=3411944947,.pad=2,.ev=.{.axis=.{.idx=3,.value=997}}}, -.{.t=3423178470,.pad=2,.ev=.{.axis=.{.idx=5,.value=10307}}}, -.{.t=3423178470,.pad=2,.ev=.{.axis=.{.idx=0,.value=-802}}}, -.{.t=3423178470,.pad=2,.ev=.{.axis=.{.idx=1,.value=924}}}, -.{.t=3423187080,.pad=2,.ev=.{.axis=.{.idx=5,.value=8298}}}, -.{.t=3423187080,.pad=2,.ev=.{.axis=.{.idx=1,.value=981}}}, -.{.t=3423187080,.pad=2,.ev=.{.axis=.{.idx=3,.value=1027}}}, -.{.t=3434307174,.pad=2,.ev=.{.axis=.{.idx=5,.value=6340}}}, -.{.t=3434307174,.pad=2,.ev=.{.axis=.{.idx=1,.value=924}}}, -.{.t=3434315334,.pad=2,.ev=.{.axis=.{.idx=5,.value=4532}}}, -.{.t=3434315334,.pad=2,.ev=.{.axis=.{.idx=3,.value=997}}}, -.{.t=3434318744,.pad=2,.ev=.{.axis=.{.idx=5,.value=2975}}}, -.{.t=3434318744,.pad=2,.ev=.{.axis=.{.idx=1,.value=866}}}, -.{.t=3445336427,.pad=2,.ev=.{.axis=.{.idx=5,.value=1067}}}, -.{.t=3445336427,.pad=2,.ev=.{.axis=.{.idx=1,.value=635}}}, -.{.t=3445344507,.pad=2,.ev=.{.axis=.{.idx=4,.value=446}}}, -.{.t=3445344507,.pad=2,.ev=.{.axis=.{.idx=5,.value=0}}}, -.{.t=3445344507,.pad=2,.ev=.{.axis=.{.idx=1,.value=346}}}, -.{.t=3445344507,.pad=2,.ev=.{.axis=.{.idx=3,.value=1027}}}, -.{.t=3445348567,.pad=2,.ev=.{.axis=.{.idx=4,.value=1854}}}, -.{.t=3445348567,.pad=2,.ev=.{.axis=.{.idx=1,.value=-59}}}, -.{.t=3456475621,.pad=2,.ev=.{.axis=.{.idx=4,.value=3310}}}, -.{.t=3456475621,.pad=2,.ev=.{.axis=.{.idx=1,.value=-176}}}, -.{.t=3456475621,.pad=2,.ev=.{.axis=.{.idx=3,.value=997}}}, -.{.t=3456483971,.pad=2,.ev=.{.axis=.{.idx=4,.value=4436}}}, -.{.t=3456483971,.pad=2,.ev=.{.axis=.{.idx=1,.value=-441}}}, -.{.t=3456487161,.pad=2,.ev=.{.axis=.{.idx=4,.value=5891}}}, -.{.t=3456487161,.pad=2,.ev=.{.axis=.{.idx=1,.value=-558}}}, -.{.t=22900269279,.pad=2,.ev=.{.axis=.{.idx=0,.value=-1493}}}, -.{.t=22900269279,.pad=2,.ev=.{.axis=.{.idx=1,.value=981}}}, -.{.t=22900269279,.pad=2,.ev=.{.axis=.{.idx=3,.value=1087}}}, -.{.t=22900282319,.pad=2,.ev=.{.axis=.{.idx=0,.value=-1465}}}, -.{.t=22900282319,.pad=2,.ev=.{.axis=.{.idx=1,.value=953}}}, -.{.t=22900282319,.pad=2,.ev=.{.axis=.{.idx=2,.value=-469}}}, -.{.t=22900282319,.pad=2,.ev=.{.axis=.{.idx=3,.value=1118}}}, -.{.t=22900288339,.pad=2,.ev=.{.axis=.{.idx=1,.value=981}}}, -.{.t=22900288339,.pad=2,.ev=.{.axis=.{.idx=2,.value=-439}}}, -.{.t=22900288339,.pad=2,.ev=.{.axis=.{.idx=3,.value=1087}}}, -.{.t=22911078513,.pad=2,.ev=.{.axis=.{.idx=0,.value=-1438}}}, -.{.t=22911078513,.pad=2,.ev=.{.axis=.{.idx=1,.value=953}}}, -.{.t=22911078513,.pad=2,.ev=.{.axis=.{.idx=2,.value=-469}}}, -.{.t=22911090183,.pad=2,.ev=.{.axis=.{.idx=2,.value=-498}}}, -.{.t=22922174447,.pad=2,.ev=.{.axis=.{.idx=0,.value=-1465}}}, -.{.t=22922174447,.pad=2,.ev=.{.axis=.{.idx=2,.value=-527}}}, -.{.t=22922174447,.pad=2,.ev=.{.axis=.{.idx=3,.value=1148}}}, -.{.t=22922182927,.pad=2,.ev=.{.axis=.{.idx=0,.value=-1493}}}, -.{.t=22922182927,.pad=2,.ev=.{.axis=.{.idx=1,.value=981}}}, -.{.t=22922182927,.pad=2,.ev=.{.axis=.{.idx=2,.value=-498}}}, -.{.t=22922182927,.pad=2,.ev=.{.axis=.{.idx=3,.value=1118}}}, -.{.t=22922186907,.pad=2,.ev=.{.axis=.{.idx=0,.value=-1465}}}, -.{.t=22933453380,.pad=2,.ev=.{.axis=.{.idx=2,.value=-469}}}, -.{.t=22933463530,.pad=2,.ev=.{.axis=.{.idx=0,.value=-1438}}}, -.{.t=22933463530,.pad=2,.ev=.{.axis=.{.idx=1,.value=924}}}, -.{.t=22933463530,.pad=2,.ev=.{.axis=.{.idx=2,.value=-498}}}, -.{.t=22933463530,.pad=2,.ev=.{.axis=.{.idx=3,.value=1148}}}, -.{.t=22933469520,.pad=2,.ev=.{.axis=.{.idx=1,.value=953}}}, -.{.t=22933469520,.pad=2,.ev=.{.axis=.{.idx=2,.value=-469}}}, -.{.t=22933469520,.pad=2,.ev=.{.axis=.{.idx=3,.value=1118}}}, -.{.t=22944601464,.pad=2,.ev=.{.axis=.{.idx=2,.value=-439}}}, -.{.t=22944601464,.pad=2,.ev=.{.axis=.{.idx=3,.value=1087}}}, -.{.t=22944613874,.pad=2,.ev=.{.axis=.{.idx=0,.value=-1465}}}, -.{.t=22944613874,.pad=2,.ev=.{.axis=.{.idx=2,.value=-469}}}, -.{.t=22944613874,.pad=2,.ev=.{.axis=.{.idx=3,.value=1118}}}, -.{.t=22944619754,.pad=2,.ev=.{.axis=.{.idx=0,.value=-1438}}}, -.{.t=22955633677,.pad=2,.ev=.{.axis=.{.idx=0,.value=-1493}}}, -.{.t=22955633677,.pad=2,.ev=.{.axis=.{.idx=1,.value=981}}}, -.{.t=22955633677,.pad=2,.ev=.{.axis=.{.idx=2,.value=-439}}}, -.{.t=22955633677,.pad=2,.ev=.{.axis=.{.idx=3,.value=1087}}}, -.{.t=22955647207,.pad=2,.ev=.{.axis=.{.idx=0,.value=-1465}}}, -.{.t=22955647207,.pad=2,.ev=.{.axis=.{.idx=1,.value=953}}}, -.{.t=22955647207,.pad=2,.ev=.{.axis=.{.idx=2,.value=-498}}}, -.{.t=22955647207,.pad=2,.ev=.{.axis=.{.idx=3,.value=1148}}}, -.{.t=22955652047,.pad=2,.ev=.{.axis=.{.idx=0,.value=-1438}}}, -.{.t=22955652047,.pad=2,.ev=.{.axis=.{.idx=3,.value=1118}}}, -.{.t=22966619841,.pad=2,.ev=.{.axis=.{.idx=0,.value=-1465}}}, -.{.t=22966619841,.pad=2,.ev=.{.axis=.{.idx=2,.value=-469}}}, -.{.t=22966628121,.pad=2,.ev=.{.axis=.{.idx=1,.value=924}}}, -.{.t=22966628121,.pad=2,.ev=.{.axis=.{.idx=3,.value=1087}}}, -.{.t=22977745245,.pad=2,.ev=.{.axis=.{.idx=0,.value=-1438}}}, -.{.t=22977745245,.pad=2,.ev=.{.axis=.{.idx=1,.value=953}}}, -.{.t=22977745245,.pad=2,.ev=.{.axis=.{.idx=2,.value=-498}}}, -.{.t=22977745245,.pad=2,.ev=.{.axis=.{.idx=3,.value=1148}}}, -.{.t=22977753905,.pad=2,.ev=.{.axis=.{.idx=0,.value=-1465}}}, -.{.t=22977753905,.pad=2,.ev=.{.axis=.{.idx=2,.value=-469}}}, -.{.t=22977753905,.pad=2,.ev=.{.axis=.{.idx=3,.value=1118}}}, -.{.t=22977757525,.pad=2,.ev=.{.axis=.{.idx=2,.value=-439}}}, -.{.t=22988922908,.pad=2,.ev=.{.axis=.{.idx=0,.value=-1438}}}, -.{.t=22988922908,.pad=2,.ev=.{.axis=.{.idx=1,.value=981}}}, -.{.t=22988936008,.pad=2,.ev=.{.axis=.{.idx=0,.value=-1465}}}, -.{.t=22988936008,.pad=2,.ev=.{.axis=.{.idx=2,.value=-469}}}, -.{.t=22988940638,.pad=2,.ev=.{.axis=.{.idx=0,.value=-1438}}}, -.{.t=22988940638,.pad=2,.ev=.{.axis=.{.idx=1,.value=953}}}, -.{.t=23000140672,.pad=2,.ev=.{.axis=.{.idx=0,.value=-1465}}}, -.{.t=23000140672,.pad=2,.ev=.{.axis=.{.idx=2,.value=-498}}}, -.{.t=23000152872,.pad=2,.ev=.{.axis=.{.idx=0,.value=-1438}}}, -.{.t=23000152872,.pad=2,.ev=.{.axis=.{.idx=1,.value=924}}}, -.{.t=23000152872,.pad=2,.ev=.{.axis=.{.idx=2,.value=-439}}}, -.{.t=23000152872,.pad=2,.ev=.{.axis=.{.idx=3,.value=1087}}}, -.{.t=23000158442,.pad=2,.ev=.{.axis=.{.idx=0,.value=-1493}}}, -.{.t=23000158442,.pad=2,.ev=.{.axis=.{.idx=1,.value=953}}}, -.{.t=23000158442,.pad=2,.ev=.{.axis=.{.idx=2,.value=-410}}}, -.{.t=23011247285,.pad=2,.ev=.{.axis=.{.idx=0,.value=-1438}}}, -.{.t=23011247285,.pad=2,.ev=.{.axis=.{.idx=2,.value=-439}}}, -.{.t=23011247285,.pad=2,.ev=.{.axis=.{.idx=3,.value=1057}}}, -.{.t=23011260265,.pad=2,.ev=.{.axis=.{.idx=0,.value=-1465}}}, -.{.t=23011260265,.pad=2,.ev=.{.axis=.{.idx=2,.value=-469}}}, -.{.t=23011260265,.pad=2,.ev=.{.axis=.{.idx=3,.value=1118}}}, -.{.t=23022366569,.pad=2,.ev=.{.axis=.{.idx=0,.value=-1438}}}, -.{.t=23022366569,.pad=2,.ev=.{.axis=.{.idx=1,.value=924}}}, -.{.t=23022366569,.pad=2,.ev=.{.axis=.{.idx=2,.value=-498}}}, -.{.t=23022366569,.pad=2,.ev=.{.axis=.{.idx=3,.value=1148}}}, -.{.t=23022380099,.pad=2,.ev=.{.axis=.{.idx=2,.value=-439}}}, -.{.t=23022380099,.pad=2,.ev=.{.axis=.{.idx=3,.value=1087}}}, -.{.t=23022385329,.pad=2,.ev=.{.axis=.{.idx=2,.value=-469}}}, -.{.t=23022385329,.pad=2,.ev=.{.axis=.{.idx=3,.value=1118}}}, -.{.t=23033207513,.pad=2,.ev=.{.axis=.{.idx=0,.value=-1465}}}, -.{.t=23033207513,.pad=2,.ev=.{.axis=.{.idx=1,.value=953}}}, -.{.t=23033215483,.pad=2,.ev=.{.axis=.{.idx=0,.value=-1438}}}, -.{.t=23033215483,.pad=2,.ev=.{.axis=.{.idx=1,.value=924}}}, -.{.t=23033215483,.pad=2,.ev=.{.axis=.{.idx=2,.value=-439}}}, -.{.t=23033215483,.pad=2,.ev=.{.axis=.{.idx=3,.value=1087}}}, -.{.t=23033219653,.pad=2,.ev=.{.axis=.{.idx=1,.value=953}}}, -.{.t=23044563226,.pad=2,.ev=.{.axis=.{.idx=1,.value=924}}}, -.{.t=23044563226,.pad=2,.ev=.{.axis=.{.idx=2,.value=-469}}}, -.{.t=23044563226,.pad=2,.ev=.{.axis=.{.idx=3,.value=1118}}}, -.{.t=23044572856,.pad=2,.ev=.{.axis=.{.idx=2,.value=-410}}}, -.{.t=23044572856,.pad=2,.ev=.{.axis=.{.idx=3,.value=1087}}}, -.{.t=23044576806,.pad=2,.ev=.{.axis=.{.idx=1,.value=953}}}, -.{.t=23044576806,.pad=2,.ev=.{.axis=.{.idx=2,.value=-469}}}, -.{.t=23044576806,.pad=2,.ev=.{.axis=.{.idx=3,.value=1118}}}, -.{.t=23055818709,.pad=2,.ev=.{.axis=.{.idx=0,.value=-1465}}}, -.{.t=23055818709,.pad=2,.ev=.{.axis=.{.idx=3,.value=1087}}}, -.{.t=23055828779,.pad=2,.ev=.{.axis=.{.idx=0,.value=-1438}}}, -.{.t=23055828779,.pad=2,.ev=.{.axis=.{.idx=1,.value=924}}}, -.{.t=23055828779,.pad=2,.ev=.{.axis=.{.idx=3,.value=1118}}}, -.{.t=23055832789,.pad=2,.ev=.{.axis=.{.idx=0,.value=-1410}}}, -.{.t=23055832789,.pad=2,.ev=.{.axis=.{.idx=3,.value=1087}}}, -.{.t=23066680603,.pad=2,.ev=.{.axis=.{.idx=0,.value=-1465}}}, -.{.t=23066680603,.pad=2,.ev=.{.axis=.{.idx=1,.value=953}}}, -.{.t=23066680603,.pad=2,.ev=.{.axis=.{.idx=3,.value=1118}}}, -.{.t=23066690143,.pad=2,.ev=.{.axis=.{.idx=0,.value=-1493}}}, -.{.t=23066690143,.pad=2,.ev=.{.axis=.{.idx=1,.value=981}}}, -.{.t=23066690143,.pad=2,.ev=.{.axis=.{.idx=2,.value=-439}}}, -.{.t=23066690143,.pad=2,.ev=.{.axis=.{.idx=3,.value=1087}}}, -.{.t=23077703397,.pad=2,.ev=.{.axis=.{.idx=0,.value=-1438}}}, -.{.t=23077703397,.pad=2,.ev=.{.axis=.{.idx=1,.value=924}}}, -.{.t=23077703397,.pad=2,.ev=.{.axis=.{.idx=3,.value=1118}}}, -.{.t=23077711687,.pad=2,.ev=.{.axis=.{.idx=0,.value=-1465}}}, -.{.t=23077711687,.pad=2,.ev=.{.axis=.{.idx=1,.value=953}}}, -.{.t=23077711687,.pad=2,.ev=.{.axis=.{.idx=2,.value=-469}}}, -.{.t=23077715567,.pad=2,.ev=.{.axis=.{.idx=0,.value=-1493}}}, -.{.t=23077715567,.pad=2,.ev=.{.axis=.{.idx=1,.value=981}}}, -.{.t=23077715567,.pad=2,.ev=.{.axis=.{.idx=2,.value=-439}}}, -.{.t=23077715567,.pad=2,.ev=.{.axis=.{.idx=3,.value=1087}}}, -.{.t=23088844720,.pad=2,.ev=.{.axis=.{.idx=0,.value=-1438}}}, -.{.t=23088844720,.pad=2,.ev=.{.axis=.{.idx=1,.value=953}}}, -.{.t=23088844720,.pad=2,.ev=.{.axis=.{.idx=2,.value=-498}}}, -.{.t=23088844720,.pad=2,.ev=.{.axis=.{.idx=3,.value=1148}}}, -.{.t=23088853270,.pad=2,.ev=.{.axis=.{.idx=0,.value=-1465}}}, -.{.t=23088853270,.pad=2,.ev=.{.axis=.{.idx=2,.value=-469}}}, -.{.t=23088853270,.pad=2,.ev=.{.axis=.{.idx=3,.value=1118}}}, -.{.t=23088856830,.pad=2,.ev=.{.axis=.{.idx=0,.value=-1438}}}, -.{.t=23088856830,.pad=2,.ev=.{.axis=.{.idx=1,.value=924}}}, -.{.t=23088856830,.pad=2,.ev=.{.axis=.{.idx=2,.value=-439}}}, -.{.t=23100184994,.pad=2,.ev=.{.axis=.{.idx=1,.value=953}}}, -.{.t=23100184994,.pad=2,.ev=.{.axis=.{.idx=2,.value=-410}}}, -.{.t=23100184994,.pad=2,.ev=.{.axis=.{.idx=3,.value=1087}}}, -.{.t=23100197834,.pad=2,.ev=.{.axis=.{.idx=0,.value=-1465}}}, -.{.t=23100202044,.pad=2,.ev=.{.axis=.{.idx=0,.value=-1438}}}, -.{.t=23100202044,.pad=2,.ev=.{.axis=.{.idx=1,.value=924}}}, -.{.t=23100202044,.pad=2,.ev=.{.axis=.{.idx=2,.value=-439}}}, -.{.t=23111316337,.pad=2,.ev=.{.axis=.{.idx=2,.value=-410}}}, -.{.t=23111328087,.pad=2,.ev=.{.axis=.{.idx=0,.value=-1465}}}, -.{.t=23111328087,.pad=2,.ev=.{.axis=.{.idx=2,.value=-439}}}, -.{.t=23122579831,.pad=2,.ev=.{.axis=.{.idx=0,.value=-1438}}}, -.{.t=23122579831,.pad=2,.ev=.{.axis=.{.idx=2,.value=-498}}}, -.{.t=23122579831,.pad=2,.ev=.{.axis=.{.idx=3,.value=1118}}}, -.{.t=23122592031,.pad=2,.ev=.{.axis=.{.idx=1,.value=953}}}, -.{.t=23122592031,.pad=2,.ev=.{.axis=.{.idx=2,.value=-469}}}, -.{.t=23122595681,.pad=2,.ev=.{.axis=.{.idx=1,.value=924}}}, -.{.t=23122595681,.pad=2,.ev=.{.axis=.{.idx=2,.value=-439}}}, -.{.t=23122595681,.pad=2,.ev=.{.axis=.{.idx=3,.value=1087}}}, -.{.t=23133201565,.pad=2,.ev=.{.axis=.{.idx=1,.value=953}}}, -.{.t=23133205635,.pad=2,.ev=.{.axis=.{.idx=4,.value=728}}}, -.{.t=23133205635,.pad=2,.ev=.{.axis=.{.idx=1,.value=924}}}, -.{.t=23133205635,.pad=2,.ev=.{.axis=.{.idx=3,.value=1118}}}, -.{.t=23144628108,.pad=2,.ev=.{.axis=.{.idx=4,.value=3169}}}, -.{.t=23144628108,.pad=2,.ev=.{.axis=.{.idx=0,.value=-1493}}}, -.{.t=23144628108,.pad=2,.ev=.{.axis=.{.idx=1,.value=953}}}, -.{.t=23144628108,.pad=2,.ev=.{.axis=.{.idx=2,.value=-410}}}, -.{.t=23144628108,.pad=2,.ev=.{.axis=.{.idx=3,.value=1087}}}, -.{.t=23144640728,.pad=2,.ev=.{.axis=.{.idx=4,.value=6314}}}, -.{.t=23144640728,.pad=2,.ev=.{.axis=.{.idx=0,.value=-1465}}}, -.{.t=23144640728,.pad=2,.ev=.{.axis=.{.idx=2,.value=-469}}}, -.{.t=23144640728,.pad=2,.ev=.{.axis=.{.idx=3,.value=1118}}}, -.{.t=23144644338,.pad=2,.ev=.{.axis=.{.idx=4,.value=10679}}}, -.{.t=23144644338,.pad=2,.ev=.{.axis=.{.idx=1,.value=981}}}, -.{.t=23144644338,.pad=2,.ev=.{.axis=.{.idx=2,.value=-410}}}, -.{.t=23144644338,.pad=2,.ev=.{.axis=.{.idx=3,.value=1087}}}, -.{.t=23155757852,.pad=2,.ev=.{.axis=.{.idx=4,.value=16500}}}, -.{.t=23155757852,.pad=2,.ev=.{.axis=.{.idx=0,.value=-1493}}}, -.{.t=23155757852,.pad=2,.ev=.{.axis=.{.idx=1,.value=953}}}, -.{.t=23155767512,.pad=2,.ev=.{.axis=.{.idx=4,.value=23682}}}, -.{.t=23155767512,.pad=2,.ev=.{.axis=.{.idx=0,.value=-1438}}}, -.{.t=23155767512,.pad=2,.ev=.{.axis=.{.idx=1,.value=924}}}, -.{.t=23155773302,.pad=2,.ev=.{.axis=.{.idx=4,.value=32084}}}, -.{.t=23155773302,.pad=2,.ev=.{.axis=.{.idx=0,.value=-1465}}}, -.{.t=23166856095,.pad=2,.ev=.{.axis=.{.idx=4,.value=32766}}}, -.{.t=23166856095,.pad=2,.ev=.{.axis=.{.idx=0,.value=-1438}}}, -.{.t=23166856095,.pad=2,.ev=.{.axis=.{.idx=2,.value=-439}}}, -.{.t=23166869315,.pad=2,.ev=.{.axis=.{.idx=1,.value=953}}}, -.{.t=23166869315,.pad=2,.ev=.{.axis=.{.idx=3,.value=1118}}}, -.{.t=23177937079,.pad=2,.ev=.{.axis=.{.idx=1,.value=924}}}, -.{.t=23177937079,.pad=2,.ev=.{.axis=.{.idx=3,.value=1087}}}, -.{.t=23177947099,.pad=2,.ev=.{.axis=.{.idx=0,.value=-1465}}}, -.{.t=23177947099,.pad=2,.ev=.{.axis=.{.idx=2,.value=-410}}}, -.{.t=23177950979,.pad=2,.ev=.{.axis=.{.idx=0,.value=-1438}}}, -.{.t=23177950979,.pad=2,.ev=.{.axis=.{.idx=2,.value=-439}}}, -.{.t=23177950979,.pad=2,.ev=.{.axis=.{.idx=3,.value=1118}}}, -.{.t=23188909763,.pad=2,.ev=.{.axis=.{.idx=2,.value=-410}}}, -.{.t=23188909763,.pad=2,.ev=.{.axis=.{.idx=3,.value=1087}}}, -.{.t=23188919373,.pad=2,.ev=.{.axis=.{.idx=0,.value=-1493}}}, -.{.t=23188919373,.pad=2,.ev=.{.axis=.{.idx=1,.value=981}}}, -.{.t=23188923533,.pad=2,.ev=.{.axis=.{.idx=0,.value=-1465}}}, -.{.t=23188923533,.pad=2,.ev=.{.axis=.{.idx=1,.value=953}}}, -.{.t=23188923533,.pad=2,.ev=.{.axis=.{.idx=2,.value=-439}}}, -.{.t=23188923533,.pad=2,.ev=.{.axis=.{.idx=3,.value=1057}}}, -.{.t=23200341706,.pad=2,.ev=.{.axis=.{.idx=0,.value=-1438}}}, -.{.t=23200341706,.pad=2,.ev=.{.axis=.{.idx=1,.value=924}}}, -.{.t=23200341706,.pad=2,.ev=.{.axis=.{.idx=3,.value=1087}}}, -.{.t=23200357446,.pad=2,.ev=.{.axis=.{.idx=2,.value=-469}}}, -.{.t=23200360546,.pad=2,.ev=.{.axis=.{.idx=1,.value=866}}}, -.{.t=23200360546,.pad=2,.ev=.{.axis=.{.idx=2,.value=-439}}}, -.{.t=23211356329,.pad=2,.ev=.{.axis=.{.idx=0,.value=-1493}}}, -.{.t=23211356329,.pad=2,.ev=.{.axis=.{.idx=1,.value=895}}}, -.{.t=23211356329,.pad=2,.ev=.{.axis=.{.idx=3,.value=1057}}}, -.{.t=23211369469,.pad=2,.ev=.{.axis=.{.idx=0,.value=-1438}}}, -.{.t=23211369469,.pad=2,.ev=.{.axis=.{.idx=1,.value=808}}}, -.{.t=23211369469,.pad=2,.ev=.{.axis=.{.idx=2,.value=-469}}}, -.{.t=23211369469,.pad=2,.ev=.{.axis=.{.idx=3,.value=1118}}}, -.{.t=23222496653,.pad=2,.ev=.{.axis=.{.idx=1,.value=722}}}, -.{.t=23222496653,.pad=2,.ev=.{.axis=.{.idx=2,.value=-410}}}, -.{.t=23222496653,.pad=2,.ev=.{.axis=.{.idx=3,.value=1057}}}, -.{.t=23222508723,.pad=2,.ev=.{.axis=.{.idx=1,.value=664}}}, -.{.t=23222508723,.pad=2,.ev=.{.axis=.{.idx=2,.value=-439}}}, -.{.t=23222508723,.pad=2,.ev=.{.axis=.{.idx=3,.value=1087}}}, -.{.t=23222512923,.pad=2,.ev=.{.axis=.{.idx=0,.value=-1465}}}, -.{.t=23222512923,.pad=2,.ev=.{.axis=.{.idx=1,.value=693}}}, -.{.t=23222512923,.pad=2,.ev=.{.axis=.{.idx=3,.value=1118}}}, -.{.t=23233616896,.pad=2,.ev=.{.axis=.{.idx=1,.value=404}}}, -.{.t=23233616896,.pad=2,.ev=.{.axis=.{.idx=3,.value=1087}}}, -.{.t=23233628876,.pad=2,.ev=.{.axis=.{.idx=1,.value=462}}}, -.{.t=23233628876,.pad=2,.ev=.{.axis=.{.idx=2,.value=-469}}}, -.{.t=23233628876,.pad=2,.ev=.{.axis=.{.idx=3,.value=1118}}}, -.{.t=23233634716,.pad=2,.ev=.{.axis=.{.idx=1,.value=375}}}, -.{.t=23233634716,.pad=2,.ev=.{.axis=.{.idx=2,.value=-439}}}, -.{.t=23244703810,.pad=2,.ev=.{.axis=.{.idx=1,.value=404}}}, -.{.t=23244703810,.pad=2,.ev=.{.axis=.{.idx=2,.value=-469}}}, -.{.t=23244703810,.pad=2,.ev=.{.axis=.{.idx=3,.value=1087}}}, -.{.t=23244716710,.pad=2,.ev=.{.axis=.{.idx=0,.value=-1438}}}, -.{.t=23244716710,.pad=2,.ev=.{.axis=.{.idx=1,.value=288}}}, -.{.t=23244716710,.pad=2,.ev=.{.axis=.{.idx=2,.value=-439}}}, -.{.t=23244722470,.pad=2,.ev=.{.axis=.{.idx=1,.value=317}}}, -.{.t=23255891634,.pad=2,.ev=.{.axis=.{.idx=1,.value=260}}}, -.{.t=23255891634,.pad=2,.ev=.{.axis=.{.idx=2,.value=-469}}}, -.{.t=23255903964,.pad=2,.ev=.{.axis=.{.idx=0,.value=-1410}}}, -.{.t=23255903964,.pad=2,.ev=.{.axis=.{.idx=1,.value=144}}}, -.{.t=23255903964,.pad=2,.ev=.{.axis=.{.idx=3,.value=1057}}}, -.{.t=23255909564,.pad=2,.ev=.{.axis=.{.idx=0,.value=-1465}}}, -.{.t=23255909564,.pad=2,.ev=.{.axis=.{.idx=1,.value=115}}}, -.{.t=23266911057,.pad=2,.ev=.{.axis=.{.idx=4,.value=30723}}}, -.{.t=23266911057,.pad=2,.ev=.{.axis=.{.idx=0,.value=-1438}}}, -.{.t=23266911057,.pad=2,.ev=.{.axis=.{.idx=1,.value=86}}}, -.{.t=23266924047,.pad=2,.ev=.{.axis=.{.idx=4,.value=27437}}}, -.{.t=23266924047,.pad=2,.ev=.{.axis=.{.idx=0,.value=-1465}}}, -.{.t=23266924047,.pad=2,.ev=.{.axis=.{.idx=1,.value=115}}}, -.{.t=23266924047,.pad=2,.ev=.{.axis=.{.idx=3,.value=1087}}}, -.{.t=23278235081,.pad=2,.ev=.{.axis=.{.idx=4,.value=24292}}}, -.{.t=23278235081,.pad=2,.ev=.{.axis=.{.idx=0,.value=-1438}}}, -.{.t=23278235081,.pad=2,.ev=.{.axis=.{.idx=1,.value=29}}}, -.{.t=23278246901,.pad=2,.ev=.{.axis=.{.idx=4,.value=21053}}}, -.{.t=23278246901,.pad=2,.ev=.{.axis=.{.idx=1,.value=57}}}, -.{.t=23278246901,.pad=2,.ev=.{.axis=.{.idx=2,.value=-439}}}, -.{.t=23278246901,.pad=2,.ev=.{.axis=.{.idx=3,.value=1057}}}, -.{.t=23278254110,.pad=2,.ev=.{.axis=.{.idx=4,.value=17814}}}, -.{.t=23278254110,.pad=2,.ev=.{.axis=.{.idx=1,.value=86}}}, -.{.t=23278254110,.pad=2,.ev=.{.axis=.{.idx=2,.value=-498}}}, -.{.t=23278254110,.pad=2,.ev=.{.axis=.{.idx=3,.value=1087}}}, -.{.t=23289217094,.pad=2,.ev=.{.axis=.{.idx=4,.value=14341}}}, -.{.t=23289217094,.pad=2,.ev=.{.axis=.{.idx=0,.value=-1465}}}, -.{.t=23289217094,.pad=2,.ev=.{.axis=.{.idx=1,.value=144}}}, -.{.t=23289217094,.pad=2,.ev=.{.axis=.{.idx=2,.value=-469}}}, -.{.t=23289217094,.pad=2,.ev=.{.axis=.{.idx=3,.value=1057}}}, -.{.t=23289231434,.pad=2,.ev=.{.axis=.{.idx=4,.value=11384}}}, -.{.t=23289231434,.pad=2,.ev=.{.axis=.{.idx=1,.value=57}}}, -.{.t=23289236534,.pad=2,.ev=.{.axis=.{.idx=4,.value=8708}}}, -.{.t=23289236534,.pad=2,.ev=.{.axis=.{.idx=0,.value=-1438}}}, -.{.t=23289236534,.pad=2,.ev=.{.axis=.{.idx=1,.value=0}}}, -.{.t=23300340478,.pad=2,.ev=.{.axis=.{.idx=4,.value=6126}}}, -.{.t=23300340478,.pad=2,.ev=.{.axis=.{.idx=2,.value=-439}}}, -.{.t=23300350538,.pad=2,.ev=.{.axis=.{.idx=4,.value=4014}}}, -.{.t=23300350538,.pad=2,.ev=.{.axis=.{.idx=1,.value=86}}}, -.{.t=23300354158,.pad=2,.ev=.{.axis=.{.idx=4,.value=2465}}}, -.{.t=23300354158,.pad=2,.ev=.{.axis=.{.idx=0,.value=-1410}}}, -.{.t=23300354158,.pad=2,.ev=.{.axis=.{.idx=1,.value=288}}}, -.{.t=23311366832,.pad=2,.ev=.{.axis=.{.idx=4,.value=634}}}, -.{.t=23311366832,.pad=2,.ev=.{.axis=.{.idx=1,.value=462}}}, -.{.t=23311366832,.pad=2,.ev=.{.axis=.{.idx=3,.value=1027}}}, -.{.t=23311379542,.pad=2,.ev=.{.axis=.{.idx=4,.value=0}}}, -.{.t=23311379542,.pad=2,.ev=.{.axis=.{.idx=0,.value=-1355}}}, -.{.t=23311379542,.pad=2,.ev=.{.axis=.{.idx=1,.value=779}}}, -.{.t=23311379542,.pad=2,.ev=.{.axis=.{.idx=2,.value=-410}}}, -.{.t=23322638775,.pad=2,.ev=.{.axis=.{.idx=0,.value=-1272}}}, -.{.t=23322638775,.pad=2,.ev=.{.axis=.{.idx=1,.value=953}}}, -.{.t=23322638775,.pad=2,.ev=.{.axis=.{.idx=2,.value=-439}}}, -.{.t=23322649765,.pad=2,.ev=.{.axis=.{.idx=0,.value=-1051}}}, -.{.t=23322649765,.pad=2,.ev=.{.axis=.{.idx=1,.value=981}}}, -.{.t=23322649765,.pad=2,.ev=.{.axis=.{.idx=3,.value=1057}}}, -.{.t=23322654995,.pad=2,.ev=.{.axis=.{.idx=0,.value=-885}}}, -.{.t=23322654995,.pad=2,.ev=.{.axis=.{.idx=1,.value=1039}}}, -.{.t=23333351109,.pad=2,.ev=.{.axis=.{.idx=0,.value=-691}}}, -.{.t=23333351109,.pad=2,.ev=.{.axis=.{.idx=2,.value=-469}}}, -.{.t=23333359049,.pad=2,.ev=.{.axis=.{.idx=0,.value=-553}}}, -.{.t=23333359049,.pad=2,.ev=.{.axis=.{.idx=3,.value=1087}}}, -.{.t=23333362519,.pad=2,.ev=.{.axis=.{.idx=1,.value=1010}}}, -.{.t=23333362519,.pad=2,.ev=.{.axis=.{.idx=2,.value=-439}}}, -.{.t=23333362519,.pad=2,.ev=.{.axis=.{.idx=3,.value=1057}}}, -.{.t=23344695372,.pad=2,.ev=.{.axis=.{.idx=1,.value=981}}}, -.{.t=23344706662,.pad=2,.ev=.{.axis=.{.idx=0,.value=-525}}}, -.{.t=23344706662,.pad=2,.ev=.{.axis=.{.idx=1,.value=953}}}, -.{.t=23344711982,.pad=2,.ev=.{.axis=.{.idx=0,.value=-553}}}, -.{.t=23344711982,.pad=2,.ev=.{.axis=.{.idx=1,.value=981}}}, -.{.t=23355868326,.pad=2,.ev=.{.axis=.{.idx=0,.value=-498}}}, -.{.t=23355868326,.pad=2,.ev=.{.axis=.{.idx=1,.value=1010}}}, -.{.t=23355878956,.pad=2,.ev=.{.axis=.{.idx=0,.value=-525}}}, -.{.t=23355878956,.pad=2,.ev=.{.axis=.{.idx=1,.value=981}}}, -.{.t=23355878956,.pad=2,.ev=.{.axis=.{.idx=2,.value=-469}}}, -.{.t=23355878956,.pad=2,.ev=.{.axis=.{.idx=3,.value=1087}}}, -.{.t=23355884866,.pad=2,.ev=.{.axis=.{.idx=1,.value=1010}}}, -.{.t=23355884866,.pad=2,.ev=.{.axis=.{.idx=2,.value=-410}}}, -.{.t=23355884866,.pad=2,.ev=.{.axis=.{.idx=3,.value=1027}}}, -.{.t=23366942749,.pad=2,.ev=.{.axis=.{.idx=0,.value=-553}}}, -.{.t=23366952219,.pad=2,.ev=.{.axis=.{.idx=0,.value=-525}}}, -.{.t=23366952219,.pad=2,.ev=.{.axis=.{.idx=1,.value=981}}}, -.{.t=23366952219,.pad=2,.ev=.{.axis=.{.idx=2,.value=-439}}}, -.{.t=23366952219,.pad=2,.ev=.{.axis=.{.idx=3,.value=1057}}}, -.{.t=23378047613,.pad=2,.ev=.{.axis=.{.idx=0,.value=-553}}}, -.{.t=23378047613,.pad=2,.ev=.{.axis=.{.idx=1,.value=1010}}}, -.{.t=23378064723,.pad=2,.ev=.{.axis=.{.idx=0,.value=-525}}}, -.{.t=23378064723,.pad=2,.ev=.{.axis=.{.idx=1,.value=981}}}, -.{.t=23378064723,.pad=2,.ev=.{.axis=.{.idx=2,.value=-469}}}, -.{.t=23388957907,.pad=2,.ev=.{.axis=.{.idx=0,.value=-553}}}, -.{.t=23388957907,.pad=2,.ev=.{.axis=.{.idx=1,.value=1039}}}, -.{.t=23388957907,.pad=2,.ev=.{.axis=.{.idx=2,.value=-439}}}, -.{.t=23388957907,.pad=2,.ev=.{.axis=.{.idx=3,.value=1027}}}, -.{.t=23388967217,.pad=2,.ev=.{.axis=.{.idx=1,.value=1010}}}, -.{.t=23388967217,.pad=2,.ev=.{.axis=.{.idx=2,.value=-410}}}, -.{.t=23388970117,.pad=2,.ev=.{.axis=.{.idx=0,.value=-525}}}, -.{.t=23388970117,.pad=2,.ev=.{.axis=.{.idx=1,.value=981}}}, -.{.t=23388970117,.pad=2,.ev=.{.axis=.{.idx=2,.value=-439}}}, -.{.t=23388970117,.pad=2,.ev=.{.axis=.{.idx=3,.value=1057}}}, -.{.t=23400316180,.pad=2,.ev=.{.axis=.{.idx=2,.value=-469}}}, -.{.t=23400325960,.pad=2,.ev=.{.axis=.{.idx=0,.value=-580}}}, -.{.t=23400325960,.pad=2,.ev=.{.axis=.{.idx=1,.value=1039}}}, -.{.t=23400325960,.pad=2,.ev=.{.axis=.{.idx=2,.value=-410}}}, -.{.t=23400330510,.pad=2,.ev=.{.axis=.{.idx=0,.value=-525}}}, -.{.t=23400330510,.pad=2,.ev=.{.axis=.{.idx=1,.value=981}}}, -.{.t=23400330510,.pad=2,.ev=.{.axis=.{.idx=2,.value=-439}}}, -.{.t=23411327274,.pad=2,.ev=.{.axis=.{.idx=1,.value=1039}}}, -.{.t=23411337364,.pad=2,.ev=.{.axis=.{.idx=1,.value=1010}}}, -.{.t=23411337364,.pad=2,.ev=.{.axis=.{.idx=3,.value=1027}}}, -.{.t=23422593127,.pad=2,.ev=.{.axis=.{.idx=2,.value=-469}}}, -.{.t=23422593127,.pad=2,.ev=.{.axis=.{.idx=3,.value=1057}}}, -.{.t=23422603997,.pad=2,.ev=.{.axis=.{.idx=2,.value=-410}}}, -.{.t=23422603997,.pad=2,.ev=.{.axis=.{.idx=3,.value=1027}}}, -.{.t=23422607677,.pad=2,.ev=.{.axis=.{.idx=2,.value=-439}}}, -.{.t=23422607677,.pad=2,.ev=.{.axis=.{.idx=3,.value=1057}}}, -.{.t=23433465571,.pad=2,.ev=.{.axis=.{.idx=1,.value=1039}}}, -.{.t=23433465571,.pad=2,.ev=.{.axis=.{.idx=3,.value=1027}}}, -.{.t=23433473571,.pad=2,.ev=.{.axis=.{.idx=1,.value=1010}}}, -.{.t=23433473571,.pad=2,.ev=.{.axis=.{.idx=2,.value=-469}}}, -.{.t=23433473571,.pad=2,.ev=.{.axis=.{.idx=3,.value=1057}}}, -.{.t=23444613485,.pad=2,.ev=.{.axis=.{.idx=1,.value=1039}}}, -.{.t=23444623255,.pad=2,.ev=.{.axis=.{.idx=2,.value=-439}}}, -.{.t=23444626645,.pad=2,.ev=.{.axis=.{.idx=1,.value=1010}}}, -.{.t=23444626645,.pad=2,.ev=.{.axis=.{.idx=3,.value=1027}}}, + .{ .t = 3100837937, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 997 } } }, + .{ .t = 3100845387, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -829 } } }, + .{ .t = 3100845387, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = -1441 } } }, + .{ .t = 3100845387, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1027 } } }, + .{ .t = 3100849157, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -802 } } }, + .{ .t = 3100849157, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = -1411 } } }, + .{ .t = 3100849157, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1057 } } }, + .{ .t = 3111923010, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -829 } } }, + .{ .t = 3111923010, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = -1529 } } }, + .{ .t = 3111923010, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1027 } } }, + .{ .t = 3111936310, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -802 } } }, + .{ .t = 3111936310, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = -1323 } } }, + .{ .t = 3111941850, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = -1558 } } }, + .{ .t = 3111941850, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 997 } } }, + .{ .t = 3123013224, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -829 } } }, + .{ .t = 3123013224, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = -1294 } } }, + .{ .t = 3123013224, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1027 } } }, + .{ .t = 3123021794, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -802 } } }, + .{ .t = 3123021794, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = -941 } } }, + .{ .t = 3123021794, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 997 } } }, + .{ .t = 3134267607, .pad = 2, .ev = .{ .axis = .{ .idx = 5, .value = 0 } } }, + .{ .t = 3134267607, .pad = 2, .ev = .{ .axis = .{ .idx = 5, .value = 214 } } }, + .{ .t = 3134267607, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -829 } } }, + .{ .t = 3134267607, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = -647 } } }, + .{ .t = 3134277137, .pad = 2, .ev = .{ .axis = .{ .idx = 5, .value = 2674 } } }, + .{ .t = 3134277137, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -802 } } }, + .{ .t = 3134277137, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = -500 } } }, + .{ .t = 3134280727, .pad = 2, .ev = .{ .axis = .{ .idx = 5, .value = 5436 } } }, + .{ .t = 3134280727, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -829 } } }, + .{ .t = 3134280727, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = -206 } } }, + .{ .t = 3134280727, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1027 } } }, + .{ .t = 3146260210, .pad = 2, .ev = .{ .axis = .{ .idx = 5, .value = 8198 } } }, + .{ .t = 3146260210, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -774 } } }, + .{ .t = 3146260210, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = -176 } } }, + .{ .t = 3146260210, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 997 } } }, + .{ .t = 3146270520, .pad = 2, .ev = .{ .axis = .{ .idx = 5, .value = 11211 } } }, + .{ .t = 3146270520, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -802 } } }, + .{ .t = 3146270520, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = -29 } } }, + .{ .t = 3146274870, .pad = 2, .ev = .{ .axis = .{ .idx = 5, .value = 13671 } } }, + .{ .t = 3146274870, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 86 } } }, + .{ .t = 3146274870, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1027 } } }, + .{ .t = 3156416215, .pad = 2, .ev = .{ .axis = .{ .idx = 5, .value = 16432 } } }, + .{ .t = 3156416215, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -829 } } }, + .{ .t = 3156416215, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 288 } } }, + .{ .t = 3156416215, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 997 } } }, + .{ .t = 3156435465, .pad = 2, .ev = .{ .axis = .{ .idx = 5, .value = 18893 } } }, + .{ .t = 3156435465, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -802 } } }, + .{ .t = 3156435465, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 462 } } }, + .{ .t = 3156441825, .pad = 2, .ev = .{ .axis = .{ .idx = 5, .value = 21504 } } }, + .{ .t = 3156441825, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 491 } } }, + .{ .t = 3156441825, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1057 } } }, + .{ .t = 3167440508, .pad = 2, .ev = .{ .axis = .{ .idx = 5, .value = 23915 } } }, + .{ .t = 3167440508, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 664 } } }, + .{ .t = 3167440508, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1027 } } }, + .{ .t = 3167449678, .pad = 2, .ev = .{ .axis = .{ .idx = 5, .value = 26224 } } }, + .{ .t = 3167449678, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -829 } } }, + .{ .t = 3167449678, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 779 } } }, + .{ .t = 3167449678, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 997 } } }, + .{ .t = 3178634312, .pad = 2, .ev = .{ .axis = .{ .idx = 5, .value = 28384 } } }, + .{ .t = 3178634312, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -802 } } }, + .{ .t = 3178634312, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 837 } } }, + .{ .t = 3178634312, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1027 } } }, + .{ .t = 3178646332, .pad = 2, .ev = .{ .axis = .{ .idx = 5, .value = 30593 } } }, + .{ .t = 3178646332, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -829 } } }, + .{ .t = 3178646332, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 997 } } }, + .{ .t = 3178651472, .pad = 2, .ev = .{ .axis = .{ .idx = 5, .value = 32702 } } }, + .{ .t = 3178651472, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -802 } } }, + .{ .t = 3189737565, .pad = 2, .ev = .{ .axis = .{ .idx = 5, .value = 32766 } } }, + .{ .t = 3189737565, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 924 } } }, + .{ .t = 3189737565, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1027 } } }, + .{ .t = 3189748175, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1057 } } }, + .{ .t = 3189751215, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 953 } } }, + .{ .t = 3189751215, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1027 } } }, + .{ .t = 3200899959, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 997 } } }, + .{ .t = 3200909349, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -774 } } }, + .{ .t = 3200909349, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 924 } } }, + .{ .t = 3200914229, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -802 } } }, + .{ .t = 3200914229, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 953 } } }, + .{ .t = 3200914229, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1027 } } }, + .{ .t = 3212027402, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -829 } } }, + .{ .t = 3212027402, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 1010 } } }, + .{ .t = 3212027402, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 997 } } }, + .{ .t = 3212033902, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1027 } } }, + .{ .t = 3222960156, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 981 } } }, + .{ .t = 3222960156, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 997 } } }, + .{ .t = 3222967916, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -802 } } }, + .{ .t = 3222967916, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 953 } } }, + .{ .t = 3222967916, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1087 } } }, + .{ .t = 3234186130, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -857 } } }, + .{ .t = 3234186130, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 981 } } }, + .{ .t = 3234186130, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1027 } } }, + .{ .t = 3234194710, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -802 } } }, + .{ .t = 3234194710, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 953 } } }, + .{ .t = 3234194710, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 997 } } }, + .{ .t = 3234198480, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -829 } } }, + .{ .t = 3234198480, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 1097 } } }, + .{ .t = 3245272663, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 1126 } } }, + .{ .t = 3245272663, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1057 } } }, + .{ .t = 3245280873, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -802 } } }, + .{ .t = 3245280873, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 997 } } }, + .{ .t = 3245284263, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 1097 } } }, + .{ .t = 3245284263, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1027 } } }, + .{ .t = 3256351647, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -829 } } }, + .{ .t = 3256351647, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 997 } } }, + .{ .t = 3256361897, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 1126 } } }, + .{ .t = 3256361897, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1027 } } }, + .{ .t = 3256366557, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -857 } } }, + .{ .t = 3267453910, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -829 } } }, + .{ .t = 3267461450, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -802 } } }, + .{ .t = 3267461450, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 1097 } } }, + .{ .t = 3267461450, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1057 } } }, + .{ .t = 3278671394, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1027 } } }, + .{ .t = 3278679494, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -829 } } }, + .{ .t = 3278679494, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 1126 } } }, + .{ .t = 3278679494, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 997 } } }, + .{ .t = 3278684284, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 1097 } } }, + .{ .t = 3289747017, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -802 } } }, + .{ .t = 3289757957, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -774 } } }, + .{ .t = 3289757957, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 1068 } } }, + .{ .t = 3289757957, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1057 } } }, + .{ .t = 3289764977, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -829 } } }, + .{ .t = 3289764977, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1027 } } }, + .{ .t = 3300894251, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -802 } } }, + .{ .t = 3300894251, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1057 } } }, + .{ .t = 3300904161, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -829 } } }, + .{ .t = 3300904161, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1027 } } }, + .{ .t = 3300908771, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1057 } } }, + .{ .t = 3312130554, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -802 } } }, + .{ .t = 3312130554, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 1039 } } }, + .{ .t = 3312130554, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1027 } } }, + .{ .t = 3312142164, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1057 } } }, + .{ .t = 3312145624, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -829 } } }, + .{ .t = 3312145624, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 1068 } } }, + .{ .t = 3312145624, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1027 } } }, + .{ .t = 3323185928, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -802 } } }, + .{ .t = 3323185928, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 1039 } } }, + .{ .t = 3323197438, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 1010 } } }, + .{ .t = 3334415941, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -829 } } }, + .{ .t = 3334415941, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1057 } } }, + .{ .t = 3334428191, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -802 } } }, + .{ .t = 3334428191, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1027 } } }, + .{ .t = 3334433441, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -829 } } }, + .{ .t = 3345319335, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -802 } } }, + .{ .t = 3345319335, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 1039 } } }, + .{ .t = 3345329665, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -774 } } }, + .{ .t = 3345329665, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 1010 } } }, + .{ .t = 3345329665, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 997 } } }, + .{ .t = 3345334835, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -802 } } }, + .{ .t = 3356434069, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -829 } } }, + .{ .t = 3356434069, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 1039 } } }, + .{ .t = 3356434069, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1027 } } }, + .{ .t = 3356449919, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -802 } } }, + .{ .t = 3356449919, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 1010 } } }, + .{ .t = 3356449919, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 997 } } }, + .{ .t = 3367716072, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -857 } } }, + .{ .t = 3367716072, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 1068 } } }, + .{ .t = 3367728332, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -829 } } }, + .{ .t = 3367728332, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 1039 } } }, + .{ .t = 3367728332, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1027 } } }, + .{ .t = 3367733692, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -802 } } }, + .{ .t = 3367733692, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 1010 } } }, + .{ .t = 3367733692, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1057 } } }, + .{ .t = 3378615526, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 997 } } }, + .{ .t = 3389836929, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -774 } } }, + .{ .t = 3389836929, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 981 } } }, + .{ .t = 3389836929, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1027 } } }, + .{ .t = 3389847129, .pad = 2, .ev = .{ .axis = .{ .idx = 5, .value = 31648 } } }, + .{ .t = 3389847129, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -802 } } }, + .{ .t = 3389847129, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 1010 } } }, + .{ .t = 3389852719, .pad = 2, .ev = .{ .axis = .{ .idx = 5, .value = 29137 } } }, + .{ .t = 3389852719, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 1039 } } }, + .{ .t = 3401186593, .pad = 2, .ev = .{ .axis = .{ .idx = 5, .value = 26074 } } }, + .{ .t = 3401186593, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -829 } } }, + .{ .t = 3401194003, .pad = 2, .ev = .{ .axis = .{ .idx = 5, .value = 23262 } } }, + .{ .t = 3401194003, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -802 } } }, + .{ .t = 3401194003, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 1010 } } }, + .{ .t = 3401194003, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1057 } } }, + .{ .t = 3401198713, .pad = 2, .ev = .{ .axis = .{ .idx = 5, .value = 20349 } } }, + .{ .t = 3401198713, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 997 } } }, + .{ .t = 3411932407, .pad = 2, .ev = .{ .axis = .{ .idx = 5, .value = 17587 } } }, + .{ .t = 3411932407, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -829 } } }, + .{ .t = 3411932407, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 1039 } } }, + .{ .t = 3411941077, .pad = 2, .ev = .{ .axis = .{ .idx = 5, .value = 15127 } } }, + .{ .t = 3411941077, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -802 } } }, + .{ .t = 3411941077, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1027 } } }, + .{ .t = 3411944947, .pad = 2, .ev = .{ .axis = .{ .idx = 5, .value = 12617 } } }, + .{ .t = 3411944947, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -829 } } }, + .{ .t = 3411944947, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 953 } } }, + .{ .t = 3411944947, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 997 } } }, + .{ .t = 3423178470, .pad = 2, .ev = .{ .axis = .{ .idx = 5, .value = 10307 } } }, + .{ .t = 3423178470, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -802 } } }, + .{ .t = 3423178470, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 924 } } }, + .{ .t = 3423187080, .pad = 2, .ev = .{ .axis = .{ .idx = 5, .value = 8298 } } }, + .{ .t = 3423187080, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 981 } } }, + .{ .t = 3423187080, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1027 } } }, + .{ .t = 3434307174, .pad = 2, .ev = .{ .axis = .{ .idx = 5, .value = 6340 } } }, + .{ .t = 3434307174, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 924 } } }, + .{ .t = 3434315334, .pad = 2, .ev = .{ .axis = .{ .idx = 5, .value = 4532 } } }, + .{ .t = 3434315334, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 997 } } }, + .{ .t = 3434318744, .pad = 2, .ev = .{ .axis = .{ .idx = 5, .value = 2975 } } }, + .{ .t = 3434318744, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 866 } } }, + .{ .t = 3445336427, .pad = 2, .ev = .{ .axis = .{ .idx = 5, .value = 1067 } } }, + .{ .t = 3445336427, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 635 } } }, + .{ .t = 3445344507, .pad = 2, .ev = .{ .axis = .{ .idx = 4, .value = 446 } } }, + .{ .t = 3445344507, .pad = 2, .ev = .{ .axis = .{ .idx = 5, .value = 0 } } }, + .{ .t = 3445344507, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 346 } } }, + .{ .t = 3445344507, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1027 } } }, + .{ .t = 3445348567, .pad = 2, .ev = .{ .axis = .{ .idx = 4, .value = 1854 } } }, + .{ .t = 3445348567, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = -59 } } }, + .{ .t = 3456475621, .pad = 2, .ev = .{ .axis = .{ .idx = 4, .value = 3310 } } }, + .{ .t = 3456475621, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = -176 } } }, + .{ .t = 3456475621, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 997 } } }, + .{ .t = 3456483971, .pad = 2, .ev = .{ .axis = .{ .idx = 4, .value = 4436 } } }, + .{ .t = 3456483971, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = -441 } } }, + .{ .t = 3456487161, .pad = 2, .ev = .{ .axis = .{ .idx = 4, .value = 5891 } } }, + .{ .t = 3456487161, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = -558 } } }, + .{ .t = 22900269279, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -1493 } } }, + .{ .t = 22900269279, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 981 } } }, + .{ .t = 22900269279, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1087 } } }, + .{ .t = 22900282319, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -1465 } } }, + .{ .t = 22900282319, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 953 } } }, + .{ .t = 22900282319, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -469 } } }, + .{ .t = 22900282319, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1118 } } }, + .{ .t = 22900288339, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 981 } } }, + .{ .t = 22900288339, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -439 } } }, + .{ .t = 22900288339, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1087 } } }, + .{ .t = 22911078513, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -1438 } } }, + .{ .t = 22911078513, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 953 } } }, + .{ .t = 22911078513, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -469 } } }, + .{ .t = 22911090183, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -498 } } }, + .{ .t = 22922174447, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -1465 } } }, + .{ .t = 22922174447, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -527 } } }, + .{ .t = 22922174447, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1148 } } }, + .{ .t = 22922182927, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -1493 } } }, + .{ .t = 22922182927, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 981 } } }, + .{ .t = 22922182927, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -498 } } }, + .{ .t = 22922182927, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1118 } } }, + .{ .t = 22922186907, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -1465 } } }, + .{ .t = 22933453380, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -469 } } }, + .{ .t = 22933463530, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -1438 } } }, + .{ .t = 22933463530, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 924 } } }, + .{ .t = 22933463530, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -498 } } }, + .{ .t = 22933463530, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1148 } } }, + .{ .t = 22933469520, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 953 } } }, + .{ .t = 22933469520, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -469 } } }, + .{ .t = 22933469520, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1118 } } }, + .{ .t = 22944601464, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -439 } } }, + .{ .t = 22944601464, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1087 } } }, + .{ .t = 22944613874, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -1465 } } }, + .{ .t = 22944613874, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -469 } } }, + .{ .t = 22944613874, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1118 } } }, + .{ .t = 22944619754, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -1438 } } }, + .{ .t = 22955633677, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -1493 } } }, + .{ .t = 22955633677, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 981 } } }, + .{ .t = 22955633677, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -439 } } }, + .{ .t = 22955633677, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1087 } } }, + .{ .t = 22955647207, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -1465 } } }, + .{ .t = 22955647207, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 953 } } }, + .{ .t = 22955647207, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -498 } } }, + .{ .t = 22955647207, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1148 } } }, + .{ .t = 22955652047, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -1438 } } }, + .{ .t = 22955652047, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1118 } } }, + .{ .t = 22966619841, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -1465 } } }, + .{ .t = 22966619841, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -469 } } }, + .{ .t = 22966628121, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 924 } } }, + .{ .t = 22966628121, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1087 } } }, + .{ .t = 22977745245, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -1438 } } }, + .{ .t = 22977745245, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 953 } } }, + .{ .t = 22977745245, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -498 } } }, + .{ .t = 22977745245, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1148 } } }, + .{ .t = 22977753905, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -1465 } } }, + .{ .t = 22977753905, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -469 } } }, + .{ .t = 22977753905, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1118 } } }, + .{ .t = 22977757525, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -439 } } }, + .{ .t = 22988922908, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -1438 } } }, + .{ .t = 22988922908, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 981 } } }, + .{ .t = 22988936008, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -1465 } } }, + .{ .t = 22988936008, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -469 } } }, + .{ .t = 22988940638, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -1438 } } }, + .{ .t = 22988940638, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 953 } } }, + .{ .t = 23000140672, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -1465 } } }, + .{ .t = 23000140672, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -498 } } }, + .{ .t = 23000152872, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -1438 } } }, + .{ .t = 23000152872, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 924 } } }, + .{ .t = 23000152872, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -439 } } }, + .{ .t = 23000152872, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1087 } } }, + .{ .t = 23000158442, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -1493 } } }, + .{ .t = 23000158442, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 953 } } }, + .{ .t = 23000158442, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -410 } } }, + .{ .t = 23011247285, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -1438 } } }, + .{ .t = 23011247285, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -439 } } }, + .{ .t = 23011247285, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1057 } } }, + .{ .t = 23011260265, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -1465 } } }, + .{ .t = 23011260265, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -469 } } }, + .{ .t = 23011260265, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1118 } } }, + .{ .t = 23022366569, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -1438 } } }, + .{ .t = 23022366569, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 924 } } }, + .{ .t = 23022366569, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -498 } } }, + .{ .t = 23022366569, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1148 } } }, + .{ .t = 23022380099, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -439 } } }, + .{ .t = 23022380099, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1087 } } }, + .{ .t = 23022385329, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -469 } } }, + .{ .t = 23022385329, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1118 } } }, + .{ .t = 23033207513, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -1465 } } }, + .{ .t = 23033207513, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 953 } } }, + .{ .t = 23033215483, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -1438 } } }, + .{ .t = 23033215483, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 924 } } }, + .{ .t = 23033215483, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -439 } } }, + .{ .t = 23033215483, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1087 } } }, + .{ .t = 23033219653, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 953 } } }, + .{ .t = 23044563226, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 924 } } }, + .{ .t = 23044563226, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -469 } } }, + .{ .t = 23044563226, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1118 } } }, + .{ .t = 23044572856, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -410 } } }, + .{ .t = 23044572856, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1087 } } }, + .{ .t = 23044576806, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 953 } } }, + .{ .t = 23044576806, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -469 } } }, + .{ .t = 23044576806, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1118 } } }, + .{ .t = 23055818709, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -1465 } } }, + .{ .t = 23055818709, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1087 } } }, + .{ .t = 23055828779, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -1438 } } }, + .{ .t = 23055828779, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 924 } } }, + .{ .t = 23055828779, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1118 } } }, + .{ .t = 23055832789, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -1410 } } }, + .{ .t = 23055832789, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1087 } } }, + .{ .t = 23066680603, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -1465 } } }, + .{ .t = 23066680603, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 953 } } }, + .{ .t = 23066680603, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1118 } } }, + .{ .t = 23066690143, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -1493 } } }, + .{ .t = 23066690143, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 981 } } }, + .{ .t = 23066690143, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -439 } } }, + .{ .t = 23066690143, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1087 } } }, + .{ .t = 23077703397, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -1438 } } }, + .{ .t = 23077703397, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 924 } } }, + .{ .t = 23077703397, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1118 } } }, + .{ .t = 23077711687, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -1465 } } }, + .{ .t = 23077711687, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 953 } } }, + .{ .t = 23077711687, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -469 } } }, + .{ .t = 23077715567, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -1493 } } }, + .{ .t = 23077715567, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 981 } } }, + .{ .t = 23077715567, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -439 } } }, + .{ .t = 23077715567, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1087 } } }, + .{ .t = 23088844720, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -1438 } } }, + .{ .t = 23088844720, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 953 } } }, + .{ .t = 23088844720, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -498 } } }, + .{ .t = 23088844720, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1148 } } }, + .{ .t = 23088853270, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -1465 } } }, + .{ .t = 23088853270, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -469 } } }, + .{ .t = 23088853270, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1118 } } }, + .{ .t = 23088856830, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -1438 } } }, + .{ .t = 23088856830, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 924 } } }, + .{ .t = 23088856830, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -439 } } }, + .{ .t = 23100184994, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 953 } } }, + .{ .t = 23100184994, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -410 } } }, + .{ .t = 23100184994, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1087 } } }, + .{ .t = 23100197834, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -1465 } } }, + .{ .t = 23100202044, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -1438 } } }, + .{ .t = 23100202044, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 924 } } }, + .{ .t = 23100202044, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -439 } } }, + .{ .t = 23111316337, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -410 } } }, + .{ .t = 23111328087, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -1465 } } }, + .{ .t = 23111328087, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -439 } } }, + .{ .t = 23122579831, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -1438 } } }, + .{ .t = 23122579831, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -498 } } }, + .{ .t = 23122579831, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1118 } } }, + .{ .t = 23122592031, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 953 } } }, + .{ .t = 23122592031, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -469 } } }, + .{ .t = 23122595681, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 924 } } }, + .{ .t = 23122595681, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -439 } } }, + .{ .t = 23122595681, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1087 } } }, + .{ .t = 23133201565, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 953 } } }, + .{ .t = 23133205635, .pad = 2, .ev = .{ .axis = .{ .idx = 4, .value = 728 } } }, + .{ .t = 23133205635, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 924 } } }, + .{ .t = 23133205635, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1118 } } }, + .{ .t = 23144628108, .pad = 2, .ev = .{ .axis = .{ .idx = 4, .value = 3169 } } }, + .{ .t = 23144628108, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -1493 } } }, + .{ .t = 23144628108, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 953 } } }, + .{ .t = 23144628108, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -410 } } }, + .{ .t = 23144628108, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1087 } } }, + .{ .t = 23144640728, .pad = 2, .ev = .{ .axis = .{ .idx = 4, .value = 6314 } } }, + .{ .t = 23144640728, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -1465 } } }, + .{ .t = 23144640728, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -469 } } }, + .{ .t = 23144640728, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1118 } } }, + .{ .t = 23144644338, .pad = 2, .ev = .{ .axis = .{ .idx = 4, .value = 10679 } } }, + .{ .t = 23144644338, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 981 } } }, + .{ .t = 23144644338, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -410 } } }, + .{ .t = 23144644338, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1087 } } }, + .{ .t = 23155757852, .pad = 2, .ev = .{ .axis = .{ .idx = 4, .value = 16500 } } }, + .{ .t = 23155757852, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -1493 } } }, + .{ .t = 23155757852, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 953 } } }, + .{ .t = 23155767512, .pad = 2, .ev = .{ .axis = .{ .idx = 4, .value = 23682 } } }, + .{ .t = 23155767512, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -1438 } } }, + .{ .t = 23155767512, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 924 } } }, + .{ .t = 23155773302, .pad = 2, .ev = .{ .axis = .{ .idx = 4, .value = 32084 } } }, + .{ .t = 23155773302, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -1465 } } }, + .{ .t = 23166856095, .pad = 2, .ev = .{ .axis = .{ .idx = 4, .value = 32766 } } }, + .{ .t = 23166856095, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -1438 } } }, + .{ .t = 23166856095, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -439 } } }, + .{ .t = 23166869315, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 953 } } }, + .{ .t = 23166869315, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1118 } } }, + .{ .t = 23177937079, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 924 } } }, + .{ .t = 23177937079, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1087 } } }, + .{ .t = 23177947099, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -1465 } } }, + .{ .t = 23177947099, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -410 } } }, + .{ .t = 23177950979, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -1438 } } }, + .{ .t = 23177950979, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -439 } } }, + .{ .t = 23177950979, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1118 } } }, + .{ .t = 23188909763, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -410 } } }, + .{ .t = 23188909763, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1087 } } }, + .{ .t = 23188919373, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -1493 } } }, + .{ .t = 23188919373, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 981 } } }, + .{ .t = 23188923533, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -1465 } } }, + .{ .t = 23188923533, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 953 } } }, + .{ .t = 23188923533, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -439 } } }, + .{ .t = 23188923533, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1057 } } }, + .{ .t = 23200341706, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -1438 } } }, + .{ .t = 23200341706, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 924 } } }, + .{ .t = 23200341706, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1087 } } }, + .{ .t = 23200357446, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -469 } } }, + .{ .t = 23200360546, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 866 } } }, + .{ .t = 23200360546, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -439 } } }, + .{ .t = 23211356329, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -1493 } } }, + .{ .t = 23211356329, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 895 } } }, + .{ .t = 23211356329, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1057 } } }, + .{ .t = 23211369469, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -1438 } } }, + .{ .t = 23211369469, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 808 } } }, + .{ .t = 23211369469, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -469 } } }, + .{ .t = 23211369469, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1118 } } }, + .{ .t = 23222496653, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 722 } } }, + .{ .t = 23222496653, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -410 } } }, + .{ .t = 23222496653, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1057 } } }, + .{ .t = 23222508723, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 664 } } }, + .{ .t = 23222508723, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -439 } } }, + .{ .t = 23222508723, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1087 } } }, + .{ .t = 23222512923, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -1465 } } }, + .{ .t = 23222512923, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 693 } } }, + .{ .t = 23222512923, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1118 } } }, + .{ .t = 23233616896, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 404 } } }, + .{ .t = 23233616896, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1087 } } }, + .{ .t = 23233628876, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 462 } } }, + .{ .t = 23233628876, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -469 } } }, + .{ .t = 23233628876, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1118 } } }, + .{ .t = 23233634716, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 375 } } }, + .{ .t = 23233634716, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -439 } } }, + .{ .t = 23244703810, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 404 } } }, + .{ .t = 23244703810, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -469 } } }, + .{ .t = 23244703810, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1087 } } }, + .{ .t = 23244716710, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -1438 } } }, + .{ .t = 23244716710, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 288 } } }, + .{ .t = 23244716710, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -439 } } }, + .{ .t = 23244722470, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 317 } } }, + .{ .t = 23255891634, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 260 } } }, + .{ .t = 23255891634, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -469 } } }, + .{ .t = 23255903964, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -1410 } } }, + .{ .t = 23255903964, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 144 } } }, + .{ .t = 23255903964, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1057 } } }, + .{ .t = 23255909564, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -1465 } } }, + .{ .t = 23255909564, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 115 } } }, + .{ .t = 23266911057, .pad = 2, .ev = .{ .axis = .{ .idx = 4, .value = 30723 } } }, + .{ .t = 23266911057, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -1438 } } }, + .{ .t = 23266911057, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 86 } } }, + .{ .t = 23266924047, .pad = 2, .ev = .{ .axis = .{ .idx = 4, .value = 27437 } } }, + .{ .t = 23266924047, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -1465 } } }, + .{ .t = 23266924047, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 115 } } }, + .{ .t = 23266924047, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1087 } } }, + .{ .t = 23278235081, .pad = 2, .ev = .{ .axis = .{ .idx = 4, .value = 24292 } } }, + .{ .t = 23278235081, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -1438 } } }, + .{ .t = 23278235081, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 29 } } }, + .{ .t = 23278246901, .pad = 2, .ev = .{ .axis = .{ .idx = 4, .value = 21053 } } }, + .{ .t = 23278246901, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 57 } } }, + .{ .t = 23278246901, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -439 } } }, + .{ .t = 23278246901, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1057 } } }, + .{ .t = 23278254110, .pad = 2, .ev = .{ .axis = .{ .idx = 4, .value = 17814 } } }, + .{ .t = 23278254110, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 86 } } }, + .{ .t = 23278254110, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -498 } } }, + .{ .t = 23278254110, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1087 } } }, + .{ .t = 23289217094, .pad = 2, .ev = .{ .axis = .{ .idx = 4, .value = 14341 } } }, + .{ .t = 23289217094, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -1465 } } }, + .{ .t = 23289217094, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 144 } } }, + .{ .t = 23289217094, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -469 } } }, + .{ .t = 23289217094, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1057 } } }, + .{ .t = 23289231434, .pad = 2, .ev = .{ .axis = .{ .idx = 4, .value = 11384 } } }, + .{ .t = 23289231434, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 57 } } }, + .{ .t = 23289236534, .pad = 2, .ev = .{ .axis = .{ .idx = 4, .value = 8708 } } }, + .{ .t = 23289236534, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -1438 } } }, + .{ .t = 23289236534, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 0 } } }, + .{ .t = 23300340478, .pad = 2, .ev = .{ .axis = .{ .idx = 4, .value = 6126 } } }, + .{ .t = 23300340478, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -439 } } }, + .{ .t = 23300350538, .pad = 2, .ev = .{ .axis = .{ .idx = 4, .value = 4014 } } }, + .{ .t = 23300350538, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 86 } } }, + .{ .t = 23300354158, .pad = 2, .ev = .{ .axis = .{ .idx = 4, .value = 2465 } } }, + .{ .t = 23300354158, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -1410 } } }, + .{ .t = 23300354158, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 288 } } }, + .{ .t = 23311366832, .pad = 2, .ev = .{ .axis = .{ .idx = 4, .value = 634 } } }, + .{ .t = 23311366832, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 462 } } }, + .{ .t = 23311366832, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1027 } } }, + .{ .t = 23311379542, .pad = 2, .ev = .{ .axis = .{ .idx = 4, .value = 0 } } }, + .{ .t = 23311379542, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -1355 } } }, + .{ .t = 23311379542, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 779 } } }, + .{ .t = 23311379542, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -410 } } }, + .{ .t = 23322638775, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -1272 } } }, + .{ .t = 23322638775, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 953 } } }, + .{ .t = 23322638775, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -439 } } }, + .{ .t = 23322649765, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -1051 } } }, + .{ .t = 23322649765, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 981 } } }, + .{ .t = 23322649765, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1057 } } }, + .{ .t = 23322654995, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -885 } } }, + .{ .t = 23322654995, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 1039 } } }, + .{ .t = 23333351109, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -691 } } }, + .{ .t = 23333351109, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -469 } } }, + .{ .t = 23333359049, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -553 } } }, + .{ .t = 23333359049, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1087 } } }, + .{ .t = 23333362519, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 1010 } } }, + .{ .t = 23333362519, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -439 } } }, + .{ .t = 23333362519, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1057 } } }, + .{ .t = 23344695372, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 981 } } }, + .{ .t = 23344706662, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -525 } } }, + .{ .t = 23344706662, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 953 } } }, + .{ .t = 23344711982, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -553 } } }, + .{ .t = 23344711982, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 981 } } }, + .{ .t = 23355868326, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -498 } } }, + .{ .t = 23355868326, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 1010 } } }, + .{ .t = 23355878956, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -525 } } }, + .{ .t = 23355878956, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 981 } } }, + .{ .t = 23355878956, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -469 } } }, + .{ .t = 23355878956, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1087 } } }, + .{ .t = 23355884866, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 1010 } } }, + .{ .t = 23355884866, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -410 } } }, + .{ .t = 23355884866, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1027 } } }, + .{ .t = 23366942749, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -553 } } }, + .{ .t = 23366952219, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -525 } } }, + .{ .t = 23366952219, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 981 } } }, + .{ .t = 23366952219, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -439 } } }, + .{ .t = 23366952219, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1057 } } }, + .{ .t = 23378047613, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -553 } } }, + .{ .t = 23378047613, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 1010 } } }, + .{ .t = 23378064723, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -525 } } }, + .{ .t = 23378064723, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 981 } } }, + .{ .t = 23378064723, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -469 } } }, + .{ .t = 23388957907, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -553 } } }, + .{ .t = 23388957907, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 1039 } } }, + .{ .t = 23388957907, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -439 } } }, + .{ .t = 23388957907, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1027 } } }, + .{ .t = 23388967217, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 1010 } } }, + .{ .t = 23388967217, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -410 } } }, + .{ .t = 23388970117, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -525 } } }, + .{ .t = 23388970117, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 981 } } }, + .{ .t = 23388970117, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -439 } } }, + .{ .t = 23388970117, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1057 } } }, + .{ .t = 23400316180, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -469 } } }, + .{ .t = 23400325960, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -580 } } }, + .{ .t = 23400325960, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 1039 } } }, + .{ .t = 23400325960, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -410 } } }, + .{ .t = 23400330510, .pad = 2, .ev = .{ .axis = .{ .idx = 0, .value = -525 } } }, + .{ .t = 23400330510, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 981 } } }, + .{ .t = 23400330510, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -439 } } }, + .{ .t = 23411327274, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 1039 } } }, + .{ .t = 23411337364, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 1010 } } }, + .{ .t = 23411337364, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1027 } } }, + .{ .t = 23422593127, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -469 } } }, + .{ .t = 23422593127, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1057 } } }, + .{ .t = 23422603997, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -410 } } }, + .{ .t = 23422603997, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1027 } } }, + .{ .t = 23422607677, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -439 } } }, + .{ .t = 23422607677, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1057 } } }, + .{ .t = 23433465571, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 1039 } } }, + .{ .t = 23433465571, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1027 } } }, + .{ .t = 23433473571, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 1010 } } }, + .{ .t = 23433473571, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -469 } } }, + .{ .t = 23433473571, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1057 } } }, + .{ .t = 23444613485, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 1039 } } }, + .{ .t = 23444623255, .pad = 2, .ev = .{ .axis = .{ .idx = 2, .value = -439 } } }, + .{ .t = 23444626645, .pad = 2, .ev = .{ .axis = .{ .idx = 1, .value = 1010 } } }, + .{ .t = 23444626645, .pad = 2, .ev = .{ .axis = .{ .idx = 3, .value = 1027 } } }, } } diff --git a/test/fs_bench.zig b/test/fs_bench.zig index 4764049f..a8a8fd8c 100644 --- a/test/fs_bench.zig +++ b/test/fs_bench.zig @@ -113,7 +113,7 @@ fn checkReply(s: *Session, req: ctlfs.Req, reply: ctlfs.Reply) !void { if (reply.payload != .staged or reply.payload.staged != bytes.len or bytes.len > req.size) return error.IncorrectReply; const pane = s.core.panes[s.file_id].?; - if (req.node == @intFromEnum(ctlfs.TopFile.index)) { + if (req.node == @backingInt(ctlfs.TopFile.index)) { var expected_buf: [4200]u8 = undefined; const expected = try std.fmt.bufPrint(&expected_buf, "{d} text {d} {s}\n", .{ s.file_serial, @intFromBool(pane.file.?.revision != pane.file.?.saved_revision), pane.file.?.path }); if (!std.mem.eql(u8, expected, bytes)) return error.IncorrectReply; @@ -134,7 +134,7 @@ fn checkReply(s: *Session, req: ctlfs.Req, reply: ctlfs.Reply) !void { if (reply.payload != .staged or reply.payload.staged != bytes.len or bytes.len > req.size) return error.IncorrectReply; const names = [_][]const u8{ "README", "index", "status", "focus", "ctl", "commands", "look", "exec", "log", "screen", "listeners", "pane", "os" }; - const nodes = [_]u64{ @intFromEnum(ctlfs.TopFile.README), @intFromEnum(ctlfs.TopFile.index), @intFromEnum(ctlfs.TopFile.status), @intFromEnum(ctlfs.TopFile.focus), @intFromEnum(ctlfs.TopFile.ctl), @intFromEnum(ctlfs.TopFile.commands), @intFromEnum(ctlfs.TopFile.look), @intFromEnum(ctlfs.TopFile.exec), @intFromEnum(ctlfs.TopFile.log), @intFromEnum(ctlfs.TopFile.screen), @intFromEnum(ctlfs.TopFile.listeners), @intFromEnum(ctlfs.TopFile.pane), filesystem.os_root }; + const nodes = [_]u64{ @backingInt(ctlfs.TopFile.README), @backingInt(ctlfs.TopFile.index), @backingInt(ctlfs.TopFile.status), @backingInt(ctlfs.TopFile.focus), @backingInt(ctlfs.TopFile.ctl), @backingInt(ctlfs.TopFile.commands), @backingInt(ctlfs.TopFile.look), @backingInt(ctlfs.TopFile.exec), @backingInt(ctlfs.TopFile.log), @backingInt(ctlfs.TopFile.screen), @backingInt(ctlfs.TopFile.listeners), @backingInt(ctlfs.TopFile.pane), filesystem.os_root }; var off: usize = 0; var entry: usize = 0; while (off < bytes.len) : (entry += 1) { @@ -253,7 +253,7 @@ pub fn main(init: std.process.Init) !void { try bench(&s, "read index", reps, .{ .tag = 6, .op = .read, - .node = @intFromEnum(ctlfs.TopFile.index), + .node = @backingInt(ctlfs.TopFile.index), .size = 4096, }, "one line per pane"); try bench(&s, "readdir root", reps, .{ diff --git a/test/lspfixture/broken.zig b/test/lspfixture/broken.zig index 22c86c9b..b27840cd 100644 --- a/test/lspfixture/broken.zig +++ b/test/lspfixture/broken.zig @@ -20,6 +20,6 @@ pub fn hasUnusedLocal() u32 { return 7; } -pub fn badly_spaced ( a : u32 , b : u32 ) u32 { - return a+b; +pub fn badly_spaced(a: u32, b: u32) u32 { + return a + b; } diff --git a/test/output.zig b/test/output.zig index 6ea6f6fa..8403effa 100644 --- a/test/output.zig +++ b/test/output.zig @@ -475,7 +475,7 @@ test "Mini syntax colors survive toggles themes and rendering without source acc try panes.mini.open(p, 0, "demo.zig"); const id = p.active; const mini = p.panes[id].?; - const keyword = std.mem.indexOfScalar(u8, mini.file.?.mini.?.colors, @intFromEnum(pardes.syntax.Syn.keyword)) orelse return error.MissingKeywordColor; + const keyword = std.mem.indexOfScalar(u8, mini.file.?.mini.?.colors, @backingInt(pardes.syntax.Syn.keyword)) orelse return error.MissingKeywordColor; // Direct pane construction bypasses the host update's layout sync. p.update(.{ .resize = .{ .cols = 80, .rows = 24 } }); const position = modal.positionAt(mini.file.?.content, keyword); @@ -1656,7 +1656,7 @@ test "stacked search and LSP results retain source tint navigation and dump owne } try std.testing.expectEqual(@as(usize, 6), marked); const number = std.mem.indexOf(u8, file.content, "42").?; - try std.testing.expectEqual(@intFromEnum(pardes.syntax.Syn.number), file.highlights[number]); + try std.testing.expectEqual(@backingInt(pardes.syntax.Syn.number), file.highlights[number]); p.active = id; pane.body.mode = .normal; pardes.look.armLookWalk(p, id); @@ -1815,7 +1815,7 @@ test "location cache eviction retains early colors and honors disk and unsaved r return error.MissingEarlyContext; } }; - try std.testing.expectEqual(@intFromEnum(pardes.syntax.Syn.comment), try Color.valueColor(file)); + try std.testing.expectEqual(@backingInt(pardes.syntax.Syn.comment), try Color.valueColor(file)); const single = "f00.c:4:1-6 needle();\n"; // Put the evicted file back before a same-size edit tests exact-byte keys. try panes.Output.fillResults(p, 0, dir, .search, "eviction", try p.gpa.dupe(u8, single), null); @@ -1823,14 +1823,14 @@ test "location cache eviction retains early colors and honors disk and unsaved r try tmp.dir.writeFile(std.testing.io, .{ .sub_path = "f00.c", .data = code }); try panes.Output.fillResults(p, 0, dir, .search, "eviction", try p.gpa.dupe(u8, single), null); try std.testing.expect(p.locations_cache.analyses > analyses); - try std.testing.expectEqual(@intFromEnum(pardes.syntax.Syn.number), try Color.valueColor(file)); + try std.testing.expectEqual(@backingInt(pardes.syntax.Syn.number), try Color.valueColor(file)); // An open buffer has priority over that disk revision, even with equal size. p.gpa.free(source.file.?.path); source.file.?.path = try std.fs.path.join(p.gpa, &.{ dir, "f00.c" }); panes.File.setContent(p, &source.file.?, try p.gpa.dupe(u8, comment)); try panes.Output.fillResults(p, 0, dir, .search, "eviction", try p.gpa.dupe(u8, single), null); - try std.testing.expectEqual(@intFromEnum(pardes.syntax.Syn.comment), try Color.valueColor(file)); + try std.testing.expectEqual(@backingInt(pardes.syntax.Syn.comment), try Color.valueColor(file)); try std.testing.expectEqualStrings(comment, source.file.?.content); } diff --git a/test/panes.zig b/test/panes.zig index 54100f91..c8f4b7eb 100644 --- a/test/panes.zig +++ b/test/panes.zig @@ -3193,7 +3193,7 @@ const OutputTests = struct { p.update(.{ .mouse = .{ .button = config.select_button, .kind = .press, .col = x, .row = y } }); p.update(.{ .mouse = .{ .button = config.select_button, .kind = .drag, .col = x + 2, .row = y + 1 } }); try std.testing.expect(p.drag == .select); - try std.testing.expectEqual(.dragging, result.sel[@intFromEnum(config.select_button)].state); + try std.testing.expectEqual(.dragging, result.sel[@backingInt(config.select_button)].state); try fillResults(p, 0, "/", .{ .query = .hover }, "", try p.gpa.dupe(u8, "short\n"), null); try std.testing.expect(p.drag == .none); p.update(.{ .mouse = .{ .button = config.select_button, .kind = .release, .col = x + 2, .row = y + 1 } }); diff --git a/test/pdf.zig b/test/pdf.zig index a51fd1a9..6c9308d4 100644 --- a/test/pdf.zig +++ b/test/pdf.zig @@ -25,7 +25,7 @@ const themes = pardes.themes; const pdf_raster_policy = pardes.pdf_raster_policy; const PDF_PAGE_GAP_PX = pardes.PDF_PAGE_GAP_PX; const BOX_H = pardes.BOX_H; -const sel_slot = @intFromEnum(config.select_button); +const sel_slot = @backingInt(config.select_button); const pane_tail = " " ++ config.pdf_pane_builtins_str; fn hasPdf(pane: *const pardes.Pane) bool { @@ -483,10 +483,10 @@ test "`:N` on a PDF turns to page N, from the pane and from the root's look, and try std.testing.expectEqual(failures, p.fs.failures); // Over 9P too: the root's look at `@pN:2` answers ok and logs no err. const ctlfs = pardes.ctlfs; - const written = p.serveFs(.{ .tag = 1, .op = .write, .node = @intFromEnum(ctlfs.TopFile.look), .data = try std.fmt.bufPrint(&line, "@p{d}:2\n", .{doc.serial}) }); + const written = p.serveFs(.{ .tag = 1, .op = .write, .node = @backingInt(ctlfs.TopFile.look), .data = try std.fmt.bufPrint(&line, "@p{d}:2\n", .{doc.serial}) }); try std.testing.expectEqual(ctlfs.Status.ok, written.status); try std.testing.expectEqual(@as(usize, 1), doc.pdf.?.page); - const log = @intFromEnum(ctlfs.TopFile.log); + const log = @backingInt(ctlfs.TopFile.log); const h = p.serveFs(.{ .tag = 2, .op = .open, .node = log }).handle; const record = p.fsPayload(p.serveFs(.{ .tag = 3, .op = .read, .node = log, .handle = h, .size = 1 << 16 })); try std.testing.expect(std.mem.indexOf(u8, record, "\nerr ") == null); diff --git a/test/pdf_scroll_bench.zig b/test/pdf_scroll_bench.zig index fdc42660..0f93068d 100644 --- a/test/pdf_scroll_bench.zig +++ b/test/pdf_scroll_bench.zig @@ -475,7 +475,7 @@ const Recorder = struct { self.visual = mix(self.visual, place.w); self.visual = mix(self.visual, place.h); self.visual = mix(self.visual, place.native.page); - self.visual = mix(self.visual, @intFromEnum(place.native.fit)); + self.visual = mix(self.visual, @backingInt(place.native.fit)); self.visual = mix(self.visual, place.native.pan_x); self.visual = mix(self.visual, place.native.pan_y); self.visual = mix(self.visual, @as(u32, @bitCast(place.native.pixel_offset_y))); diff --git a/test/perf-baseline-gui-debug.json b/test/perf-baseline-gui-debug.json index 4b60520b..ffcd678f 100644 --- a/test/perf-baseline-gui-debug.json +++ b/test/perf-baseline-gui-debug.json @@ -1 +1 @@ -{"harness":"6cf9f4b8943e7e29","build":{"compiler":"0.17.0","target":"x86_64-linux.5.10...7.2-gnu.2.38","cpu":"x86_64","driver_optimize":"fast","core_optimize":"debug","c_optimize":"fast","terminal_optimize":"safe","platform":"gui","grammars":"full","mupdf":true,"jpx":true,"tracy":false,"quic":false,"theme_animation":true,"terminal_simd":true,"prebuilt_shaders":false},"cols":120,"rows":40,"reps":10,"only":"medium","fixtures":[{"name":"small","lines":1000,"cols":60,"bytes":62694},{"name":"medium","lines":50000,"cols":60,"bytes":3201944},{"name":"large","lines":300000,"cols":60,"bytes":19464444},{"name":"longline","lines":400,"cols":8000,"bytes":3200400},{"name":"esp32p4","lines":12,"cols":240,"bytes":2892}],"cells":[{"op":"open","fixture":"medium","min_us":1732,"med_us":1881,"p90_us":2035,"max_us":2072},{"op":"render","fixture":"medium","min_us":89,"med_us":92,"p90_us":101,"max_us":102},{"op":"key-down","fixture":"medium","min_us":92,"med_us":94,"p90_us":100,"max_us":100},{"op":"key-right","fixture":"medium","min_us":91,"med_us":93,"p90_us":105,"max_us":109},{"op":"page-down","fixture":"medium","min_us":91,"med_us":95,"p90_us":99,"max_us":106},{"op":"wheel","fixture":"medium","min_us":90,"med_us":95,"p90_us":101,"max_us":101},{"op":"edit-char","fixture":"medium","min_us":1226,"med_us":1678,"p90_us":2093,"max_us":2323},{"op":"edit-twin","fixture":"medium","min_us":2275,"med_us":2697,"p90_us":2868,"max_us":2920},{"op":"body-2m","fixture":"medium","min_us":5213,"med_us":11333,"p90_us":18974,"max_us":18999},{"op":"body-appends","fixture":"medium","min_us":175012,"med_us":260087,"p90_us":317184,"max_us":317469},{"op":"deep-sel","fixture":"medium","min_us":83,"med_us":85,"p90_us":86,"max_us":98}]} +{"harness":"15bee9f100e5ef64","build":{"compiler":"0.17.0","target":"x86_64-linux.5.10...7.2-gnu.2.38","cpu":"x86_64","driver_optimize":"fast","core_optimize":"debug","c_optimize":"fast","terminal_optimize":"safe","platform":"gui","grammars":"full","mupdf":true,"jpx":true,"tracy":false,"quic":false,"theme_animation":true,"terminal_simd":true,"prebuilt_shaders":false},"cols":120,"rows":40,"reps":10,"only":"medium","fixtures":[{"name":"small","lines":1000,"cols":60,"bytes":62694},{"name":"medium","lines":50000,"cols":60,"bytes":3201944},{"name":"large","lines":300000,"cols":60,"bytes":19464444},{"name":"longline","lines":400,"cols":8000,"bytes":3200400},{"name":"esp32p4","lines":12,"cols":240,"bytes":2892}],"cells":[{"op":"open","fixture":"medium","min_us":1744,"med_us":1832,"p90_us":2468,"max_us":2524},{"op":"render","fixture":"medium","min_us":88,"med_us":97,"p90_us":114,"max_us":115},{"op":"key-down","fixture":"medium","min_us":95,"med_us":98,"p90_us":104,"max_us":105},{"op":"key-right","fixture":"medium","min_us":92,"med_us":96,"p90_us":98,"max_us":105},{"op":"page-down","fixture":"medium","min_us":91,"med_us":95,"p90_us":97,"max_us":105},{"op":"wheel","fixture":"medium","min_us":87,"med_us":93,"p90_us":99,"max_us":100},{"op":"edit-char","fixture":"medium","min_us":1241,"med_us":1459,"p90_us":1691,"max_us":1724},{"op":"edit-twin","fixture":"medium","min_us":2592,"med_us":3003,"p90_us":3481,"max_us":3503},{"op":"body-2m","fixture":"medium","min_us":4576,"med_us":8262,"p90_us":15424,"max_us":17259},{"op":"body-appends","fixture":"medium","min_us":152003,"med_us":227268,"p90_us":272872,"max_us":326510},{"op":"deep-sel","fixture":"medium","min_us":82,"med_us":83,"p90_us":90,"max_us":93}]} diff --git a/test/perf-baseline-tty-debug.json b/test/perf-baseline-tty-debug.json index a01335bd..b8e534c4 100644 --- a/test/perf-baseline-tty-debug.json +++ b/test/perf-baseline-tty-debug.json @@ -1 +1 @@ -{"harness":"6cf9f4b8943e7e29","build":{"compiler":"0.17.0","target":"x86_64-linux.5.10...7.2-gnu.2.38","cpu":"x86_64","driver_optimize":"fast","core_optimize":"debug","c_optimize":"fast","terminal_optimize":"safe","platform":"tty","grammars":"full","mupdf":true,"jpx":true,"tracy":false,"quic":false,"theme_animation":true,"terminal_simd":true,"prebuilt_shaders":false},"cols":120,"rows":40,"reps":10,"only":"medium","fixtures":[{"name":"small","lines":1000,"cols":60,"bytes":62694},{"name":"medium","lines":50000,"cols":60,"bytes":3201944},{"name":"large","lines":300000,"cols":60,"bytes":19464444},{"name":"longline","lines":400,"cols":8000,"bytes":3200400},{"name":"esp32p4","lines":12,"cols":240,"bytes":2892}],"cells":[{"op":"open","fixture":"medium","min_us":2169,"med_us":2697,"p90_us":3126,"max_us":3207},{"op":"render","fixture":"medium","min_us":89,"med_us":96,"p90_us":101,"max_us":115},{"op":"key-down","fixture":"medium","min_us":93,"med_us":98,"p90_us":104,"max_us":115},{"op":"key-right","fixture":"medium","min_us":96,"med_us":97,"p90_us":102,"max_us":108},{"op":"page-down","fixture":"medium","min_us":96,"med_us":98,"p90_us":102,"max_us":103},{"op":"wheel","fixture":"medium","min_us":89,"med_us":100,"p90_us":128,"max_us":168},{"op":"edit-char","fixture":"medium","min_us":1821,"med_us":2274,"p90_us":2404,"max_us":2610},{"op":"edit-twin","fixture":"medium","min_us":2710,"med_us":3180,"p90_us":3413,"max_us":3636},{"op":"body-2m","fixture":"medium","min_us":9090,"med_us":14438,"p90_us":18158,"max_us":22063},{"op":"body-appends","fixture":"medium","min_us":241367,"med_us":375874,"p90_us":470623,"max_us":528094},{"op":"deep-sel","fixture":"medium","min_us":88,"med_us":89,"p90_us":90,"max_us":90}]} +{"harness":"15bee9f100e5ef64","build":{"compiler":"0.17.0","target":"x86_64-linux.5.10...7.2-gnu.2.38","cpu":"x86_64","driver_optimize":"fast","core_optimize":"debug","c_optimize":"fast","terminal_optimize":"safe","platform":"tty","grammars":"full","mupdf":true,"jpx":true,"tracy":false,"quic":false,"theme_animation":true,"terminal_simd":true,"prebuilt_shaders":false},"cols":120,"rows":40,"reps":10,"only":"medium","fixtures":[{"name":"small","lines":1000,"cols":60,"bytes":62694},{"name":"medium","lines":50000,"cols":60,"bytes":3201944},{"name":"large","lines":300000,"cols":60,"bytes":19464444},{"name":"longline","lines":400,"cols":8000,"bytes":3200400},{"name":"esp32p4","lines":12,"cols":240,"bytes":2892}],"cells":[{"op":"open","fixture":"medium","min_us":1747,"med_us":1912,"p90_us":2150,"max_us":2247},{"op":"render","fixture":"medium","min_us":89,"med_us":95,"p90_us":102,"max_us":104},{"op":"key-down","fixture":"medium","min_us":97,"med_us":101,"p90_us":107,"max_us":133},{"op":"key-right","fixture":"medium","min_us":93,"med_us":104,"p90_us":109,"max_us":112},{"op":"page-down","fixture":"medium","min_us":92,"med_us":96,"p90_us":106,"max_us":108},{"op":"wheel","fixture":"medium","min_us":90,"med_us":92,"p90_us":96,"max_us":96},{"op":"edit-char","fixture":"medium","min_us":1167,"med_us":1345,"p90_us":1483,"max_us":1627},{"op":"edit-twin","fixture":"medium","min_us":2319,"med_us":2921,"p90_us":3425,"max_us":3539},{"op":"body-2m","fixture":"medium","min_us":4333,"med_us":7752,"p90_us":15941,"max_us":17192},{"op":"body-appends","fixture":"medium","min_us":149149,"med_us":234177,"p90_us":285302,"max_us":295516},{"op":"deep-sel","fixture":"medium","min_us":83,"med_us":88,"p90_us":99,"max_us":119}]} diff --git a/test/perf-baseline-tty-fast.json b/test/perf-baseline-tty-fast.json index 04fc88d3..46125349 100644 --- a/test/perf-baseline-tty-fast.json +++ b/test/perf-baseline-tty-fast.json @@ -1 +1 @@ -{"harness":"6cf9f4b8943e7e29","build":{"compiler":"0.17.0","target":"x86_64-linux.5.10...7.2-gnu.2.38","cpu":"x86_64","driver_optimize":"fast","core_optimize":"fast","c_optimize":"fast","terminal_optimize":"fast","platform":"tty","grammars":"full","mupdf":true,"jpx":true,"tracy":false,"quic":false,"theme_animation":true,"terminal_simd":true,"prebuilt_shaders":false},"cols":120,"rows":40,"reps":10,"only":"medium","fixtures":[{"name":"small","lines":1000,"cols":60,"bytes":62694},{"name":"medium","lines":50000,"cols":60,"bytes":3201944},{"name":"large","lines":300000,"cols":60,"bytes":19464444},{"name":"longline","lines":400,"cols":8000,"bytes":3200400},{"name":"esp32p4","lines":12,"cols":240,"bytes":2892}],"cells":[{"op":"open","fixture":"medium","min_us":1695,"med_us":2024,"p90_us":2180,"max_us":2292},{"op":"render","fixture":"medium","min_us":79,"med_us":82,"p90_us":92,"max_us":94},{"op":"key-down","fixture":"medium","min_us":81,"med_us":82,"p90_us":83,"max_us":84},{"op":"key-right","fixture":"medium","min_us":80,"med_us":82,"p90_us":91,"max_us":91},{"op":"page-down","fixture":"medium","min_us":81,"med_us":84,"p90_us":90,"max_us":171},{"op":"wheel","fixture":"medium","min_us":79,"med_us":80,"p90_us":90,"max_us":101},{"op":"edit-char","fixture":"medium","min_us":1332,"med_us":1691,"p90_us":1967,"max_us":1987},{"op":"edit-twin","fixture":"medium","min_us":2160,"med_us":2457,"p90_us":2718,"max_us":2757},{"op":"body-2m","fixture":"medium","min_us":5047,"med_us":13525,"p90_us":16257,"max_us":20323},{"op":"body-appends","fixture":"medium","min_us":155834,"med_us":261597,"p90_us":329936,"max_us":333538},{"op":"deep-sel","fixture":"medium","min_us":75,"med_us":76,"p90_us":84,"max_us":96}]} +{"harness":"15bee9f100e5ef64","build":{"compiler":"0.17.0","target":"x86_64-linux.5.10...7.2-gnu.2.38","cpu":"x86_64","driver_optimize":"fast","core_optimize":"fast","c_optimize":"fast","terminal_optimize":"fast","platform":"tty","grammars":"full","mupdf":true,"jpx":true,"tracy":false,"quic":false,"theme_animation":true,"terminal_simd":true,"prebuilt_shaders":false},"cols":120,"rows":40,"reps":10,"only":"medium","fixtures":[{"name":"small","lines":1000,"cols":60,"bytes":62694},{"name":"medium","lines":50000,"cols":60,"bytes":3201944},{"name":"large","lines":300000,"cols":60,"bytes":19464444},{"name":"longline","lines":400,"cols":8000,"bytes":3200400},{"name":"esp32p4","lines":12,"cols":240,"bytes":2892}],"cells":[{"op":"open","fixture":"medium","min_us":1904,"med_us":2040,"p90_us":2290,"max_us":2600},{"op":"render","fixture":"medium","min_us":80,"med_us":83,"p90_us":88,"max_us":93},{"op":"key-down","fixture":"medium","min_us":81,"med_us":87,"p90_us":93,"max_us":109},{"op":"key-right","fixture":"medium","min_us":79,"med_us":82,"p90_us":86,"max_us":96},{"op":"page-down","fixture":"medium","min_us":79,"med_us":83,"p90_us":89,"max_us":93},{"op":"wheel","fixture":"medium","min_us":77,"med_us":79,"p90_us":82,"max_us":83},{"op":"edit-char","fixture":"medium","min_us":1139,"med_us":1338,"p90_us":1453,"max_us":1578},{"op":"edit-twin","fixture":"medium","min_us":2515,"med_us":2776,"p90_us":2879,"max_us":2907},{"op":"body-2m","fixture":"medium","min_us":4832,"med_us":7650,"p90_us":15076,"max_us":15371},{"op":"body-appends","fixture":"medium","min_us":165796,"med_us":240881,"p90_us":284919,"max_us":292573},{"op":"deep-sel","fixture":"medium","min_us":73,"med_us":75,"p90_us":83,"max_us":93}]} diff --git a/test/perf.zig b/test/perf.zig index d01d1bb5..7662d028 100644 --- a/test/perf.zig +++ b/test/perf.zig @@ -517,8 +517,8 @@ fn gate(cells: *const [std.enums.values(Op).len][fixtures.len]Cell, base: *const }; // Typing beside a twin costs about what typing alone does, whatever the // baseline: the twin takes the splice, never a copy of the text. - const twin_op = @intFromEnum(Op.edit_twin); - const alone_op = @intFromEnum(Op.edit_char); + const twin_op = @backingInt(Op.edit_twin); + const alone_op = @backingInt(Op.edit_char); for (fixtures, 0..) |fx, fi| { const twin = cells[twin_op][fi].min_us; const alone = cells[alone_op][fi].min_us; @@ -1220,7 +1220,7 @@ fn measureMini(io: std.Io, fallback: std.mem.Allocator, reps: usize, json: bool) break :blk try pardes.syntax.highlightFileRange(gpa, path, source, 0, source.len); }; defer gpa.free(styles); - if (styles.len != source.len or std.mem.indexOfScalar(u8, styles, @intFromEnum(pardes.syntax.Syn.comment)) == null) + if (styles.len != source.len or std.mem.indexOfScalar(u8, styles, @backingInt(pardes.syntax.Syn.comment)) == null) return error.MiniSyntaxUnavailable; const expected = try pardes.panes.mini.generate(gpa, source, styles); defer expected.deinit(gpa); diff --git a/test/unit_profile.zig b/test/unit_profile.zig index 59794df9..941efeb2 100644 --- a/test/unit_profile.zig +++ b/test/unit_profile.zig @@ -6,7 +6,7 @@ const Memory = struct { rss_after_bytes: ?usize = null, cumulative_peak_rss_byte fn send(io: std.Io, file: std.Io.File, tag: Client.Tag, body: []const u8, deadline: std.Io.Timeout) !void { var header: [8]u8 = undefined; - std.mem.writeInt(u32, header[0..4], @intFromEnum(tag), .little); + std.mem.writeInt(u32, header[0..4], @backingInt(tag), .little); std.mem.writeInt(u32, header[4..8], @intCast(body.len), .little); for ([_][]const u8{ &header, body }) |part| { var offset: usize = 0; @@ -36,7 +36,7 @@ fn readAll(io: std.Io, file: std.Io.File, bytes: []u8, deadline: std.Io.Timeout) fn receive(io: std.Io, file: std.Io.File, gpa: std.mem.Allocator, deadline: std.Io.Timeout) !struct { tag: Server.Tag, body: []u8 } { var header: [8]u8 = undefined; try readAll(io, file, &header, deadline); - const tag: Server.Tag = @enumFromInt(std.mem.readInt(u32, header[0..4], .little)); + const tag: Server.Tag = @fromBackingInt(@intCast(std.mem.readInt(u32, header[0..4], .little))); const len = std.mem.readInt(u32, header[4..8], .little); if (len > 16 * 1024 * 1024) return error.MessageTooLarge; const bytes = try gpa.alloc(u8, len); -- cgit v1.3 From b730ce12667fb75c99b97eafcfc73d7b1f8bdd13 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Wed, 21 Oct 2026 21:05:10 -0300 Subject: GUI scrollbar thumb moves by the pixel and follows the glide --- src/CHANGELOG.md | 6 ++++ src/draw.zig | 2 ++ src/gui/gui.zig | 100 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- src/pdf_view.zig | 2 ++ src/surface.zig | 5 +++ 5 files changed, 114 insertions(+), 1 deletion(-) (limited to 'src/gui/gui.zig') diff --git a/src/CHANGELOG.md b/src/CHANGELOG.md index c6c2eadd..1d6a1e71 100644 --- a/src/CHANGELOG.md +++ b/src/CHANGELOG.md @@ -16,6 +16,12 @@ - Workspace, column and pane tags share a tighter text inset. - A diff paged into a session (`git show | pardes -`) opens its `+Diff` alone; the `+Pager` no longer stays folded under it. +- The workspace Pet wanders to a random spot, rests there a few seconds, + then sets off for another; the frog is drawn side-on and hops. +- A drag started on a file's line numbers copies only the text; the + numbers no longer come along with the first line. +- The GUI's scrollbar thumb moves by the pixel and follows a smooth + scroll as it glides, instead of jumping a row of the track at a time. - Built with Zig 0.17. A bare `zig build` still puts the binaries in `~/.local/bin`, now as a copy beside the prefix, which `--prefix` no diff --git a/src/draw.zig b/src/draw.zig index 22a8dc2a..84575873 100644 --- a/src/draw.zig +++ b/src/draw.zig @@ -87,6 +87,8 @@ pub fn place(p: *Pardes, s: *Surface) void { const pos = (track_h * sb.offset) / total; rail.thumb_y = @intCast(@min(pos, track_h)); rail.thumb_h = @intCast(@min(len, track_h - rail.thumb_y)); + rail.thumb_at = @as(f32, @floatFromInt(sb.offset)) / @as(f32, @floatFromInt(total)); + rail.thumb_span = @as(f32, @floatFromInt(@max(1, sb.len))) / @as(f32, @floatFromInt(total)); } s.addRegion(rail); // Each notice a chip at the right edge, one to a row in the order diff --git a/src/gui/gui.zig b/src/gui/gui.zig index f0dd0682..2abf9166 100644 --- a/src/gui/gui.zig +++ b/src/gui/gui.zig @@ -2969,6 +2969,9 @@ test "an attached frontend draws the session's chrome from its frame alone" { g.tagline_width = 6; g.tagline_height = 12; g.decor = .empty; + g.glide = .{}; + g.scroll_pane = null; + g.scroll_lag = 0; defer g.decor.deinit(gpa); var groups = makeGroups(&.{}, false); try buildDecor(&g, gpa, s, &groups, fixedCellLayout(&g), 800, 480, true); @@ -7165,6 +7168,9 @@ test "every pixel of a grip column is band, button or ring, and the button sits var g: Gui = undefined; g.words = .{}; g.decor = .empty; + g.glide = .{}; + g.scroll_pane = null; + g.scroll_lag = 0; defer g.decor.deinit(gpa); g.cell_w = m.w; g.cell_h = m.h; @@ -7473,6 +7479,9 @@ test "lapis plaques stay in their tag's band, clear of every grip; only the focu try std.testing.expect(s.chrome.decor_box_border != null and s.chrome.decor_checker != null and s.chrome.decor_dots != null and s.chrome.decor_title != null); var g: Gui = undefined; g.decor = .empty; + g.glide = .{}; + g.scroll_pane = null; + g.scroll_lag = 0; defer g.decor.deinit(gpa); g.cell_w = 16; g.cell_h = 32; @@ -7572,6 +7581,9 @@ test "insert cursor overlays without replacing the character beneath it" { const surface: pardes.Surface = .{ .cols = 5, .rows = 5, .cells = &cells, .cursor = .{ .x = 2, .y = 3, .bar = true } }; var g: Gui = undefined; g.decor = .empty; + g.glide = .{}; + g.scroll_pane = null; + g.scroll_lag = 0; defer g.decor.deinit(std.testing.allocator); g.cell_w = 10; g.cell_h = 20; @@ -9032,6 +9044,9 @@ test "a lift never touches a tag, a grip or a header, on a light theme or a dark g.tagline_width = 6; g.tagline_height = 12; g.decor = .empty; + g.glide = .{}; + g.scroll_pane = null; + g.scroll_lag = 0; defer g.decor.deinit(gpa); var groups = makeGroups(&.{}, false); try buildDecor(&g, gpa, settled, &groups, fixedCellLayout(&g), 800, 480, true); @@ -9317,7 +9332,19 @@ fn paneDecor(g: *Gui, gpa: std.mem.Allocator, regions: []const pardes.Region, gr try addChecker(g, gpa, column[0], y0, column[1], y1, chrome.scroll_track, gold, dp(@floatFromInt(@max(1, chrome.decor_checker_px))), track, win_w, win_h) else try addDecor(g, gpa, column[0], y0, column[1], y1, chrome.scroll_track, 1, track, win_w, win_h); - if (rail.thumb_h != 0) { + if (rail.thumb_h != 0 and rail.thumb_span > 0) { + // In pixels, not rows, and with the picture while it glides + // or lags behind the core's rows (both in rows of the body). + const lag: f32 = if (g.glide.offset != 0 and g.glide.pane == rail.owner) + g.glide.offset + else if (g.scroll_pane != null and g.scroll_pane.? == rail.owner) g.scroll_lag else 0; + const track_px = body_y1 - y0; + const size = @min(track_px, @max(layout.h, rail.thumb_span * track_px)); + const at = rail.thumb_at + lag * rail.thumb_span / @as(f32, @floatFromInt(rail.rect.h)); + const thumb_y0 = y0 + std.math.clamp(at * track_px, 0, track_px - size); + const thumb_y1 = if (thumb_y0 + size >= body_y1 - 0.5) y1 else thumb_y0 + size; + try addDecor(g, gpa, column[0], thumb_y0, column[1] - dp(1), thumb_y1, chrome.scroll_thumb, 1, track, win_w, win_h); + } else if (rail.thumb_h != 0) { const thumb_y0 = @as(f32, @floatFromInt(rail.rect.y + rail.thumb_y)) * layout.h; const thumb_y1 = if (rail.thumb_y + rail.thumb_h == rail.rect.h) y1 else @as(f32, @floatFromInt(rail.rect.y + rail.thumb_y + rail.thumb_h)) * layout.h; try addDecor(g, gpa, column[0], thumb_y0, column[1] - dp(1), thumb_y1, chrome.scroll_thumb, 1, track, win_w, win_h); @@ -9681,6 +9708,9 @@ test "decor less its holes covers each pixel of the rest once and none of the ho g.cell_w = 1; g.cell_h = 1; g.decor = .empty; + g.glide = .{}; + g.scroll_pane = null; + g.scroll_lag = 0; defer g.decor.deinit(gpa); const holes = [_][4]f32{ .{ 3, 2, 9, 6 }, .{ 5, 4, 12, 8 }, .{ 30, 30, 40, 40 } }; try addDecorExcept(&g, gpa, .{ 1, 1, 11, 10 }, &holes, .{ 1, 2, 3 }, null, 16, 12); @@ -9872,6 +9902,9 @@ test "a theme's own rules and scrollbar are drawn at its widths: acme's 2px blac try std.testing.expectEqual(@as(u8, 18), s.chrome.rail_px); var g: Gui = undefined; g.decor = .empty; + g.glide = .{}; + g.scroll_pane = null; + g.scroll_lag = 0; defer g.decor.deinit(gpa); g.cell_w = 16; g.cell_h = 20; @@ -9900,6 +9933,47 @@ test "a theme's own rules and scrollbar are drawn at its widths: acme's 2px blac try std.testing.expect(tracks >= 2); } +test "the scrollbar thumb moves by the pixel and follows a glide" { + const gpa = std.testing.allocator; + const core = try pardes.Pardes.init(gpa, .{ .cols = 80, .rows = 24 }); + defer core.deinit(); + const pane = try core.setTestFile(std.mem.asBytes(&@as([1000][5]u8, @splat("line\n".*)))); + var g: Gui = undefined; + g.decor = .empty; + defer g.decor.deinit(gpa); + g.glide = .{}; + g.scroll_pane = null; + g.scroll_lag = 0; + g.cell_w = 10; + g.cell_h = 20; + g.tagline_width = 6; + g.tagline_height = 12; + const thumb = struct { + // The thumb's top, in window pixels. + fn top(gui: *Gui, p: *pardes.Pardes) !f32 { + gui.decor.clearRetainingCapacity(); + pardes.test_api.sync(p); + const s = try p.render(p.scratch.allocator()); + var groups = makeGroups(&.{}, false); + try buildDecor(gui, std.testing.allocator, s, &groups, fixedCellLayout(gui), 800, 480, true); + const ink = s.chrome.scroll_thumb; + for (gui.decor.items) |item| if (@abs(item.br - @as(f32, @floatFromInt(ink[0])) / 255) < 1e-3 and + @abs(item.bg - @as(f32, @floatFromInt(ink[1])) / 255) < 1e-3 and + @abs(item.bb - @as(f32, @floatFromInt(ink[2])) / 255) < 1e-3) return (1 - item.y0) / 2 * 480; + return error.TestExpectedThumb; + } + }; + pane.file.?.scroll = 10; + const at10 = try thumb.top(&g, core); + pane.file.?.scroll = 11; + const at11 = try thumb.top(&g, core); + // A line of a thousand moves it a fraction of a row, not 0 or 20 px. + try std.testing.expect(at11 > at10 and at11 - at10 < 1); + g.glide.pane = core.active; + g.glide.offset = -1; + try std.testing.expectApproxEqAbs(at10, try thumb.top(&g, core), 1e-3); +} + test "the rule between stacked panes stays in the tag band's slack, at any tagline size" { const gpa = std.testing.allocator; const core = try pardes.Pardes.init(gpa, .{ .cols = 80, .rows = 24 }); @@ -9914,6 +9988,9 @@ test "the rule between stacked panes stays in the tag band's slack, at any tagli for ([_]u32{ 12, 20 }) |tagline_h| { var g: Gui = undefined; g.decor = .empty; + g.glide = .{}; + g.scroll_pane = null; + g.scroll_lag = 0; defer g.decor.deinit(gpa); g.cell_w = 10; g.cell_h = 20; @@ -9949,6 +10026,9 @@ test "an empty column is ruled on both sides, as between two filled ones" { const s = try core.render(core.scratch.allocator()); var g: Gui = undefined; g.decor = .empty; + g.glide = .{}; + g.scroll_pane = null; + g.scroll_lag = 0; defer g.decor.deinit(gpa); g.cell_w = 10; g.cell_h = 20; @@ -9985,6 +10065,9 @@ test "at a 2x display every logical pixel is two: rules, the tag rule, the grip' defer display_scale = 1; var g: Gui = undefined; g.decor = .empty; + g.glide = .{}; + g.scroll_pane = null; + g.scroll_lag = 0; defer g.decor.deinit(gpa); g.cell_w = 16; g.cell_h = 32; @@ -10049,6 +10132,9 @@ test "decor is read from the regions, each pane's in its own group" { const s = try core.render(core.scratch.allocator()); var g: Gui = undefined; g.decor = .empty; + g.glide = .{}; + g.scroll_pane = null; + g.scroll_lag = 0; defer g.decor.deinit(gpa); g.cell_w = 10; g.cell_h = 20; @@ -10114,6 +10200,9 @@ test "a pane on the move casts a shadow on the other panes' bodies alone, most a const s = try core.render(core.scratch.allocator()); var g: Gui = undefined; g.decor = .empty; + g.glide = .{}; + g.scroll_pane = null; + g.scroll_lag = 0; defer g.decor.deinit(gpa); g.cell_w = 10; g.cell_h = 20; @@ -10167,6 +10256,9 @@ test "the selection glows round its block, on the body only, fading in over 100 s.cursor = null; var g: Gui = undefined; g.decor = .empty; + g.glide = .{}; + g.scroll_pane = null; + g.scroll_lag = 0; defer g.decor.deinit(gpa); g.cell_w = 10; g.cell_h = 20; @@ -10219,6 +10311,9 @@ test "a hovered word glows along its foot, never over the cursor, fading in over s.cursor = .{ .x = body.rect.x + 8, .y = row }; var g: Gui = undefined; g.decor = .empty; + g.glide = .{}; + g.scroll_pane = null; + g.scroll_lag = 0; defer g.decor.deinit(gpa); g.cell_w = 10; g.cell_h = 20; @@ -10262,6 +10357,9 @@ test "occlusion shades each body's edges, inside it, never a tag, a grip or the s.cursor = .{ .x = body.rect.x, .y = body.rect.y }; var g: Gui = undefined; g.decor = .empty; + g.glide = .{}; + g.scroll_pane = null; + g.scroll_lag = 0; defer g.decor.deinit(gpa); g.cell_w = 10; g.cell_h = 20; diff --git a/src/pdf_view.zig b/src/pdf_view.zig index 500f05f3..2a89ef01 100644 --- a/src/pdf_view.zig +++ b/src/pdf_view.zig @@ -2814,6 +2814,8 @@ pub fn draw( )); rail.thumb_y = @intCast(pos); rail.thumb_h = @intCast(@min(len, track_h -| pos)); + rail.thumb_at = @floatCast(state.document_scroll_y / @as(f64, @floatFromInt(total))); + rail.thumb_span = @as(f32, @floatFromInt(view.pixel_h)) / @as(f32, @floatFromInt(total)); s.fill(rail.rect.x, rail.rect.y, 1, rail.rect.h, .{ .bg = .{ .rgb = chrome.scroll_track } }); s.fill(rail.rect.x + 1, rail.rect.y, 1, rail.rect.h, .{ .bg = pane_bg }); s.fill(rail.rect.x, rail.rect.y + rail.thumb_y, 1, rail.thumb_h, .{ .bg = .{ .rgb = chrome.scroll_thumb } }); diff --git a/src/surface.zig b/src/surface.zig index f7cc6010..e67cf21c 100644 --- a/src/surface.zig +++ b/src/surface.zig @@ -368,6 +368,11 @@ pub const Region = struct { /// regions once render has returned. thumb_y: u16 = 0, thumb_h: u16 = 0, + /// The same thumb unrounded, for a pixel shell: its top and its length + /// as fractions of the track (the length before any minimum, so one + /// row of the content is `thumb_span / rect.h`). Zero when unmeasured. + thumb_at: f32 = 0, + thumb_span: f32 = 0, /// A notice's index in its pane's `notices`. notice: u8 = 0, /// How far it stands off the page, 0 to 1: a pane's while it has the -- cgit v1.3 From 1c6ebadde64b2e0f416550f9fc806dfc3c80b5c1 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Wed, 21 Oct 2026 21:42:33 -0300 Subject: GUI pointer: the desktop's cursor theme on Linux --- src/CHANGELOG.md | 4 ++++ src/gui/gui.zig | 15 +++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) (limited to 'src/gui/gui.zig') diff --git a/src/CHANGELOG.md b/src/CHANGELOG.md index 6f94b98f..6ebabb5b 100644 --- a/src/CHANGELOG.md +++ b/src/CHANGELOG.md @@ -36,6 +36,10 @@ pane's letter jumps straight to it. Ctrl-w h/j/k/l and SPC w h/j/k/l no longer move the focus at once; on a column or workspace tag Ctrl-w h/j/k/l still walk the tags. +- On Linux the GUI's pointer is the desktop's cursor theme (niri's or + XCURSOR_THEME's, at its size and scale): its default arrow, its hand + over a link, and its move cursor while a grip carries a pane, which + the plan9 theme draws as acme's box. Elsewhere acme's own bitmaps stay. - Built with Zig 0.17. A bare `zig build` still puts the binaries in `~/.local/bin`, now as a copy beside the prefix, which `--prefix` no diff --git a/src/gui/gui.zig b/src/gui/gui.zig index 2abf9166..46d2cc78 100644 --- a/src/gui/gui.zig +++ b/src/gui/gui.zig @@ -2367,12 +2367,23 @@ fn runNative(init: std.process.Init, opts_in: pardes.Options, attach: ?[]const u defer c.SDL_DestroyWindow(window); updateDisplayScale(window); if (native_wayland) log.info("Wayland opacity: background-only transparent surface", .{}); - const arrow_cursor = c.SDL_CreateCursor(&p9_arrow_set, &p9_arrow_mask, 16, 16, 1, 1); + // On Linux the desktop's own cursor theme draws them (the compositor's + // cursor-shape protocol, else XCURSOR_THEME), at its size and scale: + // the arrow is its default, acme's box its move, as the plan9 theme + // has them. Elsewhere acme's bitmaps, at 16 pixels. + const themed_cursors = builtin.os.tag == .linux; + const arrow_cursor = if (themed_cursors) + c.SDL_CreateSystemCursor(c.SDL_SYSTEM_CURSOR_DEFAULT) + else + c.SDL_CreateCursor(&p9_arrow_set, &p9_arrow_mask, 16, 16, 1, 1); defer if (arrow_cursor) |cursor| c.SDL_DestroyCursor(cursor); const link_cursor = c.SDL_CreateSystemCursor(c.SDL_SYSTEM_CURSOR_POINTER); defer if (link_cursor) |cursor| c.SDL_DestroyCursor(cursor); // Its hot spot the middle, as acme's {-7, -7} offset puts it. - const box_cursor = c.SDL_CreateCursor(&p9_box_set, &p9_box_mask, 16, 16, 7, 7); + const box_cursor = if (themed_cursors) + c.SDL_CreateSystemCursor(c.SDL_SYSTEM_CURSOR_MOVE) + else + c.SDL_CreateCursor(&p9_box_set, &p9_box_mask, 16, 16, 7, 7); defer if (box_cursor) |cursor| c.SDL_DestroyCursor(cursor); if (arrow_cursor) |cur| { _ = c.SDL_SetCursor(cur); -- cgit v1.3 From 7e9d2c4169245072265b483ffaa6aa05f23f08d3 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Wed, 21 Oct 2026 22:53:57 -0300 Subject: A terminal under a wrapper is where its foreground shell is, not where the wrapper stays A shell that re-execs itself under a wrapper (fish's `exec 9ns --mntgen -- fish` when NINE_MOUNT is unset) left /proc//cwd at the wrapper's first directory, so the pane never followed a cd and a relative path printed after one (fd's b/c.txt) looked up nothing. host_io.ttyCwd: while the forked process still runs the shell pardes started, its own directory, as before, so a job in another directory (a nested pardes, (cd sub && make)) never names the pane; once it is something else, the tty's foreground group's when that is the same shell, else no answer. Co-Authored-By: Claude Opus 5.5 --- src/CHANGELOG.md | 5 +++ src/detached/server.zig | 2 +- src/gui/gui.zig | 2 +- src/host_io.zig | 77 ++++++++++++++++++++++++++++++++++++++ src/macos.zig | 2 +- src/tty/tty.zig | 2 +- test/snapshots/look-fd-deep.golden | 30 +++++++++++++++ test/snapshots/look-fd-deep.snap | 34 +++++++++++++++++ 8 files changed, 150 insertions(+), 4 deletions(-) create mode 100644 test/snapshots/look-fd-deep.golden create mode 100644 test/snapshots/look-fd-deep.snap (limited to 'src/gui/gui.zig') diff --git a/src/CHANGELOG.md b/src/CHANGELOG.md index ab9432ef..24ee3b0e 100644 --- a/src/CHANGELOG.md +++ b/src/CHANGELOG.md @@ -13,6 +13,11 @@ Signatures use syntax colors; only calls to the queried function get background emphasis, and tree guides continue through multiline signatures and wrapped rows. Cross-directory call locations use shorter relative paths. +- A terminal follows the shell at its prompt (the tty's foreground group), + not the process pardes started: a shell that re-execs itself under a + wrapper (fish's `exec 9ns --mntgen -- fish`) no longer leaves the pane + in its first directory, where `b/c.txt` printed by `fd` after a `cd` + looked up nothing. - Workspace, column and pane tags share a tighter text inset. - A diff paged into a session (`git show | pardes -`) opens its `+Diff` alone; the `+Pager` no longer stays folded under it. diff --git a/src/detached/server.zig b/src/detached/server.zig index 41bc054f..d6a1f553 100644 --- a/src/detached/server.zig +++ b/src/detached/server.zig @@ -660,7 +660,7 @@ pub const Session = struct { for (&s.ptys, 0..) |*pt, pane| { if (pt.fd < 0) continue; var lbuf: [pardes.memory.limits.host_path_cap + 1]u8 = undefined; - if (host_io.shellCwd(pt.pid, &lbuf)) |cwd| s.core.setCwd(pane, cwd); + if (host_io.ttyCwd(pt.pid, pt.fd, s.core.settings.shell.effective.get(), &lbuf)) |cwd| s.core.setCwd(pane, cwd); } } diff --git a/src/gui/gui.zig b/src/gui/gui.zig index 46d2cc78..f9921111 100644 --- a/src/gui/gui.zig +++ b/src/gui/gui.zig @@ -4949,7 +4949,7 @@ fn pollCwds(core: *pardes.Pardes, ptys: *[pardes.MAX_PANES]?Pty) void { for (ptys, 0..) |slot, id| if (slot) |pt| { if (pt.fd < 0) continue; var lbuf: [pardes.memory.limits.host_path_cap + 1]u8 = undefined; - if (host_io.shellCwd(pt.pid, &lbuf)) |cwd| core.setCwd(id, cwd); + if (host_io.ttyCwd(pt.pid, pt.fd, core.settings.shell.effective.get(), &lbuf)) |cwd| core.setCwd(id, cwd); }; } diff --git a/src/host_io.zig b/src/host_io.zig index bef88172..c593551b 100644 --- a/src/host_io.zig +++ b/src/host_io.zig @@ -1795,6 +1795,83 @@ pub fn shellCwd(pid: libc.pid_t, buf: []u8) ?[]const u8 { } } +/// Where a terminal is. The process forked for it, while it still runs the +/// shell pardes started (`shell_exe`), as ever: a job it runs, in another +/// directory (`(cd sub && make)`, a nested pardes), never names the pane. +/// One that exec'd into something else is a wrapper whose own directory +/// never moves (fish's `exec 9ns --mntgen -- fish`): the shell is the +/// foreground group when that is the same shell, and while a job holds the +/// foreground there is no answer, the last one standing. +pub fn ttyCwd(shell_pid: libc.pid_t, master_fd: c_int, shell_exe: []const u8, buf: []u8) ?[]const u8 { + var exe_buf: [std.fs.max_path_bytes]u8 = undefined; + var shell_buf: [std.fs.max_path_bytes]u8 = undefined; + const shell = realShell(shell_exe, &shell_buf) orelse return shellCwd(shell_pid, buf); + const exe = procExe(shell_pid, &exe_buf) orelse return shellCwd(shell_pid, buf); + if (std.mem.eql(u8, exe, shell)) return shellCwd(shell_pid, buf); + const fg = tcgetpgrp(master_fd); + if (fg <= 0 or fg == shell_pid) return null; + const fg_exe = procExe(fg, &exe_buf) orelse return null; + return if (std.mem.eql(u8, fg_exe, shell)) shellCwd(fg, buf) else null; +} + +/// `shell_exe` as /proc//exe would read it: its links followed. +fn realShell(shell_exe: []const u8, buf: *[std.fs.max_path_bytes]u8) ?[]const u8 { + var z: [std.fs.max_path_bytes:0]u8 = undefined; + const path = std.fmt.bufPrintSentinel(&z, "{s}", .{shell_exe}, 0) catch return null; + const r = libc.realpath(path, buf) orelse return null; + return std.mem.span(@as([*:0]const u8, @ptrCast(r))); +} + +test "a terminal is where its shell is: under a wrapper the foreground shell, never a job's directory" { + if (comptime builtin.os.tag != .linux) return error.SkipZigTest; + if (!haveFile("/bin/sh") or !haveFile("/usr/bin/timeout")) return error.SkipZigTest; + const io = std.testing.io; + var tmp = std.testing.tmpDir(.{}); + defer tmp.cleanup(); + try tmp.dir.createDirPath(io, "start/a/b"); + var path_buf: [4096]u8 = undefined; + const start = path_buf[0..try tmp.dir.realPathFile(io, "start", &path_buf)]; + var inner_buf: [4096]u8 = undefined; + const inner = inner_buf[0..try tmp.dir.realPathFile(io, "start/a/b", &inner_buf)]; + const rcs: Shell.PromptFiles = .{}; + var result: [4096]u8 = undefined; + // A wrapper exec'd over the shell (timeout standing in for 9ns) runs + // another, two directories down, in the foreground. + { + const child = try forkShell(null, 0, &rcs, "/bin/sh", start, 24, 80, null); + defer { + _ = libc.kill(child.pid, libc.SIG.KILL); + _ = libc.waitpid(child.pid, null, 0); + _ = libc.close(child.file.handle); + } + var sh: TestShell = .{ .master = child.file.handle, .pid = child.pid }; + try std.testing.expect(writeFd(child.file.handle, "exec timeout --foreground 30 /bin/sh -c 'cd a/b && printf \"\\160ardes-in-\\n\" && exec /bin/sh -i'\n")); + try std.testing.expect(sh.waitText("pardes-in-", 5_000)); + // printf runs before the inner shell takes the foreground. + var tries: usize = 0; + while (ttyCwd(child.pid, child.file.handle, "/bin/sh", &result) == null and tries < 50) : (tries += 1) { + const ts: libc.timespec = .{ .sec = 0, .nsec = 20 * std.time.ns_per_ms }; + _ = libc.nanosleep(&ts, null); + } + try std.testing.expectEqualStrings(start, shellCwd(child.pid, &result) orelse return error.MissingCwd); + try std.testing.expectEqualStrings(inner, ttyCwd(child.pid, child.file.handle, "/bin/sh", &result) orelse return error.MissingCwd); + } + // A job of the shell's own, gone into a/b, leaves the pane where the + // shell is. + { + const child = try forkShell(null, 0, &rcs, "/bin/sh", start, 24, 80, null); + defer { + _ = libc.kill(child.pid, libc.SIG.KILL); + _ = libc.waitpid(child.pid, null, 0); + _ = libc.close(child.file.handle); + } + var sh: TestShell = .{ .master = child.file.handle, .pid = child.pid }; + try std.testing.expect(writeFd(child.file.handle, "set -m; (cd a/b && printf '\\160ardes-job\\n' && exec sleep 30)\n")); + try std.testing.expect(sh.waitText("pardes-job", 5_000)); + try std.testing.expectEqualStrings(start, ttyCwd(child.pid, child.file.handle, "/bin/sh", &result) orelse return error.MissingCwd); + } +} + test "shell cwd rejects truncation and preserves an owned child path longer than 1024 bytes" { if (comptime builtin.os.tag != .linux) return error.SkipZigTest; if (!haveFile("/bin/sh")) return error.SkipZigTest; diff --git a/src/macos.zig b/src/macos.zig index 21af41ae..50fa04fa 100644 --- a/src/macos.zig +++ b/src/macos.zig @@ -1110,7 +1110,7 @@ fn refreshCwds(ctx: ?*anyopaque) void { stale.* = false; const pt = st.ptys[id] orelse continue; var buf: [1024]u8 = undefined; - if (host_io.shellCwd(pt.pid, &buf)) |wd| st.core.setCwd(id, wd); + if (host_io.ttyCwd(pt.pid, pt.file.handle, st.core.settings.shell.effective.get(), &buf)) |wd| st.core.setCwd(id, wd); } } diff --git a/src/tty/tty.zig b/src/tty/tty.zig index 82cb40bd..4cd1bc9a 100644 --- a/src/tty/tty.zig +++ b/src/tty/tty.zig @@ -1737,7 +1737,7 @@ const Shell = struct { }; for (&s.ptys, 0..) |*slot, id| if (slot.*) |pt| { var lbuf: [pardes.memory.limits.host_path_cap + 1]u8 = undefined; - if (host_io.shellCwd(pt.pid, &lbuf)) |cwd| s.core.setCwd(id, cwd); + if (host_io.ttyCwd(pt.pid, pt.file.handle, s.core.settings.shell.effective.get(), &lbuf)) |cwd| s.core.setCwd(id, cwd); }; if (s.caps_pending and s.vx.queries_done.load(.unordered)) { diff --git a/test/snapshots/look-fd-deep.golden b/test/snapshots/look-fd-deep.golden new file mode 100644 index 00000000..c0e0c304 --- /dev/null +++ b/test/snapshots/look-fd-deep.golden @@ -0,0 +1,30 @@ +== snap listed grid=100x31 cursor=4,9 +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol +|$ /tmp/pardes-snap/look-fd-deep/cwd/a Tty+bash Save Mode Filter Collapse Del +| $ exec timeout --foreground 600 bash -i +| $ cd a && ls && fd +| b top.txt +| b/ +| b/c.txt +| top.txt +| $ +| +| +| +| +| +| +| +| +| +| +| +| /tmp/pardes-snap/look-fd-deep/cwd/+New Save Tty Collapse Del +| 1 +== snap fd-path-looked grid=100x31 cursor=7,11 +|10: /tmp/pardes-snap/look-fd-deep/cwd/a/b/c.txt Save Tty Collapse Del +|11: 1 deep-marker +== snap ls-name-looked grid=100x31 cursor=7,14 +|13: /tmp/pardes-snap/look-fd-deep/cwd/a/top.txt Save Tty Collapse Del +|14: 1 top-marker diff --git a/test/snapshots/look-fd-deep.snap b/test/snapshots/look-fd-deep.snap new file mode 100644 index 00000000..8df0aaaf --- /dev/null +++ b/test/snapshots/look-fd-deep.snap @@ -0,0 +1,34 @@ +# A shell run under a wrapper exec'd over the one pardes started, that +# stays where it started (fish's own `exec 9ns --mntgen -- fish`; timeout +# here): after a cd the pane is where the foreground shell is, not where +# the wrapper is. So a path fd prints two +# directories down (b/c.txt) and a name ls prints (top.txt) look from there. +# The fd path goes first: the file it opens sits in a/b, a directory that +# could not rescue the ls name after it. +dirmk a +dirmk a/b +file a/top.txt top-marker +file a/b/c.txt deep-marker +start 31 100 +wait 8000 $ +stable 700 20000 +text exec timeout --foreground 600 bash -i +key enter +stable 700 20000 +text cd a && ls && fd +key enter +wait 8000 c.txt +wait 8000 cwd/a Tty +stable 700 20000 +snap listed +press right 6 8 +release right 6 8 +wait 10000 deep-marker +stable 700 15000 +snap fd-path-looked +# the ls name, from the shell's directory +press right 8 6 +release right 8 6 +wait 10000 top-marker +stable 700 15000 +snap ls-name-looked -- cgit v1.3