From fd50bd971d6dea7eaaa4ee5436ba16b95fa25b30 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Sun, 20 Sep 2026 02:34:12 -0300 Subject: Serve Unix and TCP 9P through cloud9.serve's std.Io runner The hand-written poll loop for Unix/TCP listeners is replaced by cloud9.serve.Runner; requests are queued to the editor thread, which answers them under the connection lock on each frame and retries parked reads as before. QUIC keeps the poll path (its adapter is fd based). The detached server no longer loses a wake that lands between frames. The firmware path keeps driving the engine with push/step. cloud9 re-pinned. Co-Authored-By: Claude Fable 5.1 --- src/gui/gui.zig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/gui') diff --git a/src/gui/gui.zig b/src/gui/gui.zig index dbad10d4..27f3346c 100644 --- a/src/gui/gui.zig +++ b/src/gui/gui.zig @@ -2382,7 +2382,7 @@ fn localSession( inotify_fd = -1; }; var watches: file_watch.Table = @splat(null); - var fs = ninep_io.start(gpa, core); + var fs = ninep_io.start(io, gpa, core); defer if (fs) |f| f.deinit(gpa); var shell: Shell = .{ @@ -2412,7 +2412,7 @@ fn localSession( watch_stop = try stopPipe(); watch_reader = try std.Thread.spawn(.{}, watchThread, .{ inotify_fd, watch_stop[0], &queue }); } - if (fs) |f| try f.wakeThread(&queue, wakeFs); + if (fs) |f| try f.watch(&queue, wakeFs); _ = c.SDL_StartTextInput(g.window); @@ -2680,7 +2680,7 @@ fn runGrid(init: std.process.Init, opts_in: pardes.Options) !void { var pipe_tasks: PipeTasks = .{}; defer pipe_tasks.cancelAll(io); var watches: file_watch.Table = @splat(null); - const fs = ninep_io.start(gpa, core); + const fs = ninep_io.start(io, gpa, core); defer if (fs) |f| f.deinit(gpa); var shell: Shell = .{ .core = core, -- cgit v1.3 From 44ce573e15c773cf5bb0d42941a143b63e44d900 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Mon, 21 Sep 2026 14:55:53 -0300 Subject: Make the macOS shell a first-class host MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pty children are exec'd with their own TERM/COLORTERM/TERM_PROGRAM instead of inheriting a .app launch's empty environment, and ttyTaken finally answers on darwin — libproc walks the tty's foreground process group — so Escape reaches the child and Exec stops believing every pane sits at its prompt. The occupancy suite runs on both platforms now. The workspace tag row moves into the native menu bar as a Builtins menu. -Dworkspace-tag (default off for -Dplatform=macos, on everywhere else) drives it, and Pardes.topBarHeight replaces the TOPBAR_H constant so the core stops reserving the row. The view pins every variable-font axis to the file's own default (Maple Mono came up Thin otherwise), shapes ligatures, carries per-shape pointer cursors, and draws the look-hover affordance as refracted glass. Tag rows fill edge to edge, with the anchor box painted back on top of that fill and its mode glyph centred on the same square. Theme accents re-saturated across the set. Co-Authored-By: Claude Opus 5 (1M context) --- build.zig | 8 + docs/config.md | 1 + docs/macos.md | 38 +++- src/CHANGELOG.md | 12 ++ src/config.zig | 15 ++ src/gui/gui.zig | 22 +- src/host_io.zig | 320 +++++++++++++++++++++++++--- src/layout.zig | 8 +- src/macos.zig | 58 ++++-- src/macos/Sources/AppDelegate.swift | 18 +- src/macos/Sources/PardesView.swift | 406 +++++++++++++++++++++++++++++++++--- src/macos/pardes.h | 12 +- src/pardes.zig | 149 ++++++++----- src/themes/acme.zig | 8 +- src/themes/atelier.zig | 32 +-- src/themes/clay.zig | 32 +-- src/themes/dark.zig | 12 +- src/themes/daybreak.zig | 28 +-- src/themes/dusk.zig | 32 +-- src/themes/forge.zig | 28 +-- src/themes/forge_black.zig | 28 +-- src/themes/forge_soft.zig | 28 +-- src/themes/harvest.zig | 32 +-- src/themes/helix.zig | 6 +- src/themes/ink.zig | 18 +- src/themes/lagoon.zig | 24 +-- src/themes/orchard.zig | 32 +-- src/themes/orchard_black.zig | 32 +-- src/themes/paper.zig | 32 +-- src/themes/solarium.zig | 32 +-- src/themes/spectrum.zig | 22 +- src/web.zig | 2 +- test/macos_e2e.swift | 10 +- 33 files changed, 1160 insertions(+), 377 deletions(-) (limited to 'src/gui') diff --git a/build.zig b/build.zig index 6734d9b0..0cd7f312 100644 --- a/build.zig +++ b/build.zig @@ -301,6 +301,9 @@ pub fn build(b: *std.Build) void { const esp32p4_cols = b.option(u16, "esp32p4-cols", "the board's grid width in cells (-Dplatform=esp32p4 only)") orelse 56; const esp32p4_rows = b.option(u16, "esp32p4-rows", "the board's grid height in cells (-Dplatform=esp32p4 only)") orelse 14; const theme_animation = b.option(bool, "theme-animation", "animate chrome colors across a theme change (default: off for esp32p4)"); + // The macOS shell carries the workspace tag row's commands in its native + // menu bar; the row itself goes away. `-Dworkspace-tag=true` puts it back. + const workspace_tag = b.option(bool, "workspace-tag", "draw the workspace tag row (default: on except on macOS, whose menu bar carries its commands)"); const shell_cfg: ShellConfig = .{ .tree_sitter_grammars = tree_sitter_grammars, .tracy = tracy != null, @@ -309,6 +312,7 @@ pub fn build(b: *std.Build) void { .esp32p4_cols = esp32p4_cols, .esp32p4_rows = esp32p4_rows, .theme_animation = theme_animation, + .workspace_tag = workspace_tag, .prebuilt_shaders = prebuilt_shaders, .embed_sources = embed_sources, .zig_lib_dir = b.graph.zig_lib_directory.path orelse "", @@ -1434,6 +1438,9 @@ const ShellConfig = struct { /// null = "the platform's own default", resolved per shell below, because /// the default is off for the board and on everywhere else. theme_animation: ?bool, + /// null = "the platform's own default": the macOS shell hands the row to + /// its native menu bar, every other shell keeps the acme topbar. + workspace_tag: ?bool, prebuilt_shaders: bool, embed_sources: bool, zig_lib_dir: []const u8, @@ -1452,6 +1459,7 @@ fn shellOptions(b: *std.Build, cfg: ShellConfig, platform: Platform) *std.Build. o.addOption(bool, "mupdf", cfg.mupdf); o.addOption(u16, "esp32p4_cols", cfg.esp32p4_cols); o.addOption(u16, "esp32p4_rows", cfg.esp32p4_rows); + o.addOption(bool, "workspace_tag", cfg.workspace_tag orelse (platform != .macos)); o.addOption(bool, "theme_animation", cfg.theme_animation orelse (platform != .esp32p4)); // Meaningful only for the SDL shell. Keeping the platform condition here // prevents Config/EffectCode from describing tty/macOS/web as "prebuilt". diff --git a/docs/config.md b/docs/config.md index a55aef1c..a229830b 100644 --- a/docs/config.md +++ b/docs/config.md @@ -538,6 +538,7 @@ including the standard `-Dtarget` and `-Doptimize` options. | `-Djpx` | bool | `true` — JPEG 2000, and with it scanned PDFs | | `-Dtree-sitter` | `disabled`, `zig`, `minimal`, `full` | `full` natively, `zig` for web, `disabled` for esp32p4 | | `-Dtheme-animation` | bool | on everywhere except `-Dplatform=esp32p4` | +| `-Dworkspace-tag` | bool; draw the workspace tag row — the macOS shell hands its commands to the native menu bar instead | on except on `-Dplatform=macos` | | `-Dprebuilt-shaders` | bool | on for a bare `zig build`, off when `-Dplatform` names a shell | | `-Dtracy` | path to a Tracy source checkout | off | | `-Dmacos-identity` | codesigning identity for `pardes.app` | `-` (ad-hoc) | diff --git a/docs/macos.md b/docs/macos.md index 9190ca67..e104d3a6 100644 --- a/docs/macos.md +++ b/docs/macos.md @@ -369,6 +369,14 @@ second spelling of builtins — `AppDelegate` calls `run("New")`, `run("Save")`, `run("Help")`, `run("Tutor")` — and the items with no builtin behind them are left out rather than stubbed. +The workspace tag row — the topmost tagline, the one carrying `Newcol Joincol +Find Grep …` — is not drawn on this shell. `-Dworkspace-tag` (default off for +`-Dplatform=macos`, on everywhere else) hands the row to the menu bar: the +core stops reserving the row (`Pardes.topBarHeight`), the grid starts at the +column tags, and the row's commands live in a **Builtins** menu instead. The +items are the tag's own words, spelled exactly as a tag Exec would type them, +and nothing in that menu is editable — it is the tag's buttons, not the tag: + | menu | item | chord | what it does | |---|---|---|---| | pardes | About pardes | — | AppKit's panel | @@ -378,6 +386,7 @@ left out rather than stubbed. | | New | ⌘N | the `New` builtin | | | Save | ⌘S | the `Save` builtin | | | Close Window | ⌘W | AppKit; the app terminates after the last one | +| Builtins | Newcol / Joincol / Find / Grep / Changelog / Dump / NextColor / Debug / Kill | — | the workspace tag's own builtins, `run(word)` | | Edit | Paste | ⌘V | the view's own paste path, not a second one | | View | Zoom In / Zoom Out / Actual Size | ⌘= / ⌘- / ⌘0 | point size, host-side | | Window | Minimize / Zoom | ⌘M / — | AppKit | @@ -455,6 +464,32 @@ Nested launches use the same inherited 9P address and pane serial as other native hosts. They do not inspect ancestor processes or executable names. See [the control filesystem](fs.md) for paths and transports. +Two more things this host cannot inherit from its launcher, because a `.app` +has none: + +- **The terminal's identity.** `host_io.ChildEnv` writes `TERM`, `COLORTERM` + and `TERM_PROGRAM` over whatever the environment carried and the child is + `execve`'d with that array — built before the fork, because a `setenv` + between fork and exec can deadlock on the heap a pty reader thread was + holding. Every pane is emulated by the bundled VT, so the value describes + pardes and never the terminal pardes was started from; `-Dplatform=gui` and + the tty shell take the same path, where the difference is only that their + launcher usually happened to set something. The names come from + `config.child_term` / `child_colorterm` / `child_term_program`, and `TERM` + is deliberately `xterm-256color` rather than a name with no installed + terminfo entry — `clear`, colour and cursor addressing all resolve through + that lookup. +- **Whether a program has the terminal.** `host_io.ttyTaken` is what + `Pardes.takesCommandLine` asks before deciding that Escape is the `Last` + builtin rather than a keystroke for the child, and what `Exec` asks before + believing a pane is at its prompt. Linux descends `/proc//task// + children`; darwin has neither that nor a children list, so it enumerates the + tty's foreground process group with `proc_listpids(PROC_PGRP_ONLY)` and + compares each member's `proc_pidpath` against the shell's own. A nested + interactive shell is therefore still a prompt, and `bash -c 'sleep 30'` is + still taken — the wrapper wears the shell's binary, but `sleep` shares its + group. The occupancy suite in `src/host_io.zig` runs on both platforms. + ## Fonts and zoom The face is the shell's business and the size is the window's, so the two are @@ -1109,9 +1144,6 @@ used for the table and is not folded into the direct-path claim. says nothing either. Wiring it up means a unix-socket frontend loop beside the AppKit one, which is `src/detached/client.zig`'s job in the tty and SDL shells; see `docs/detached.md`. -- **`tty_taken` on darwin.** The pull is wired (`ttyTaken`, `src/macos.zig:1838`) - but `look.ttyTaken` has no libproc implementation and answers `false`, so an - `Exec` here always believes the pane is still at the prompt it forked. - **IME and marked text.** Only finished characters reach `pardes_key`, so a dead key composes nothing and Option is Alt rather than a compose modifier. Real composition means implementing `NSTextInputClient` *and* giving the core diff --git a/src/CHANGELOG.md b/src/CHANGELOG.md index 18bcceb9..e518f97a 100644 --- a/src/CHANGELOG.md +++ b/src/CHANGELOG.md @@ -2,6 +2,18 @@ ## 0.0.3 +- Give pty children their own terminal identity. `TERM`, `COLORTERM` and + `TERM_PROGRAM` are now written by pardes rather than inherited from whatever + launched it, and the child is exec'd with that environment. A macOS `.app` + launch supplies no `TERM` at all, so until now `clear` failed, nothing + painted a colour, and every cursor-addressing program fell back to printing + lines. +- Answer tty occupancy on macOS. `ttyTaken` had no darwin implementation and + said `false` for every pane, which made `Pardes.takesCommandLine` permanently + true: a bare Escape in a raw terminal ran the `Last` builtin instead of + reaching the child, and `Exec` always believed the pane sat at its prompt. + libproc answers it from the tty's foreground process group, and the + occupancy suite now runs on both platforms instead of only Linux. - Flatten the 9P control tree: `self/` is gone, so `/index`, `/pane//`, `/screen` and `/os` sit at the root. `/new` is one clone file (reading it makes a pane and answers its serial), `/ctl` takes `look TEXT` and diff --git a/src/config.zig b/src/config.zig index 440549b3..da23f51f 100644 --- a/src/config.zig +++ b/src/config.zig @@ -222,6 +222,17 @@ pub const tty_blank: enum { prompt, prompt_and_input } = .prompt; // Projected colors below this contrast use the theme's more legible anchor. pub const tty_filter_min_contrast: f64 = 1.5; +// What a pty child is told it is talking to. Every pane is emulated by the +// bundled VT, so this describes pardes and never the terminal pardes itself +// was launched from — the child inherits the launcher's TERM otherwise, which +// under a macOS .app launch is no TERM at all, and `clear`, colour and every +// cursor-addressing program fail at the terminfo lookup. There is no installed +// `xterm-ghostty` entry to name, and a name with no entry is worse than a +// conservative one that every system ships. +pub const child_term = "xterm-256color"; +pub const child_colorterm = "truecolor"; +pub const child_term_program = "pardes"; + pub const topbar_str = "Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill"; pub const pane_builtins_str = "Tty Del Collapse"; @@ -538,6 +549,10 @@ pub const Runtime = struct { tree_context_tag_style: bool = true, debug: bool = false, focus_tint: bool = true, + /// The workspace tag row. Native shells with their own chrome (the macOS + /// menu bar) turn it off and carry its commands there instead; the core + /// keeps the row as the acme tradition everywhere else. + workspace_tag: bool = true, column_tags: bool = true, syntax_bold: bool = false, window_opacity: u8 = 100, diff --git a/src/gui/gui.zig b/src/gui/gui.zig index 27f3346c..d871e55e 100644 --- a/src/gui/gui.zig +++ b/src/gui/gui.zig @@ -5290,10 +5290,12 @@ test "tagline bands face the topbar rule and Tagbottom faces the window edge" { const canvas_h: f32 = 200; const border = topbarPaneBorderPixels(cell_h, tagline_h); try std.testing.expectEqual(@as(u32, 1), border); - try std.testing.expectEqual(@as(u32, 4), taglineBandOffset(0, canvas_h, cell_h, tagline_h)); - try std.testing.expectEqual(@as(u32, 1), taglineBandOffset(1, canvas_h, cell_h, tagline_h)); - try std.testing.expectEqual(@as(u32, 2), taglineBandOffset(5, canvas_h, cell_h, tagline_h)); - try std.testing.expectEqual(@as(u32, 4), taglineBandOffset(9, canvas_h, cell_h, tagline_h)); + try std.testing.expectEqual(@as(u32, 4), taglineBandOffset(0, canvas_h, cell_h, tagline_h, true)); + try std.testing.expectEqual(@as(u32, 2), taglineBandOffset(0, canvas_h, cell_h, tagline_h, false)); + try std.testing.expectEqual(@as(u32, 1), taglineBandOffset(1, canvas_h, cell_h, tagline_h, true)); + try std.testing.expectEqual(@as(u32, 2), taglineBandOffset(1, canvas_h, cell_h, tagline_h, false)); + try std.testing.expectEqual(@as(u32, 2), taglineBandOffset(5, canvas_h, cell_h, tagline_h, true)); + try std.testing.expectEqual(@as(u32, 4), taglineBandOffset(9, canvas_h, cell_h, tagline_h, true)); } fn resolveCell(g: *Gui, cell: *const pardes.Cell, role: pardes.FontRole, is_cursor: bool, page: Ground) ResolvedCell { @@ -5486,7 +5488,7 @@ fn emitBodyLayer(g: *Gui, instances: [*]CellInstance, next: *u32, layer: *const if (left + @as(f32, @floatFromInt(col)) * width >= right) break; const cell = &layer.cells[index * layer.cols + col]; const cursor = if (layer.cursor) |cu| show_cursor and !cu.bar and cu.x == col and cu.y == row else false; - const glyph_top = top - (if (header) @as(f32, @floatFromInt(taglineBandOffset(0, win_h, g.cell_h, g.tagline_height))) else 0); + const glyph_top = top - (if (header) @as(f32, @floatFromInt(taglineBandOffset(0, win_h, g.cell_h, g.tagline_height, true))) else 0); emitInstance(g, instances, next.*, 0, 0, .{ .w = width, .h = height, .x_off = left + @as(f32, @floatFromInt(col)) * width, .y_off = glyph_top }, win_w, win_h, track, role, cell, old_layer, cursor, page); clipBodyInstance(&instances[next.*], bottom, win_h); clipInstanceRight(&instances[next.*], right, win_w); @@ -5638,7 +5640,7 @@ fn emitInstance( else layout.h; const band_offset: f32 = if (resolved.role == .tagline) - @floatFromInt(taglineBandOffset(row, win_h, g.cell_h, g.tagline_height)) + @floatFromInt(taglineBandOffset(row, win_h, g.cell_h, g.tagline_height, true)) else 0; const py0 = layout.y_off + @as(f32, @floatFromInt(row)) * layout.h + band_offset; @@ -6448,7 +6450,7 @@ fn addCursorBar( const x0 = layout.x_off + @as(f32, @floatFromInt(x)) * layout.w; const height = std.math.clamp(visual_height, 1.0, layout.h); const y0 = layout.y_off + @as(f32, @floatFromInt(y)) * layout.h + - @as(f32, @floatFromInt(taglineBandOffset(y, builder.win_h, @intFromFloat(layout.h), @intFromFloat(height)))); + @as(f32, @floatFromInt(taglineBandOffset(y, builder.win_h, @intFromFloat(layout.h), @intFromFloat(height), true))); builder.addRect( x0, y0, @@ -6548,7 +6550,7 @@ fn buildOverlay( const right = left + @as(f32, @floatFromInt(layer.viewport.w)) * layout.w; const x = left + @as(f32, @floatFromInt(cursor.col)) * width; if (x >= right) continue; - const top = @as(f32, @floatFromInt(layer.viewport.y)) * layout.h + @as(f32, @floatFromInt(taglineBandOffset(layer.viewport.y, builder.win_h, g.cell_h, g.tagline_height))); + const top = @as(f32, @floatFromInt(layer.viewport.y)) * layout.h + @as(f32, @floatFromInt(taglineBandOffset(layer.viewport.y, builder.win_h, g.cell_h, g.tagline_height, true))); builder.addRect(x, top, @min(right, x + @max(1, width / 8)), top + @as(f32, @floatFromInt(g.tagline_height)), overlayRgb(cursorColor(core, &layer.cells[cursor.col], .tagline))); }; if (transient_on) appendTouchOverlay(g, &builder, debug_on); @@ -6569,7 +6571,7 @@ fn appendWorkspacePet(g: *Gui, core: ?*const pardes.Pardes, surface: *const pard if (cellCodepoint(cell) != ' ') occupied = i + 1; } const editing = p.topbar_col != null and p.header_column == null; - const band_top: f32 = @floatFromInt(taglineBandOffset(0, builder.win_h, g.cell_h, g.tagline_height)); + const band_top: f32 = @floatFromInt(taglineBandOffset(0, builder.win_h, g.cell_h, g.tagline_height, true)); const region = if (occupied >= surface.cols) null else pet.lane( occupied, @floatFromInt(g.tagline_width), @@ -6741,7 +6743,7 @@ fn appendTagGrips(g: *const Gui, surface: *const pardes.Surface, layout: CellLay else => continue, }; const center_x = (@as(f32, @floatFromInt(x)) + @as(f32, @floatFromInt(config.GUTTER)) / 2) * layout.w; - const center_y = @as(f32, @floatFromInt(y)) * layout.h + @as(f32, @floatFromInt(taglineBandOffset(y, builder.win_h, g.cell_h, g.tagline_height))) + @as(f32, @floatFromInt(g.tagline_height)) / 2; + const center_y = @as(f32, @floatFromInt(y)) * layout.h + @as(f32, @floatFromInt(taglineBandOffset(y, builder.win_h, g.cell_h, g.tagline_height, true))) + @as(f32, @floatFromInt(g.tagline_height)) / 2; const half_w = @max(1, @min(3, layout.w - 2)); builder.addRect(@floor(center_x - half_w), @floor(center_y - 2), @floor(center_x + half_w), @floor(center_y - 1), overlayRgb(rgb)); builder.addRect(@floor(center_x - half_w), @floor(center_y + 1), @floor(center_x + half_w), @floor(center_y + 2), overlayRgb(rgb)); diff --git a/src/host_io.zig b/src/host_io.zig index 212c23b4..55592957 100644 --- a/src/host_io.zig +++ b/src/host_io.zig @@ -837,6 +837,7 @@ pub const Shell = struct { extern "c" fn forkpty(amaster: *c_int, name: ?[*:0]u8, termp: ?*const anyopaque, winp: ?*const posix.winsize) c_int; extern "c" fn execv(path: [*:0]const u8, argv: [*:null]const ?[*:0]const u8) c_int; +extern "c" fn execve(path: [*:0]const u8, argv: [*:null]const ?[*:0]const u8, envp: [*:null]const ?[*:0]const u8) c_int; extern "c" fn chdir(path: [*:0]const u8) c_int; extern "c" fn _exit(status: c_int) noreturn; @@ -845,6 +846,100 @@ pub const Child = struct { pid: posix.pid_t, }; +/// The environment a pty child is handed: everything this process carries, +/// with the terminal's own identity written over whatever the launcher left +/// behind. The child is talking to the bundled VT, never to the terminal +/// pardes itself was started from, and a macOS `.app` launch supplies no +/// `TERM` at all — which is exactly why `clear` fails there, why nothing +/// paints a colour, and why every cursor-addressing program falls back to a +/// dumb line-at-a-time mode. +pub const ChildEnv = struct { + /// Entries pardes owns. The name of each is read back out of its own + /// spelling, so there is one place to edit and no second list to drift. + const own = [_][*:0]const u8{ + "TERM=" ++ pardes.config.child_term, + "COLORTERM=" ++ pardes.config.child_colorterm, + "TERM_PROGRAM=" ++ pardes.config.child_term_program, + }; + + /// Wide enough for any real environment; `build` answers null rather than + /// truncate, because a child missing half its variables is a worse bug + /// than one missing TERM, and the caller then execs with `environ` intact. + pub const Slots = [1024]?[*:0]const u8; + + fn name(entry: [*:0]const u8) []const u8 { + const line = std.mem.span(entry); + return line[0 .. std.mem.indexOfScalar(u8, line, '=') orelse line.len]; + } + + pub fn build(slots: *Slots) ?[*:null]const ?[*:0]const u8 { + var n: usize = 0; + var i: usize = 0; + while (libc.environ[i]) |entry| : (i += 1) { + const inherited = name(entry); + const shadowed = for (own) |mine| { + if (std.mem.eql(u8, inherited, name(mine))) break true; + } else false; + if (shadowed) continue; + if (n + own.len + 1 > slots.len) return null; + slots[n] = entry; + n += 1; + } + for (own) |mine| { + slots[n] = mine; + n += 1; + } + slots[n] = null; + return @ptrCast(slots); + } +}; + +test "the child environment replaces the launcher's terminal identity exactly once" { + const saved: ?[]const u8 = if (libc.getenv("TERM")) |t| std.mem.span(t) else null; + var saved_buf: [256]u8 = undefined; + const restore: ?[:0]const u8 = if (saved) |t| blk: { + if (t.len >= saved_buf.len) break :blk null; + @memcpy(saved_buf[0..t.len], t); + saved_buf[t.len] = 0; + break :blk saved_buf[0..t.len :0]; + } else null; + defer if (restore) |t| { + _ = Shell.setenv("TERM", t.ptr, 1); + } else { + _ = unsetenv("TERM"); + }; + + // A launcher TERM must be shadowed rather than duplicated, and the rest of + // the environment must arrive untouched. + try std.testing.expectEqual(@as(c_int, 0), Shell.setenv("TERM", "dumb", 1)); + try std.testing.expectEqual(@as(c_int, 0), Shell.setenv("PARDES_CHILD_ENV_PROBE", "1", 1)); + defer _ = unsetenv("PARDES_CHILD_ENV_PROBE"); + + var slots: ChildEnv.Slots = undefined; + const envp = ChildEnv.build(&slots) orelse return error.EnvironmentTooLarge; + var terms: usize = 0; + var colorterms: usize = 0; + var probes: usize = 0; + var dumb = false; + var i: usize = 0; + while (envp[i]) |entry| : (i += 1) { + const line = std.mem.span(entry); + if (std.mem.startsWith(u8, line, "TERM=")) terms += 1; + if (std.mem.startsWith(u8, line, "COLORTERM=")) colorterms += 1; + if (std.mem.eql(u8, line, "TERM=dumb")) dumb = true; + if (std.mem.eql(u8, line, "PARDES_CHILD_ENV_PROBE=1")) probes += 1; + } + try std.testing.expectEqual(@as(usize, 1), terms); + try std.testing.expectEqual(@as(usize, 1), colorterms); + try std.testing.expectEqual(@as(usize, 1), probes); + try std.testing.expect(!dumb); + // TERM_PROGRAM shares the prefix "TERM"; the match is on the name, so it + // is a separate entry and never a second TERM. + try std.testing.expectEqualStrings("TERM=" ++ pardes.config.child_term, std.mem.span(envp[i - ChildEnv.own.len].?)); +} + +extern "c" fn unsetenv(name: [*:0]const u8) c_int; + pub fn forkShell( core: ?*pardes.Pardes, pane: usize, @@ -888,6 +983,11 @@ pub fn forkShell( try @import("linux/v9fs.zig").writeLaunchCommand(&command.writer, path, std.mem.span(socket), &spawn.argv); if (!try pardes.panes.Terminal.queuePendingCommand(pn, command.written())) return error.ShellAlreadyStarted; } + // Built here and not after the fork: between fork and exec the child may + // not call setenv, whose malloc can deadlock against a pty reader thread + // that held the heap when the fork took its snapshot. + var env_slots: ChildEnv.Slots = undefined; + const envp = ChildEnv.build(&env_slots); const ws = posix.winsize{ .row = rows, .col = cols, .xpixel = 0, .ypixel = 0 }; const pid = forkpty(&master, null, null, &ws); if (pid < 0) return error.ForkFailed; @@ -896,6 +996,7 @@ pub fn forkShell( posix.sigaddset(&set, posix.SIG.WINCH); posix.sigprocmask(posix.SIG.UNBLOCK, &set, null); if (cwd_z) |path| if (chdir(path.ptr) != 0) _exit(126); + if (envp) |env| _ = execve(spawn.path, &spawn.argv, env); _ = execv(spawn.path, &spawn.argv); _exit(127); } @@ -925,6 +1026,42 @@ test "shell spawn rejects invalid directories before creating a child" { try std.testing.expectError(error.FileNotFound, forkShell(null, 0, &rcs, "/bin/sh", missing, 24, 80, null)); } +test "a forked shell is told which terminal it is talking to" { + if (!haveFile("/bin/sh")) return error.SkipZigTest; + // Whatever launched the test is the wrong answer, so make it a loud one. + const saved = libc.getenv("TERM"); + var saved_buf: [256]u8 = undefined; + const restore: ?[:0]const u8 = if (saved) |t| blk: { + const span = std.mem.span(t); + if (span.len >= saved_buf.len) break :blk null; + @memcpy(saved_buf[0..span.len], span); + saved_buf[span.len] = 0; + break :blk saved_buf[0..span.len :0]; + } else null; + defer if (restore) |t| { + _ = Shell.setenv("TERM", t.ptr, 1); + } else { + _ = unsetenv("TERM"); + }; + _ = Shell.setenv("TERM", "dumb", 1); + + const rcs: Shell.PromptFiles = .{}; + const child = try forkShell(null, 0, &rcs, "/bin/sh", "", 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 }; + // The echoed command carries the unexpanded `$TERM`, so only the shell's + // own expansion can match this. + try std.testing.expect(writeFd(child.file.handle, "printf '\nPARDES-TERM:%s:%s\n' \"$TERM\" \"$COLORTERM\"; exit\n")); + try std.testing.expect(sh.waitText( + "PARDES-TERM:" ++ pardes.config.child_term ++ ":" ++ pardes.config.child_colorterm, + 5_000, + )); +} + test "shell spawn uses an explicit OS directory longer than 256 bytes" { if (!haveFile("/bin/sh")) return error.SkipZigTest; var tmp = std.testing.tmpDir(.{}); @@ -1031,6 +1168,14 @@ extern "c" fn tcgetpgrp(fd: c_int) libc.pid_t; const occ_max_depth: u8 = 8; const occ_max_visited: usize = 32; +/// Where `ttyTaken` answers from evidence rather than from `false`. The two +/// implementations are different walks over the same question, so they share +/// one suite rather than each asserting half of it. +const tty_probe_platform = switch (builtin.os.tag) { + .linux, .macos => true, + else => false, +}; + const TtyProbe = struct { self_exe: [std.fs.max_path_bytes]u8 = undefined, exe: [std.fs.max_path_bytes]u8 = undefined, @@ -1085,10 +1230,94 @@ pub fn ttyTaken(shell_pid: libc.pid_t, master_fd: c_int) bool { } return !saw_fg; }, + .macos => { + const fg = tcgetpgrp(master_fd); + if (fg <= 0) return false; + if (fg == shell_pid) return false; + return darwin.taken(shell_pid, fg); + }, else => return false, } } +/// The same question the Linux walk asks, answered the way macOS can answer +/// it. There is no /proc to descend and no children list, but the tty's +/// foreground process group can be enumerated in one call — and "is anything +/// but the shell itself holding this terminal?" is exactly a statement about +/// the executables in that group. The test is the shell's own executable and +/// never its pid, which is what keeps a nested interactive shell a prompt, +/// and what still catches `bash -c 'sleep 30'`: the group holds `sleep` too. +/// +/// Until this existed, `ttyTaken` answered `false` on darwin for every pane, +/// so `Pardes.takesCommandLine` was permanently true and every bare Escape in +/// a raw terminal ran the `Last` builtin instead of reaching the child. +const darwin = struct { + const proc_pgrp_only: u32 = 2; + const proc_pidt_shortbsdinfo: c_int = 13; + const zombie_status: u32 = 5; // SZOMB + /// PROC_PIDPATHINFO_MAXSIZE. + const path_max = 4 * 1024; + /// A foreground group is a pipeline; anything larger is not a prompt. + const group_max = 64; + + const ShortBsdInfo = extern struct { + pid: u32, + ppid: u32, + pgid: u32, + status: u32, + comm: [16]u8, + flags: u32, + uid: u32, + gid: u32, + ruid: u32, + rgid: u32, + svuid: u32, + svgid: u32, + rfu: u32, + }; + + extern "c" fn proc_listpids(kind: u32, typeinfo: u32, buffer: ?*anyopaque, buffersize: c_int) c_int; + extern "c" fn proc_pidpath(pid: c_int, buffer: [*]u8, buffersize: u32) c_int; + + fn exe(pid: libc.pid_t, buf: *[path_max]u8) ?[]const u8 { + const got = proc_pidpath(pid, buf, buf.len); + if (got <= 0) return null; + return buf[0..@intCast(got)]; + } + + /// A pid with no readable path is either gone or not ours. Only a zombie + /// is provably harmless — it holds no tty — so everything else is taken. + fn zombie(pid: libc.pid_t) bool { + var info: ShortBsdInfo = undefined; + const got = proc_pidinfo(pid, proc_pidt_shortbsdinfo, 0, &info, @sizeOf(ShortBsdInfo)); + if (got != @sizeOf(ShortBsdInfo)) return false; + return info.status == zombie_status; + } + + fn taken(shell_pid: libc.pid_t, fg: libc.pid_t) bool { + var shell_buf: [path_max]u8 = undefined; + const shell_exe = exe(shell_pid, &shell_buf) orelse return false; + var group: [group_max]libc.pid_t = undefined; + const bytes = proc_listpids(proc_pgrp_only, @intCast(fg), &group, @sizeOf(@TypeOf(group))); + // An empty group is a group whose last member just exited: the shell + // is about to have its terminal back, and calling that taken would + // blink the prompt heuristic off for a frame every time a job ends. + if (bytes <= 0) return false; + const n = @as(usize, @intCast(bytes)) / @sizeOf(libc.pid_t); + if (n >= group.len) return true; + var exe_buf: [path_max]u8 = undefined; + for (group[0..n]) |pid| { + if (pid <= 0 or pid == shell_pid) continue; + const path = exe(pid, &exe_buf) orelse { + if (zombie(pid)) continue; + return true; + }; + if (!std.mem.eql(u8, path, shell_exe)) return true; + } + return false; + } +}; + pub fn signalTty(shell_pid: libc.pid_t, master_fd: c_int, which: pardes.PtySignal) void { const sig = switch (which) { .int => libc.SIG.INT, @@ -1329,23 +1558,33 @@ const TestShell = struct { } fn stop(sh: *TestShell) void { - var probe: TtyProbe = undefined; - var pending: usize = 0; - var doomed: [occ_max_visited]libc.pid_t = undefined; - var n: usize = 0; - _ = pushChildren(&probe, &pending, sh.pid, 1); - while (pending > 0) { - pending -= 1; - const node = probe.pending[pending]; - if (n == doomed.len) break; - doomed[n] = node.pid; - n += 1; - if (node.depth < occ_max_depth) _ = pushChildren(&probe, &pending, node.pid, node.depth + 1); - } - _ = libc.kill(sh.pid, libc.SIG.KILL); - for (doomed[0..n]) |kid| { - _ = libc.kill(kid, libc.SIG.KILL); - _ = libc.kill(-kid, libc.SIG.KILL); + if (comptime builtin.os.tag == .linux) { + var probe: TtyProbe = undefined; + var pending: usize = 0; + var doomed: [occ_max_visited]libc.pid_t = undefined; + var n: usize = 0; + _ = pushChildren(&probe, &pending, sh.pid, 1); + while (pending > 0) { + pending -= 1; + const node = probe.pending[pending]; + if (n == doomed.len) break; + doomed[n] = node.pid; + n += 1; + if (node.depth < occ_max_depth) _ = pushChildren(&probe, &pending, node.pid, node.depth + 1); + } + _ = libc.kill(sh.pid, libc.SIG.KILL); + for (doomed[0..n]) |kid| { + _ = libc.kill(kid, libc.SIG.KILL); + _ = libc.kill(-kid, libc.SIG.KILL); + } + } else { + // No children list to descend. forkpty made the shell a session + // leader, so its own group plus whichever group currently holds + // the tty covers the job the test left running. + const fg = tcgetpgrp(sh.master); + if (fg > 0 and fg != sh.pid) _ = libc.kill(-fg, libc.SIG.KILL); + _ = libc.kill(-sh.pid, libc.SIG.KILL); + _ = libc.kill(sh.pid, libc.SIG.KILL); } _ = libc.waitpid(sh.pid, null, 0); _ = libc.close(sh.master); @@ -1374,7 +1613,7 @@ fn sleepMs(ms: i64) void { } test "an idle prompt is free, a foreground job takes the tty, and Ctrl-C hands it back" { - if (comptime builtin.os.tag != .linux) return error.SkipZigTest; + if (comptime !tty_probe_platform) return error.SkipZigTest; var sh = TestShell.start() orelse return error.SkipZigTest; defer sh.stop(); @@ -1390,7 +1629,7 @@ test "an idle prompt is free, a foreground job takes the tty, and Ctrl-C hands i } test "a background job is not the tty's owner" { - if (comptime builtin.os.tag != .linux) return error.SkipZigTest; + if (comptime !tty_probe_platform) return error.SkipZigTest; var sh = TestShell.start() orelse return error.SkipZigTest; defer sh.stop(); @@ -1403,7 +1642,7 @@ test "a background job is not the tty's owner" { } test "a nested interactive shell is still a prompt" { - if (comptime builtin.os.tag != .linux) return error.SkipZigTest; + if (comptime !tty_probe_platform) return error.SkipZigTest; var sh = TestShell.start() orelse return error.SkipZigTest; defer sh.stop(); @@ -1424,7 +1663,7 @@ test "a nested interactive shell is still a prompt" { } test "the walk reaches the leaf: bash -c 'sleep 30' takes the tty" { - if (comptime builtin.os.tag != .linux) return error.SkipZigTest; + if (comptime !tty_probe_platform) return error.SkipZigTest; var sh = TestShell.start() orelse return error.SkipZigTest; defer sh.stop(); @@ -1436,23 +1675,40 @@ test "the walk reaches the leaf: bash -c 'sleep 30' takes the tty" { sh.send("bash --norc -c 'sleep 30; :'\n"); try std.testing.expect(sh.waitTaken(true, 10_000)); - var probe: TtyProbe = undefined; - var pending: usize = 0; - try std.testing.expectEqual(Pushed.pushed, pushChildren(&probe, &pending, sh.pid, 1)); - try std.testing.expectEqual(@as(usize, 1), pending); - var wrapper_buf: [std.fs.max_path_bytes]u8 = undefined; - var shell_buf: [std.fs.max_path_bytes]u8 = undefined; - try std.testing.expectEqualStrings( - procExe(sh.pid, &shell_buf).?, - procExe(probe.pending[0].pid, &wrapper_buf).?, - ); + // Why the shallow answer is the wrong one, in each walk's own evidence: + // the wrapper between the shell and `sleep` wears the shell's executable, + // so a probe that stopped at it would report a prompt. + if (comptime builtin.os.tag == .linux) { + var probe: TtyProbe = undefined; + var pending: usize = 0; + try std.testing.expectEqual(Pushed.pushed, pushChildren(&probe, &pending, sh.pid, 1)); + try std.testing.expectEqual(@as(usize, 1), pending); + var wrapper_buf: [std.fs.max_path_bytes]u8 = undefined; + var shell_buf: [std.fs.max_path_bytes]u8 = undefined; + try std.testing.expectEqualStrings( + procExe(sh.pid, &shell_buf).?, + procExe(probe.pending[0].pid, &wrapper_buf).?, + ); + } else { + const fg = tcgetpgrp(sh.master); + try std.testing.expect(fg > 0 and fg != sh.pid); + var leader_buf: [darwin.path_max]u8 = undefined; + var shell_buf: [darwin.path_max]u8 = undefined; + // The group's leader IS that wrapper, and it is the shell's binary. + try std.testing.expectEqualStrings( + darwin.exe(sh.pid, &shell_buf).?, + darwin.exe(fg, &leader_buf).?, + ); + // Taken all the same, because the rest of the group is not. + try std.testing.expect(darwin.taken(sh.pid, fg)); + } sh.send("\x03"); try std.testing.expect(sh.waitTaken(false, 10_000)); } test "a full-screen program takes the tty until it quits" { - if (comptime builtin.os.tag != .linux) return error.SkipZigTest; + if (comptime !tty_probe_platform) return error.SkipZigTest; const cases = [_]struct { bin: [*:0]const u8, run: []const u8, quit: []const u8 }{ .{ .bin = "/usr/bin/vim", .run = "vim -u NONE -i NONE\n", .quit = "\x1b:q!\r" }, .{ .bin = "/usr/bin/less", .run = "env LESS= less /etc/hosts\n", .quit = "q" }, diff --git a/src/layout.zig b/src/layout.zig index 47b2c1a4..c6cb7503 100644 --- a/src/layout.zig +++ b/src/layout.zig @@ -8,7 +8,7 @@ pub const Rect = struct { x: u16 = 0, y: u16 = 0, w: u16 = 0, h: u16 = 0 }; pub const Snapshot = struct { serial: u32, box: Box }; const MAX_COLS = pardes.MAX_COLS; const MAX_PANES = pardes.MAX_PANES; -const TOPBAR_H = pardes.TOPBAR_H; + const BOX_H = pardes.BOX_H; pub const Presentation = struct { @@ -795,7 +795,7 @@ pub fn movePlacement(p: *Pardes, id: usize, cur_x: u16, cur_y: u16) ?MovePlaceme const sib = if (src.idx > 0) p.col_panes[src.col][src.idx - 1] else p.col_panes[src.col][src.idx + 1]; heights[sib] +|= p.rects[id].h; } - var y: u16 = TOPBAR_H + p.columnBarHeight(); + var y: u16 = p.topBarHeight() + p.columnBarHeight(); var last: ?MovePlacement = null; for (0..p.col_n[tc]) |k| { const pid = p.col_panes[tc][k]; @@ -1123,7 +1123,7 @@ fn collapseNeighbor(p: *Pardes, col: usize, index: usize) ?usize { } fn computeCollapsedColumn(p: *Pardes, c: usize, x: u16, width: u16, folded: usize) void { - var y: u16 = TOPBAR_H + p.columnBarHeight(); + var y: u16 = p.topBarHeight() + p.columnBarHeight(); const available = p.screen_h -| y; var expanded_left: usize = 0; var weight: f32 = 0; @@ -1196,7 +1196,7 @@ pub fn compute(p: *Pardes) void { } if (vsum <= 0) vsum = 1; - var y: u16 = TOPBAR_H + p.columnBarHeight(); + var y: u16 = p.topBarHeight() + p.columnBarHeight(); const avail_h = p.screen_h -| y; for (0..p.col_n[c]) |k| { const id = p.col_panes[c][k]; diff --git a/src/macos.zig b/src/macos.zig index 79036c3e..d263cfc6 100644 --- a/src/macos.zig +++ b/src/macos.zig @@ -106,6 +106,7 @@ const color_default: u32 = 0x01000000; const color_indexed: u32 = 0x02000000; const cell_flag_default: u8 = 1; const cell_flag_tagline: u8 = 2; +const cell_flag_hover: u8 = 4; const scene_flag_crt: u32 = 1 << 0; const scene_flag_ripple: u32 = 1 << 1; const scene_flag_glitch: u32 = 1 << 2; @@ -730,6 +731,16 @@ fn initCore(runtime: ?*const Runtime, cols_arg: u16, rows_arg: u16) !void { const core = try pardes.Pardes.init(allocs.pardes, opts); errdefer core.deinit(); + // The workspace tag row is the macOS menu bar's business here (see + // docs/macos.md): the build option says whether this shell keeps the + // acme topbar or hands its commands to native chrome. The e2e harness + // opts back in with PARDES_WORKSPACE_TAG=1 — its scripts speak to a + // grid that has the row. Applied before the first resize so the layout + // has never seen it the other way. + core.settings.workspace_tag = if (std.c.getenv("PARDES_WORKSPACE_TAG")) |v| + std.mem.eql(u8, std.mem.span(v), "1") + else + @import("pardes_config").workspace_tag; core.native_images = true; var prompt_rcs = host_io.Shell.prepare(); @@ -917,7 +928,7 @@ export fn pardes_gui_tagline_font_percent() u8 { } export fn pardes_tagline_band_offset(row: u16, canvas_h: f32, cell_h: u32, tagline_h: u32) u32 { - return pardes.taglineBandOffset(row, canvas_h, cell_h, tagline_h); + return pardes.taglineBandOffset(row, canvas_h, cell_h, tagline_h, if (state) |*st| st.core.settings.workspace_tag else true); } export fn pardes_topbar_pane_border_px(cell_h: u32, tagline_h: u32) u32 { @@ -942,6 +953,11 @@ export fn pardes_topbar_pane_border_rgb() u32 { return @as(u32, rgb[0]) << 16 | @as(u32, rgb[1]) << 8 | rgb[2]; } +export fn pardes_tag_active_bg() u32 { + const st = state orelse return color_default; + const rgb = st.core.chromeTheme().tag_active_bg; + return @as(u32, rgb[0]) << 16 | @as(u32, rgb[1]) << 8 | rgb[2]; +} export fn pardes_tagline_bg() u32 { const st = state orelse return color_default; const rgb = st.core.chromeTheme().tag_bg; @@ -1756,12 +1772,18 @@ fn clearFrame(st: *State) void { st.panel_diff_len = 0; } -fn blankTagCells(cells: []Cell, cols: u16, rows: u16, layers: []const pardes.TagLayer) void { +fn blankTagCells(cells: []Cell, cols: u16, rows: u16, source: []const pardes.Cell, layers: []const pardes.TagLayer) void { for (layers) |layer| { if (layer.cols == 0 or layer.viewport.y >= rows or layer.viewport.x >= cols) continue; const start = @as(usize, layer.viewport.y) * cols + layer.viewport.x; const count = @min(layer.viewport.w, cols - layer.viewport.x); - for (cells[start..][0..count]) |*cell| cell.* = encodeCell(.{}); + for (cells[start..][0..count], source[start..][0..count]) |*cell, was| { + // The tag text is the layer's to draw, but a look-hover on a tag + // word is a canonical fact: carry the hover bit through so the + // glass overlay still finds the affordance rect. + cell.* = encodeCell(.{}); + cell.flags |= @as(u8, @intFromBool(was.hover)) * cell_flag_hover; + } } } @@ -1800,7 +1822,7 @@ fn presentFrame(ctx: ?*anyopaque, surface: *const pardes.Surface) void { defer tz_cells.end(); for (surface.cells, st.cells[0..count]) |cell, *out| out.* = encodeCell(cell); } - blankTagCells(st.cells[0..count], surface.cols, surface.rows, &surface.tag_layers); + blankTagCells(st.cells[0..count], surface.cols, surface.rows, surface.cells, &surface.tag_layers); collectPanelDiff(st, surface, count); collectImages(st, surface); collectPanelTracks(st, surface); @@ -1831,7 +1853,7 @@ fn collectPanelDiff(st: *State, surface: *const pardes.Surface, count: usize) vo } for (surface.previous_cells, st.previous_cells[0..count]) |cell, *out| out.* = encodeCell(cell); - blankTagCells(st.previous_cells[0..count], surface.cols, surface.rows, surface.previous_tag_layers); + blankTagCells(st.previous_cells[0..count], surface.cols, surface.rows, surface.previous_cells, surface.previous_tag_layers); for (surface.cell_diffs, st.changed_cells[0..count]) |diff, *out| out.* = encodeChanged(diff); st.panel_diff_len = count; @@ -2395,8 +2417,8 @@ fn encodeCell(cell: pardes.Cell) Cell { .fg = encodeColor(cell.style.fg), .bg = encodeColor(cell.style.bg), .attrs = encodeAttrs(cell.style), + .flags = encodeCellFlags(cell.default, cell.style.font_role, cell.hover), .len = if (cell.default) 1 else cell.len, - .flags = encodeCellFlags(cell.default, cell.style.font_role), }; if (cell.default) out.text[0] = ' ' @@ -2418,9 +2440,10 @@ fn encodeAttrs(style: pardes.CellStyle) u16 { return attrs; } -fn encodeCellFlags(default: bool, role: pardes.FontRole) u8 { +fn encodeCellFlags(default: bool, role: pardes.FontRole, hover: bool) u8 { return @as(u8, @intFromBool(default)) * cell_flag_default | - @as(u8, @intFromBool(role == .tagline)) * cell_flag_tagline; + @as(u8, @intFromBool(role == .tagline)) * cell_flag_tagline | + @as(u8, @intFromBool(hover)) * cell_flag_hover; } fn noteScrollVelocity(st: *State, delta_rows: f32, delta_cols: f32) void { @@ -2566,7 +2589,8 @@ test "pardes.h declares every export the way it is defined" { try expectSameAbi(@TypeOf(c.pardes_animating), @TypeOf(pardes_animating)); try expectSameAbi(@TypeOf(c.pardes_gui_tagline_font_percent), @TypeOf(pardes_gui_tagline_font_percent)); try expectSameAbi(@TypeOf(c.pardes_tagline_band_offset), @TypeOf(pardes_tagline_band_offset)); - try expectSameAbi(@TypeOf(c.pardes_topbar_pane_border_px), @TypeOf(pardes_topbar_pane_border_px)); + try expectSameAbi(@TypeOf(c.pardes_topbar_pane_border_rgb), @TypeOf(pardes_topbar_pane_border_rgb)); + try expectSameAbi(@TypeOf(c.pardes_tag_active_bg), @TypeOf(pardes_tag_active_bg)); try expectSameAbi(@TypeOf(c.pardes_tagline_origin_col), @TypeOf(pardes_tagline_origin_col)); try expectSameAbi(@TypeOf(c.pardes_grid_col_at), @TypeOf(pardes_grid_col_at)); try expectSameAbi(@TypeOf(c.pardes_topbar_pane_border_rgb), @TypeOf(pardes_topbar_pane_border_rgb)); @@ -2658,6 +2682,7 @@ test "pardes.h matches the Zig boundary" { try expectEqual(@as(u32, c.PARDES_COLOR_INDEXED), color_indexed); try expectEqual(@as(u8, c.PARDES_CELL_DEFAULT), cell_flag_default); try expectEqual(@as(u8, c.PARDES_CELL_TAGLINE), cell_flag_tagline); + 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(u32, c.PARDES_SCENE_RIPPLE), scene_flag_ripple); @@ -2723,9 +2748,10 @@ test "pardes.h matches the Zig boundary" { encodeAttrs(.{ .ul = .curly }), ); - try expectEqual(@as(u8, 0), encodeCellFlags(false, .body)); - try expectEqual(cell_flag_tagline, encodeCellFlags(false, .tagline)); - try expectEqual(cell_flag_default | cell_flag_tagline, encodeCellFlags(true, .tagline)); + try expectEqual(@as(u8, 0), encodeCellFlags(false, .body, false)); + try expectEqual(cell_flag_hover, encodeCellFlags(false, .body, true)); + try expectEqual(cell_flag_tagline, encodeCellFlags(false, .tagline, false)); + try expectEqual(cell_flag_default | cell_flag_tagline, encodeCellFlags(true, .tagline, false)); try expectEqual(pardes.config.gui_tagline_font_percent, pardes_gui_tagline_font_percent()); } @@ -2947,10 +2973,16 @@ 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 })); - blankTagCells(&canonical, 8, 3, &core.surface.tag_layers); + // A look-hover under the layer is a canonical fact and survives the blank; + // the glyph it marks does not, because the layer redraws that text itself. + var source: [24]pardes.Cell = @splat(.{}); + source[11].hover = true; + blankTagCells(&canonical, 8, 3, &source, &core.surface.tag_layers); try std.testing.expectEqual(@as(u8, 'G'), canonical[9].text[0]); try std.testing.expectEqual(@as(u8, 'G'), canonical[18].text[0]); try std.testing.expectEqual(encodeCell(.{}).len, canonical[10].len); + try std.testing.expectEqual(@as(u8, 0), canonical[10].flags & cell_flag_hover); + try std.testing.expectEqual(cell_flag_hover, canonical[11].flags & cell_flag_hover); } test "mac window blur builtin reaches the ABI without changing opacity" { diff --git a/src/macos/Sources/AppDelegate.swift b/src/macos/Sources/AppDelegate.swift index cbe9cdc9..3cce7592 100644 --- a/src/macos/Sources/AppDelegate.swift +++ b/src/macos/Sources/AppDelegate.swift @@ -310,6 +310,16 @@ final class AppDelegate: NSObject, NSApplicationDelegate, PardesViewDelegate { file.addItem(withTitle: "Close Window", action: #selector(NSWindow.performClose(_:)), keyEquivalent: "w") + // The workspace tag row's commands, in the place macOS keeps window + // commands. The build hands that row to this menu bar (see + // docs/macos.md): the words are the same builtins the tag carried, + // spelled exactly as a tag Exec would type them, and nothing here is + // editable — the menu is the tag's buttons, not the tag. + let builtins = submenu("Builtins", of: main) + for word in ["Newcol", "Joincol", "Find", "Grep", "Changelog", + "Dump", "NextColor", "Debug", "Kill"] { + builtins.addItem(command(word, #selector(menuBuiltin(_:)), "")) + } let edit = submenu("Edit", of: main) // Paste and nothing else. Copy, Cut, Undo and Select All have no // builtin behind them — the core yanks into the clipboard on its own @@ -379,13 +389,17 @@ final class AppDelegate: NSObject, NSApplicationDelegate, PardesViewDelegate { // here would hide half of what Look does. panel.canChooseDirectories = true panel.allowsMultipleSelection = true - panel.resolvesAliases = true - guard panel.runModal() == .OK else { return } for url in panel.urls where url.isFileURL { look(url.path) } } + /// Any workspace-tag word. The title is the builtin's own spelling, so + /// this is the same `run` a tag Exec performs and there is no second + /// vocabulary to keep in step. + @objc private func menuBuiltin(_ sender: NSMenuItem) { run(sender.title) } + + @objc private func menuNew(_ sender: Any?) { run("New") } @objc private func menuSave(_ sender: Any?) { run("Save") } @objc private func menuHelp(_ sender: Any?) { run("Help") } diff --git a/src/macos/Sources/PardesView.swift b/src/macos/Sources/PardesView.swift index 7981cf46..5ad09c38 100644 --- a/src/macos/Sources/PardesView.swift +++ b/src/macos/Sources/PardesView.swift @@ -433,7 +433,26 @@ private struct Metrics { let symbolic = (traits?[kCTFontSymbolicTrait] as? UInt32) ?? 0 return symbolic & UInt32(CTFontSymbolicTraits.traitBold.rawValue | CTFontSymbolicTraits.traitItalic.rawValue) == 0 } - let face = CTFontCreateWithFontDescriptor(plain ?? descriptors[0], size, nil) + let chosen = CTFontCreateWithFontDescriptor(plain ?? descriptors[0], size, nil) + // A variable face's descriptor carries no variation, and CoreText + // picks whichever named instance it likes for it — Maple Mono's + // variable file comes up Thin. Pin every axis to its own default: + // the face the file itself calls regular. + var face = chosen + if let axes = CTFontCopyVariationAxes(face) as? [[CFString: Any]] { + var defaults: [CFNumber: Any] = [:] + for axis in axes { + guard let tag = axis[kCTFontVariationAxisIdentifierKey], + let value = axis[kCTFontVariationAxisDefaultValueKey] else { continue } + defaults[tag as! CFNumber] = value + } + if !defaults.isEmpty { + let descriptor = CTFontDescriptorCreateCopyWithAttributes( + CTFontCopyFontDescriptor(face), + [kCTFontVariationAttribute: defaults] as CFDictionary) + face = CTFontCreateWithFontDescriptor(descriptor, size, nil) + } + } // The core already filtered for fixed pitch by reading the file's own // advances. This is the same question asked of the face CoreText // actually built, which is the one that will be drawn with. @@ -577,7 +596,14 @@ final class PardesView: NSView { // full redraw does not allocate 24 times. private var runGlyphs: [CGGlyph] = [] private var runPositions: [CGPoint] = [] - + /// Ligature shaping, keyed by face and text. A sequence ligates when + /// shaping it produces fewer glyphs than it has characters — the only + /// answer CoreText gives without interrogating the font's own features. + /// Cleared with the glyph caches, because it belongs to one face. + private var ligatureShaped: [String: Bool] = [:] + /// Columns the current row has already consumed as part of a ligature + /// drawn further left. One row's worth at a time. + private var ligatureCovered: Set = [] /// Constructed lazily because the ordinary path is still a direct /// CoreText/CoreGraphics frame. No scene bit and no panel track means no /// bitmap, no Core Image context and no Metal work. @@ -748,6 +774,7 @@ final class PardesView: NSView { bodyGlyphCache.removeAll(keepingCapacity: true) taglineGlyphCache.removeAll(keepingCapacity: true) gripGlyphCache.removeAll(keepingCapacity: true) + ligatureShaped.removeAll(keepingCapacity: true) metrics = next taglines = TaglineMetrics(body: next, percent: taglines.percent, scale: scale) metricsScale = scale @@ -844,12 +871,12 @@ final class PardesView: NSView { // whatever we do, so clipping would save fills and nothing else. Narrow // the row loops to the dirty band if that ever shows up in a profile. let count = pardes_frame() - let nextLinkPointer = pardes_pointer_shape() == 1 - if nextLinkPointer != linkPointer { - linkPointer = nextLinkPointer + let nextPointer = pointerShape() + if nextPointer != pointer { + pointer = nextPointer window?.invalidateCursorRects(for: self) if let window, bounds.contains(convert(window.mouseLocationOutsideOfEventStream, from: nil)) { - (linkPointer ? NSCursor.pointingHand : NSCursor.iBeam).set() + cursorFor(pointer).set() } } let scene = pardes_scene() @@ -1178,10 +1205,13 @@ final class PardesView: NSView { drawTagLayers(ctx, hideCursor:hideCursor, canonical:cells, cols:cols, rows:rows) } else { for layer in presentedTagLayers { - drawTagGrip(ctx, values:layer.values, canonical:cells, cols:cols, rows:rows) - layer.cells.withUnsafeBufferPointer { cells in - if let base = cells.baseAddress { drawTagLayer(ctx, values:layer.values, cells:base, hideCursor:true) } + layer.cells.withUnsafeBufferPointer { tagCells in + if let base = tagCells.baseAddress { + drawTagLayer(ctx, values: layer.values, cells: base, hideCursor: true, + canonical: cells, cols: cols) + } } + drawTagGrip(ctx, values: layer.values, canonical: cells, cols: cols, rows: rows) } for layer in presentedBodyLayers { layer.cells.withUnsafeBufferPointer { cells in @@ -1190,6 +1220,7 @@ final class PardesView: NSView { } drawTagRules(ctx, layers: presentedTagLayers.map { $0.values }) } + drawHoverGlass(ctx, cells: cells, cols: cols, rows: rows) } private var presentedTagLayers: [FrozenBodyLayer] = [] @@ -1212,16 +1243,22 @@ final class PardesView: NSView { let values = (0...12).map { Int(pardes_tag_layer_value(index, UInt32($0))) } if values[0] == 0 { continue } layers.append(values) - drawTagGrip(ctx, values:values, canonical:canonical, cols:cols, rows:rows) - if let cells = pardes_tag_layer_cells(index) { drawTagLayer(ctx, values: values, cells: cells, hideCursor: hideCursor) } + // The layer's full-row fill must land before the grip: the row + // background now spans the anchor columns, and the grip glyph + // and the anchor fills have to come back on top of it. + if let cells = pardes_tag_layer_cells(index) { + drawTagLayer(ctx, values: values, cells: cells, hideCursor: hideCursor, + canonical: canonical, cols: cols) + } + drawTagGrip(ctx, values: values, canonical: canonical, cols: cols, rows: rows) } drawTagRules(ctx, layers: layers) } /// SDL's chrome overlay is drawn after its compact layers. Keep these - /// one-pixel rules above the full-row tag backgrounds as well. + /// one-point rules above the full-row tag backgrounds as well. private func drawTagRules(_ ctx: CGContext, layers: [[Int]]) { - let pixel = 1 / metricsScale + let pixel = CGFloat(1) for values in layers where values[1] != 0 { let kind = values[1] let bottom = kind == 2 && values[11] != 0 @@ -1252,15 +1289,17 @@ final class PardesView: NSView { } private func drawTagGrip(_ ctx: CGContext, values: [Int], canonical: UnsafePointer, cols: Int, rows: Int) { - let width = Int(pardes_grip_columns()) let x = values[4] - Int(pardes_tag_text_inset()), y = values[5] if values[1] != 2 || x < 0 || x >= cols || y < 0 || y >= rows { return } var cell = canonical[y * cols + x] let text = withUnsafeBytes(of: &cell.text) { String(decoding: $0.prefix(Int(cell.len)), as: UTF8.self) } if text.isEmpty { return } let style = resolve(cell, block:false, ground:themeBG ?? pardesDefaultBG, clearGround:false) - let centerX = (CGFloat(x) + CGFloat(width) / 2) * cellWidth - let centerY = CGFloat(y) * cellHeight + taglines.top(row:y, canvasHeight:bounds.height) + taglines.height / 2 + // The box drawTagLayer filled is this mark's ground, so the mark + // centres on that same square rather than on the grip columns: one + // rect measures both and the two cannot drift apart. + guard let square = anchorSquare(values: values) else { return } + let centerX = square.midX, centerY = square.midY if text != " " { let face = Face(bold: cell.attrs & UInt16(PARDES_ATTR_BOLD) != 0, italic: cell.attrs & UInt16(PARDES_ATTR_ITALIC) != 0) @@ -1268,9 +1307,7 @@ final class PardesView: NSView { let originX = ((centerX - measured.ink.midX) * metricsScale).rounded() / metricsScale let baseline = ((bounds.height - centerY - measured.ink.midY) * metricsScale).rounded() / metricsScale ctx.saveGState() - ctx.clip(to: CGRect(x: CGFloat(x) * cellWidth, - y: CGFloat(y) * cellHeight + taglines.top(row:y, canvasHeight:bounds.height), - width: CGFloat(width) * cellWidth, height: taglines.height)) + ctx.clip(to: square) ctx.translateBy(x: 0, y: bounds.height) ctx.scaleBy(x: 1, y: -1) ctx.textMatrix = .identity @@ -1286,16 +1323,36 @@ final class PardesView: NSView { fill(ctx, CGRect(x:floor(centerX-halfWidth), y:floor(centerY+1), width:2*halfWidth, height:1), style.fg, 1) } - private func drawTagLayer(_ ctx: CGContext, values: [Int], cells: UnsafePointer, hideCursor: Bool) { + private func drawTagLayer(_ ctx: CGContext, values: [Int], cells: UnsafePointer, + hideCursor: Bool, canonical: UnsafePointer, cols: Int) { let left = CGFloat(values[4]) * cellWidth let y = CGFloat(values[5]) * cellHeight + taglines.top(row: values[5], canvasHeight: bounds.height) // SDL gives the tag a full body-row background; only its glyphs - // and per-cell highlights use the compact band. - let viewport = CGRect(x: left, y: CGFloat(values[5]) * cellHeight, - width: CGFloat(values[6]) * cellWidth, height: cellHeight) + // and per-cell highlights use the compact band. The band spans the + // row's whole extent, not just its text: the grip and the mode box + // live in the inset columns to the left of `values[4]`, and their + // own fills cover only the compact band — a row background that + // stops at the text leaves holes of ground under those anchors. + // The rule in drawTagRules spans exactly this left-to-right range. + let rowLeft = CGFloat(max(0, values[4] - Int(pardes_tag_text_inset()))) * cellWidth + let rowRight = CGFloat(values[4] + values[6]) * cellWidth + let viewport = CGRect(x: rowLeft, y: CGFloat(values[5]) * cellHeight, + width: rowRight - rowLeft, height: cellHeight) ctx.saveGState() ctx.clip(to: viewport) fillBackground(ctx, viewport, UInt32(values[10]), backgroundAlpha) + // The anchor (grip, mode box) lives in the inset columns that fill + // just covered, so its own box goes back on top: one solid fill in + // the box colour the anchor cell wears, with drawTagGrip's mark + // drawn over it afterwards. + if let square = anchorSquare(values: values) { + let anchorX = max(0, values[4] - Int(pardes_tag_text_inset())) + let cell = canonical[values[5] * cols + anchorX] + let style = resolve(cell, block: false, + ground: UInt32(values[10]), clearGround: false) + if style.visible { fillBackground(ctx, square.integral, style.bg, backgroundAlpha) } + } + for pass in 0...1 { for col in 0.. CGRect? { + let anchorX = max(0, values[4] - Int(pardes_tag_text_inset())) + guard anchorX < values[4] else { return nil } + let pad = (cellHeight - taglines.height) / 2 + return CGRect(x: CGFloat(anchorX) * cellWidth + pad, + y: CGFloat(values[5]) * cellHeight + taglines.top(row: values[5], canvasHeight: bounds.height), + width: taglines.height, height: taglines.height) + } + + /// The look-hover affordance as liquid glass: the core marks the word's + /// cells (PARDES_CELL_HOVER), and this composes a real material over the + /// run — the drawn frame snapshot refracted through CoreImage (a small + /// blur, then a lens scale about the pill's centre, which is what makes + /// the edges swim), the theme's selection colour as a faint tint, a + /// specular sheen from the top edge, and a light rim — with the word's + /// own glyphs drawn back on top, crisp, the way text sits on a real + /// material rather than behind one. + private func drawHoverGlass(_ ctx: CGContext, cells: UnsafePointer, cols: Int, rows: Int) { + var drew = false + for row in 0..= 0 { + let rect = CGRect(x: CGFloat(start) * cellWidth, y: CGFloat(row) * cellHeight, + width: CGFloat(col - start) * cellWidth, height: cellHeight) + drawLiquidGlass(ctx, rect, tint: tint) + redrawHoverRun(ctx, cells, cols: cols, row: row, start: start, end: col) + drew = true + start = -1 + } + } + } + // No affordance this frame: the held snapshot describes a frame + // that no longer exists, and the next hover must take a fresh one. + if !drew { glassShot = nil } + } + + /// A CoreImage context for the glass refraction, created once. + private lazy var glassContext = CIContext() + /// The snapshot behind the current pill. Refraction reads the already + /// drawn frame, and re-reading it every pump would blur a moving pill + /// out of its own budget, so the shot is taken when the rect changes. + private var glassShot: (rect: CGRect, image: CGImage)? + + private func drawLiquidGlass(_ ctx: CGContext, _ rect: CGRect, tint: UInt32) { + let radius = min(rect.height / 4, 6) + let pill = CGPath(roundedRect: rect.insetBy(dx: 1, dy: 1.5), + cornerWidth: radius, cornerHeight: radius, transform: nil) + // The refraction: the frame as drawn, blurred a little and scaled + // about the pill's centre, so the rim bends what surrounds it. The + // shot extends past the pill for exactly this — the lens needs + // pixels from outside the glass to pull in. + let lens = rect.insetBy(dx: -10, dy: -10) + if refract(ctx, pill: pill, rect: rect, lens: lens, tint: tint) { + // Specular: light caught at the top edge, fading as it falls. + ctx.saveGState() + ctx.addPath(pill) + ctx.clip() + let shine = [CGColor(srgbRed: 1, green: 1, blue: 1, alpha: 0.22), + CGColor(srgbRed: 1, green: 1, blue: 1, alpha: 0.0)] as CFArray + if let gradient = CGGradient(colorsSpace: CGColorSpace(name: CGColorSpace.sRGB), + colors: shine, locations: [0, 0.55]) { + ctx.drawLinearGradient(gradient, + start: CGPoint(x: rect.minX, y: rect.minY), + end: CGPoint(x: rect.minX, y: rect.maxY), options: []) + } + ctx.restoreGState() + } else { + // No refraction without a snapshot: the tint alone, faint. + ctx.saveGState() + ctx.addPath(pill) + ctx.clip() + ctx.setFillColor(CGColor(srgbRed: CGFloat((tint >> 16) & 0xFF) / 255, + green: CGFloat((tint >> 8) & 0xFF) / 255, + blue: CGFloat(tint & 0xFF) / 255, + alpha: 0.18)) + ctx.fill(rect) + ctx.restoreGState() + } + // The lens edge: a light rim and a darker bottom hairline, the way a + // real material catches its own edge. + ctx.addPath(pill) + ctx.setStrokeColor(CGColor(srgbRed: 1, green: 1, blue: 1, alpha: 0.35)) + ctx.setLineWidth(1) + ctx.strokePath() + ctx.addPath(pill) + ctx.setStrokeColor(CGColor(srgbRed: 0, green: 0, blue: 0, alpha: 0.25)) + ctx.setLineWidth(0.5) + ctx.clip() + ctx.stroke(CGRect(x: rect.minX, y: rect.maxY - 2, width: rect.width, height: 1.5)) + } + + /// True when the refraction composited. The snapshot is taken when the + /// pill moves and reused while it sits still. + private func refract(_ ctx: CGContext, pill: CGPath, rect: CGRect, lens: CGRect, tint: UInt32) -> Bool { + guard let shot = snapshotFor(ctx, lens: lens) else { return false } + var image = CIImage(cgImage: shot) + // The blur is grown slightly past the crop and the whole thing is + // pulled toward the centre by a few percent: the rim bends what + // surrounds it, which is the refraction the eye reads as glass. + let blur = image.applyingGaussianBlur(sigma: 2 * metricsScale) + let grown = blur.extent.insetBy(dx: -8 * metricsScale, dy: -8 * metricsScale) + let centre = CGPoint(x: grown.midX, y: grown.midY) + let scale = 1.06 + let lensTransform = CGAffineTransform(translationX: centre.x * (1 - scale), + y: centre.y * (1 - scale)).scaledBy(x: scale, y: scale) + image = blur.transformed(by: lensTransform) + guard let filtered = glassContext.createCGImage(image, from: grown) else { return false } + ctx.saveGState() + ctx.addPath(pill) + ctx.clip() + ctx.draw(filtered, in: rect) + // The glass's own body colour: the theme's selection, faint — the + // refraction and the sheen carry the material, not opacity. + ctx.setFillColor(CGColor(srgbRed: CGFloat((tint >> 16) & 0xFF) / 255, + green: CGFloat((tint >> 8) & 0xFF) / 255, + blue: CGFloat(tint & 0xFF) / 255, + alpha: 0.15)) + ctx.fill(rect) + ctx.restoreGState() + return true + } + + private func snapshotFor(_ ctx: CGContext, lens: CGRect) -> CGImage? { + if let held = glassShot, held.rect == lens { return held.image } + guard let whole = ctx.makeImage() else { return nil } + // makeImage hands back backing pixels; the lens is in view points. + let region = CGRect(x: lens.minX * metricsScale, y: lens.minY * metricsScale, + width: lens.width * metricsScale, height: lens.height * metricsScale) + guard let cropped = whole.cropping(to: region) else { return nil } + glassShot = (lens, cropped) + return cropped + } + + /// The hovered word's glyphs, back on top of the material, crisp: text + /// sits on liquid glass, not behind it. + private func redrawHoverRun(_ ctx: CGContext, _ cells: UnsafePointer, + cols: Int, row: Int, start: Int, end: Int) { + ctx.saveGState() + ctx.textMatrix = .identity + ctx.translateBy(x: 0, y: bounds.height) + ctx.scaleBy(x: 1, y: -1) + let baseline = bounds.height - (CGFloat(row) * cellHeight + metrics.ascent) + for col in start.. = [ + "<", ">", "=", "!", "&", "|", "-", "/", ":", ".", "#", "*", "+", "~", "^", "%", + ] + + private func ligates(_ face: Face, _ text: String) -> Bool { + let key = "\(face.rawValue):\(text)" + if let cached = ligatureShaped[key] { return cached } + let attributed = NSAttributedString(string: text, attributes: [fontAttribute: metrics.fonts[face.rawValue], + NSAttributedString.Key(kCTForegroundColorFromContextAttributeName as String): true]) + let shaped = CTLineCreateWithAttributedString(attributed as CFAttributedString) + var glyphs: [CGGlyph] = [] + for run in (CTLineGetGlyphRuns(shaped) as? [CTRun]) ?? [] { + let count = CTRunGetGlyphCount(run) + var runGlyphs = [CGGlyph](repeating: 0, count: count) + CTRunGetGlyphs(run, CFRange(location: 0, length: count), &runGlyphs) + glyphs.append(contentsOf: runGlyphs) + } + // A ligature is any divergence from per-character mapping. A font may + // collapse the pair into one glyph (JetBrains Mono) or swap each + // character for a joining half kept at the same count (Maple Mono) — + // either way the sequence must be shaped, not mapped. + let singles = text.utf16.map { glyph(face, $0, tagline: false) } + let result = glyphs.count != singles.count + || zip(glyphs, singles).contains { $0 != $1 } + ligatureShaped[key] = result + return result + } + + /// When the cells at `col` ligate under `face`, the text to shape and how + /// many cells the ligature covers. Nil when they do not. Ligature cells + /// must carry the same face, colour and alpha and no rules of their own — + /// a ligature is one glyph of one style, not a style transition. + private func ligatureSpan(_ cells: UnsafePointer, base: Int, cols: Int, col: Int, + face: Face, fg: UInt32, alpha: CGFloat, + blockCol: Int, paneGripCells: Set) -> (text: String, covered: Int)? { + func eligible(_ index: Int) -> String? { + let cell = cells[base + index] + if cell.flags & UInt8(PARDES_CELL_DEFAULT) != 0 { return nil } + if cell.flags & UInt8(PARDES_CELL_TAGLINE) != 0 { return nil } + if cell.attrs >> UInt16(PARDES_ATTR_UL_SHIFT) != 0 + || cell.attrs & UInt16(PARDES_ATTR_STRIKETHROUGH) != 0 { return nil } + if paneGripCells.contains(base + index) { return nil } + let text = withUnsafeBytes(of: cell.text) { raw in + String(decoding: raw.prefix(Int(cell.len)), as: UTF8.self) + } + guard text.utf16.count == 1 else { return nil } + let other = resolve(cell, block: blockCol == index, + ground: themeBG ?? pardesDefaultBG, clearGround: false) + guard other.visible, other.fg == fg, other.alpha == alpha, + Face(bold: cell.attrs & UInt16(PARDES_ATTR_BOLD) != 0, + italic: cell.attrs & UInt16(PARDES_ATTR_ITALIC) != 0) == face else { return nil } + return text + } + guard let head = eligible(col), PardesView.ligatureHeads.contains(head.first!) else { return nil } + guard col + 1 < cols, let second = eligible(col + 1) else { return nil } + let pair = head + second + if col + 2 < cols, let third = eligible(col + 2) { + let triple = pair + third + if ligates(face, triple) { return (triple, 3) } + } + if ligates(face, pair) { return (pair, 2) } + return nil + } + private func drawRules( _ ctx: CGContext, _ cell: pardes_cell_s, @@ -1921,6 +2243,13 @@ final class PardesView: NSView { override func keyDown(with event: NSEvent) { let flags = event.modifierFlags + // Same reason as the trackpad trace below: whether AppKit delivered a + // keystroke at all is not something this process can otherwise answer, + // and "Escape does nothing" has two entirely different causes + // depending on whether this line prints. + trace("key: code=\(event.keyCode) mods=\(flags.rawValue) chars=" + + (event.charactersIgnoringModifiers?.unicodeScalars + .map { String($0.value, radix: 16) }.joined(separator: ",") ?? "-")) // The ABI has no super bit, so a Command chord cannot be expressed at all. // Anything the main menu claims never reaches here; the rest is swallowed // rather than delivered as the bare keystroke the core would insert. @@ -2328,12 +2657,35 @@ final class PardesView: NSView { userInfo: nil)) } - private var linkPointer = false + private enum Pointer: Equatable { case text, link, target } + private var pointer: Pointer = .text + + /// The core's pointer_shape, in this shell's cursor vocabulary: a link + /// is a PDF hyperlink (the hand), a target is a word the core's own + /// Look-hover plumbing validated as a real Look or Exec operand, and + /// anything else is text — the I-beam. + private func pointerShape() -> Pointer { + switch pardes_pointer_shape() { + case 1: return .link + case 2: return .target + default: return .text + } + } + + private func cursorFor(_ shape: Pointer) -> NSCursor { + switch shape { + case .link: return .pointingHand + case .target: return .arrow + case .text: return .iBeam + } + } override func resetCursorRects() { - // Every cell in this view is text, including the tags. An arrow over a - // grid you can sweep and click words in is the wrong affordance. - addCursorRect(bounds, cursor: linkPointer ? .pointingHand : .iBeam) + // Every cell in this view is text, including the tags. An arrow over + // plain text is the wrong affordance — but a word the core has + // validated as a Look or Exec target earns it: middle- and + // right-clicking there acts, and the cursor says so before it does. + addCursorRect(bounds, cursor: cursorFor(pointer)) } override func setFrameSize(_ newSize: NSSize) { diff --git a/src/macos/pardes.h b/src/macos/pardes.h index df3ba04f..f74330e5 100644 --- a/src/macos/pardes.h +++ b/src/macos/pardes.h @@ -76,6 +76,11 @@ typedef struct { #define PARDES_CELL_DEFAULT 0x01u #define PARDES_CELL_TAGLINE 0x02u +// The look-hover affordance: the word under the pointer is a real Look or +// Exec operand. Hosts that draw the affordance as more than the quiet tint +// (macOS composes a liquid-glass overlay) read this instead of guessing +// from the background colour, which a real selection shares. +#define PARDES_CELL_HOVER 0x04u // One coherent snapshot for the full-window shader pass. The bitmask lets the // host run CRT, ripple and glitch in one kernel instead of stacking filters; @@ -323,6 +328,10 @@ uint32_t pardes_topbar_pane_border_rgb(void); // pardes.TOPBAR_H, and src/macos.zig asserts the two agree. #define PARDES_TOPBAR_H 1u +// The active pane's tag row background, for hosts that afford the active +// tagline more than a tint — macOS raises it like an old-school bevel. +uint32_t pardes_tag_active_bg(void); + // Persistent full-window effect switches and their display-clock time. A zero // flags word means draw the CoreText frame directly; any nonzero combination // is one postprocess pass. Snapshot by value, with no borrowed storage. @@ -510,7 +519,8 @@ bool pardes_active_dirty(void); int32_t pardes_cursor_x(void); int32_t pardes_cursor_y(void); bool pardes_cursor_bar(void); -// Mouse pointer affordance: 0 = default text pointer, 1 = link hand. +// Mouse pointer affordance: 0 = default text pointer, 1 = link hand, +// 2 = a validated Look/Exec target under the pointer (the acme arrow). uint32_t pardes_pointer_shape(void); // The Look or Exec the core performed since this was last asked, and clears diff --git a/src/pardes.zig b/src/pardes.zig index ed71102e..dee8a902 100644 --- a/src/pardes.zig +++ b/src/pardes.zig @@ -88,12 +88,19 @@ pub const BOX_H: u16 = 1; pub const TAG_GAP: u16 = 1; pub const TAG_TEXT_INSET: u16 = config.GUTTER + TAG_GAP; -pub fn taglineBandOffset(row: u16, canvas_h: f32, cell_h: u32, tagline_h: u32) u32 { +pub fn taglineBandOffset(row: u16, canvas_h: f32, cell_h: u32, tagline_h: u32, workspace: bool) u32 { const spare = cell_h -| tagline_h; const border = topbarPaneBorderPixels(cell_h, tagline_h); + const rows: u32 = @max(1, @as(u32, @intFromFloat(@floor(canvas_h / @as(f32, @floatFromInt(cell_h)))))); + if (!workspace) { + // No workspace row: nothing above row 0 to share a rule with, so + // every band centers in its cell the way the middle rows always + // have. The anchor boxes this lets the hosts draw stay symmetric. + if (@as(u32, row) + 1 >= rows) return spare; + return spare / 2; + } if (row == 0) return spare - border / 2; if (row == TOPBAR_H) return border - border / 2; - const rows: u32 = @max(1, @as(u32, @intFromFloat(@floor(canvas_h / @as(f32, @floatFromInt(cell_h)))))); if (@as(u32, row) + 1 >= rows) return spare; return spare / 2; } @@ -104,8 +111,8 @@ pub fn topbarPaneBorderPixels(cell_h: u32, tagline_h: u32) u32 { } pub fn taglineOriginCol(p: *const Pardes, col: u16, row: u16, track: ?layout.Track) f32 { - if (row < TOPBAR_H) return 0; - if (row < TOPBAR_H + p.columnBarHeight()) { + if (row < p.topBarHeight()) return 0; + if (row < p.topBarHeight() + p.columnBarHeight()) { for (p.col_x[0..p.ncol], p.col_w[0..p.ncol]) |x, w| if (col >= x and col - x < w) return @floatFromInt(x); } @@ -164,8 +171,8 @@ test "paint order is moving, then opening, then closing tombstones on top" { pub fn gridColAt(p: ?*const Pardes, x: f32, row: u16, body_w: f32, tagline_w: f32) u16 { const body = @max(body_w, 1); const tag = @max(tagline_w, 1); - if (row < TOPBAR_H) return colFromSpan(x, tag); - if (p) |core| if (row < TOPBAR_H + core.columnBarHeight()) { + if (row < (if (p) |core| core.topBarHeight() else TOPBAR_H)) return colFromSpan(x, tag); + if (p) |core| if (row < core.topBarHeight() + core.columnBarHeight()) { for (core.col_x[0..core.ncol], core.col_w[0..core.ncol]) |origin, width| { if (width == 0) continue; const left = @as(f32, @floatFromInt(origin)) * body; @@ -3395,6 +3402,12 @@ pub const Cell = struct { len: u8 = 1, style: CellStyle = .{}, default: bool = true, + /// The look-hover affordance is on this cell: the word under the pointer + /// is a real Look or Exec operand, and hosts that draw the quiet tint as + /// more than a flat fill — macOS renders it as a glass overlay — read + /// this instead of guessing from the background colour, which a real + /// selection shares. + hover: bool = false, pub fn grapheme(c: *const Cell) []const u8 { return c.text[0..c.len]; @@ -3670,8 +3683,12 @@ test "pixel attachment fit and pan do not invalidate cached pixels" { /// The canonical interface: what a frame of pardes IS. The tty shell writes /// these cells to vaxis one-to-one; the SDL shells rasterize them. pub const Surface = struct { - pub const PointerShape = enum(u8) { arrow, link }; + pub const PointerShape = enum(u8) { arrow, link, target }; pointer_shape: PointerShape = .arrow, + /// Set only for the duration of the look-hover paint, so the cells that + /// paint the quiet affordance can carry the hover bit through the ABI + /// without every selection painter learning a new parameter. + mark_hover: bool = false, body_layers: [MAX_PANES]BodyLayer = @splat(.{}), tag_layers: [MAX_TAG_LAYERS]TagLayer = @splat(.{}), cols: u16 = 0, @@ -3717,7 +3734,11 @@ pub const Surface = struct { pub fn at(s: *Surface, x: u16, y: u16) *Cell { std.debug.assert(x < s.cols and y < s.rows); - return &s.cells[@as(usize, y) * s.cols + x]; + const cell = &s.cells[@as(usize, y) * s.cols + x]; + // The look-hover paint runs with mark_hover set, and its cells are + // exactly the ones this marks — see render's preview block. + if (s.mark_hover) cell.hover = true; + return cell; } pub fn set(s: *Surface, x: u16, y: u16, text: []const u8, style: CellStyle) void { @@ -6263,6 +6284,14 @@ pub const Pardes = struct { return config.topbar_str; } + /// The workspace tag row's height: `TOPBAR_H` while the setting keeps + /// it, zero once a native shell takes its commands over. Layout and hit + /// testing read this rather than the constant, the way they read + /// `columnBarHeight`. + pub fn topBarHeight(p: *const Pardes) u16 { + return if (p.settings.workspace_tag) TOPBAR_H else 0; + } + pub fn columnBarHeight(p: *const Pardes) u16 { return if (p.settings.column_tags and p.screen_h >= 3) COLBAR_H else 0; } @@ -7765,7 +7794,7 @@ pub const Pardes = struct { } var dest: ?usize = null; for (p.panes, 0..) |slot, i| { - if (slot == null or p.rects[i].y != TOPBAR_H + p.columnBarHeight()) continue; + if (slot == null or p.rects[i].y != p.topBarHeight() + p.columnBarHeight()) continue; if (p.header_column) |c| if (p.rects[i].x != p.col_x[c]) continue; if (i == p.active) { dest = i; @@ -11015,7 +11044,7 @@ pub const Pardes = struct { pub const ChromeTarget = struct { col: u16, row: u16 }; pub fn chromeTarget(p: *const Pardes, col: u16, row: u16) ?ChromeTarget { - if (row < TOPBAR_H + p.columnBarHeight()) return .{ .col = col, .row = row }; + if (row < p.topBarHeight() + p.columnBarHeight()) return .{ .col = col, .row = row }; for (p.panes, 0..) |slot, id| { if (slot == null) continue; const rect = p.rects[id]; @@ -11330,7 +11359,7 @@ pub const Pardes = struct { p.chord_arg = null; } } - if (mrow >= TOPBAR_H and mrow < TOPBAR_H + p.columnBarHeight() and m.kind == .press) { + if (mrow >= p.topBarHeight() and mrow < p.topBarHeight() + p.columnBarHeight() and m.kind == .press) { for (0..p.ncol) |column| { if (mcol < p.col_x[column] or mcol >= p.col_x[column] + @min(config.GUTTER, p.col_w[column])) continue; if (m.button == config.select_button) { @@ -11347,7 +11376,7 @@ pub const Pardes = struct { if (m.kind == .release) p.header_drag = false; return; } - if (mrow < TOPBAR_H + p.columnBarHeight() and m.kind == .press and + if (mrow < p.topBarHeight() + p.columnBarHeight() and m.kind == .press and (m.button == config.select_button or m.button == config.exec_button or m.button == config.look_button)) { if (m.button == config.select_button) if (p.panes[p.active]) |pane| { @@ -11355,7 +11384,7 @@ pub const Pardes = struct { }; var column: ?usize = null; var x: u16 = 0; - if (mrow >= TOPBAR_H) { + if (mrow >= p.topBarHeight()) { for (0..p.ncol) |c| if (mcol >= p.col_x[c] and mcol < p.col_x[c] + p.col_w[c]) { column = c; x = p.col_x[c] + TAG_TEXT_INSET; @@ -13186,6 +13215,15 @@ pub const Pardes = struct { } } }; + // A look-hover preview means the pointed word is a real Look or Exec + // operand: the same plumbing a click would act on. Hosts that model + // the pointer per-text (the macOS I-beam) read this as "target" and + // afford it the arrow instead. + if (p.look_hover_preview != null) s.pointer_shape = .target; + // Stale hover bits must not survive into a frame whose pointer has + // moved on: the ordinary content paint does not clear fields it + // never set. + for (s.cells) |*c| c.hover = false; for (&s.body_layers) |*layer| layer.rows = 0; for (&s.tag_layers) |*layer| layer.cols = 0; s.nimages = 0; @@ -13252,21 +13290,24 @@ pub const Pardes = struct { } } - // global tagbar: full width, top row + // global tagbar: full width, top row — unless a native shell has + // taken its commands over, in which case the row is not ours to draw p.revealHeader(); - s.fill(0, 0, s.cols, TOPBAR_H, .{ - .bg = .{ .rgb = chrome.tag_bg }, - .font_role = .tagline, - }); var tb_buf: [1200]u8 = undefined; const global_bar = p.topbar(&tb_buf); const global_scroll = if (p.topbar_col != null and p.header_column == null) p.header_scroll else 0; - _ = s.print(0, 0, s.cols, global_bar[panes.File.rawAtDisplay(global_bar, global_scroll)..], .{ - .fg = .{ .rgb = chrome.tag_fg }, - .bg = .{ .rgb = chrome.tag_bg }, - .font_role = .tagline, - }); - if (p.pointer_inside and p.hover_row < TOPBAR_H) { + if (p.settings.workspace_tag) { + s.fill(0, 0, s.cols, TOPBAR_H, .{ + .bg = .{ .rgb = chrome.tag_bg }, + .font_role = .tagline, + }); + _ = s.print(0, 0, s.cols, global_bar[panes.File.rawAtDisplay(global_bar, global_scroll)..], .{ + .fg = .{ .rgb = chrome.tag_fg }, + .bg = .{ .rgb = chrome.tag_bg }, + .font_role = .tagline, + }); + } + if (p.pointer_inside and p.hover_row < p.topBarHeight()) { const bar = p.topbar(&tb_buf); if (wordBoundsAtCol(bar, panes.File.rawAtDisplay(bar, p.hover_col + global_scroll))) |bounds| { var col = panes.File.rawDisplayCol(bar, bounds.lo) -| global_scroll; @@ -13296,24 +13337,24 @@ pub const Pardes = struct { const lum = (@as(u16, grip_bg[0]) * 3 + @as(u16, grip_bg[1]) * 6 + @as(u16, grip_bg[2])) / 10; const ink: [3]u8 = if (lum > 140) .{ 0, 0, 0 } else .{ 255, 255, 255 }; const grip_style: CellStyle = .{ .bg = .{ .rgb = grip_bg }, .fg = .{ .rgb = ink }, .font_role = .tagline }; - s.fill(p.col_x[c], TOPBAR_H, grip, 1, grip_style); - s.fill(p.col_x[c] + grip, TOPBAR_H, inset - grip, 1, .{ .bg = .{ .rgb = bg }, .font_role = .tagline }); + s.fill(p.col_x[c], p.topBarHeight(), grip, 1, grip_style); + s.fill(p.col_x[c] + grip, p.topBarHeight(), inset - grip, 1, .{ .bg = .{ .rgb = bg }, .font_role = .tagline }); - s.fill(x, TOPBAR_H, w, 1, .{ .bg = .{ .rgb = bg }, .font_role = .tagline }); + s.fill(x, p.topBarHeight(), w, 1, .{ .bg = .{ .rgb = bg }, .font_role = .tagline }); const bar_scroll = if (p.topbar_col != null and p.header_column == c) p.header_scroll else 0; const tag = p.columnTag(c); - _ = s.print(x, TOPBAR_H, w, tag[panes.File.rawAtDisplay(tag, bar_scroll)..], .{ + _ = s.print(x, p.topBarHeight(), w, tag[panes.File.rawAtDisplay(tag, bar_scroll)..], .{ .fg = .{ .rgb = fg }, .bg = .{ .rgb = bg }, .font_role = .tagline, }); - if (p.pointer_inside and p.hover_row == TOPBAR_H and p.hover_col >= x and p.hover_col < x + w) { + if (p.pointer_inside and p.hover_row == p.topBarHeight() and p.hover_col >= x and p.hover_col < x + w) { const bar = p.columnTag(c); if (wordBoundsAtCol(bar, panes.File.rawAtDisplay(bar, p.hover_col - x + bar_scroll))) |bounds| { var col = panes.File.rawDisplayCol(bar, bounds.lo) -| bar_scroll; const hi = panes.File.rawDisplayCol(bar, bounds.hi) -| bar_scroll; while (col < hi and col < w) : (col += 1) { - const cell = s.at(x + @as(u16, @intCast(col)), TOPBAR_H); + const cell = s.at(x + @as(u16, @intCast(col)), p.topBarHeight()); cell.style.bg = .{ .rgb = th.sel_bg }; cell.style.fg = .{ .rgb = th.sel_fg }; } @@ -13324,7 +13365,7 @@ pub const Pardes = struct { const bar = p.headerText(); const x = if (p.header_column) |c| p.col_x[c] + TAG_TEXT_INSET else 0; const w = if (p.header_column) |c| p.col_w[c] -| TAG_TEXT_INSET else s.cols; - const y: u16 = if (p.header_column != null) TOPBAR_H else 0; + const y: u16 = if (p.header_column != null) p.topBarHeight() else 0; const anchor = p.header_anchor orelse cur; var col = panes.File.rawDisplayCol(bar, @min(cur, anchor)) -| p.header_scroll; const hi = panes.File.rawDisplayCol(bar, @max(cur, anchor)) -| p.header_scroll; @@ -13342,7 +13383,7 @@ pub const Pardes = struct { switch (p.drag) { .border_v => |d| { if (d.cur_x < s.cols) { - var row: u16 = TOPBAR_H; + var row: u16 = p.topBarHeight(); while (row < s.rows) : (row += 1) s.overlayDash(d.cur_x, row, "╎"); } if (d.corner) |k| if (d.cur_y < s.rows) { @@ -13367,11 +13408,11 @@ pub const Pardes = struct { for (&s.body_layers) |*layer| if (layer.rows > 0 and layer.viewport.x + layer.viewport.w == s.cols) { layer.viewport.w -|= 1; }; - for (&s.tag_layers) |*layer| if (layer.cols > 0 and layer.viewport.x + layer.viewport.w == s.cols and layer.viewport.y >= TOPBAR_H) { + for (&s.tag_layers) |*layer| if (layer.cols > 0 and layer.viewport.x + layer.viewport.w == s.cols and layer.viewport.y >= p.topBarHeight()) { layer.viewport.w -|= 1; }; } - var row: u16 = TOPBAR_H; + var row: u16 = p.topBarHeight(); while (row < s.rows) : (row += 1) s.overlayDash(x, row, "╎"); } }, @@ -13389,7 +13430,7 @@ pub const Pardes = struct { var c: usize = 0; while (c + 1 < p.ncol) : (c += 1) { if (p.hover_col == p.col_x[c] + p.col_w[c] -| 1) { - var row: u16 = TOPBAR_H; + var row: u16 = p.topBarHeight(); while (row < s.rows) : (row += 1) s.overlayDash(p.hover_col, row, "╎"); } } @@ -13443,27 +13484,27 @@ pub const Pardes = struct { const ow: u16 = 38; const oh: u16 = 10; const ox: u16 = if (s.cols > ow) s.cols - ow else 0; - if (ox + ow <= s.cols and TOPBAR_H + oh <= s.rows) { + if (ox + ow <= s.cols and p.topBarHeight() + oh <= s.rows) { // vaxis single_rounded border ring, default style - s.set(ox, TOPBAR_H, "╭", .{}); - s.set(ox + ow - 1, TOPBAR_H, "╮", .{}); - s.set(ox, TOPBAR_H + oh - 1, "╰", .{}); - s.set(ox + ow - 1, TOPBAR_H + oh - 1, "╯", .{}); + s.set(ox, p.topBarHeight(), "╭", .{}); + s.set(ox + ow - 1, p.topBarHeight(), "╮", .{}); + s.set(ox, p.topBarHeight() + oh - 1, "╰", .{}); + s.set(ox + ow - 1, p.topBarHeight() + oh - 1, "╯", .{}); var bx = ox + 1; while (bx < ox + ow - 1) : (bx += 1) { - s.set(bx, TOPBAR_H, "─", .{}); - s.set(bx, TOPBAR_H + oh - 1, "─", .{}); + s.set(bx, p.topBarHeight(), "─", .{}); + s.set(bx, p.topBarHeight() + oh - 1, "─", .{}); } - var by = TOPBAR_H + 1; - while (by < TOPBAR_H + oh - 1) : (by += 1) { + var by = p.topBarHeight() + 1; + while (by < p.topBarHeight() + oh - 1) : (by += 1) { s.set(ox, by, "│", .{}); s.set(ox + ow - 1, by, "│", .{}); } - s.fill(ox + 1, TOPBAR_H + 1, ow - 2, oh - 2, .{ .bg = .{ .rgb = chrome.scroll_track } }); + s.fill(ox + 1, p.topBarHeight() + 1, ow - 2, oh - 2, .{ .bg = .{ .rgb = chrome.scroll_track } }); var lines = std.mem.splitScalar(u8, text, '\n'); - var ly: u16 = TOPBAR_H + 1; + var ly: u16 = p.topBarHeight() + 1; while (lines.next()) |line| : (ly += 1) { - if (ly >= TOPBAR_H + oh - 1) break; + if (ly >= p.topBarHeight() + oh - 1) break; _ = s.print(ox + 1, ly, ow - 2, line, .{ .fg = .{ .rgb = chrome.tag_fg } }); } } @@ -13702,11 +13743,14 @@ pub const Pardes = struct { layer.cursor = if (p.topbar_col == null and pane.promptAt() == null and temporary.cursor != null) .{ .col = temporary.cursor.?.x - TAG_TEXT_INSET, .bar = temporary.cursor.?.bar } else null; } var text_buf: [1200]u8 = undefined; - try p.renderHeaderLayer(arena, MAX_PANES + MAX_COLS, .workspace, 0, .{ .x = 0, .y = 0, .w = p.screen_w, .h = TOPBAR_H }, p.topbar(&text_buf), chrome.tag_bg, chrome.tag_fg); + // With the workspace tag row handed to native chrome there is no + // workspace layer to render; the menu bar carries its commands. + if (p.settings.workspace_tag) + try p.renderHeaderLayer(arena, MAX_PANES + MAX_COLS, .workspace, 0, .{ .x = 0, .y = 0, .w = p.screen_w, .h = TOPBAR_H }, p.topbar(&text_buf), chrome.tag_bg, chrome.tag_fg); if (p.columnBarHeight() > 0) for (0..p.ncol) |column| { if (p.col_w[column] == 0) continue; const active = if (layout.findPane(p, p.active)) |found| found.col == column and p.settings.focus_tint else false; - try p.renderHeaderLayer(arena, MAX_PANES + column, .column, @intCast(column), .{ .x = p.col_x[column] + @min(TAG_TEXT_INSET, p.col_w[column]), .y = TOPBAR_H, .w = p.col_w[column] -| TAG_TEXT_INSET, .h = COLBAR_H }, p.columnTag(column), if (active) chrome.tag_active_bg else chrome.tag_bg, if (active) chrome.tag_active_fg else chrome.tag_fg); + try p.renderHeaderLayer(arena, MAX_PANES + column, .column, @intCast(column), .{ .x = p.col_x[column] + @min(TAG_TEXT_INSET, p.col_w[column]), .y = p.topBarHeight(), .w = p.col_w[column] -| TAG_TEXT_INSET, .h = COLBAR_H }, p.columnTag(column), if (active) chrome.tag_active_bg else chrome.tag_bg, if (active) chrome.tag_active_fg else chrome.tag_fg); }; } @@ -14010,13 +14054,14 @@ pub const Pardes = struct { if (p.look_hover_preview) |preview| { if (preview.pane == id and preview.serial == pane.serial) { // Preserve body ink, then let every real user selection below - // win over this quiet affordance. + // win over this quiet affordance. mark_hover carries the + // cells this paints out to the hosts as the affordance rect — + // macOS composes its glass overlay over exactly these. const preview_bg = mix(page_rgb, mix(page_rgb, th.sel_bg)); if (preview.file_word) |word| panes.File.paintWordSelection(p, pane, r, word.row, word.lo, word.hi, preview_bg) else if (preview.sel) |sel| - if (@max(sel.r0, sel.r1) >= BOX_H) - p.paintPointerSelection(pane, r, tx, tw, tag_y, body_y, sel, preview_bg, null); + p.paintPointerSelection(pane, r, tx, tw, tag_y, body_y, sel, preview_bg, null); } } const modal_hover = if (p.look_hover_preview) |preview| diff --git a/src/themes/acme.zig b/src/themes/acme.zig index 87183ebc..d91e626b 100644 --- a/src/themes/acme.zig +++ b/src/themes/acme.zig @@ -14,13 +14,13 @@ pub const theme = .{ .name = "acme", .bg = .{ 0xff, 0xff, 0xea }, .fg = .{ 0x00, 0x00, 0x00 }, - .sel_bg = .{ 0xee, 0xee, 0x9e }, + .sel_bg = .{ 0xfa, 0xfa, 0x92 }, .sel_fg = .{ 0x00, 0x00, 0x00 }, .tag_bg = .{ 0xea, 0xff, 0xff }, .tag_fg = .{ 0x00, 0x00, 0x00 }, - .box = .{ 0x6e, 0x4f, 0xd0 }, - .box_dim = .{ 0x38, 0x3c, 0x54 }, - .kw = .{ 0x88, 0x22, 0x99 }, + .box = .{ 0x66, 0x3f, 0xe0 }, + .box_dim = .{ 0x35, 0x3a, 0x58 }, + .kw = .{ 0x97, 0x0d, 0xae }, .str = .{ 0x00, 0x77, 0x33 }, .num = .{ 0xa0, 0x52, 0x00 }, .comment = .{ 0x55, 0x55, 0x55 }, diff --git a/src/themes/atelier.zig b/src/themes/atelier.zig index 0193e2e9..f367c341 100644 --- a/src/themes/atelier.zig +++ b/src/themes/atelier.zig @@ -11,27 +11,27 @@ pub const theme = .{ .tag_active_name_fg = .{ 0x65, 0x3f, 0x6b }, .tag_active_bg = .{ 0xd3, 0xe7, 0xdf }, .tag_active_fg = .{ 0x35, 0x58, 0x4d }, - .box = .{ 0x3e, 0x7a, 0x68 }, - .box_dim = .{ 0x99, 0xb6, 0xa3 }, - .column_box = .{ 0x88, 0x57, 0x22 }, - .column_box_dim = .{ 0xb6, 0xa3, 0x87 }, - .kw = .{ 0x76, 0x4d, 0x80 }, - .str = .{ 0x3c, 0x6c, 0x43 }, - .num = .{ 0x88, 0x57, 0x22 }, - .comment = .{ 0x35, 0x73, 0x3a }, + .box = .{ 0x36, 0x82, 0x6b }, + .box_dim = .{ 0x95, 0xba, 0xa2 }, + .column_box = .{ 0x95, 0x58, 0x15 }, + .column_box_dim = .{ 0xbc, 0xa4, 0x81 }, + .kw = .{ 0x7b, 0x44, 0x89 }, + .str = .{ 0x34, 0x74, 0x3d }, + .num = .{ 0x9a, 0x58, 0x10 }, + .comment = .{ 0x29, 0x7c, 0x30 }, .lineno = .{ 0x90, 0x98, 0x80 }, .lineno_active = .{ 0x88, 0x90, 0x78 }, .scroll_track = .{ 0xee, 0xec, 0xcf }, - .scroll_thumb = .{ 0x9d, 0xa9, 0x7b }, - .border = .{ 0xb8, 0xc8, 0xb4 }, - .sel_bg = .{ 0xe5, 0xe9, 0xae }, + .scroll_thumb = .{ 0x9f, 0xae, 0x76 }, + .border = .{ 0xff, 0xff, 0xff }, + .sel_bg = .{ 0xed, 0xf2, 0xa5 }, .sel_fg = .{ 0x35, 0x49, 0x2d }, - .search_bg = .{ 0xf0, 0xd7, 0x94 }, + .search_bg = .{ 0xfe, 0xdd, 0x86 }, .search_fg = .{ 0x61, 0x47, 0x15 }, - .diagnostic_error = .{ 0xa3, 0x3d, 0x37 }, - .diagnostic_warning = .{ 0x81, 0x59, 0x08 }, - .diagnostic_info = .{ 0x33, 0x65, 0x78 }, - .diagnostic_hint = .{ 0x52, 0x6e, 0x3d }, + .diagnostic_error = .{ 0xb3, 0x2f, 0x27 }, + .diagnostic_warning = .{ 0x89, 0x5c, 0x00 }, + .diagnostic_info = .{ 0x29, 0x6a, 0x82 }, + .diagnostic_hint = .{ 0x51, 0x75, 0x36 }, .palette = .{ .{ 0x29, 0x3f, 0x35 }, .{ 0xa3, 0x3d, 0x37 }, diff --git a/src/themes/clay.zig b/src/themes/clay.zig index af824764..85487d48 100644 --- a/src/themes/clay.zig +++ b/src/themes/clay.zig @@ -12,27 +12,27 @@ pub const theme = .{ .tag_active_name_fg = .{ 0xb5, 0xec, 0xec }, .tag_active_bg = .{ 0x42, 0x4f, 0x40 }, .tag_active_fg = .{ 0xe3, 0xe2, 0xc2 }, - .box = .{ 0x8e, 0xc0, 0x7c }, - .box_dim = .{ 0x67, 0x77, 0x52 }, - .column_box = .{ 0xd3, 0x86, 0x9b }, - .column_box_dim = .{ 0x83, 0x62, 0x68 }, - .kw = .{ 0xfb, 0x8a, 0x69 }, - .str = .{ 0xb8, 0xbb, 0x26 }, - .num = .{ 0xd3, 0x86, 0x9b }, - .comment = .{ 0xe2, 0xb5, 0x6f }, + .box = .{ 0x8a, 0xc8, 0x74 }, + .box_dim = .{ 0x68, 0x7c, 0x4d }, + .column_box = .{ 0xdd, 0x7c, 0x97 }, + .column_box_dim = .{ 0x87, 0x5e, 0x65 }, + .kw = .{ 0xff, 0x88, 0x65 }, + .str = .{ 0xd1, 0xd5, 0x0c }, + .num = .{ 0xe0, 0x79, 0x95 }, + .comment = .{ 0xf6, 0xb9, 0x5b }, .lineno = .{ 0x69, 0x64, 0x55 }, .lineno_active = .{ 0x71, 0x6c, 0x5d }, .scroll_track = .{ 0x22, 0x21, 0x19 }, - .scroll_thumb = .{ 0x8a, 0x90, 0x6b }, - .border = .{ 0x56, 0x64, 0x48 }, - .sel_bg = .{ 0x4f, 0x58, 0x3c }, + .scroll_thumb = .{ 0x8c, 0x94, 0x67 }, + .border = .{ 0x74, 0x87, 0x61 }, + .sel_bg = .{ 0x50, 0x5c, 0x38 }, .sel_fg = .{ 0xfb, 0xf1, 0xc7 }, - .search_bg = .{ 0x66, 0x51, 0x28 }, + .search_bg = .{ 0x6f, 0x54, 0x1f }, .search_fg = .{ 0xff, 0xe2, 0xa0 }, - .diagnostic_error = .{ 0xfb, 0x8a, 0x69 }, - .diagnostic_warning = .{ 0xfa, 0xbd, 0x2f }, - .diagnostic_info = .{ 0x83, 0xb5, 0xa8 }, - .diagnostic_hint = .{ 0x8e, 0xc0, 0x7c }, + .diagnostic_error = .{ 0xff, 0x88, 0x65 }, + .diagnostic_warning = .{ 0xff, 0xbf, 0x2a }, + .diagnostic_info = .{ 0x7b, 0xbd, 0xac }, + .diagnostic_hint = .{ 0x89, 0xca, 0x72 }, .palette = .{ .{ 0x10, 0x10, 0x0e }, .{ 0xfb, 0x8a, 0x69 }, diff --git a/src/themes/dark.zig b/src/themes/dark.zig index 5b39b1c7..82396397 100644 --- a/src/themes/dark.zig +++ b/src/themes/dark.zig @@ -13,15 +13,15 @@ pub const theme = .{ .name = "dark", .bg = null, .fg = null, - .sel_bg = .{ 0x4a, 0x3a, 0x1e }, + .sel_bg = .{ 0x51, 0x3c, 0x17 }, .sel_fg = .{ 0xd8, 0xc8, 0xa8 }, .tag_bg = .{ 0x2c, 0x2a, 0x3e }, .tag_fg = .{ 0x96, 0x96, 0x96 }, - .box = .{ 0x6e, 0x4f, 0xd0 }, - .box_dim = .{ 0x38, 0x3c, 0x54 }, - .kw = .{ 0xcc, 0x70, 0xd8 }, - .str = .{ 0x8a, 0xb8, 0x7a }, - .num = .{ 0xd0, 0xc0, 0x70 }, + .box = .{ 0x66, 0x3f, 0xe0 }, + .box_dim = .{ 0x35, 0x3a, 0x58 }, + .kw = .{ 0xda, 0x5e, 0xea }, + .str = .{ 0x85, 0xc3, 0x6f }, + .num = .{ 0xe1, 0xcb, 0x5f }, .comment = .{ 0xf0, 0xf0, 0xf0 }, .lineno = .{ 0x5a, 0x5a, 0x5a }, .scroll_track = .{ 0x2a, 0x2a, 0x2a }, diff --git a/src/themes/daybreak.zig b/src/themes/daybreak.zig index c55069a9..80f4883c 100644 --- a/src/themes/daybreak.zig +++ b/src/themes/daybreak.zig @@ -11,27 +11,27 @@ pub const theme = .{ .tag_active_name_fg = .{ 0x52, 0x25, 0x5f }, .tag_active_bg = .{ 0xdf, 0xea, 0xf3 }, .tag_active_fg = .{ 0x21, 0x3e, 0x56 }, - .box = .{ 0x07, 0x5f, 0x91 }, - .box_dim = .{ 0x81, 0x9d, 0xb1 }, - .column_box = .{ 0x76, 0x42, 0x09 }, - .column_box_dim = .{ 0xb1, 0x9a, 0x80 }, - .kw = .{ 0x62, 0x2a, 0x88 }, - .str = .{ 0x24, 0x5b, 0x30 }, - .num = .{ 0x76, 0x42, 0x09 }, - .comment = .{ 0x14, 0x56, 0x38 }, + .box = .{ 0x00, 0x61, 0x98 }, + .box_dim = .{ 0x7b, 0x9e, 0xb7 }, + .column_box = .{ 0x7f, 0x42, 0x00 }, + .column_box_dim = .{ 0xb7, 0x9a, 0x7a }, + .kw = .{ 0x65, 0x1a, 0x98 }, + .str = .{ 0x1a, 0x65, 0x2b }, + .num = .{ 0x7f, 0x42, 0x00 }, + .comment = .{ 0x08, 0x62, 0x39 }, .lineno = .{ 0x88, 0x93, 0x9b }, .lineno_active = .{ 0x80, 0x8b, 0x93 }, .scroll_track = .{ 0xe6, 0xed, 0xf3 }, - .scroll_thumb = .{ 0x6b, 0x85, 0x9b }, - .border = .{ 0x85, 0x9b, 0xac }, - .sel_bg = .{ 0xc1, 0xde, 0xf3 }, + .scroll_thumb = .{ 0x66, 0x85, 0xa0 }, + .border = .{ 0xc5, 0xcf, 0xd7 }, + .sel_bg = .{ 0xb9, 0xdf, 0xfb }, .sel_fg = .{ 0x10, 0x36, 0x4f }, .search_bg = .{ 0xff, 0xe3, 0x96 }, .search_fg = .{ 0x4b, 0x35, 0x00 }, - .diagnostic_error = .{ 0xa1, 0x1c, 0x30 }, + .diagnostic_error = .{ 0xb3, 0x08, 0x22 }, .diagnostic_warning = .{ 0x70, 0x49, 0x00 }, - .diagnostic_info = .{ 0x07, 0x5a, 0x83 }, - .diagnostic_hint = .{ 0x38, 0x55, 0x2b }, + .diagnostic_info = .{ 0x00, 0x5c, 0x8a }, + .diagnostic_hint = .{ 0x36, 0x5b, 0x25 }, .palette = .{ .{ 0x14, 0x2d, 0x40 }, .{ 0xa1, 0x1c, 0x30 }, diff --git a/src/themes/dusk.zig b/src/themes/dusk.zig index 32948d02..b9377992 100644 --- a/src/themes/dusk.zig +++ b/src/themes/dusk.zig @@ -11,27 +11,27 @@ pub const theme = .{ .tag_active_name_fg = .{ 0xa1, 0xd5, 0xc4 }, .tag_active_bg = .{ 0x3b, 0x2f, 0x3b }, .tag_active_fg = .{ 0xd2, 0xc2, 0xd1 }, - .box = .{ 0xe4, 0xb3, 0x9b }, - .box_dim = .{ 0x71, 0x57, 0x68 }, - .column_box = .{ 0xba, 0xc8, 0x94 }, - .column_box_dim = .{ 0x73, 0x77, 0x62 }, - .kw = .{ 0xcf, 0xb1, 0xe8 }, - .str = .{ 0xba, 0xc8, 0x94 }, - .num = .{ 0xe8, 0xb5, 0x92 }, - .comment = .{ 0xf1, 0xb9, 0x89 }, + .box = .{ 0xed, 0xb0, 0x92 }, + .box_dim = .{ 0x74, 0x54, 0x69 }, + .column_box = .{ 0xbd, 0xce, 0x8e }, + .column_box_dim = .{ 0x75, 0x7a, 0x5f }, + .kw = .{ 0xd0, 0xa7, 0xf2 }, + .str = .{ 0xbe, 0xd1, 0x8b }, + .num = .{ 0xf7, 0xb2, 0x83 }, + .comment = .{ 0xff, 0xb8, 0x7b }, .lineno = .{ 0x82, 0x71, 0x7e }, .lineno_active = .{ 0x8a, 0x79, 0x86 }, .scroll_track = .{ 0x3d, 0x35, 0x40 }, - .scroll_thumb = .{ 0x8b, 0x69, 0x7c }, - .border = .{ 0x51, 0x41, 0x4f }, - .sel_bg = .{ 0x61, 0x44, 0x53 }, + .scroll_thumb = .{ 0x8e, 0x66, 0x7c }, + .border = .{ 0x6d, 0x58, 0x6b }, + .sel_bg = .{ 0x65, 0x40, 0x53 }, .sel_fg = .{ 0xff, 0xf0, 0xeb }, - .search_bg = .{ 0x5e, 0x49, 0x2e }, + .search_bg = .{ 0x65, 0x4a, 0x27 }, .search_fg = .{ 0xff, 0xe3, 0xa2 }, - .diagnostic_error = .{ 0xf6, 0xaa, 0xa4 }, - .diagnostic_warning = .{ 0xed, 0xca, 0x8a }, - .diagnostic_info = .{ 0xaa, 0xcb, 0xdc }, - .diagnostic_hint = .{ 0xc2, 0xcd, 0xa1 }, + .diagnostic_error = .{ 0xff, 0xa2, 0x9b }, + .diagnostic_warning = .{ 0xfc, 0xce, 0x7b }, + .diagnostic_info = .{ 0xa2, 0xcd, 0xe4 }, + .diagnostic_hint = .{ 0xc5, 0xd4, 0x9a }, .palette = .{ .{ 0x39, 0x32, 0x3b }, .{ 0xf6, 0xaa, 0xa4 }, diff --git a/src/themes/forge.zig b/src/themes/forge.zig index 7f78f2ca..a27f66fb 100644 --- a/src/themes/forge.zig +++ b/src/themes/forge.zig @@ -12,27 +12,27 @@ pub const theme = .{ .tag_active_name_fg = .{ 0xf8, 0xcb, 0xa7 }, .tag_active_bg = .{ 0x2d, 0x34, 0x40 }, .tag_active_fg = .{ 0xd1, 0xd5, 0xde }, - .box = .{ 0xa5, 0xc4, 0xee }, - .box_dim = .{ 0x59, 0x65, 0x77 }, - .column_box = .{ 0xb5, 0xce, 0xa8 }, - .column_box_dim = .{ 0x6b, 0x79, 0x69 }, - .kw = .{ 0x75, 0xb5, 0xe8 }, - .str = .{ 0xce, 0x91, 0x78 }, - .num = .{ 0xb5, 0xce, 0xa8 }, + .box = .{ 0x9c, 0xc3, 0xf7 }, + .box_dim = .{ 0x55, 0x64, 0x7b }, + .column_box = .{ 0xb4, 0xd3, 0xa3 }, + .column_box_dim = .{ 0x6a, 0x7b, 0x67 }, + .kw = .{ 0x61, 0xb7, 0xfc }, + .str = .{ 0xdd, 0x8b, 0x69 }, + .num = .{ 0xb3, 0xd5, 0xa1 }, .comment = .{ 0xb3, 0xca, 0xff }, .lineno = .{ 0x62, 0x65, 0x6c }, .lineno_active = .{ 0x6a, 0x6d, 0x74 }, .scroll_track = .{ 0x1a, 0x1c, 0x21 }, - .scroll_thumb = .{ 0x73, 0x80, 0x92 }, - .border = .{ 0x47, 0x52, 0x63 }, - .sel_bg = .{ 0x26, 0x4f, 0x68 }, + .scroll_thumb = .{ 0x70, 0x80, 0x95 }, + .border = .{ 0x60, 0x6f, 0x86 }, + .sel_bg = .{ 0x1c, 0x51, 0x72 }, .sel_fg = .{ 0xe2, 0xee, 0xf4 }, - .search_bg = .{ 0x59, 0x4a, 0x25 }, + .search_bg = .{ 0x61, 0x4d, 0x1d }, .search_fg = .{ 0xf5, 0xdf, 0xa1 }, - .diagnostic_error = .{ 0xf2, 0x8a, 0x81 }, - .diagnostic_warning = .{ 0xd7, 0xba, 0x7d }, + .diagnostic_error = .{ 0xff, 0x7f, 0x74 }, + .diagnostic_warning = .{ 0xe4, 0xbf, 0x70 }, .diagnostic_info = .{ 0x75, 0xbe, 0xff }, - .diagnostic_hint = .{ 0x8b, 0xce, 0xba }, + .diagnostic_hint = .{ 0x81, 0xd8, 0xbe }, // ANSI roles are semantic colors, independent of peach string syntax. .palette = .{ .{ 0x0c, 0x0c, 0x0e }, diff --git a/src/themes/forge_black.zig b/src/themes/forge_black.zig index d9835110..85f6132e 100644 --- a/src/themes/forge_black.zig +++ b/src/themes/forge_black.zig @@ -12,27 +12,27 @@ pub const theme = .{ .tag_active_name_fg = .{ 0xf8, 0xcb, 0xa7 }, .tag_active_bg = .{ 0x2d, 0x34, 0x40 }, .tag_active_fg = .{ 0xd1, 0xd5, 0xde }, - .box = .{ 0xa5, 0xc4, 0xee }, - .box_dim = .{ 0x59, 0x65, 0x77 }, - .column_box = .{ 0xb5, 0xce, 0xa8 }, - .column_box_dim = .{ 0x6b, 0x79, 0x69 }, - .kw = .{ 0x75, 0xb5, 0xe8 }, - .str = .{ 0xce, 0x91, 0x78 }, - .num = .{ 0xb5, 0xce, 0xa8 }, + .box = .{ 0x9c, 0xc3, 0xf7 }, + .box_dim = .{ 0x55, 0x64, 0x7b }, + .column_box = .{ 0xb4, 0xd3, 0xa3 }, + .column_box_dim = .{ 0x6a, 0x7b, 0x67 }, + .kw = .{ 0x61, 0xb7, 0xfc }, + .str = .{ 0xdd, 0x8b, 0x69 }, + .num = .{ 0xb3, 0xd5, 0xa1 }, .comment = .{ 0xb3, 0xca, 0xff }, .lineno = .{ 0x62, 0x65, 0x6c }, .lineno_active = .{ 0x6a, 0x6d, 0x74 }, .scroll_track = .{ 0x14, 0x16, 0x1a }, - .scroll_thumb = .{ 0x73, 0x80, 0x92 }, - .border = .{ 0x47, 0x52, 0x63 }, - .sel_bg = .{ 0x26, 0x4f, 0x68 }, + .scroll_thumb = .{ 0x70, 0x80, 0x95 }, + .border = .{ 0x60, 0x6f, 0x86 }, + .sel_bg = .{ 0x1c, 0x51, 0x72 }, .sel_fg = .{ 0xe2, 0xee, 0xf4 }, - .search_bg = .{ 0x59, 0x4a, 0x25 }, + .search_bg = .{ 0x61, 0x4d, 0x1d }, .search_fg = .{ 0xf5, 0xdf, 0xa1 }, - .diagnostic_error = .{ 0xf2, 0x8a, 0x81 }, - .diagnostic_warning = .{ 0xd7, 0xba, 0x7d }, + .diagnostic_error = .{ 0xff, 0x7f, 0x74 }, + .diagnostic_warning = .{ 0xe4, 0xbf, 0x70 }, .diagnostic_info = .{ 0x75, 0xbe, 0xff }, - .diagnostic_hint = .{ 0x8b, 0xce, 0xba }, + .diagnostic_hint = .{ 0x81, 0xd8, 0xbe }, // ANSI roles are semantic colors, independent of peach string syntax. .palette = .{ .{ 0x00, 0x00, 0x00 }, diff --git a/src/themes/forge_soft.zig b/src/themes/forge_soft.zig index 896bd9e8..0ca062a4 100644 --- a/src/themes/forge_soft.zig +++ b/src/themes/forge_soft.zig @@ -12,27 +12,27 @@ pub const theme = .{ .tag_active_name_fg = .{ 0xf8, 0xcb, 0xa7 }, .tag_active_bg = .{ 0x37, 0x3e, 0x49 }, .tag_active_fg = .{ 0xd1, 0xd5, 0xde }, - .box = .{ 0xa5, 0xc4, 0xee }, - .box_dim = .{ 0x59, 0x65, 0x77 }, - .column_box = .{ 0xb5, 0xce, 0xa8 }, - .column_box_dim = .{ 0x6f, 0x7d, 0x6e }, - .kw = .{ 0x75, 0xb5, 0xe8 }, - .str = .{ 0xda, 0xa5, 0x8e }, - .num = .{ 0xb5, 0xce, 0xa8 }, + .box = .{ 0x9c, 0xc3, 0xf7 }, + .box_dim = .{ 0x55, 0x64, 0x7b }, + .column_box = .{ 0xb4, 0xd3, 0xa3 }, + .column_box_dim = .{ 0x6d, 0x7f, 0x6c }, + .kw = .{ 0x61, 0xb7, 0xfc }, + .str = .{ 0xe7, 0xa0, 0x81 }, + .num = .{ 0xb3, 0xd5, 0xa1 }, .comment = .{ 0xb3, 0xca, 0xff }, .lineno = .{ 0x86, 0x89, 0x91 }, .lineno_active = .{ 0x8e, 0x91, 0x99 }, .scroll_track = .{ 0x3d, 0x40, 0x47 }, - .scroll_thumb = .{ 0x73, 0x80, 0x92 }, - .border = .{ 0x47, 0x52, 0x63 }, - .sel_bg = .{ 0x26, 0x4f, 0x68 }, + .scroll_thumb = .{ 0x70, 0x80, 0x95 }, + .border = .{ 0x60, 0x6f, 0x86 }, + .sel_bg = .{ 0x1c, 0x51, 0x72 }, .sel_fg = .{ 0xe2, 0xee, 0xf4 }, - .search_bg = .{ 0x59, 0x4a, 0x25 }, + .search_bg = .{ 0x61, 0x4d, 0x1d }, .search_fg = .{ 0xf5, 0xdf, 0xa1 }, - .diagnostic_error = .{ 0xf2, 0x8a, 0x81 }, - .diagnostic_warning = .{ 0xd7, 0xba, 0x7d }, + .diagnostic_error = .{ 0xff, 0x7f, 0x74 }, + .diagnostic_warning = .{ 0xe4, 0xbf, 0x70 }, .diagnostic_info = .{ 0x75, 0xbe, 0xff }, - .diagnostic_hint = .{ 0x8b, 0xce, 0xba }, + .diagnostic_hint = .{ 0x81, 0xd8, 0xbe }, // ANSI roles are semantic colors, independent of peach string syntax. .palette = .{ .{ 0x35, 0x38, 0x3e }, diff --git a/src/themes/harvest.zig b/src/themes/harvest.zig index bf367a24..cf10a779 100644 --- a/src/themes/harvest.zig +++ b/src/themes/harvest.zig @@ -12,27 +12,27 @@ pub const theme = .{ .tag_active_name_fg = .{ 0xc5, 0xe7, 0xf7 }, .tag_active_bg = .{ 0x42, 0x4d, 0x38 }, .tag_active_fg = .{ 0xe1, 0xe4, 0xc4 }, - .box = .{ 0xcf, 0xba, 0x8b }, - .box_dim = .{ 0x77, 0x79, 0x53 }, - .column_box = .{ 0xf0, 0x7d, 0x63 }, - .column_box_dim = .{ 0x92, 0x5c, 0x48 }, - .kw = .{ 0xf0, 0x7d, 0x63 }, - .str = .{ 0x99, 0xbe, 0x70 }, - .num = .{ 0xfa, 0xd5, 0x66 }, - .comment = .{ 0xef, 0xc7, 0x8c }, + .box = .{ 0xd8, 0xbd, 0x83 }, + .box_dim = .{ 0x7b, 0x7e, 0x4e }, + .column_box = .{ 0xff, 0x74, 0x54 }, + .column_box_dim = .{ 0x9b, 0x58, 0x3f }, + .kw = .{ 0xff, 0x74, 0x54 }, + .str = .{ 0x9a, 0xcc, 0x62 }, + .num = .{ 0xff, 0xd8, 0x61 }, + .comment = .{ 0xff, 0xca, 0x7c }, .lineno = .{ 0x6a, 0x64, 0x56 }, .lineno_active = .{ 0x72, 0x6c, 0x5e }, .scroll_track = .{ 0x20, 0x1d, 0x17 }, - .scroll_thumb = .{ 0x85, 0x8a, 0x62 }, - .border = .{ 0x59, 0x65, 0x47 }, - .sel_bg = .{ 0x4d, 0x54, 0x38 }, + .scroll_thumb = .{ 0x88, 0x8e, 0x5e }, + .border = .{ 0x78, 0x88, 0x60 }, + .sel_bg = .{ 0x4f, 0x58, 0x34 }, .sel_fg = .{ 0xf3, 0xf2, 0xcc }, - .search_bg = .{ 0x66, 0x45, 0x2d }, + .search_bg = .{ 0x6f, 0x44, 0x24 }, .search_fg = .{ 0xff, 0xe2, 0xac }, - .diagnostic_error = .{ 0xf5, 0x8a, 0x73 }, - .diagnostic_warning = .{ 0xfa, 0xd5, 0x66 }, - .diagnostic_info = .{ 0x86, 0xc1, 0xb9 }, - .diagnostic_hint = .{ 0xb5, 0xc6, 0x8c }, + .diagnostic_error = .{ 0xff, 0x84, 0x69 }, + .diagnostic_warning = .{ 0xff, 0xd8, 0x61 }, + .diagnostic_info = .{ 0x7d, 0xca, 0xbf }, + .diagnostic_hint = .{ 0xb9, 0xcf, 0x83 }, .palette = .{ .{ 0x10, 0x0e, 0x0b }, .{ 0xf5, 0x8a, 0x73 }, diff --git a/src/themes/helix.zig b/src/themes/helix.zig index 3c2934f7..76eaeab2 100644 --- a/src/themes/helix.zig +++ b/src/themes/helix.zig @@ -45,9 +45,9 @@ pub const theme = .{ .tag_fg = .{ 0x94, 0x94, 0x94 }, .box = .{ 0x62, 0x62, 0x62 }, .box_dim = .{ 0x26, 0x26, 0x26 }, - .kw = .{ 0xcf, 0x87, 0xe8 }, - .str = .{ 0xe3, 0xc7, 0x8a }, - .num = .{ 0xe3, 0xc7, 0x8a }, + .kw = .{ 0xd7, 0x76, 0xf9 }, + .str = .{ 0xf3, 0xcd, 0x7a }, + .num = .{ 0xf3, 0xcd, 0x7a }, .comment = .{ 0xff, 0xff, 0xff }, .lineno = .{ 0x62, 0x62, 0x62 }, .scroll_track = .{ 0x12, 0x12, 0x12 }, diff --git a/src/themes/ink.zig b/src/themes/ink.zig index 3b92a635..1e254a3c 100644 --- a/src/themes/ink.zig +++ b/src/themes/ink.zig @@ -12,26 +12,26 @@ pub const theme = .{ .tag_active_bg = .{ 0x22, 0x33, 0x42 }, .tag_active_fg = .{ 0xe1, 0xee, 0xf9 }, .box = .{ 0x86, 0xd8, 0xff }, - .box_dim = .{ 0x64, 0x79, 0x8b }, + .box_dim = .{ 0x5f, 0x79, 0x90 }, .column_box = .{ 0xff, 0xd6, 0x94 }, - .column_box_dim = .{ 0x8a, 0x7b, 0x60 }, + .column_box_dim = .{ 0x8f, 0x7d, 0x5b }, .kw = .{ 0xd5, 0xb8, 0xff }, - .str = .{ 0xb5, 0xee, 0xae }, + .str = .{ 0xac, 0xf9, 0xa3 }, .num = .{ 0xff, 0xd6, 0x94 }, - .comment = .{ 0xa8, 0xe7, 0xf4 }, + .comment = .{ 0x9d, 0xee, 0xff }, .lineno = .{ 0x62, 0x6b, 0x75 }, .lineno_active = .{ 0x6a, 0x73, 0x7d }, .scroll_track = .{ 0x15, 0x21, 0x2c }, - .scroll_thumb = .{ 0x8b, 0xa7, 0xbd }, - .border = .{ 0x59, 0x6f, 0x83 }, - .sel_bg = .{ 0x26, 0x52, 0x71 }, + .scroll_thumb = .{ 0x86, 0xa8, 0xc2 }, + .border = .{ 0x80, 0x95, 0xa9 }, + .sel_bg = .{ 0x1b, 0x54, 0x7c }, .sel_fg = .{ 0xff, 0xff, 0xff }, - .search_bg = .{ 0x75, 0x50, 0x1b }, + .search_bg = .{ 0x7c, 0x4e, 0x0d }, .search_fg = .{ 0xff, 0xff, 0xff }, .diagnostic_error = .{ 0xff, 0xb1, 0xb1 }, .diagnostic_warning = .{ 0xff, 0xe2, 0x9c }, .diagnostic_info = .{ 0x9b, 0xde, 0xff }, - .diagnostic_hint = .{ 0xc6, 0xe4, 0xb5 }, + .diagnostic_hint = .{ 0xc4, 0xeb, 0xae }, .palette = .{ .{ 0x00, 0x00, 0x00 }, .{ 0xff, 0xb1, 0xb1 }, diff --git a/src/themes/lagoon.zig b/src/themes/lagoon.zig index 516639b0..4d975794 100644 --- a/src/themes/lagoon.zig +++ b/src/themes/lagoon.zig @@ -12,27 +12,27 @@ pub const theme = .{ .tag_active_name_fg = .{ 0xf0, 0xce, 0xf8 }, .tag_active_bg = .{ 0x34, 0x57, 0x4d }, .tag_active_fg = .{ 0xc7, 0xe3, 0xd7 }, - .box = .{ 0x89, 0xc7, 0xb4 }, - .box_dim = .{ 0x59, 0x7e, 0x71 }, + .box = .{ 0x81, 0xcf, 0xb7 }, + .box_dim = .{ 0x54, 0x83, 0x72 }, .column_box = .{ 0xff, 0xad, 0x91 }, - .column_box_dim = .{ 0x94, 0x78, 0x68 }, - .kw = .{ 0xd5, 0xa8, 0xed }, - .str = .{ 0xc3, 0xe8, 0x8d }, + .column_box_dim = .{ 0x9a, 0x76, 0x62 }, + .kw = .{ 0xd9, 0x9c, 0xf9 }, + .str = .{ 0xc6, 0xf8, 0x7d }, .num = .{ 0xff, 0xad, 0x91 }, - .comment = .{ 0x92, 0xe1, 0xd1 }, + .comment = .{ 0x84, 0xef, 0xd9 }, .lineno = .{ 0x7b, 0x91, 0x94 }, .lineno_active = .{ 0x83, 0x99, 0x9c }, .scroll_track = .{ 0x3a, 0x4c, 0x50 }, - .scroll_thumb = .{ 0x72, 0x97, 0x8a }, - .border = .{ 0x50, 0x74, 0x68 }, - .sel_bg = .{ 0x39, 0x5b, 0x65 }, + .scroll_thumb = .{ 0x6e, 0x9b, 0x8b }, + .border = .{ 0x6e, 0x9b, 0x8c }, + .sel_bg = .{ 0x32, 0x5f, 0x6c }, .sel_fg = .{ 0xe6, 0xf2, 0xf3 }, - .search_bg = .{ 0x60, 0x53, 0x27 }, + .search_bg = .{ 0x69, 0x58, 0x1e }, .search_fg = .{ 0xff, 0xf0, 0xb9 }, .diagnostic_error = .{ 0xff, 0x9d, 0xa1 }, .diagnostic_warning = .{ 0xff, 0xcb, 0x6b }, - .diagnostic_info = .{ 0x82, 0xc9, 0xfa }, - .diagnostic_hint = .{ 0x89, 0xdd, 0xcc }, + .diagnostic_info = .{ 0x7d, 0xca, 0xff }, + .diagnostic_hint = .{ 0x7c, 0xea, 0xd4 }, .palette = .{ .{ 0x34, 0x46, 0x4c }, .{ 0xff, 0x9d, 0xa1 }, diff --git a/src/themes/orchard.zig b/src/themes/orchard.zig index 888a5b27..f927c50e 100644 --- a/src/themes/orchard.zig +++ b/src/themes/orchard.zig @@ -11,27 +11,27 @@ pub const theme = .{ .tag_active_name_fg = .{ 0xdf, 0xbc, 0xe5 }, .tag_active_bg = .{ 0x26, 0x36, 0x2d }, .tag_active_fg = .{ 0xbe, 0xcf, 0xc4 }, - .box = .{ 0xad, 0xcc, 0x91 }, - .box_dim = .{ 0x4c, 0x63, 0x56 }, - .column_box = .{ 0xe9, 0xbf, 0x91 }, - .column_box_dim = .{ 0x83, 0x73, 0x5a }, - .kw = .{ 0xc9, 0xb0, 0xe4 }, - .str = .{ 0xb6, 0xce, 0x94 }, - .num = .{ 0xe9, 0xbf, 0x91 }, - .comment = .{ 0xb9, 0xe5, 0x8f }, + .box = .{ 0xad, 0xd3, 0x8a }, + .box_dim = .{ 0x49, 0x66, 0x56 }, + .column_box = .{ 0xf4, 0xc0, 0x86 }, + .column_box_dim = .{ 0x88, 0x74, 0x55 }, + .kw = .{ 0xc9, 0xa7, 0xed }, + .str = .{ 0xb8, 0xd8, 0x8a }, + .num = .{ 0xf8, 0xc0, 0x82 }, + .comment = .{ 0xb9, 0xf4, 0x80 }, .lineno = .{ 0x59, 0x67, 0x5c }, .lineno_active = .{ 0x61, 0x6f, 0x64 }, .scroll_track = .{ 0x15, 0x20, 0x19 }, - .scroll_thumb = .{ 0x63, 0x7f, 0x6a }, - .border = .{ 0x35, 0x48, 0x3d }, - .sel_bg = .{ 0x40, 0x5d, 0x4b }, + .scroll_thumb = .{ 0x60, 0x82, 0x69 }, + .border = .{ 0x48, 0x61, 0x52 }, + .sel_bg = .{ 0x3c, 0x61, 0x4a }, .sel_fg = .{ 0xf5, 0xf7, 0xee }, - .search_bg = .{ 0x57, 0x47, 0x2a }, + .search_bg = .{ 0x5e, 0x49, 0x23 }, .search_fg = .{ 0xf7, 0xe4, 0xa5 }, - .diagnostic_error = .{ 0xf1, 0xa3, 0x9b }, - .diagnostic_warning = .{ 0xe9, 0xc6, 0x80 }, - .diagnostic_info = .{ 0x9b, 0xcb, 0xd5 }, - .diagnostic_hint = .{ 0xb6, 0xc5, 0x9e }, + .diagnostic_error = .{ 0xfe, 0x98, 0x8e }, + .diagnostic_warning = .{ 0xf9, 0xcb, 0x70 }, + .diagnostic_info = .{ 0x92, 0xd1, 0xde }, + .diagnostic_hint = .{ 0xb7, 0xcb, 0x98 }, .palette = .{ .{ 0x0d, 0x14, 0x10 }, .{ 0xf1, 0xa3, 0x9b }, diff --git a/src/themes/orchard_black.zig b/src/themes/orchard_black.zig index be960b93..c700947f 100644 --- a/src/themes/orchard_black.zig +++ b/src/themes/orchard_black.zig @@ -11,27 +11,27 @@ pub const theme = .{ .tag_active_name_fg = .{ 0xdf, 0xbc, 0xe5 }, .tag_active_bg = .{ 0x26, 0x36, 0x2d }, .tag_active_fg = .{ 0xbe, 0xcf, 0xc4 }, - .box = .{ 0xad, 0xcc, 0x91 }, - .box_dim = .{ 0x4c, 0x63, 0x56 }, - .column_box = .{ 0xe9, 0xbf, 0x91 }, - .column_box_dim = .{ 0x83, 0x73, 0x5a }, - .kw = .{ 0xc9, 0xb0, 0xe4 }, - .str = .{ 0xb6, 0xce, 0x94 }, - .num = .{ 0xe9, 0xbf, 0x91 }, - .comment = .{ 0xb9, 0xe5, 0x8f }, + .box = .{ 0xad, 0xd3, 0x8a }, + .box_dim = .{ 0x49, 0x66, 0x56 }, + .column_box = .{ 0xf4, 0xc0, 0x86 }, + .column_box_dim = .{ 0x88, 0x74, 0x55 }, + .kw = .{ 0xc9, 0xa7, 0xed }, + .str = .{ 0xb8, 0xd8, 0x8a }, + .num = .{ 0xf8, 0xc0, 0x82 }, + .comment = .{ 0xb9, 0xf4, 0x80 }, .lineno = .{ 0x59, 0x67, 0x5c }, .lineno_active = .{ 0x61, 0x6f, 0x64 }, .scroll_track = .{ 0x11, 0x18, 0x13 }, - .scroll_thumb = .{ 0x63, 0x7f, 0x6a }, - .border = .{ 0x35, 0x48, 0x3d }, - .sel_bg = .{ 0x40, 0x5d, 0x4b }, + .scroll_thumb = .{ 0x60, 0x82, 0x69 }, + .border = .{ 0x48, 0x61, 0x52 }, + .sel_bg = .{ 0x3c, 0x61, 0x4a }, .sel_fg = .{ 0xf5, 0xf7, 0xee }, - .search_bg = .{ 0x57, 0x47, 0x2a }, + .search_bg = .{ 0x5e, 0x49, 0x23 }, .search_fg = .{ 0xf7, 0xe4, 0xa5 }, - .diagnostic_error = .{ 0xf1, 0xa3, 0x9b }, - .diagnostic_warning = .{ 0xe9, 0xc6, 0x80 }, - .diagnostic_info = .{ 0x9b, 0xcb, 0xd5 }, - .diagnostic_hint = .{ 0xb6, 0xc5, 0x9e }, + .diagnostic_error = .{ 0xfe, 0x98, 0x8e }, + .diagnostic_warning = .{ 0xf9, 0xcb, 0x70 }, + .diagnostic_info = .{ 0x92, 0xd1, 0xde }, + .diagnostic_hint = .{ 0xb7, 0xcb, 0x98 }, .palette = .{ .{ 0x00, 0x00, 0x00 }, .{ 0xf1, 0xa3, 0x9b }, diff --git a/src/themes/paper.zig b/src/themes/paper.zig index b5d24835..f1d6980b 100644 --- a/src/themes/paper.zig +++ b/src/themes/paper.zig @@ -11,27 +11,27 @@ pub const theme = .{ .tag_active_name_fg = .{ 0x69, 0x44, 0x7a }, .tag_active_bg = .{ 0xdc, 0xe5, 0xdc }, .tag_active_fg = .{ 0x4a, 0x5a, 0x52 }, - .box = .{ 0x3c, 0x6b, 0x56 }, - .box_dim = .{ 0x91, 0xa3, 0x95 }, - .column_box = .{ 0x87, 0x58, 0x26 }, - .column_box_dim = .{ 0xb7, 0xa1, 0x84 }, - .kw = .{ 0x73, 0x51, 0x90 }, - .str = .{ 0x41, 0x68, 0x48 }, - .num = .{ 0x87, 0x58, 0x26 }, - .comment = .{ 0x2e, 0x71, 0x59 }, + .box = .{ 0x36, 0x71, 0x57 }, + .box_dim = .{ 0x8f, 0xa5, 0x94 }, + .column_box = .{ 0x93, 0x58, 0x1a }, + .column_box_dim = .{ 0xbd, 0xa2, 0x7e }, + .kw = .{ 0x74, 0x46, 0x9b }, + .str = .{ 0x3a, 0x6f, 0x44 }, + .num = .{ 0x98, 0x59, 0x15 }, + .comment = .{ 0x20, 0x75, 0x56 }, .lineno = .{ 0x8b, 0x91, 0x85 }, .lineno_active = .{ 0x83, 0x89, 0x7d }, .scroll_track = .{ 0xe5, 0xe8, 0xdf }, - .scroll_thumb = .{ 0x88, 0x9b, 0x8b }, - .border = .{ 0xb5, 0xc1, 0xb3 }, - .sel_bg = .{ 0xc8, 0xdf, 0xd1 }, + .scroll_thumb = .{ 0x86, 0x9d, 0x8a }, + .border = .{ 0xfb, 0xfb, 0xfb }, + .sel_bg = .{ 0xc5, 0xe2, 0xd0 }, .sel_fg = .{ 0x20, 0x3e, 0x31 }, - .search_bg = .{ 0xf0, 0xdd, 0xa8 }, + .search_bg = .{ 0xfb, 0xe2, 0x9d }, .search_fg = .{ 0x61, 0x46, 0x1c }, - .diagnostic_error = .{ 0xa3, 0x39, 0x38 }, - .diagnostic_warning = .{ 0x80, 0x57, 0x0c }, - .diagnostic_info = .{ 0x30, 0x65, 0x75 }, - .diagnostic_hint = .{ 0x52, 0x6d, 0x3e }, + .diagnostic_error = .{ 0xb3, 0x29, 0x28 }, + .diagnostic_warning = .{ 0x8c, 0x5b, 0x00 }, + .diagnostic_info = .{ 0x26, 0x6b, 0x7f }, + .diagnostic_hint = .{ 0x51, 0x74, 0x37 }, .palette = .{ .{ 0x30, 0x3b, 0x3b }, .{ 0xa3, 0x39, 0x38 }, diff --git a/src/themes/solarium.zig b/src/themes/solarium.zig index fe2525a6..21b4c451 100644 --- a/src/themes/solarium.zig +++ b/src/themes/solarium.zig @@ -12,27 +12,27 @@ pub const theme = .{ .tag_active_name_fg = .{ 0xf5, 0xcd, 0xec }, .tag_active_bg = .{ 0x21, 0x4e, 0x50 }, .tag_active_fg = .{ 0xd3, 0xe0, 0xc9 }, - .box = .{ 0xd5, 0xbc, 0x72 }, - .box_dim = .{ 0x4c, 0x79, 0x72 }, - .column_box = .{ 0x6a, 0xae, 0xdd }, - .column_box_dim = .{ 0x3e, 0x76, 0x90 }, - .kw = .{ 0x6a, 0xae, 0xdd }, - .str = .{ 0xaf, 0xbd, 0x52 }, - .num = .{ 0xd9, 0x9a, 0x5e }, - .comment = .{ 0xe2, 0xc4, 0x6e }, + .box = .{ 0xe1, 0xc2, 0x66 }, + .box_dim = .{ 0x46, 0x7f, 0x76 }, + .column_box = .{ 0x5c, 0xb1, 0xeb }, + .column_box_dim = .{ 0x34, 0x7a, 0x9a }, + .kw = .{ 0x56, 0xb2, 0xf1 }, + .str = .{ 0xbd, 0xd0, 0x3f }, + .num = .{ 0xef, 0x99, 0x48 }, + .comment = .{ 0xf6, 0xce, 0x5a }, .lineno = .{ 0x64, 0x7e, 0x7c }, .lineno_active = .{ 0x6c, 0x86, 0x84 }, .scroll_track = .{ 0x1c, 0x45, 0x4c }, - .scroll_thumb = .{ 0x69, 0x93, 0x8a }, - .border = .{ 0x38, 0x65, 0x5f }, - .sel_bg = .{ 0x27, 0x56, 0x5c }, + .scroll_thumb = .{ 0x65, 0x97, 0x8c }, + .border = .{ 0x4c, 0x88, 0x80 }, + .sel_bg = .{ 0x1f, 0x5c, 0x64 }, .sel_fg = .{ 0xee, 0xe8, 0xd5 }, - .search_bg = .{ 0x64, 0x53, 0x26 }, + .search_bg = .{ 0x6d, 0x57, 0x1d }, .search_fg = .{ 0xff, 0xf0, 0xb9 }, - .diagnostic_error = .{ 0xed, 0x84, 0x77 }, - .diagnostic_warning = .{ 0xdf, 0xb6, 0x5b }, - .diagnostic_info = .{ 0x6a, 0xae, 0xdd }, - .diagnostic_hint = .{ 0x69, 0xbd, 0xb0 }, + .diagnostic_error = .{ 0xff, 0x7a, 0x6a }, + .diagnostic_warning = .{ 0xf3, 0xbe, 0x47 }, + .diagnostic_info = .{ 0x59, 0xb1, 0xee }, + .diagnostic_hint = .{ 0x5c, 0xca, 0xb9 }, .palette = .{ .{ 0x17, 0x3e, 0x45 }, .{ 0xed, 0x84, 0x77 }, diff --git a/src/themes/spectrum.zig b/src/themes/spectrum.zig index 5a1cecc6..a0faf897 100644 --- a/src/themes/spectrum.zig +++ b/src/themes/spectrum.zig @@ -13,26 +13,26 @@ pub const theme = .{ .tag_active_bg = .{ 0x4d, 0x47, 0x36 }, .tag_active_fg = .{ 0xe9, 0xe4, 0xc7 }, .box = .{ 0xff, 0xd8, 0x66 }, - .box_dim = .{ 0x8b, 0x80, 0x56 }, - .column_box = .{ 0xab, 0x9d, 0xf2 }, - .column_box_dim = .{ 0x73, 0x6a, 0x91 }, + .box_dim = .{ 0x92, 0x84, 0x4f }, + .column_box = .{ 0xa4, 0x92, 0xfd }, + .column_box_dim = .{ 0x70, 0x65, 0x96 }, .kw = .{ 0xff, 0x61, 0x88 }, - .str = .{ 0xa9, 0xdc, 0x76 }, - .num = .{ 0xab, 0x9d, 0xf2 }, + .str = .{ 0xa9, 0xee, 0x64 }, + .num = .{ 0xa2, 0x90, 0xff }, .comment = .{ 0xff, 0xe0, 0x9b }, .lineno = .{ 0x68, 0x61, 0x6b }, .lineno_active = .{ 0x70, 0x69, 0x73 }, .scroll_track = .{ 0x21, 0x1d, 0x23 }, - .scroll_thumb = .{ 0x91, 0x8b, 0x72 }, - .border = .{ 0x6a, 0x64, 0x50 }, - .sel_bg = .{ 0x51, 0x43, 0x5c }, + .scroll_thumb = .{ 0x94, 0x8d, 0x6f }, + .border = .{ 0x8f, 0x87, 0x6c }, + .sel_bg = .{ 0x51, 0x3f, 0x60 }, .sel_fg = .{ 0xfc, 0xfc, 0xfa }, - .search_bg = .{ 0x66, 0x56, 0x27 }, + .search_bg = .{ 0x6f, 0x5b, 0x1e }, .search_fg = .{ 0xff, 0xf0, 0xb0 }, .diagnostic_error = .{ 0xff, 0x79, 0x9b }, .diagnostic_warning = .{ 0xff, 0xd8, 0x66 }, - .diagnostic_info = .{ 0x78, 0xdc, 0xe8 }, - .diagnostic_hint = .{ 0xa9, 0xdc, 0x76 }, + .diagnostic_info = .{ 0x67, 0xe9, 0xf9 }, + .diagnostic_hint = .{ 0xa9, 0xeb, 0x67 }, .palette = .{ .{ 0x10, 0x0e, 0x11 }, .{ 0xff, 0x79, 0x9b }, diff --git a/src/web.zig b/src/web.zig index b5a992ae..7325af54 100644 --- a/src/web.zig +++ b/src/web.zig @@ -376,7 +376,7 @@ export fn pardes_tag_layer_cells(index: u32) ?[*]const WebCell { } export fn pardes_tagline_band_offset(row: u16, canvas_h: f32, cell_h: u32, tagline_h: u32) u32 { - return pardes.taglineBandOffset(row, canvas_h, cell_h, tagline_h); + return pardes.taglineBandOffset(row, canvas_h, cell_h, tagline_h, true); } export fn pardes_body_layer_value(index: u32, field: u32) u32 { diff --git a/test/macos_e2e.swift b/test/macos_e2e.swift index 5efc366c..5f172f9d 100644 --- a/test/macos_e2e.swift +++ b/test/macos_e2e.swift @@ -628,8 +628,8 @@ private final class Driver: PardesViewDelegate { let bottom = kind == 2 && pardes_tag_layer_value(i, 11) != 0 for pixel in 0..= height - 2) { rgb = 0x606f86 } + if pardes_tag_layer_value(i, 5) == UInt32(PARDES_TOPBAR_H) && pixel == 0 { rgb = 0x606f86 } try check(x: x, y: top + (CGFloat(pixel) + 0.5) / scale, rgb: rgb, name: "tag \(i), pixel \(pixel)") } @@ -656,7 +656,7 @@ private final class Driver: PardesViewDelegate { guard let c = sample(rep, x: Int(x * scale), y: Int(y * scale)) else { throw ScriptError(message: "context: no separator pixel") } - let rgb: UInt32 = 0x475263 // Forge border, also used by the Linux chrome overlay. + let rgb: UInt32 = 0x606f86 // Forge border, also used by the Linux chrome overlay. guard abs(c.redComponent * 255 - CGFloat((rgb >> 16) & 255)) < 4, abs(c.greenComponent * 255 - CGFloat((rgb >> 8) & 255)) < 4, abs(c.blueComponent * 255 - CGFloat(rgb & 255)) < 4, @@ -1270,6 +1270,10 @@ private func buildWorld(stem: String) throws -> String { // A wall clock cannot live in a golden. Everything that would print one // prints fixed characters instead when this is set. _ = setenv("PARDES_NOTIME", "1", 1) + // The scripts speak to a grid that HAS the workspace tag row: the app + // hands that row to its native menu bar, but this harness is the + // topbar's test bench, so opt back in before pardes_init reads it. + _ = setenv("PARDES_WORKSPACE_TAG", "1", 1) guard fm.changeCurrentDirectoryPath(work) else { throw ScriptError(message: "could not chdir into \(work)") } -- cgit v1.3 From 43b9d696f9e25ad7589527b91a74666e71ff0472 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 22 Sep 2026 02:21:03 -0300 Subject: Notices become tagline bands at the top of the body A message, a leader chord and a prompt used to share one row of body text at the bottom of a pane, wearing the tagline font and nothing else about a tagline. Now each one is a TagLayer of its own, emitted through the same renderHeaderLayer the pane and column tags go through, so it gets the tagline height, the small-font metrics, the band offset and the border for free -- none of which a body-grid row can have by changing its font role. The text is right aligned. The prompt stays on the canonical grid because it owns a cursor, and a cursor has to sit on a real cell. The body starts BELOW the bands rather than under them, the way tree-sitter context rows already worked. Pane.body_offset is how many rows they took and Pardes.bodyTop(pane, rect) is the one place that answers "where does the body begin" -- replacing fifteen copies of `if (tag_bottom) r.y else r.y + BOX_H` spread across the paint, hit-test, scroll, PDF and image paths, which is what let the bands and the text under them come adrift. Every notice is painted on the grid as well, because the grid is what a terminal client draws and a band it cannot see is a message it never gets; the GUI skips grid cells a tag layer covers, so nothing is drawn twice. Three bugs the bands exposed, fixed here: - a prompt band flush with the right edge put its caret one column past the pane, which the detached wire refuses -- so every frame was dropped for as long as the prompt was open. The band now reserves that column. - a click on a band mapped to Sel row 0, which is the TAG row: clicking chrome expanded a word out of the tagline and ran it as a builtin. - a watched file reloading under the editor changed the core without going through update, so needs_frame was never set and the reload was never drawn. Pardes.invalidate() is the name for that, and the file and theme reloads call it. A session can now drive its own 9P namespace instead of being refused one: ownMountSuffix answers what a path names inside this editors own tree and resolve, readLimit and write serve it from memory rather than making the syscall that never returns. The match is anchored to whole components under the registrys 9p/pardes/, because a bare /pardes/ anywhere in a string would claim ~/src/pardes//README -- and, before write learned the same trick, write the trees bytes over the real file. readFileLimit and writeFile refuse instead, having no core to answer from. A toggle setting SETS when given `on` or `off` and only flips when it is bare, so the report LocationsConfig prints can be fed back as configuration and mean what it says. Snapshots: 97/98, from 0/98. The goldens were several commits stale and 17 scripts had stopped running; `config ` is a new script command that appends to the per-script startup config, so a script that clicks body coordinates pins `Verbose off` instead of counting the rows an announcement moves. nested-optout is left failing on purpose: two levels of nesting prepend vaxis F3 codepoints to typed lines, which is a real bug and is written down in docs/divergences.md with a repro. Co-Authored-By: Claude Opus 5 (1M context) --- docs/divergences.md | 38 +- features.txt | 30 + src/config.zig | 48 +- src/detached/client.zig | 26 +- src/detached/wire.zig | 7 +- src/file_watch.zig | 2 + src/fs.zig | 124 +++- src/gui/gui.zig | 25 +- src/panes.zig | 42 +- src/pardes.zig | 328 +++++++-- src/tag_layer.zig | 6 +- test/e2e_harness.zig | 12 + test/fs.py | 6 +- test/output.zig | 4 +- test/panes.zig | 32 +- test/snapshot.zig | 8 +- test/snapshots/argv.golden | 33 +- test/snapshots/badutf.golden | 8 +- test/snapshots/boot.golden | 64 +- test/snapshots/builtins.golden | 27 +- test/snapshots/builtins.snap | 19 +- test/snapshots/chordcut.golden | 115 +-- test/snapshots/cmdword.golden | 16 +- test/snapshots/cmdword.snap | 4 + test/snapshots/collapse.golden | 79 +- test/snapshots/cornerdrag-left.golden | 32 +- test/snapshots/cornerdrag.golden | 48 +- test/snapshots/cursorline.golden | 72 +- test/snapshots/doccol.golden | 10 +- test/snapshots/doccol.snap | 4 + test/snapshots/dump.golden | 13 +- test/snapshots/edit.golden | 66 +- test/snapshots/exec-bigdrag.golden | 6 +- test/snapshots/exec-bigdrag.snap | 4 + test/snapshots/exec.golden | 39 +- test/snapshots/exec.snap | 2 +- test/snapshots/fileedit.golden | 8 +- test/snapshots/filewatch.golden | 33 +- test/snapshots/filewatch.snap | 4 + test/snapshots/find.golden | 177 +++-- test/snapshots/fsearch.golden | 161 ++-- test/snapshots/fsearch.snap | 9 +- test/snapshots/ghostty-mid.golden | 6 +- test/snapshots/grep.golden | 35 +- test/snapshots/grep.snap | 9 +- test/snapshots/hscroll.golden | 24 +- test/snapshots/images.golden | 132 ++-- test/snapshots/jumps.golden | 217 ++++-- test/snapshots/layout-close.golden | 29 +- test/snapshots/layout-open.golden | 20 +- test/snapshots/leader.golden | 81 +-- test/snapshots/load.golden | 66 +- test/snapshots/logquiet.golden | 4 +- test/snapshots/look-center.golden | 38 +- test/snapshots/look-dir.golden | 14 +- test/snapshots/look-file-1col.golden | 8 +- test/snapshots/look-file.golden | 74 +- test/snapshots/lookloaded.golden | 28 +- test/snapshots/lookpanes.golden | 114 +-- test/snapshots/lookpanes.snap | 4 + test/snapshots/lookrange.golden | 179 +++-- test/snapshots/lookrange.snap | 8 +- test/snapshots/lsp-client-edit.golden | 44 +- test/snapshots/lsp-client.golden | 40 +- test/snapshots/lsp-rename.golden | 29 +- test/snapshots/lsp.golden | 56 +- test/snapshots/lspcomplete.golden | 28 +- test/snapshots/lspcompletemoved.golden | 4 +- test/snapshots/lspdebug.golden | 4 +- test/snapshots/lspdebug.snap | 7 + test/snapshots/lsprelpath.golden | 162 +++-- test/snapshots/markup.golden | 104 +-- test/snapshots/mini.golden | 234 +++--- test/snapshots/modal.golden | 86 +-- test/snapshots/msg.golden | 93 ++- test/snapshots/multicursor.golden | 82 +-- test/snapshots/nested.golden | 69 +- test/snapshots/ninep.golden | 288 ++++---- test/snapshots/pipe.golden | 20 +- test/snapshots/psearch.golden | 140 ++-- test/snapshots/reflow.golden | 12 +- test/snapshots/respawn.golden | 10 +- test/snapshots/respawn.snap | 2 +- test/snapshots/restore.golden | 6 +- test/snapshots/rsearch.golden | 42 +- test/snapshots/rsearch.snap | 11 +- test/snapshots/savepane.golden | 20 +- test/snapshots/scroll.golden | 66 +- test/snapshots/scrolloff.golden | 4 +- test/snapshots/selarg.golden | 6 +- test/snapshots/selregex.golden | 121 ++-- test/snapshots/shellset.golden | 12 +- test/snapshots/shrinktag.golden | 12 +- test/snapshots/splitparent.golden | 26 +- test/snapshots/stepgrain.golden | 131 ++-- test/snapshots/syntax.golden | 183 ++--- test/snapshots/tag.golden | 23 +- test/snapshots/tagalign.golden | 32 +- test/snapshots/tagalign2col.golden | 21 +- test/snapshots/tagbottom.golden | 36 +- test/snapshots/tagbottom.snap | 15 +- test/snapshots/tagbottomimage.golden | 126 ++-- test/snapshots/tagbottomshort.golden | 40 +- test/snapshots/tagcmd.golden | 30 +- test/snapshots/tagnav.golden | 101 +-- test/snapshots/tagpath.golden | 84 +-- test/snapshots/theme.golden | 1248 ++++++++++++++++---------------- test/snapshots/themesel.golden | 1194 +++++++++++++++--------------- test/snapshots/tinywin.golden | 94 ++- test/snapshots/topbarexec.golden | 27 +- test/snapshots/tty.golden | 33 +- test/snapshots/ttyclick.golden | 10 +- test/snapshots/ttyedit.golden | 10 +- test/snapshots/ttyfollow.golden | 10 +- test/snapshots/ttyhelp.golden | 37 +- test/snapshots/ttyhelp.snap | 5 +- test/snapshots/ttylook.golden | 79 +- test/snapshots/ttyonly.golden | 81 ++- test/snapshots/ttypaste.golden | 6 +- test/snapshots/ttyprompt.golden | 10 +- test/snapshots/ttytaken.golden | 22 +- test/snapshots/tutor.golden | 8 +- test/snapshots/wheeldrift.golden | 16 +- test/snapshots/winch.golden | 12 +- test/snapshots/windownav.golden | 63 +- test/snapshots/windowops.golden | 108 +-- test/snapshots/wrap.golden | 36 +- test/snapshots/yankpaste.golden | 4 +- 128 files changed, 4912 insertions(+), 3744 deletions(-) (limited to 'src/gui') diff --git a/docs/divergences.md b/docs/divergences.md index fada830c..6679d962 100644 --- a/docs/divergences.md +++ b/docs/divergences.md @@ -43,17 +43,41 @@ there, deliberately, because that box serves a public site. ## Known-failing on `main`, not caused by the 9P work -* **`zig build fs-test`** fails on a syntax-highlighting assertion — the - word `fn` is expected bold and comes back unstyled: +* **`zig build snap` fails `nested-optout`, and the cause is a real bug.** + At the SECOND level of nesting -- a pardes whose shell runs a pardes whose + shell runs a command -- two U+E016 codepoints are prepended to whatever is + typed. U+E016 is 57366, which is vaxis's private-use spelling of **F3** + (`Key.zig`, "kitty encodes these keys directly in the private use area"), so + something in the chain is decoding a capability-query REPLY as a key and + forwarding it to the shell as text. bash then sees + `$'\356\200\226\356\200\226echo'` and answers `command not found`; with a + path it answers `No such file or directory` for a path that exists and runs + perfectly from the same shell a moment later. + + Minimal repro, in a snapshot script: ``` - AssertionError: ('fn', [{'fg': {'rgb': [201, 176, 228]}, ..., 'bold': False}, ...]) + dirmk innerdir + file innerdir/deeper.txt deepest-marker\n + start 31 100 + wait 8000 $ + stable 700 20000 + text (cd innerdir && $(readlink /proc/$PPID/exe) --nested) + key enter + wait 20000 cwd/innerdir + stable 700 20000 + text E=$(readlink /proc/$PPID/exe); "$E" deeper.txt + key enter + settle 5000 + stable 700 10000 + snap probe ``` - Verified by restoring `main`'s own `src/9p_io.zig`, `build.zig` and - `build.zig.zon` and re-running: it fails identically. The editor line - (`rruwvuzm`) has substantial `src/syntax.zig` changes and may well be the - fix in progress. + `bash: E=/home/.../pardes: No such file or directory` -- bash did not even + parse the assignment, because the line does not start where it looks like it + starts. `--nested` is exactly the flag meant to opt a child out of this, so + the fix belongs next to the key-forwarding path in `panes.Terminal.forwardKey` + and whatever answers terminal capability queries on a nested stdin. * **pardes does not start headless.** `pardes --9p=` with no terminal exits 1 from the argument-forwarding path; the installed build fails diff --git a/features.txt b/features.txt index eeadba39..d035648a 100644 --- a/features.txt +++ b/features.txt @@ -167,3 +167,33 @@ Found by adversarial review and NOT fixed, because they are upstream or macOS-on frontend. Fixing it means a new header variant, i.e. a protocol change. - A shell that outlives its editor keeps PARDES_PID; if that pid is reused, `pardes ` now exits 1 instead of falling back to starting an editor. Exiting 1 only when the socket itself refused would keep the old behaviour. + +Notices are tagline bands at the TOP of the body now, not a row of body text at the bottom. Each message or leader prefix is emitted through the same +renderHeaderLayer the pane and column tags use, as a TagLayer of the new `.notice` kind, so it gets the tagline's height, its small-font metrics, its band +offset and its border for free -- none of which a body-grid row can have just by wearing a tagline font. The text is right aligned. The prompt stays on the +canonical grid because it owns a cursor, which has to sit on a real cell. + +The body starts BELOW the bands rather than under them: Pane.body_offset is the number of rows they take, and every painter and hit test derives the body's +first row from Pardes.bodyTop(pane, rect). That replaced fifteen copies of `if (tag_bottom) r.y else r.y + BOX_H` scattered across the paint and pointer paths, +which is what let the bands and the text they sit over come adrift in the first place. renderBodyLayer zeroes the offset around its own render, because it +paints into a surface of its own that carries no bands. + +Every notice is ALSO painted on the canonical grid, because the grid is what a terminal client draws and a band it cannot see is a message it never gets. The +GUI skips grid cells a tag layer covers, so nothing is drawn twice there. + +Snapshot suite: 97/98. The goldens were several commits stale (Delcol on the column tagline, the closing word moved last in every +tagline, the bare-tty boot's empty pane, stacked Locations rows, the notice bands) and 17 scripts had stopped running at all. Fixed +by making the scripts say what they mean rather than by loosening them: `config ` is a new snapshot-script command that appends +to the per-script startup config, so a script that clicks body coordinates can pin `Verbose off` instead of counting the rows an +announcement band moves; `@word` column specs replace counted columns where a tagline word has moved; and two grids grew because a +pane tag is wider now than its `Del` could fit in. + +Found by that pass and fixed: a watched file reloading under the editor changed the core WITHOUT going through `update`, so +`needs_frame` was never set and the reload was never drawn. `Pardes.invalidate()` is the name for "something changed me from +outside the event loop"; `reloadWatchedFile` and the theme reload call it. + +Also from it: a toggle setting now SETS when given `on` or `off` and only flips when it is bare, so `writeReport`'s `Verbose on` +means what it says when fed back as configuration -- the symmetry the report was asked for, on the input side too. + +Left failing, deliberately: `nested-optout`. See docs/divergences.md -- two levels of nesting prepend U+E016 (vaxis's F3) to typed +lines, which is a real bug in the key-forwarding path and not a stale expectation. diff --git a/src/config.zig b/src/config.zig index 81fefd2c..98bbf3f4 100644 --- a/src/config.zig +++ b/src/config.zig @@ -677,7 +677,9 @@ pub const Runtime = struct { pub fn takesArg(setting: Setting) bool { return switch (setting.action) { - .shell, .theme, .font, .tagline_size, .window_opacity, .window_blur => true, + // A toggle flips when it is a bare tagline word and SETS when + // it is given `on` or `off`, so the report is configuration. + .shell, .theme, .font, .tagline_size, .window_opacity, .window_blur, .toggle => true, else => false, }; } @@ -781,9 +783,23 @@ pub const Runtime = struct { pub fn apply(state: *Runtime, setting: Setting, argument: ?[]const u8) bool { switch (setting.action) { // Every toggle names a bool field of its own, so one line covers - // all of them and a new toggle needs no arm here. - .toggle => |field| switch (field) { - inline else => |f| @field(state, @tagName(f)) = !@field(state, @tagName(f)), + // all of them and a new toggle needs no arm here. Bare, a toggle + // flips -- that is what a tagline word is for. With `on` or `off` + // it SETS, so the report `writeReport` prints (`Verbose on`) can + // be fed straight back as configuration and mean what it says. + .toggle => |field| { + const text = std.mem.trim(u8, argument orelse "", " \t\r\n"); + const want: ?bool = if (text.len == 0) + null + else if (std.mem.eql(u8, text, "on")) + true + else if (std.mem.eql(u8, text, "off")) + false + else + return false; + switch (field) { + inline else => |f| @field(state, @tagName(f)) = want orelse !@field(state, @tagName(f)), + } }, .shell => { const value = std.mem.trim(u8, argument orelse return false, " \t\r\n"); @@ -977,12 +993,34 @@ pub const Runtime = struct { for (settings[i + 1 ..]) |later| try std.testing.expect(!std.mem.eql(u8, setting.word, later.word)); try std.testing.expectEqual(switch (setting.action) { - .shell, .theme, .font, .tagline_size, .window_opacity, .window_blur => true, + .shell, .theme, .font, .tagline_size, .window_opacity, .window_blur, .toggle => true, else => false, }, setting.takesArg()); } } + test "a toggle flips when bare and sets when told on or off" { + var state: Runtime = .{}; + const verbose = find("Verbose").?; + try std.testing.expect(state.verbose); + // Bare, it flips: that is what a tagline word does. + try std.testing.expect(apply(&state, verbose, null)); + try std.testing.expect(!state.verbose); + // Told, it SETS -- twice over, so the second call proves it is not + // flipping past the value it was given. + try std.testing.expect(apply(&state, verbose, "on")); + try std.testing.expect(state.verbose); + try std.testing.expect(apply(&state, verbose, " on\n")); + try std.testing.expect(state.verbose); + try std.testing.expect(apply(&state, verbose, "off")); + try std.testing.expect(!state.verbose); + try std.testing.expect(apply(&state, verbose, "off")); + try std.testing.expect(!state.verbose); + // And anything else is refused rather than silently flipping. + try std.testing.expect(!apply(&state, verbose, "maybe")); + try std.testing.expect(!state.verbose); + } + test "simple setting application mutates only its plain field" { var state: Runtime = .{}; try std.testing.expect(apply(&state, find("Colors").?, null)); diff --git a/src/detached/client.zig b/src/detached/client.zig index 9481cd54..a027c0bb 100644 --- a/src/detached/client.zig +++ b/src/detached/client.zig @@ -1266,8 +1266,32 @@ test "detached session: a frontend that stops reading is dropped, not waited for // for, which is the whole claim: one slow peer costs its own slot. try testing.expect(h.session.clients[0].attached); try testing.expect(!h.core.quit); + // A message is a tagline band now, not a grid run, so "still being drawn + // for" is checked on the layers the frontend decoded rather than on nruns. try good.send(.{ .event = .{ .command = "Msg still here" } }); - try testing.expect((try h.pumpUntilChange(&good)).nruns > 0); + try testing.expect(try pumpUntilNotice(&h, &good, "still here")); +} + +/// Pump until this client has a notice band carrying `want`. +fn pumpUntilNotice(h: *Harness, c: *Client, want: []const u8) !bool { + var line: [256]u8 = undefined; + for (0..Harness.rounds) |_| { + try h.pump(); + try c.wait(5); + while (try c.next()) |_| {} + for (&c.tag_layers) |*layer| { + if (layer.cols == 0 or layer.kind != .notice) continue; + var n: usize = 0; + for (layer.cells[0..layer.cols]) |cell| { + const g = cell.grapheme(); + if (n + g.len > line.len) break; + @memcpy(line[n..][0..g.len], g); + n += g.len; + } + if (std.mem.indexOf(u8, line[0..n], want) != null) return true; + } + } + return false; } /// A connected socket with nothing said on it yet, for the tests whose peer is diff --git a/src/detached/wire.zig b/src/detached/wire.zig index 245bc9f4..6805d980 100644 --- a/src/detached/wire.zig +++ b/src/detached/wire.zig @@ -4,7 +4,10 @@ const std = @import("std"); const pardes = @import("../pardes.zig"); const limits = @import("../memory.zig").limits; -pub const version: u16 = 6; +/// 7: tag layers gained the `.notice` kind, so a frame can carry a tag value +/// an older frontend would reject mid-session. The greeting is where that has +/// to be refused, which is what this number is for. +pub const version: u16 = 7; pub const Error = error{ Truncated, Overlong, BadTag, BadValue, Trailing, NoSpace }; @@ -220,7 +223,7 @@ pub const Frame = struct { layer.viewport.y >= f.rows or (switch (layer.kind) { .workspace => layer.id != 0, .column => layer.id >= pardes.MAX_COLS, - .pane => layer.id >= pardes.MAX_PANES, + .pane, .notice => layer.id >= pardes.MAX_PANES, })) return error.BadValue; const cursor = try getCursor(&r, layer.cols, 1); layer.cursor = if (cursor) |c| .{ .col = c.x, .bar = c.bar } else null; diff --git a/src/file_watch.zig b/src/file_watch.zig index b2b7e380..b2908eb7 100644 --- a/src/file_watch.zig +++ b/src/file_watch.zig @@ -577,6 +577,7 @@ pub fn reloadTheme( if (watches[theme_slot]) |*entry| remarkFile(entry, request.path); } const bytes = filesystem.readFile(gpa, request.path) catch |err| { + core.invalidate(); core.failThemeFile(watched.serial, err); return false; }; @@ -587,6 +588,7 @@ pub fn reloadTheme( .pdf => unreachable, } if (!core.loadThemeFile(watched.serial, bytes, true)) return false; + core.invalidate(); const live = if (watches[theme_slot]) |*entry| entry else return false; if (live.serial != watched.serial) return false; live.generation = .{ .text = hash }; diff --git a/src/fs.zig b/src/fs.zig index 5c75eb72..9200236d 100644 --- a/src/fs.zig +++ b/src/fs.zig @@ -65,6 +65,9 @@ pub const WriteError = error{ }; pub fn writeFile(path: []const u8, bytes: []const u8) WriteError!void { + // No core here to answer from, so the only safe answer is no answer: an + // open(2) into our own mount is the call that never returns. + if (isOwnMount(path)) return error.OpenFailed; var pathbuf: [4096:0]u8 = undefined; if (path.len >= pathbuf.len) return error.PathTooLong; if (std.mem.indexOfScalar(u8, path, 0) != null) return error.OpenFailed; @@ -671,6 +674,9 @@ pub fn resolve(p: ?*pardes.Pardes, word: []const u8, cwd: []const u8, out: *[409 } if (std.mem.eql(u8, joined, "/virtual")) return resolveVirtual(p, "/", out); if (std.mem.startsWith(u8, joined, "/virtual/")) return resolveVirtual(p, joined[8..], out); + // This editor's own tree, seen through a mount: answer from the tree + // instead of walking out into the view and back in. + if (ownMountSuffix(joined)) |inner| return resolveVirtual(p, inner, out); if (resolveOs(joined, out)) |found| return found; if (resolveVirtual(p, joined, out)) |found| return found; if (resolveVirtual(p, word, out)) |found| return found; @@ -682,7 +688,9 @@ pub fn resolve(p: ?*pardes.Pardes, word: []const u8, cwd: []const u8, out: *[409 } /// The name this session is posted under, taken from its socket path. -var own_name_buf: [64]u8 = undefined; +/// As wide as a name a listener will accept, so there is no session whose +/// name is too long to recognise and therefore too long to protect. +var own_name_buf: [108]u8 = undefined; var own_name_len: usize = 0; pub fn noteOwnSocket(socket_path: []const u8) void { @@ -697,35 +705,91 @@ pub fn noteOwnSocket(socket_path: []const u8) void { own_name_len = name.len; } -/// Is this path inside this editor's OWN 9P tree, as a mount presents it? +/// What this path names inside this editor's OWN 9P tree, if it does: +/// `/mnt/9p/pardes//pane/3/body` -> `pane/3/body`, and the mount root +/// itself -> `/`. /// -/// Touching one from inside the editor deadlocks the session outright: the -/// realpath, the stat and the read all leave through the mount and come back -/// as 9P requests that only the editor's loop can answer, while that loop is -/// blocked making them. The filesystem then stops answering anybody. So the -/// answer has to come from the NAME, before any syscall -- the syscall is the -/// thing that never returns. Look at `/n/self/...` instead, which the editor -/// serves from memory without leaving the process. -pub fn isOwnMount(path: []const u8) bool { - if (own_name_len == 0) return false; +/// A mount is a VIEW of a tree this editor already holds. Going out through +/// the view to reach it deadlocks the session outright -- the realpath, the +/// stat and the read all leave through the mount and come back as 9P requests +/// only this editor's loop can answer, while that loop is blocked making them, +/// and the filesystem then stops answering anybody. So the view is recognised +/// by NAME, before any syscall (the syscall is the thing that never returns), +/// and the request is served from the tree directly. Same answer, no round +/// trip, and a session can drive itself through its own 9P namespace. +pub fn ownMountSuffix(path: []const u8) ?[]const u8 { + if (own_name_len == 0 or path.len == 0 or path[0] != '/') return null; + // Whole components, and the registry's own layout: a session is posted at + // `/9p/pardes/` and mounts group under `/mnt/9p/pardes/`. + // Matching a bare `/pardes/` anywhere in the string would claim + // `~/src/pardes//README` -- an ordinary directory that happens to + // read like a mount -- and serve the tree's README over the real file. var buf: [own_name_buf.len + 16]u8 = undefined; - const needle = std.fmt.bufPrint(&buf, "/pardes/{s}/", .{own_name_buf[0..own_name_len]}) catch return false; - return std.mem.indexOf(u8, path, needle) != null; + const stem = std.fmt.bufPrint(&buf, "/9p/pardes/{s}", .{own_name_buf[0..own_name_len]}) catch return null; + var at: usize = 0; + while (std.mem.indexOfPos(u8, path, at, stem)) |found| : (at = found + 1) { + const rest = path[found + stem.len ..]; + if (rest.len != 0 and rest[0] != '/') continue; // a longer name that merely starts the same + if (rest.len <= 1) return "/"; + return rest[1..]; + } + return null; } -test "a path inside this session's own mount is refused before any syscall" { +pub fn isOwnMount(path: []const u8) bool { + return ownMountSuffix(path) != null; +} + +test "a path inside this session's own mount is answered from the tree, not through the mount" { noteOwnSocket("/run/user/1000/pardes-9p-demo.sock"); defer own_name_len = 0; - try std.testing.expect(isOwnMount("/mnt/9p/pardes/demo/index")); - try std.testing.expect(isOwnMount("/mnt/9p/pardes/demo/pane/new")); - try std.testing.expect(!isOwnMount("/mnt/9p/pardes/other/index")); - try std.testing.expect(!isOwnMount("/home/goblin/src/pardes/demo.zig")); + // What the path names inside the tree, with the mount prefix taken off. + try std.testing.expectEqualStrings("index", ownMountSuffix("/mnt/9p/pardes/demo/index").?); + try std.testing.expectEqualStrings("pane/new", ownMountSuffix("/mnt/9p/pardes/demo/pane/new").?); + try std.testing.expectEqualStrings("/", ownMountSuffix("/mnt/9p/pardes/demo").?); + try std.testing.expectEqualStrings("/", ownMountSuffix("/mnt/9p/pardes/demo/").?); + // The registry posts the session there too, so that spelling counts. + try std.testing.expectEqualStrings("index", ownMountSuffix("/run/user/1000/9p/pardes/demo/index").?); + // Another session's mount is somebody else's to answer, and a name that + // merely STARTS with ours is a different name. + try std.testing.expect(ownMountSuffix("/mnt/9p/pardes/other/index") == null); + try std.testing.expect(ownMountSuffix("/mnt/9p/pardes/demo2/index") == null); + // An ordinary directory that reads like a mount is an ordinary directory. + // Serving the tree here would hand back the tree's README for the file on + // disk, and -- before `write` learned the same trick -- write the tree's + // bytes over it. + try std.testing.expect(ownMountSuffix("/home/goblin/src/pardes/demo/README") == null); + try std.testing.expect(ownMountSuffix("/home/goblin/src/pardes/demo.zig") == null); + // Relative paths never name a mount: they are resolved against a cwd first. + try std.testing.expect(ownMountSuffix("mnt/9p/pardes/demo/index") == null); + + // The syscall is the thing that never returns, so it is never made. var out: [4096]u8 = undefined; try std.testing.expect(resolveOs("/mnt/9p/pardes/demo/index", &out) == null); - // A session with no listener has no name, so nothing is refused. + // A session with no listener has no name, so nothing is redirected. noteOwnSocket("/tmp/not-a-pardes-socket"); - try std.testing.expect(!isOwnMount("/mnt/9p/pardes/demo/index")); + try std.testing.expect(ownMountSuffix("/mnt/9p/pardes/demo/index") == null); +} + +test "reading this session's own mount returns what the tree holds" { + const p = try pardes.Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 80, .rows = 24 }); + defer p.deinit(); + noteOwnSocket("/run/user/1000/pardes-9p-selfread.sock"); + defer own_name_len = 0; + + const direct = try read(p, "/n/self/index"); + defer p.gpa.free(direct); + const mounted = try read(p, "/mnt/9p/pardes/selfread/index"); + defer p.gpa.free(mounted); + try std.testing.expectEqualStrings(direct, mounted); + try std.testing.expect(direct.len > 0); + + // A write goes to the same tree the read came from, not out through the + // mount: `/index` is 0400 there, and an OS write would instead try to + // create a file under a directory that does not exist. + try std.testing.expectError(error.ReadOnlyFilesystem, write(p, "/mnt/9p/pardes/selfread/index", "nope\n")); + try std.testing.expectError(error.ReadOnlyFilesystem, write(p, "/n/self/index", "nope\n")); } pub fn resolveOs(path: []const u8, out: *[4096]u8) ?Resolved { @@ -754,7 +818,13 @@ pub fn read(p: *pardes.Pardes, path: []const u8) ![]u8 { } pub fn readLimit(p: *pardes.Pardes, path: []const u8, max_bytes: usize) ![]u8 { - if (isOwnMount(path)) return error.OwnMount; + // The same view, reached by a reader that never went through `resolve`. + // The rewritten path cannot contain the mount stem, so this recurses once. + if (ownMountSuffix(path)) |inner| { + var self_buf: [4096]u8 = undefined; + const internal = std.fmt.bufPrint(&self_buf, "/n/self/{s}", .{inner}) catch return error.FileTooLarge; + return readLimit(p, internal, max_bytes); + } const limit = @min(max_bytes, limits.max_file_bytes); if (std.mem.eql(u8, std.mem.trimEnd(u8, path, "/"), "/n")) { var out: std.Io.Writer.Allocating = .init(p.gpa); @@ -871,6 +941,14 @@ fn readNode(p: *pardes.Pardes, initial_node: u64, path: []const u8, limit: usize } pub fn write(p: *pardes.Pardes, path: []const u8, bytes: []const u8) !void { + // The same view `readLimit` answers from the tree, so a write lands where + // the matching read came from -- and, just as importantly, never becomes + // an open(2) through a mount this loop is the one that answers. + if (ownMountSuffix(path)) |inner| { + var self_buf: [4096]u8 = undefined; + const internal = std.fmt.bufPrint(&self_buf, "/n/self/{s}", .{inner}) catch return error.PathTooLong; + return write(p, internal, bytes); + } if (std.mem.eql(u8, std.mem.trimEnd(u8, path, "/"), "/n")) return error.IsDirectory; var self_path: ?[]const u8 = null; if (std.mem.eql(u8, path, "/virtual")) self_path = ""; @@ -1233,6 +1311,10 @@ test "Restore prefers default directory then falls back to original path" { fn readFileLimit(gpa: std.mem.Allocator, path: []const u8, limit: usize) ![]u8 { if (std.mem.indexOfScalar(u8, path, 0) != null) return error.OpenFailed; + // Same reason as `writeFile`: no core to answer from here, and the open is + // the call that never returns. Callers holding one use `readLimit`, which + // serves the tree instead. + if (isOwnMount(path)) return error.FileNotFound; if (!platform_has_fs or std.mem.startsWith(u8, path, "/virtual/")) { const archive_path = if (std.mem.startsWith(u8, path, "/virtual/")) path[9..] else path; var normalized_buf: [4096]u8 = undefined; diff --git a/src/gui/gui.zig b/src/gui/gui.zig index d871e55e..c26629ab 100644 --- a/src/gui/gui.zig +++ b/src/gui/gui.zig @@ -1788,6 +1788,7 @@ const Gui = struct { scroll_pane: ?usize = null, 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 how many rows it has, notice bands taken off 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 @@ -4292,14 +4293,15 @@ fn stepScroll(g: *Gui, core: *pardes.Pardes, gpa: std.mem.Allocator) void { } g.scroll_lag = st.lag; g.scroll_rect = r; - const body_y = if (core.settings.tag_bottom) r.y else r.y + pardes.BOX_H; + const body_y = core.bodyTop(pane, r); g.scroll_body_y = body_y; + g.scroll_body_h = (r.h -| pardes.BOX_H) -| pane.body_offset; if (st.rows != 0) { const s = &core.surface; g.scroll_edge_len = 0; - if (r.w > config.GUTTER and r.h > pardes.BOX_H and r.x + r.w <= s.cols) { + if (r.w > config.GUTTER and r.h > pardes.BOX_H + pane.body_offset and r.x + r.w <= s.cols) { const bw = r.w - config.GUTTER; - const bh = r.h - pardes.BOX_H; + const bh = (r.h - pardes.BOX_H) - pane.body_offset; const k: u16 = @intCast(@min(@abs(st.rows), @as(i32, bh))); const srow = body_y + (if (st.rows > 0) k - 1 else bh - k); if (srow < s.rows) { @@ -4327,7 +4329,11 @@ fn emitScrollRows(g: *Gui, instances: [*]CellInstance, base: u32, surface: *pard const x0 = r.x + config.GUTTER; const y0 = g.scroll_body_y; const bw = r.w - config.GUTTER; - const bh = r.h - pardes.BOX_H; + // The body the editor actually painted: measuring it from the rect while + // the origin comes from bodyTop reads past the pane by the band rows, and + // for the bottom-most pane past the surface, which drops the animation. + const bh = g.scroll_body_h; + if (bh == 0) return 0; 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; @@ -4359,7 +4365,7 @@ fn scrollScissor(g: *const Gui, layout: CellLayout, sw: u32, sh: u32) c.SDL_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 pw = @as(f32, @floatFromInt(r.w - config.GUTTER)) * layout.w; - const ph = @as(f32, @floatFromInt(r.h - pardes.BOX_H)) * layout.h; + const ph = @as(f32, @floatFromInt(g.scroll_body_h)) * layout.h; 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))); @@ -6685,11 +6691,14 @@ fn appendPaneChrome( const chrome = core.chromeTheme(); const page = overlayRgb(core.theme().bg orelse bg_default); for (core.panes, core.rects) |slot, r| { - if (slot == null or r.w <= config.GUTTER or r.h <= pardes.BOX_H) continue; + const pane = slot orelse continue; + if (r.w <= config.GUTTER or r.h <= pardes.BOX_H) continue; if (@as(u32, r.x) + r.w > surface.cols or @as(u32, r.y) + r.h > surface.rows) continue; const tag_y = if (core.settings.tag_bottom) r.y + r.h - pardes.BOX_H else r.y; - const body_y = if (core.settings.tag_bottom) r.y else r.y + pardes.BOX_H; - const body_end = body_y + r.h - pardes.BOX_H; + // The rail the editor painted, notice bands included -- overlaying the + // rows above it would tint the bands instead of the scrollbar. + const body_y = core.bodyTop(pane, r); + const body_end = body_y + ((r.h -| pardes.BOX_H) -| pane.body_offset); const x0 = @as(f32, @floatFromInt(r.x)) * layout.w; const x1 = x0 + @as(f32, @floatFromInt(r.w)) * layout.w; const tag_cells = surface.cells[@as(usize, tag_y) * surface.cols + r.x + pardes.TAG_TEXT_INSET ..][0 .. r.w - pardes.TAG_TEXT_INSET]; diff --git a/src/panes.zig b/src/panes.zig index e41698bb..4b5c6721 100644 --- a/src/panes.zig +++ b/src/panes.zig @@ -191,6 +191,11 @@ pub const Pane = struct { /// body layer reserves exactly `len` rows for them, the way it already /// reserves rows for sticky context headers. notices: Notices = .{}, + /// Rows the notice bands take off the TOP of the body, the way tree-sitter + /// context rows do: the body starts below them rather than being painted + /// under them. Zero while the body LAYER renders, which paints into a + /// surface of its own that carries no bands. + body_offset: u16 = 0, pub const Notices = struct { /// Painted bottom-up in this order, so a prompt keeps the row nearest @@ -2036,7 +2041,7 @@ pub const File = struct { const gcrow = if (pane.cur_pinned) pane.cur_row else @as(i32, gcur.y) + goff; const cur_line: i32 = if (active and !pane.tag_edit) gcrow else std.math.minInt(i32); // the body's first row, the way renderPane derives it (Tagbottom) - const body_y = if (p.settings.tag_bottom) r.y else r.y + pardes.BOX_H; + const body_y = p.bodyTop(pane, r); const context_bg = p.theme().tag_bg; for (0..@min(pane.context_rows, body_h)) |context_row| { for (0..tw) |col| { @@ -2090,7 +2095,7 @@ pub const File = struct { // indexed start, same as bodyText — an empty tail simply paints nothing var flines = std.mem.splitScalar(u8, f.content[lineStart(p.gpa, f, f.scroll)..], '\n'); const total = nlines(p.gpa, f); - const body_y = if (p.settings.tag_bottom) r.y else r.y + pardes.BOX_H; + const body_y = p.bodyTop(pane, r); var vr: u16 = 0; while (vr < body_h) : (vr += 1) { var base: usize = undefined; @@ -2166,7 +2171,7 @@ pub const File = struct { pane_bg: pardes.Color, ) void { if (tw <= gutterWidth(pane) + 1) return; - const body_y = if (p.settings.tag_bottom) r.y else r.y + pardes.BOX_H; + const body_y = p.bodyTop(pane, r); const marker_fg = p.chromeTheme().lineno; var row: u16 = 0; while (row + 1 < pane.wrap_n and row + 1 < body_h) : (row += 1) { @@ -2190,9 +2195,9 @@ pub const File = struct { const tx = r.x + config.GUTTER; const tw = r.w - config.GUTTER; const prefix_width = gutterWidth(pane); - const body_y = if (p.settings.tag_bottom) r.y else r.y + pardes.BOX_H; + const body_y = p.bodyTop(pane, r); var vr: i32 = 0; - while (vr + @as(i32, pardes.BOX_H) < @as(i32, r.h)) : (vr += 1) { + while (vr + @as(i32, pardes.BOX_H) < @as(i32, r.h -| pane.body_offset)) : (vr += 1) { const here = pane.wrapAt(vr); if (here.line != row) continue; var hi = word_hi; @@ -5477,7 +5482,7 @@ pub const Pdf = struct { if (slot == pane) break core.rects[id]; } else return null; const cols = rect.w -| config.GUTTER; - const rows = rect.h -| pardes.BOX_H; + const rows = (rect.h -| pardes.BOX_H) -| pane.body_offset; if (cols == 0 or rows == 0) return null; return .{ .pixel_w = @as(u32, cols) * @as(u32, core.cell_pixels.w), @@ -5515,8 +5520,8 @@ pub const Pdf = struct { const rect = for (core.panes, 0..) |slot, id| { if (slot == pane) break core.rects[id]; } else return null; - const body_y = if (core.settings.tag_bottom) rect.y else rect.y + pardes.BOX_H; - if (row < body_y or row >= body_y + (rect.h -| pardes.BOX_H)) return null; + const body_y = core.bodyTop(pane, rect); + if (row < body_y or row >= body_y + ((rect.h -| pardes.BOX_H) -| pane.body_offset)) return null; const local_y = @as(f64, @floatFromInt( @as(u32, row - body_y) * core.cell_pixels.h + core.cell_pixels.h / 2, )); @@ -5572,7 +5577,7 @@ pub const Pdf = struct { if (slot == pane) break core.rects[id]; } else return null; const body_x = @as(i64, rect.x + config.GUTTER); - const body_y = @as(i64, if (core.settings.tag_bottom) rect.y else rect.y + pardes.BOX_H); + const body_y = @as(i64, core.bodyTop(pane, rect)); const px = (@as(i64, col) - body_x) * core.cell_pixels.w + core.cell_pixels.w / 2; const py = (@as(i64, row) - body_y) * core.cell_pixels.h + core.cell_pixels.h / 2; return pointAtPage(state, view, page, px, py, clamp_to_page); @@ -5855,7 +5860,7 @@ pub const Pdf = struct { text_width: u16, ) bool { if (comptime !enabled) return false; - if (!core.native_images or rect.h <= pardes.BOX_H) return false; + if (!core.native_images or rect.h <= pardes.BOX_H + pane.body_offset) return false; const state = &(pane.pdf orelse return false); const view = paneViewport(core, pane) orelse return false; const key = TintKey{ .mode = state.tint, .colors = tintColors(core) }; @@ -5892,9 +5897,9 @@ pub const Pdf = struct { null, }, .x = text_x, - .y = if (core.settings.tag_bottom) rect.y else rect.y + pardes.BOX_H, + .y = core.bodyTop(pane, rect), .w = text_width, - .h = rect.h - pardes.BOX_H, + .h = (rect.h -| pardes.BOX_H) -| pane.body_offset, .rgba = placed.rgba, .iw = placed.width, // The texture contains the retained band, not the full page. @@ -5906,14 +5911,17 @@ pub const Pdf = struct { // This frame has spent the motion used to choose its raster band. state.scroll_travel = 0; - const body_y = if (core.settings.tag_bottom) rect.y else rect.y + pardes.BOX_H; + const body_y = core.bodyTop(pane, rect); + const body_h = (rect.h -| pardes.BOX_H) -| pane.body_offset; const chrome = core.chromeTheme(); const theme = core.theme(); const pane_bg: pardes.Color = if (theme.bg) |color| .{ .rgb = color } else .default; - core.surface.fill(rect.x, body_y, 1, rect.h -| pardes.BOX_H, .{ .bg = .{ .rgb = chrome.scroll_track } }); - core.surface.fill(rect.x + 1, body_y, 1, rect.h -| pardes.BOX_H, .{ .bg = pane_bg }); + // The rail runs past the notice bands; only the thumb tracks the text. + const rail_y = if (core.settings.tag_bottom) rect.y else rect.y + pardes.BOX_H; + core.surface.fill(rect.x, rail_y, 1, rect.h -| pardes.BOX_H, .{ .bg = .{ .rgb = chrome.scroll_track } }); + core.surface.fill(rect.x + 1, rail_y, 1, rect.h -| pardes.BOX_H, .{ .bg = pane_bg }); - const track_h: usize = rect.h - pardes.BOX_H; + const track_h: usize = body_h; const total = @max(@as(u64, 1), state.document_height); const len = @max( @as(usize, 1), @@ -7571,7 +7579,7 @@ pub const Terminal = struct { if (comptime !enabled) return; const s = &p.surface; if (pane.terminal == null) return; - const body_y = if (p.settings.tag_bottom) r.y else r.y + pardes.BOX_H; + const body_y = p.bodyTop(pane, r); var filtered_storage: FilteredColors = undefined; const filtered: ?*FilteredColors = if (pane.tty_filter) blk: { const tz_filter = tracy.zone(@src(), "filterInit"); diff --git a/src/pardes.zig b/src/pardes.zig index ec743bc6..c271a16f 100644 --- a/src/pardes.zig +++ b/src/pardes.zig @@ -75,7 +75,9 @@ pub const RowMetrics = @import("body_layer.zig").Metrics; pub const TagLayer = @import("tag_layer.zig").Layer; pub const TagHit = @import("tag_layer.zig").Hit; pub const TagKind = @import("tag_layer.zig").Kind; -pub const MAX_TAG_LAYERS = MAX_PANES + MAX_COLS + 1; +/// Panes, then columns, then the workspace bar, then each pane's notice bands. +pub const MAX_TAG_LAYERS = MAX_PANES + MAX_COLS + 1 + MAX_PANES * Pane.Notices.max; +pub const NOTICE_LAYER_BASE = MAX_PANES + MAX_COLS + 1; pub const PDF_PAGE_GAP_PX = panes.Pdf.page_gap_px; pub const MAX_COLS = 6; const column_weight_unit = layout.column_weight_unit; @@ -1168,7 +1170,17 @@ test "TreeContext tag style preserves message rows and its opt-out survives rest _ = try p.render(p.scratch.allocator()); try std.testing.expectEqual(full_height - 1, p.surface.body_layers[0].viewport.h); const r = p.rects[0]; - try std.testing.expectEqualStrings("!", p.surface.at(r.x + config.GUTTER, r.y + r.h - 1).grapheme()); + // The message is a tagline band at the top of the body now, not a body row + // at the bottom: same reservation, different carrier. + const band = for (p.surface.tagLayers()) |*layer| { + if (layer.cols != 0 and layer.kind == .notice) break layer; + } else return error.NoNoticeBand; + try std.testing.expectEqual(r.y + BOX_H, band.viewport.y); + // Right aligned: the text sits in the last cell the viewport actually + // shows, which is a column short of the layer's cursor slack. + try std.testing.expectEqualStrings("!", band.cells[p.tagCapacity(band.viewport.w) - 1].grapheme()); + // ...and the body starts below it rather than under it. + try std.testing.expectEqual(band.viewport.y + 1, p.surface.body_layers[0].viewport.y); pane.msg_len = 0; p.leader_on = true; _ = try p.render(p.scratch.allocator()); @@ -1178,7 +1190,7 @@ test "TreeContext tag style preserves message rows and its opt-out survives rest _ = try p.render(p.scratch.allocator()); try std.testing.expectEqual(@as(u16, 0), p.surface.body_layers[0].rows); try std.testing.expectEqual(@as(u16, 0), pane.body_rows); - try std.testing.expectEqual(FontRole.body, p.surface.at(r.x + config.GUTTER, r.y + BOX_H).style.font_role); + try std.testing.expectEqual(FontRole.body, p.surface.at(r.x + config.GUTTER, p.bodyTop(pane, r)).style.font_role); try p.dumpState(); const restored = try Pardes.initFromDump(p.gpa, .{ .tty_only = true }, p.dump_out.?); defer restored.deinit(); @@ -6270,6 +6282,15 @@ pub const Pardes = struct { return p; } + /// Prints `text` flush with the right edge of the band, and answers the + /// column it started at so a cursor can follow it. + fn printRight(s: *Surface, x: u16, row: u16, w: u16, text: []const u8, style: CellStyle) u16 { + const shown: u16 = @intCast(@min(@as(usize, w), panes.File.displayWidth(text))); + const left = x + w - shown; + _ = s.print(left, row, shown, text, style); + return left; + } + /// The layout every single-pane boot starts from. fn oneColumn(p: *Pardes) void { p.ncol = 1; @@ -6915,7 +6936,15 @@ pub const Pardes = struct { false; } + /// Something changed the core without going through `update` -- a watched + /// file reloading under it, a theme file rewritten on disk. `pump` draws + /// only when it has a reason to, and this is the reason. + pub fn invalidate(p: *Pardes) void { + p.needs_frame = true; + } + pub fn reloadWatchedFile(p: *Pardes, id: u8, bytes: []const u8) bool { + p.invalidate(); p.invalidateLookHover(id); const applied = p.applyWatchedFileChanged(id, bytes); _ = p.scratch.reset(.retain_capacity); @@ -11235,9 +11264,13 @@ pub const Pardes = struct { const r = p.rects[id]; if (col < r.x + config.GUTTER or col >= r.x + r.w or row < r.y or row >= r.y + r.h) return null; const tag_y = if (p.settings.tag_bottom) r.y + r.h -| BOX_H else r.y; - const body_y = if (p.settings.tag_bottom) r.y else r.y + BOX_H; + const body_y = p.bodyTop(p.panes[id].?, r); const on_tag = row >= tag_y and row < tag_y + BOX_H; if (on_tag and col < r.x + TAG_TEXT_INSET) return null; + // A notice band is chrome. Without this it maps to Sel row 0 or less, + // which is the TAG row -- so a click on a leader band would expand a + // word out of the tag text and run it as a builtin. + if (!on_tag and row >= body_y -| p.panes[id].?.body_offset and row < body_y) return null; if (!on_tag) if (body_hit) |supplied| { const mapped_hit = p.bodyHitForPane(id, supplied, false) orelse return null; const c = @as(i32, mapped_hit.col) - config.GUTTER; @@ -11624,7 +11657,7 @@ pub const Pardes = struct { if (previous.tag_edit) exitTagEdit(previous); }; const tag_y = if (p.settings.tag_bottom) r.y + r.h -| BOX_H else r.y; - const body_y = if (p.settings.tag_bottom) r.y else r.y + BOX_H; + const body_y = p.bodyTop(pane, r); if (mcol < r.x + config.GUTTER) { // gutter scrollbar: a left click scrolls UP to that row p.active = id; @@ -11688,7 +11721,7 @@ pub const Pardes = struct { // the tag row and the body's first, exactly as the select // arm above derives them const tag_y = if (p.settings.tag_bottom) r.y + r.h -| BOX_H else r.y; - const body_y = if (p.settings.tag_bottom) r.y else r.y + BOX_H; + const body_y = p.bodyTop(pane, r); const on_tag = mrow >= tag_y and mrow < tag_y + BOX_H; if (mcol < r.x + config.GUTTER and !on_tag) { const local = @as(i32, mrow) - @as(i32, body_y); @@ -11780,13 +11813,17 @@ pub const Pardes = struct { return; }; pane.sel[b].c1 = @as(i32, mcol) - @as(i32, r.x + config.GUTTER); - if (p.settings.tag_bottom) { - const body_h = r.h -| BOX_H; - pane.sel[b].r1 = if (pane.sel[b].r0 < BOX_H or body_h == 0) - 0 - else - @as(i32, @min(@max(mrow, r.y), r.y + body_h - 1)) - @as(i32, r.y) + @as(i32, BOX_H); - } else pane.sel[b].r1 = if (pane.sel[b].r0 < BOX_H) 0 else @as(i32, mrow) - @as(i32, r.y); + // Sel row BOX_H is the body's FIRST row, the same thing + // pointerTextSelection means by it -- so the drag has to + // measure from the body's top, notice bands included, or a + // selection made while a message is up lands rows away + // from the pointer. + const body_y = p.bodyTop(pane, r); + const body_h = (r.h -| BOX_H) -| pane.body_offset; + pane.sel[b].r1 = if (pane.sel[b].r0 < BOX_H or body_h == 0) + 0 + else + @as(i32, @min(@max(mrow, body_y), body_y + body_h - 1)) - @as(i32, body_y) + @as(i32, BOX_H); if (pane.sel[b].r1 < BOX_H) pane.sel[b].c1 += @as(i32, pane.tag_scroll) - TAG_GAP; if (comptime pdf_enabled) panes.Pdf.pointerUpdate(&s.pdf, p, pane, mcol, mrow); @@ -13333,6 +13370,14 @@ pub const Pardes = struct { return null; } + /// The pane's first body row: under the tag when it is on top, and under + /// whatever notice bands `collectNotices` stacked above the body. Every + /// painter and hit test derives the body from here so the bands cannot + /// come adrift from the text they sit over. + pub fn bodyTop(p: *const Pardes, pane: *const Pane, r: Rect) u16 { + return (if (p.settings.tag_bottom) r.y else r.y + BOX_H) + pane.body_offset; + } + fn tagCapacity(p: *const Pardes, physical_width: u16) u16 { const layer: TagLayer = .{ .viewport = .{ .x = 0, .y = 0, .w = physical_width, .h = 1 } }; return layer.capacity(p.row_metrics); @@ -13416,37 +13461,49 @@ pub const Pardes = struct { .bg = .{ .rgb = chrome.tag_bg }, .font_role = .tagline, }; - // The stack sits directly above the tagline, one line to a row, in - // the order collectNotices chose. A single notice therefore lands - // on exactly the row the message used to have to itself. - const bottom = if (p.settings.tag_bottom) r.y + r.h - 1 - BOX_H else r.y + r.h - 1; + // Sticky at the TOP of the body, where the tree-sitter context + // headers sit, one line to a row in the order collectNotices chose. + // Text is right aligned: the left edge is where the body's own text + // begins, and a notice that shared it would read as a line of the + // file rather than as chrome over it. + const first = if (p.settings.tag_bottom) r.y else r.y + BOX_H; for (pane.notices.slice(), 0..) |kind, i| { - const row = bottom - @as(u16, @intCast(pane.notices.len - 1 - i)); + const row = first + @as(u16, @intCast(i)); + // Every notice is painted on the canonical grid as well as + // emitted as a tag layer: the grid is what a terminal client + // draws, and a band it cannot see is a message it never gets. + // The GUI skips grid cells a tag layer covers, so nothing is + // drawn twice there. s.fill(tx, row, tw, 1, .{ .bg = msg_style.bg, .font_role = .tagline }); switch (kind) { - .message => _ = s.print(tx, row, tw, pane.msg[0..pane.msg_len], msg_style), + .message => _ = printRight(s, tx, row, tw, pane.msg[0..pane.msg_len], msg_style), .leader => { var ibuf: [16]u8 = @splat(' '); - @memcpy(ibuf[1..4], "SPC"); - var iw: usize = 4; + @memcpy(ibuf[0..3], "SPC"); + var iw: usize = 3; for (p.leader_keys[0..p.leader_n]) |ch| { ibuf[iw + 1] = ch; iw += 2; } - const w: u16 = @intCast(iw); - if (w < tw) _ = s.print(tx + tw - w, row, w, ibuf[0..iw], msg_style); + _ = printRight(s, tx, row, tw, ibuf[0..iw], msg_style); }, .prompt => { const at = pane.promptAt() orelse continue; const text = pane.tagSlice()[@min(at, pane.tag_tail_len)..]; - _ = s.print(tx, row, tw, text, msg_style); + // One column short of the edge: the caret sits AFTER + // the last character the moment a prompt opens, and + // flush right would put it at r.x + r.w -- off the + // pane, off the grid, and past what the detached wire + // will encode, which drops every frame while it is up. + const left = printRight(s, tx, row, tw -| 1, text, msg_style); if (id != p.active) continue; const prompt0 = (p.tagPrefix(pane) catch continue).len + at; const col = @as(usize, pane.tag_col); if (col >= prompt0) { + // The cursor follows the text to wherever it landed. const prompt_col = panes.File.displayWidth(text[0..@min(col - prompt0, text.len)]); if (prompt_col < tw) - s.cursor = .{ .x = tx + @as(u16, @intCast(prompt_col)), .y = row, .bar = pane.mode == .insert }; + s.cursor = .{ .x = left + @as(u16, @intCast(prompt_col)), .y = row, .bar = pane.mode == .insert }; } }, } @@ -13772,11 +13829,11 @@ pub const Pardes = struct { const raw = pane.mode == .tty; const tx = r.x + config.GUTTER; const width = r.w -| config.GUTTER; - const body_y = if (p.settings.tag_bottom) r.y else r.y + BOX_H; + const body_y = p.bodyTop(pane, r); var lines = std.mem.splitScalar(u8, body, '\n'); var visible: i32 = 0; while (lines.next()) |line| : (visible += 1) { - if (visible >= r.h -| BOX_H) break; + if (visible >= (r.h -| BOX_H) -| pane.body_offset) break; const source_row = if (raw) panes.Terminal.gridOffset(pane) + visible else pane.wrapAt(visible).line; for (rows) |row| { const target = if (row.raw_terminal) @@ -13814,10 +13871,10 @@ pub const Pardes = struct { const terminal_lines = if (pane.file == null) panes.Terminal.cursorLines(p, pane) catch return else &.{}; const tx = r.x + config.GUTTER; const width = r.w -| config.GUTTER; - const body_y = if (p.settings.tag_bottom) r.y else r.y + BOX_H; + const body_y = p.bodyTop(pane, r); const prefix: i32 = if (pane.file != null) panes.File.gutterWidth(pane) else 0; var visible: i32 = 0; - while (visible < @as(i32, r.h -| BOX_H)) : (visible += 1) { + while (visible < @as(i32, (r.h -| BOX_H) -| pane.body_offset)) : (visible += 1) { const source = pane.wrapAt(visible); const line = pointerSourceLine(pane, terminal_lines, source.line); const start = @min(line.len, @as(usize, @intCast(@max(0, source.at)))); @@ -13862,6 +13919,11 @@ pub const Pardes = struct { while (row < r.h) : (row += 1) { if (@as(i32, row) < r0 or @as(i32, row) > r1) continue; const sy = if (row < BOX_H) tag_y else body_y + row - BOX_H; + // The body sits `body_offset` rows lower than it used to, so the + // last rows of Sel space now fall past the pane. Bounding the loop + // instead would break the caller that paints a tag into a + // one-row surface of its own, where the offset means nothing. + if (row >= BOX_H and sy >= r.y + r.h) break; // File line numbers occupy a gutter only in the body. The tag is // row zero in Sel space and starts at its real first text cell. const scroll: i32 = if (row < BOX_H) pane.tag_scroll else 0; @@ -13910,6 +13972,50 @@ pub const Pardes = struct { // workspace layer to render; the menu bar carries its commands. if (p.settings.workspace_tag) try p.renderHeaderLayer(arena, MAX_PANES + MAX_COLS, .workspace, 0, .{ .x = 0, .y = 0, .w = p.screen_w, .h = TOPBAR_H }, p.topbar(&text_buf), chrome.tag_bg, chrome.tag_fg); + // Each notice is its own tagline-shaped band at the top of the body. + // Going through the same layer machinery the pane and column tags use + // is what gives it the tagline's height, its small-font metrics, the + // band offset and the border -- none of which a body-grid row can have + // just by wearing a tagline font. + for (p.panes, 0..) |slot, id| { + const pane = slot orelse continue; + const r = p.rects[id]; + if (r.w <= TAG_TEXT_INSET or r.h <= BOX_H) continue; + const first = if (p.settings.tag_bottom) r.y else r.y + BOX_H; + var band: u16 = 0; + for (pane.notices.slice()) |kind| { + const text = switch (kind) { + .message => pane.msg[0..pane.msg_len], + .leader => blk: { + var ibuf: [16]u8 = @splat(' '); + @memcpy(ibuf[0..3], "SPC"); + var iw: usize = 3; + for (p.leader_keys[0..p.leader_n]) |ch| { + ibuf[iw + 1] = ch; + iw += 2; + } + break :blk try arena.dupe(u8, ibuf[0..iw]); + }, + // A prompt is an editing line with a cursor in it, so it + // stays on the grid where the cursor can sit on a cell. + .prompt => continue, + }; + if (text.len == 0) continue; + const room = p.tagCapacity(r.w -| TAG_TEXT_INSET); + const shown = panes.File.displayWidth(text); + const pad = room -| shown; + const line = try arena.alloc(u8, pad + text.len); + @memset(line[0..pad], ' '); + @memcpy(line[pad..], text); + try p.renderHeaderLayer(arena, NOTICE_LAYER_BASE + id * Pane.Notices.max + band, .notice, @intCast(id), .{ + .x = r.x + TAG_TEXT_INSET, + .y = first + band, + .w = r.w -| TAG_TEXT_INSET, + .h = BOX_H, + }, line, chrome.tag_bg, chrome.tag_fg); + band += 1; + } + } if (p.columnBarHeight() > 0) for (0..p.ncol) |column| { if (p.col_w[column] == 0) continue; const active = if (layout.findPane(p, p.active)) |found| found.col == column and p.settings.focus_tint else false; @@ -13934,7 +14040,14 @@ pub const Pardes = struct { layer.bg = bg; layer.cursor = null; var surface: Surface = .{ .cols = columns, .rows = 1, .cells = layer.cells }; - const editing = p.topbar_col != null and (if (kind == .workspace) p.header_column == null else p.header_column == id); + // A notice band carries a PANE id, not a column index, so it must not + // answer to the column being edited -- that would scroll and select + // its text with the column tag's offsets and give it a second caret. + const editing = p.topbar_col != null and switch (kind) { + .workspace => p.header_column == null, + .column => p.header_column == id, + .pane, .notice => false, + }; const scroll = if (editing) p.header_scroll else 0; surface.fill(0, 0, columns, 1, .{ .bg = .{ .rgb = bg }, .font_role = .tagline }); _ = surface.print(0, 0, columns, text[panes.File.rawAtDisplay(text, scroll)..], .{ .fg = .{ .rgb = fg }, .bg = .{ .rgb = bg }, .font_role = .tagline }); @@ -13974,6 +14087,7 @@ pub const Pardes = struct { /// them instead of letting the last one win the row. fn collectNotices(p: *Pardes, pane: *Pane, r: Rect, id: usize) void { pane.notices.len = 0; + pane.body_offset = 0; if (r.w <= config.GUTTER or r.h <= BOX_H) return; if (pane.msg_len > 0) pane.notices.push(.message); if (id == p.active and p.leader_on) pane.notices.push(.leader); @@ -13991,6 +14105,7 @@ pub const Pardes = struct { for (0..room) |i| pane.notices.kinds[i] = pane.notices.kinds[i + drop]; pane.notices.len = room; } + pane.body_offset = pane.notices.len; } fn renderBodyLayer(p: *Pardes, arena: std.mem.Allocator, pane: *Pane, r: Rect, id: usize) !void { @@ -14017,6 +14132,9 @@ pub const Pardes = struct { @memset(temporary_cells, .{}); var temporary: Surface = .{ .cols = r.w, .rows = @intCast(logical_rows + BOX_H), .cells = temporary_cells }; std.mem.swap(Surface, &p.surface, &temporary); + // This surface carries no notice bands, so the body starts at its top. + pane.body_offset = 0; + defer pane.body_offset = pane.notices.len; const synthetic: Rect = .{ .x = 0, .y = 0, .w = r.w, .h = @intCast(logical_rows + BOX_H) }; p.renderBody(arena, pane, synthetic, id, id == p.active, false) catch |err| { std.mem.swap(Surface, &p.surface, &temporary); @@ -14030,7 +14148,11 @@ pub const Pardes = struct { } layer.pane = @intCast(id); layer.serial = pane.serial; - layer.viewport = .{ .x = r.x + config.GUTTER, .y = if (p.settings.tag_bottom) r.y else r.y + BOX_H, .w = width, .h = viewport_rows }; + // Below the notice bands, which are stacked at the TOP of the body + // now: the rows they took came off this viewport, so its origin has to + // move with them or the first context header renders under a band. + const body_top = (if (p.settings.tag_bottom) r.y else r.y + BOX_H) + @as(u16, pane.notices.len); + layer.viewport = .{ .x = r.x + config.GUTTER, .y = body_top, .w = width, .h = viewport_rows }; layer.cols = width; layer.rows = @intCast(logical_rows); layer.context_rows = pane.context_rows; @@ -14052,7 +14174,7 @@ pub const Pardes = struct { const tx = r.x + config.GUTTER; // text area (tag + body), right of the gutter const tw = r.w - config.GUTTER; const tag_y = if (p.settings.tag_bottom) r.y + r.h -| BOX_H else r.y; - const body_y = if (p.settings.tag_bottom) r.y else r.y + BOX_H; + const body_y = p.bodyTop(pane, r); const pane_bg: Color = if (th.bg) |c| .{ .rgb = c } else .default; // text area resets to terminal-default cells (vaxis clear semantics); @@ -14092,11 +14214,14 @@ pub const Pardes = struct { if (pane.hasPdf() and panes.Pdf.draw(p, pane, r, id, tx, tw)) return; if (pane.image) |*iv| { - panes.Image.draw(p, iv, @intCast(id), pane.serial, tx, body_y, tw, r.h -| BOX_H); + const image_h = (r.h -| BOX_H) -| pane.body_offset; + panes.Image.draw(p, iv, @intCast(id), pane.serial, tx, body_y, tw, image_h); // thumbless, but the same one column as the real scrollbar below — - // that is the whole point of drawing it - s.fill(r.x, body_y, 1, r.h -| BOX_H, .{ .bg = .{ .rgb = chrome.scroll_track } }); - s.fill(r.x + 1, body_y, 1, r.h -| BOX_H, .{ .bg = pane_bg }); + // that is the whole point of drawing it, and like that one it runs + // past the notice bands so the gutter has no notch in it + const rail_y = if (p.settings.tag_bottom) r.y else r.y + BOX_H; + s.fill(r.x, rail_y, 1, r.h -| BOX_H, .{ .bg = .{ .rgb = chrome.scroll_track } }); + s.fill(r.x + 1, rail_y, 1, r.h -| BOX_H, .{ .bg = pane_bg }); return; } @@ -14110,7 +14235,7 @@ pub const Pardes = struct { const tx = r.x + @min(TAG_TEXT_INSET, r.w); const tw = r.w -| TAG_TEXT_INSET; const tag_y = if (p.settings.tag_bottom) r.y + r.h -| BOX_H else r.y; - const body_y = if (p.settings.tag_bottom) r.y else r.y + BOX_H; + const body_y = p.bodyTop(pane, r); const page_rgb = th.bg orelse th.tag_bg; // Focus is visible along the tag without changing its live text grid. const tag_bg = if (active and p.settings.focus_tint) chrome.tag_active_bg else chrome.tag_bg; @@ -14194,11 +14319,15 @@ pub const Pardes = struct { const tx = r.x + config.GUTTER; const tw = r.w - config.GUTTER; const tag_y = if (p.settings.tag_bottom) r.y + r.h -| BOX_H else r.y; - const body_y = if (p.settings.tag_bottom) r.y else r.y + BOX_H; + // Below the notice bands: they are stacked at the top of the body the + // way tree-sitter context rows are, so the body starts under them + // rather than being painted over by them. + const body_y = p.bodyTop(pane, r); const pane_bg: Color = if (th.bg) |c| .{ .rgb = c } else .default; const page_rgb = th.bg orelse th.tag_bg; // body: emulator rows, prompt rows hidden outside tty mode - const body_h = if (r.h > BOX_H) r.h - BOX_H else 0; + const body_h = (r.h -| BOX_H) -| pane.body_offset; + const body_bottom = r.h -| pane.body_offset; const body_style: CellStyle = .{ .fg = if (th.fg) |c| .{ .rgb = c } else .default, .bg = pane_bg, @@ -14269,7 +14398,7 @@ pub const Pardes = struct { const lo = @min(pane.msel.r0, pane.msel.r1); const hi = @max(pane.msel.r0, pane.msel.r1); var row: u16 = BOX_H; // never paint the tag row - while (row < r.h) : (row += 1) { + while (row < body_bottom) : (row += 1) { const ar = pane.wrapAt(@as(i32, row) - @as(i32, BOX_H)).line; if (ar < lo or ar > hi) continue; var col: u16 = if (pane.file != null) panes.File.gutterWidth(pane) else 0; @@ -14306,7 +14435,7 @@ pub const Pardes = struct { else mix(th.sel_bg, page_rgb); var vr: i32 = 0; - while (vr + @as(i32, BOX_H) < @as(i32, r.h)) : (vr += 1) { + while (vr + @as(i32, BOX_H) < @as(i32, body_bottom)) : (vr += 1) { const w = pane.wrapAt(vr); if (w.line < bnd.lo_row or w.line > bnd.hi_row) continue; const visible_line = modal.lineSlice(body, @intCast(vr)); @@ -14344,7 +14473,7 @@ pub const Pardes = struct { @intCast(@max(0, cw.at)), @intCast(@max(0, sr.col)), )) + vpfx; - if (crow >= BOX_H and crow < @as(i32, r.h) and ccol >= vpfx and ccol < tw) { + if (crow >= BOX_H and crow < @as(i32, body_bottom) and ccol >= vpfx and ccol < tw) { const cell = s.at(tx + @as(u16, @intCast(ccol)), body_y + @as(u16, @intCast(crow - BOX_H))); cell.default = false; cell.style.bg = .{ .rgb = th.sel_fg }; @@ -14375,17 +14504,22 @@ pub const Pardes = struct { ) else ccol; - if (prow >= BOX_H and cx >= 0 and prow < r.h and cx < tw) + if (prow >= BOX_H and cx >= 0 and prow < body_bottom and cx < tw) s.cursor = .{ .x = tx + @as(u16, @intCast(cx)), .y = body_y + @as(u16, @intCast(prow - BOX_H)), .bar = pane.mode == .insert }; } else if (panes.Terminal.visibleCursor(pane)) |cur| { - if (cur.y + BOX_H < r.h and cur.x < tw) + if (cur.y + BOX_H < body_bottom and cur.x < tw) s.cursor = .{ .x = tx + cur.x, .y = body_y + cur.y }; } } - if (scrollbar and r.h > BOX_H) { - s.fill(r.x, body_y, 1, r.h - BOX_H, .{ .bg = .{ .rgb = chrome.scroll_track } }); - s.fill(r.x + 1, body_y, 1, r.h - BOX_H, .{ .bg = pane_bg }); + if (scrollbar and body_h > 0) { + // The rail covers the notice bands too: nothing else paints those + // two gutter columns, so a gap there keeps the frame-wide border + // fill and reads as a notch cut out of the scrollbar. + const rail_y = if (p.settings.tag_bottom) r.y else r.y + BOX_H; + const rail_h = r.h -| BOX_H; + s.fill(r.x, rail_y, 1, rail_h, .{ .bg = .{ .rgb = chrome.scroll_track } }); + s.fill(r.x + 1, rail_y, 1, rail_h, .{ .bg = pane_bg }); const sb: struct { total: usize, offset: usize, len: usize } = if (pane.file) |*f| .{ .total = panes.File.nlines(p.gpa, f), .offset = f.scroll, @@ -14398,7 +14532,7 @@ pub const Pardes = struct { const gsb = panes.Terminal.scrollbar(pane); break :blk .{ .total = gsb.total, .offset = gsb.offset, .len = gsb.len }; }; - const track_h: usize = r.h - BOX_H; + const track_h: usize = body_h; const total = if (sb.total == 0) 1 else sb.total; const len = @max(1, (track_h * @max(1, sb.len)) / total); const pos = (track_h * sb.offset) / total; @@ -14658,6 +14792,24 @@ test "a builtin announces itself on the message row, and Verbose silences it" { try std.testing.expect(pane.notices.len > 0); try std.testing.expectEqual(Pane.Notices.Kind.message, pane.notices.kinds[0]); + // ...and it is carried as a tagline band, not a body row: that is what + // gives it the tagline's height, its small font and its border. + var frame = std.heap.ArenaAllocator.init(std.testing.allocator); + defer frame.deinit(); + _ = try p.render(frame.allocator()); + const r = p.rects[p.active]; + const band = for (p.surface.tagLayers()) |*layer| { + if (layer.cols != 0 and layer.kind == .notice) break layer; + } else return error.NoNoticeBand; + try std.testing.expectEqual(@as(u16, 1), band.viewport.h); + try std.testing.expectEqual(if (p.settings.tag_bottom) r.y else r.y + BOX_H, band.viewport.y); + // Right aligned: the text ends at the band's right edge. + const line = band.cells[0..band.cols]; + var last: usize = line.len; + while (last > 0 and line[last - 1].grapheme()[0] == ' ') last -= 1; + try std.testing.expect(last > 0); + try std.testing.expect(line[0].grapheme()[0] == ' '); + // Msg owns the row itself, so it does not announce over its own text. try std.testing.expect(p.executeBuiltinLine(p.active, "Msg hello")); try std.testing.expectEqualStrings("hello", pane.msg[0..pane.msg_len]); @@ -14668,6 +14820,86 @@ test "a builtin announces itself on the message row, and Verbose silences it" { try std.testing.expectEqual(@as(u16, 0), pane.msg_len); } +test "notices stack downward from the top of the body, which starts below them" { + if (platform == .web) return; + const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 80, .rows = 24 }); + defer p.deinit(); + const id = p.active; + const pane = p.panes[id].?; + p.sync(); + var frame = std.heap.ArenaAllocator.init(std.testing.allocator); + defer frame.deinit(); + + const r = p.rects[id]; + const plain = p.bodyTop(pane, r); + try std.testing.expectEqual(@as(u16, 0), pane.body_offset); + + // A message and a leader prefix at once: two bands, stacked in the order + // collectNotices chose, each one row tall and each one row further down. + try std.testing.expect(p.executeBuiltinLine(id, "Msg first")); + p.leader_on = true; + p.leader_n = 0; + _ = frame.reset(.retain_capacity); + _ = try p.render(frame.allocator()); + try std.testing.expectEqual(@as(u16, 2), pane.body_offset); + try std.testing.expectEqual(plain + 2, p.bodyTop(pane, r)); + + var rows: [Pane.Notices.max]u16 = @splat(0); + var found: usize = 0; + for (p.surface.tagLayers()) |*layer| { + if (layer.cols == 0 or layer.kind != .notice) continue; + try std.testing.expectEqual(@as(u16, 1), layer.viewport.h); + rows[found] = layer.viewport.y; + found += 1; + } + try std.testing.expectEqual(@as(usize, 2), found); + std.mem.sort(u16, rows[0..2], {}, std.sort.asc(u16)); + try std.testing.expectEqual(plain, rows[0]); + try std.testing.expectEqual(plain + 1, rows[1]); + + // Gone with the notices: no stale band, and the body back at the top. + p.leader_on = false; + pane.msg_len = 0; + _ = frame.reset(.retain_capacity); + _ = try p.render(frame.allocator()); + try std.testing.expectEqual(@as(u16, 0), pane.body_offset); + try std.testing.expectEqual(plain, p.bodyTop(pane, r)); + for (p.surface.tagLayers()) |*layer| + try std.testing.expect(layer.cols == 0 or layer.kind != .notice); +} + +test "a prompt band keeps its caret on the grid, and a band is not a click target" { + if (platform == .web) return; + const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 80, .rows = 24 }); + defer p.deinit(); + const id = p.active; + const pane = p.panes[id].?; + p.sync(); + var frame = std.heap.ArenaAllocator.init(std.testing.allocator); + defer frame.deinit(); + + // The caret sits AFTER the prompt text the moment the prompt opens, and + // the band is flush with the pane's right edge -- so this is the frame + // that used to put it one column past the pane, off the grid and past + // what the detached wire will encode. + p.startPrompt(pane, .{ .search = "/" }); + _ = try p.render(frame.allocator()); + const r = p.rects[id]; + const cursor = p.surface.cursor orelse return error.MissingPromptCursor; + try std.testing.expect(pane.body_offset > 0); + try std.testing.expectEqual(p.bodyTop(pane, r) - 1, cursor.y); + try std.testing.expect(cursor.x < r.x + r.w); + try std.testing.expect(cursor.x < p.surface.cols); + + // The band is chrome. Mapped as body it would land on Sel row 0, which is + // the TAG row, so a click on it would run a word out of the tag as a + // builtin. + const band_row = p.bodyTop(pane, r) - 1; + p.update(.{ .mouse = .{ .button = .left, .kind = .press, .col = r.x + r.w - 4, .row = band_row } }); + p.update(.{ .mouse = .{ .button = .left, .kind = .release, .col = r.x + r.w - 4, .row = band_row } }); + for (pane.sel) |selection| try std.testing.expect(selection.state == .none); +} + test "closing the last pane in a column leaves an empty one in its place" { if (platform == .web) return; const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 120, .rows = 24 }); diff --git a/src/tag_layer.zig b/src/tag_layer.zig index 65990959..0fb2297d 100644 --- a/src/tag_layer.zig +++ b/src/tag_layer.zig @@ -3,7 +3,11 @@ const std = @import("std"); const pardes = @import("pardes.zig"); -pub const Kind = enum(u8) { workspace, column, pane }; +/// `notice` is a pane's transient line -- a builtin's name, a pending leader +/// chord -- carried as a tagline-shaped band so it gets the tagline's height, +/// small-font metrics, band offset and border instead of being a body-grid row +/// wearing a tagline font. +pub const Kind = enum(u8) { workspace, column, pane, notice }; pub const Hit = struct { kind: Kind, id: u16, diff --git a/test/e2e_harness.zig b/test/e2e_harness.zig index 5a181b78..eaa19b43 100644 --- a/test/e2e_harness.zig +++ b/test/e2e_harness.zig @@ -366,6 +366,18 @@ pub const Harness = struct { }; /// Write a file (helper for test setup, raw libc). +pub fn appendFile(path: [*:0]const u8, data: []const u8) !void { + const fd = libc.open(path, .{ .ACCMODE = .WRONLY, .CREAT = true, .APPEND = true }, @as(libc.mode_t, 0o644)); + if (fd < 0) return error.OpenFailed; + defer _ = libc.close(fd); + var off: usize = 0; + while (off < data.len) { + const w = libc.write(fd, data[off..].ptr, data.len - off); + if (w <= 0) break; + off += @intCast(w); + } +} + pub fn writeFile(path: [*:0]const u8, data: []const u8) !void { const fd = libc.open(path, .{ .ACCMODE = .WRONLY, .CREAT = true, .TRUNC = true }, @as(libc.mode_t, 0o644)); if (fd < 0) return error.OpenFailed; diff --git a/test/fs.py b/test/fs.py index c8dea2d9..33bcdfa9 100644 --- a/test/fs.py +++ b/test/fs.py @@ -612,7 +612,11 @@ def test(binary, quic=False): if start < 0: continue styles = [screen['styles'][cell[1]] for cell in cells[start:start + len(word)]] - assert all(style['bold'] and style['fg'] == styles[0]['fg'] for style in styles), (word, styles) + # Weight is opt-in (SyntaxBold, off by default); colour is + # not, so the keyword must differ from the text beside it. + plain = screen['styles'][cells[start + len(word)][1]] + assert all(not style['bold'] and style['fg'] == styles[0]['fg'] for style in styles), (word, styles) + assert styles[0]['fg'] != plain['fg'], (word, styles[0], plain) found.add(word) assert found == {'fn', 'if'}, screen diff --git a/test/output.zig b/test/output.zig index 1fcb6104..8afbf4d2 100644 --- a/test/output.zig +++ b/test/output.zig @@ -77,7 +77,7 @@ fn outputCell(p: *Pardes, surface: *pardes.Surface, id: usize, byte: usize) *par const line = modal.lineSlice(pane.file.?.content, 0); const rect = p.rects[id]; const x = rect.x + config.GUTTER + panes.File.gutterWidth(pane) + @as(u16, @intCast(panes.File.displayWidth(line[0..byte]))); - const y = if (p.settings.tag_bottom) rect.y else rect.y + pardes.BOX_H; + const y = p.bodyTop(pane, rect); return surface.at(x, y); } @@ -490,7 +490,7 @@ test "Mini syntax colors survive toggles themes and rendering without source acc const surface = try p.render(frame.allocator()); const rect = p.rects[id]; const x = rect.x + config.GUTTER + panes.File.gutterWidth(mini) + @as(u16, @intCast(column)); - const y = (if (p.settings.tag_bottom) rect.y else rect.y + pardes.BOX_H) + @as(u16, @intCast(position.row)); + const y = p.bodyTop(mini, rect) + @as(u16, @intCast(position.row)); if (enabled) try std.testing.expectEqualDeep(pardes.Color{ .rgb = p.theme().kw }, surface.at(x, y).style.fg); try std.testing.expectEqual(colors, mini.file.?.mini.?.colors.ptr); try std.testing.expectEqual(@as(usize, 0), mini.file.?.highlights.len); diff --git a/test/panes.zig b/test/panes.zig index e4e677e4..69628cd9 100644 --- a/test/panes.zig +++ b/test/panes.zig @@ -468,7 +468,7 @@ const TreeContextTests = struct { try std.testing.expectEqual(@as(i32, 59), pane.wrapAt(visible.row).line); const cursor = surface.cursor orelse return error.MissingLookCursor; const rect = p.rects[0]; - const y = if (p.settings.tag_bottom) rect.y else rect.y + pardes.BOX_H; + const y = p.bodyTop(pane, rect); try std.testing.expectEqual(y + @as(u16, @intCast(visible.row)), cursor.y); } } @@ -490,14 +490,16 @@ const TreeContextTests = struct { try std.testing.expectEqual(@as(i32, 7), pane.wrapAt(pane.context_rows).line); const rect = p.rects[0]; const x = rect.x + config.GUTTER + panes.File.gutterWidth(pane); - const y = if (p.settings.tag_bottom) rect.y else rect.y + pardes.BOX_H; + const y = p.bodyTop(pane, rect); ClickCursorTests.click(p, .left, x + 6, y); try std.testing.expectEqual(@as(i32, 0), pane.cur_row); try std.testing.expectEqual(@as(i32, 6), pane.cur_col); try std.testing.expectEqual(@as(i32, 7), pane.scroll()); const cursor = (try p.render(frame.allocator())).cursor orelse return error.MissingContextCursor; try std.testing.expectEqual(x + 6, cursor.x); - try std.testing.expectEqual(y, cursor.y); + // Read the body top again: the click cleared the announcement band the + // builtin above put up, and the body moved back up with it. + try std.testing.expectEqual(p.bodyTop(pane, p.rects[0]), cursor.y); p.update(.{ .key = .{ .cp = 'i' } }); p.update(.{ .key = .{ .cp = 'Z', .text = "Z" } }); try std.testing.expect(std.mem.startsWith(u8, pane.file.?.content, "const ZBox = struct {")); @@ -536,7 +538,7 @@ const TreeContextTests = struct { const surface = try p.render(frame.allocator()); try std.testing.expectEqual(@as(u16, 3), pane.context_rows); const rect = p.rects[0]; - const y = if (p.settings.tag_bottom) rect.y else rect.y + pardes.BOX_H; + const y = p.bodyTop(pane, rect); var glyph_x: ?u16 = null; for (0..surface.cols) |col| { if (std.mem.eql(u8, surface.at(@intCast(col), y).grapheme(), "界")) glyph_x = @intCast(col); @@ -548,7 +550,9 @@ const TreeContextTests = struct { try std.testing.expectEqual(@as(i32, 8), pane.scroll()); const cursor = (try p.render(frame.allocator())).cursor orelse return error.MissingContextCursor; try std.testing.expectEqual(x, cursor.x); - try std.testing.expectEqual(y, cursor.y); + // 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)); _ = try p.render(frame.allocator()); try std.testing.expectEqual(@as(u16, 0), pane.context_rows); @@ -576,12 +580,16 @@ const TreeContextTests = struct { target = .{ .x = @intCast(col), .y = @intCast(row) }; }; const glyph = target orelse return error.MissingWrappedContextBody; + const offset = pane.body_offset; ClickCursorTests.click(p, .left, glyph.x + 1, glyph.y); try std.testing.expectEqual(@as(i32, 2), pane.cur_row); try std.testing.expectEqual(@as(i32, @intCast(std.mem.indexOf(u8, body, "界").?)), pane.cur_col); const cursor = (try p.render(frame.allocator())).cursor orelse return error.MissingContextBodyCursor; try std.testing.expectEqual(glyph.x, cursor.x); - try std.testing.expectEqual(glyph.y, cursor.y); + // The scan above ran with the builtin's announcement band up; the click + // cleared it, so the row the glyph was found on has moved up with the + // body it belongs to. + try std.testing.expectEqual(glyph.y - offset, cursor.y); } }; @@ -607,7 +615,7 @@ const TtySelectionTests = struct { _ = try p.render(frame.allocator()); const rect = p.rects[0]; const x = rect.x + config.GUTTER; - const y = if (p.settings.tag_bottom) rect.y else rect.y + pardes.BOX_H; + const y = p.bodyTop(pane, rect); JumpSelectionTests.drag(p, x + 1, y, x + 3, y); try std.testing.expectEqualStrings("lph", p.yank orelse return error.MissingAutomaticTtyYank); p.update(.{ .key = .{ .cp = p.opts.tty_toggle, .ctrl = true } }); @@ -637,7 +645,7 @@ const TtySelectionTests = struct { _ = try p.render(frame.allocator()); const rect = p.rects[0]; const x = rect.x + config.GUTTER; - const y = if (p.settings.tag_bottom) rect.y else rect.y + pardes.BOX_H; + const y = p.bodyTop(pane, rect); JumpSelectionTests.drag(p, x + @as(u16, if (prompt) 0 else 1), y, x + 3, y + @as(u16, if (prompt) 0 else 1)); const expected = if (prompt) "$ ab" else "lph\nrav"; try std.testing.expectEqual(Pane.Mode.tty, pane.mode); @@ -952,7 +960,7 @@ const JumpSelectionTests = struct { if (wrap) try std.testing.expectEqual(pane.wrap_line[0], pane.wrap_line[1]); const rect = p.rects[0]; const x = rect.x + config.GUTTER + panes.File.gutterWidth(pane); - const y = if (p.settings.tag_bottom) rect.y else rect.y + pardes.BOX_H; + const y = p.bodyTop(pane, rect); if (reverse) drag(p, x + last_col, y + 1, x + first_col, y) else @@ -982,7 +990,9 @@ const JumpSelectionTests = struct { try std.testing.expectEqual(@as(i32, 0), pane.cur_col); // A selection created after Back must also disappear on Forward. - drag(p, x + 1, y, x + 3, y + 1); + // Back announces itself, so the body sits under a notice band now. + const y2 = p.bodyTop(pane, p.rects[0]); + drag(p, x + 1, y2, x + 3, y2 + 1); try std.testing.expect(pardes.test_api.heldSelection(p, 0) != null); p.update(.{ .key = .{ .cp = 'i', .ctrl = true } }); _ = frame.reset(.retain_capacity); @@ -4117,7 +4127,7 @@ test "cancelled normal gestures leave no count or subprefix after mouse and focu .body, .tag => { const rect = p.rects[0]; const tag_y = if (p.settings.tag_bottom) rect.y + rect.h - pardes.BOX_H else rect.y; - const body_y = if (p.settings.tag_bottom) rect.y else rect.y + pardes.BOX_H; + const body_y = p.bodyTop(pane, rect); const x = rect.x + config.GUTTER + @as(u16, @intCast(panes.File.gutterWidth(pane))) + 3; const y = if (gesture == .tag) tag_y else body_y; p.update(.{ .mouse = .{ .button = config.select_button, .kind = .press, .col = x, .row = y } }); diff --git a/test/snapshot.zig b/test/snapshot.zig index 7fa84a86..7cc5eb91 100644 --- a/test/snapshot.zig +++ b/test/snapshot.zig @@ -619,7 +619,13 @@ fn runScript(arena: std.mem.Allocator, exe_z: [:0]const u8, script_path: []const const cmd = tok.next().?; errdefer std.debug.print(" at {s}:{d}: {s}\n", .{ script_path, lineno, line }); - if (std.mem.eql(u8, cmd, "file")) { + if (std.mem.eql(u8, cmd, "config")) { + // Appended to the startup config this script's fake home already + // has, so a script can pin a setting instead of spelling out the + // screen geometry a default implies. Must precede `start`. + const setting = try std.fmt.allocPrint(arena, "{s}\n", .{tok.rest()}); + 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())); } else if (std.mem.eql(u8, cmd, "lines")) { diff --git a/test/snapshots/argv.golden b/test/snapshots/argv.golden index 4da2a12d..abf5781d 100644 --- a/test/snapshots/argv.golden +++ b/test/snapshots/argv.golden @@ -1,14 +1,31 @@ == snap noargs grid=100x31 cursor=4,5 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol -|$ /tmp/pardes-snap/argv/cwd Save Tty Del Togglettymode Filter Collapse +| New Tty Find Grep Joincol Delcol +|$ /tmp/pardes-snap/argv/cwd Tty Save Mode Filter Collapse Del | $ echo ARGV''TTY | ARGVTTY | $ +| +| +| +| +| +| +| +| +| +| +| +| +| +| +| +| /+New Save Tty Collapse Del +| 1 == snap filearg grid=100x31 cursor=7,3 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol -| /tmp/pardes-snap/argv/cwd/notes.txt Save Tty Del Collapse +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/argv/cwd/notes.txt Save Tty Collapse Del | 3 line 3 | 4 line 4 | 5 line 5 @@ -18,8 +35,8 @@ | 9 == snap filearg-n3 grid=100x31 cursor=7,3 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol -| /tmp/pardes-snap/argv/cwd/notes.txt Save Tty Del Collapse +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/argv/cwd/notes.txt Save Tty Collapse Del | 1 line 1 | 2 line 2 | 3 line 3 @@ -31,7 +48,7 @@ | 9 == snap dirarg grid=100x31 cursor=4,5 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol -| /tmp/pardes-snap/argv/cwd/sub Save Tty Del Togglettymode Filter Collapse +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/argv/cwd/sub Tty Save Mode Filter Collapse Del | ls | inside.txt diff --git a/test/snapshots/badutf.golden b/test/snapshots/badutf.golden index 270b3fe6..d3a906b1 100644 --- a/test/snapshots/badutf.golden +++ b/test/snapshots/badutf.golden @@ -1,7 +1,7 @@ == snap badbytes grid=100x31 cursor=7,3 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol -| /tmp/pardes-snap/badutf/cwd/bad.txt Save Tty Del Collapse +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/badutf/cwd/bad.txt Save Tty Collapse Del | 1 hello �� world | 2 latin-1 caf� tail | 3 truncated �� here @@ -9,8 +9,8 @@ | 5 == snap hscroll-midglyph grid=50x31 cursor=46,3 |Newcol Joincol Find Grep Help Changelog Tutor Dump -|New Tty Find Grep Joincol -| /tmp/pardes-snap/badutf/cwd/wide.txt Save Tty De +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/badutf/cwd/wide.txt Save Tty C | 1 日本語 日本語 日本語 日本語 日本語 tail | 2 | 3 diff --git a/test/snapshots/boot.golden b/test/snapshots/boot.golden index f1e159d1..2e4ad22f 100644 --- a/test/snapshots/boot.golden +++ b/test/snapshots/boot.golden @@ -1,38 +1,38 @@ == snap boot grid=100x31 cursor=4,5 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol -| /tmp/pardes-snap/boot/cwd Save Tty Del Togglettymode Filter Collapse +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/boot/cwd Tty Save Mode Filter Collapse Del | ls | hello.txt == style boot grid=100x31 |0: 0-70 #b2c3b8,#1d2824, 71-99 d,#1d2824, -|1: 0-24 #becfc4,#26362d, 25-99 d,#26362d, -|2: 0-1 #000000,#adcc91, 2-69 #becfc4,#26362d, 70-99 d,#26362d, -|3: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-99 #e5eee5,#0d1410, -|4: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-99 #e5eee5,#0d1410, -|5: 0-0 d,#637f6a, 1-99 d,#0d1410, -|6: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-99 #e5eee5,#0d1410, -|7: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-99 #e5eee5,#0d1410, -|8: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-99 #e5eee5,#0d1410, -|9: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-99 #e5eee5,#0d1410, -|10: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-99 #e5eee5,#0d1410, -|11: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-99 #e5eee5,#0d1410, -|12: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-99 #e5eee5,#0d1410, -|13: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-99 #e5eee5,#0d1410, -|14: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-99 #e5eee5,#0d1410, -|15: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-99 #e5eee5,#0d1410, -|16: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-99 #e5eee5,#0d1410, -|17: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-99 #e5eee5,#0d1410, -|18: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-99 #e5eee5,#0d1410, -|19: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-99 #e5eee5,#0d1410, -|20: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-99 #e5eee5,#0d1410, -|21: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-99 #e5eee5,#0d1410, -|22: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-99 #e5eee5,#0d1410, -|23: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-99 #e5eee5,#0d1410, -|24: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-99 #e5eee5,#0d1410, -|25: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-99 #e5eee5,#0d1410, -|26: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-99 #e5eee5,#0d1410, -|27: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-99 #e5eee5,#0d1410, -|28: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-99 #e5eee5,#0d1410, -|29: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-99 #e5eee5,#0d1410, -|30: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-99 #e5eee5,#0d1410, +|1: 0-1 #ffffff,#887455, 2-2 d,#26362d, 3-34 #becfc4,#26362d, 35-99 d,#26362d, +|2: 0-1 #000000,#add38a, 2-2 d,#26362d, 3-28 #becfc4,#26362d, 29-31 #dfbce5,#26362d, 32-61 #becfc4,#26362d, 62-99 d,#26362d, +|3: 0-0 d,#608269, 1-1 d,#0d1410, 2-99 #e5eee5,#0d1410, +|4: 0-0 d,#608269, 1-1 d,#0d1410, 2-99 #e5eee5,#0d1410, +|5: 0-0 d,#608269, 1-99 d,#0d1410, +|6: 0-0 d,#608269, 1-1 d,#0d1410, 2-99 #e5eee5,#0d1410, +|7: 0-0 d,#608269, 1-1 d,#0d1410, 2-99 #e5eee5,#0d1410, +|8: 0-0 d,#608269, 1-1 d,#0d1410, 2-99 #e5eee5,#0d1410, +|9: 0-0 d,#608269, 1-1 d,#0d1410, 2-99 #e5eee5,#0d1410, +|10: 0-0 d,#608269, 1-1 d,#0d1410, 2-99 #e5eee5,#0d1410, +|11: 0-0 d,#608269, 1-1 d,#0d1410, 2-99 #e5eee5,#0d1410, +|12: 0-0 d,#608269, 1-1 d,#0d1410, 2-99 #e5eee5,#0d1410, +|13: 0-0 d,#608269, 1-1 d,#0d1410, 2-99 #e5eee5,#0d1410, +|14: 0-0 d,#608269, 1-1 d,#0d1410, 2-99 #e5eee5,#0d1410, +|15: 0-0 d,#608269, 1-1 d,#0d1410, 2-99 #e5eee5,#0d1410, +|16: 0-0 d,#608269, 1-1 d,#0d1410, 2-99 #e5eee5,#0d1410, +|17: 0-0 d,#608269, 1-1 d,#0d1410, 2-99 #e5eee5,#0d1410, +|18: 0-0 d,#608269, 1-1 d,#0d1410, 2-99 #e5eee5,#0d1410, +|19: 0-0 d,#608269, 1-1 d,#0d1410, 2-99 #e5eee5,#0d1410, +|20: 0-0 d,#608269, 1-1 d,#0d1410, 2-99 #e5eee5,#0d1410, +|21: 0-0 d,#608269, 1-1 d,#0d1410, 2-99 #e5eee5,#0d1410, +|22: 0-0 d,#608269, 1-1 d,#0d1410, 2-99 #e5eee5,#0d1410, +|23: 0-0 d,#608269, 1-1 d,#0d1410, 2-99 #e5eee5,#0d1410, +|24: 0-0 d,#608269, 1-1 d,#0d1410, 2-99 #e5eee5,#0d1410, +|25: 0-0 d,#608269, 1-1 d,#0d1410, 2-99 #e5eee5,#0d1410, +|26: 0-0 d,#608269, 1-1 d,#0d1410, 2-99 #e5eee5,#0d1410, +|27: 0-0 d,#608269, 1-1 d,#0d1410, 2-99 #e5eee5,#0d1410, +|28: 0-0 d,#608269, 1-1 d,#0d1410, 2-99 #e5eee5,#0d1410, +|29: 0-0 d,#608269, 1-1 d,#0d1410, 2-99 #e5eee5,#0d1410, +|30: 0-0 d,#608269, 1-1 d,#0d1410, 2-99 #e5eee5,#0d1410, diff --git a/test/snapshots/builtins.golden b/test/snapshots/builtins.golden index 17b4db5e..96dabb54 100644 --- a/test/snapshots/builtins.golden +++ b/test/snapshots/builtins.golden @@ -1,7 +1,7 @@ == snap boot grid=120x67 cursor=7,3 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol -| /tmp/pardes-snap/builtins/cwd/notes.txt Save Tty Del Collapse +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/builtins/cwd/notes.txt Save Tty Collapse Del | 1 line 1 | 2 line 2 | 3 line 3 @@ -10,23 +10,23 @@ | 6 line 6 | 7 == snap window-group grid=120x67 cursor=7,36 -|35: /tmp/pardes-snap/builtins/cwd/+Help Save Tty Del Collapse +|35: /tmp/pardes-snap/builtins/cwd/+Help Save Tty Collapse Del |36: 1 pardes builtins under SPC w |37: 2 -|38: 3 SPC w h Left C-w h, C-w left -|39: 4 SPC w j Down C-w j, C-w down -|40: 5 SPC w k Up C-w k, C-w up -|41: 6 SPC w l Right C-w l, C-w right +|38: 3 SPC w h Left C-w h, C-w left +|39: 4 SPC w j Down C-w j, C-w down +|40: 5 SPC w k Up C-w k, C-w up +|41: 6 SPC w l Right C-w l, C-w right |42: 7 == snap docs-group grid=120x67 cursor=7,36 |36: 1 pardes builtins under SPC h -|38: 3 SPC h c Changelog topbar +|38: 3 SPC h c Changelog topbar |39: 4 SPC h m Messages -|40: 5 SPC h t Tutor topbar +|40: 5 SPC h t Tutor topbar |41: 6 |42: == snap tutor-from-index grid=120x67 cursor=7,20 -|19: /Tutor Save Tty Del Collapse +|19: /Tutor Save Tty Collapse Del |20: 1 |21: 2 PARDES TUTOR |22: 3 tmux + vi + acme, from scratch. @@ -42,3 +42,10 @@ |32: 13 |33: 14 A pane is just text on screen. There is no separate "buffer" type — |34: 15 what you see is what you edit. Some panes happen to be live terminals; +|36: Tutor +|37: 1 pardes builtins under SPC h +|38: 2 +|39: 3 SPC h c Changelog topbar +|40: 4 SPC h m Messages +|41: 5 SPC h t Tutor topbar +|42: 6 diff --git a/test/snapshots/builtins.snap b/test/snapshots/builtins.snap index 06298d77..cd47209f 100644 --- a/test/snapshots/builtins.snap +++ b/test/snapshots/builtins.snap @@ -9,19 +9,26 @@ key space ? wait 10000 pardes builtins, and how to run each: wait 10000 ClipPasteBefore key g e -# The new Collapse entry adds one index line: expose Look above the bottom -# viewport while keeping the same pane geometry for the later group clicks. +# Every builtin added since adds an index line, and one wheel tick is one row +# (config.wheel_rows): scroll far enough to expose Look and Exec above the +# bottom viewport while keeping the same pane geometry for the later clicks. wheel up 110 50 -wait 10000 Look enter, right-click -wait 10000 Exec tab, middle-click +wheel up 110 50 +wheel up 110 50 +wheel up 110 50 +wheel up 110 50 +wheel up 110 50 +wheel up 110 50 +wait 10000 Look enter, right-click +wait 10000 Exec tab, middle-click wait 10000 Filter wait 10000 Theme stable 700 15000 # n moves through look-able text; it must not execute command names. key n n n -wait 10000 Look enter, right-click -wait 10000 Exec tab, middle-click +wait 10000 Look enter, right-click +wait 10000 Exec tab, middle-click key space w ? wait 10000 Right stable 700 15000 diff --git a/test/snapshots/chordcut.golden b/test/snapshots/chordcut.golden index 33bc8356..a9586983 100644 --- a/test/snapshots/chordcut.golden +++ b/test/snapshots/chordcut.golden @@ -1,11 +1,11 @@ == snap opened grid=120x31 cursor=7,7 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol New Tty Find Grep Joincol -| /tmp/pardes-snap/chordcut/cwd Save Tty Del Togglettymode F /tmp/pardes-snap/chordcut/cwd Save Tty Del Togglettymode F -| ls ls -| f.txt g.txt f.txt g.txt -| -| /tmp/pardes-snap/chordcut/cwd/f.txt Save Tty Del Collapse +| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/chordcut/cwd Tty Save Mode Filter Collap /tmp/pardes-snap/chordcut/cwd Tty Save Mode Filter Collap +| Look ls +| ls f.txt g.txt +| f.txt g.txt +| /tmp/pardes-snap/chordcut/cwd/f.txt Save Tty Collapse Del | 1 line 1 | 2 line 2 | 3 line 3 @@ -16,11 +16,14 @@ | | | -| /tmp/pardes-snap/chordcut/cwd Save Tty Del Togglettymode F +| /tmp/pardes-snap/chordcut/cwd Tty Save Mode Filter Collap | ls | f.txt g.txt == snap cut grid=120x31 cursor=7,8 -|6: /tmp/pardes-snap/chordcut/cwd/f.txt * Save Tty Del Collaps +|3: ls ls +|4: f.txt g.txt f.txt g.txt +|5: +|6: /tmp/pardes-snap/chordcut/cwd/f.txt * Save Tty Collapse D |8: 2 2 == snap copied grid=120x31 cursor=10,9 == snap pointpaste grid=120x31 cursor=16,10 @@ -29,53 +32,77 @@ |11: 5 lline 5 == snap cancelexec grid=120x31 cursor=25,8 |8: 2 2echo B''OO g.txt -== snap execafter grid=120x31 cursor=25,8 +== snap execafter grid=120x31 cursor=25,9 |3: f.txt ls |4: BOO f.txt g.txt +|7: Exec +|8: 1 line 1 +|9: 2 2echo B''OO g.txt +|10: 3 line 3 +|11: 4 line 4line +|12: 5 lline 5 +|13: 6 == snap cancellook grid=120x31 cursor=25,8 +|7: 1 line 1 +|8: 2 2echo B''OO g.txt +|9: 3 line 3 +|10: 4 line 4line +|11: 5 lline 5 +|12: 6 +|13: == snap lookafter grid=120x31 cursor=7,13 -|12: /tmp/pardes-snap/chordcut/cwd/g.txt Save Tty Del Collapse +|7: Look +|8: 1 line 1 +|9: 2 2echo B''OO g.txt +|10: 3 line 3 +|11: 4 line 4line +|12: /tmp/pardes-snap/chordcut/cwd/g.txt Save Tty Collapse Del |13: 1 line 1 |14: 2 line 2 |15: 3 == style chordsel grid=120x31 |0: 0-70 #b2c3b8,#1d2824, 71-119 d,#1d2824, -|1: 0-24 #becfc4,#26362d, 25-59 d,#26362d, 60-84 #b2c3b8,#1d2824, 85-119 d,#1d2824, -|2: 0-1 #ffffff,#4c6356, 2-59 #b2c3b8,#1d2824, 60-61 #ffffff,#4c6356, 62-119 #b2c3b8,#1d2824, -|3: 0-0 d,#152019, 1-1 d,#0d1410, 2-8 #e5eee5,#0d1410, 9-59 d,#0d1410, 60-60 d,#637f6a, 61-61 d,#0d1410, 62-119 #e5eee5,#0d1410, -|4: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-59 #e5eee5,#0d1410, 60-60 d,#637f6a, 61-61 d,#0d1410, 62-119 #e5eee5,#0d1410, -|5: 0-0 d,#152019, 1-59 d,#0d1410, 60-60 d,#637f6a, 61-119 d,#0d1410, -|6: 0-1 #ffffff,#4c6356, 2-59 #b2c3b8,#1d2824, 60-60 d,#637f6a, 61-61 d,#0d1410, 62-119 #e5eee5,#0d1410, -|7: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-12 #e5eee5,#0d1410, 13-59 d,#0d1410, 60-60 d,#637f6a, 61-61 d,#0d1410, 62-119 #e5eee5,#0d1410, -|8: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-24 #e5eee5,#0d1410, 25-59 d,#0d1410, 60-60 d,#637f6a, 61-61 d,#0d1410, 62-119 #e5eee5,#0d1410, -|9: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-12 #e5eee5,#0d1410, 13-59 d,#0d1410, 60-60 d,#637f6a, 61-61 d,#0d1410, 62-119 #e5eee5,#0d1410, -|10: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-16 #e5eee5,#0d1410, 17-59 d,#0d1410, 60-60 d,#637f6a, 61-61 d,#0d1410, 62-119 #e5eee5,#0d1410, -|11: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-13 #e5eee5,#0d1410, 14-59 d,#0d1410, 60-60 d,#637f6a, 61-61 d,#0d1410, 62-119 #e5eee5,#0d1410, -|12: 0-1 #000000,#adcc91, 2-59 #becfc4,#26362d, 60-60 d,#637f6a, 61-61 d,#0d1410, 62-119 #e5eee5,#0d1410, -|13: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-10 #f5f7ee,#405d4b, 11-12 #e5eee5,#0d1410, 13-59 d,#0d1410, 60-60 d,#637f6a, 61-61 d,#0d1410, 62-119 #e5eee5,#0d1410, -|14: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-12 #e5eee5,#0d1410, 13-59 d,#0d1410, 60-60 d,#637f6a, 61-61 d,#0d1410, 62-119 #e5eee5,#0d1410, -|15: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-59 d,#0d1410, 60-60 d,#637f6a, 61-61 d,#0d1410, 62-119 #e5eee5,#0d1410, -|16: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-59 d,#0d1410, 60-60 d,#637f6a, 61-61 d,#0d1410, 62-119 #e5eee5,#0d1410, -|17: 0-1 #ffffff,#4c6356, 2-59 #b2c3b8,#1d2824, 60-60 d,#637f6a, 61-61 d,#0d1410, 62-119 #e5eee5,#0d1410, -|18: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-59 #e5eee5,#0d1410, 60-60 d,#637f6a, 61-61 d,#0d1410, 62-119 #e5eee5,#0d1410, -|19: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-59 #e5eee5,#0d1410, 60-60 d,#637f6a, 61-61 d,#0d1410, 62-119 #e5eee5,#0d1410, -|20: 0-0 d,#637f6a, 1-59 d,#0d1410, 60-60 d,#637f6a, 61-61 d,#0d1410, 62-119 #e5eee5,#0d1410, -|21: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-59 #e5eee5,#0d1410, 60-60 d,#637f6a, 61-61 d,#0d1410, 62-119 #e5eee5,#0d1410, -|22: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-59 #e5eee5,#0d1410, 60-60 d,#637f6a, 61-61 d,#0d1410, 62-119 #e5eee5,#0d1410, -|23: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-59 #e5eee5,#0d1410, 60-60 d,#637f6a, 61-61 d,#0d1410, 62-119 #e5eee5,#0d1410, -|24: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-59 #e5eee5,#0d1410, 60-60 d,#637f6a, 61-61 d,#0d1410, 62-119 #e5eee5,#0d1410, -|25: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-59 #e5eee5,#0d1410, 60-60 d,#637f6a, 61-61 d,#0d1410, 62-119 #e5eee5,#0d1410, -|26: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-59 #e5eee5,#0d1410, 60-60 d,#637f6a, 61-61 d,#0d1410, 62-119 #e5eee5,#0d1410, -|27: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-59 #e5eee5,#0d1410, 60-60 d,#637f6a, 61-61 d,#0d1410, 62-119 #e5eee5,#0d1410, -|28: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-59 #e5eee5,#0d1410, 60-60 d,#637f6a, 61-61 d,#0d1410, 62-119 #e5eee5,#0d1410, -|29: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-59 #e5eee5,#0d1410, 60-60 d,#637f6a, 61-61 d,#0d1410, 62-119 #e5eee5,#0d1410, -|30: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-59 #e5eee5,#0d1410, 60-60 d,#637f6a, 61-61 d,#0d1410, 62-119 #e5eee5,#0d1410, +|1: 0-1 #ffffff,#887455, 2-2 d,#26362d, 3-34 #becfc4,#26362d, 35-59 d,#26362d, 60-61 #ffffff,#887455, 62-62 d,#1d2824, 63-94 #b2c3b8,#1d2824, 95-119 d,#1d2824, +|2: 0-1 #ffffff,#496656, 2-2 d,#1d2824, 3-32 #b2c3b8,#1d2824, 33-35 #d3b0d9,#1d2824, 36-59 #b2c3b8,#1d2824, 60-61 #ffffff,#496656, 62-62 d,#1d2824, 63-92 #b2c3b8,#1d2824, 93-95 #d3b0d9,#1d2824, 96-119 #b2c3b8,#1d2824, +|3: 0-0 d,#152019, 1-1 d,#0d1410, 2-8 #e5eee5,#0d1410, 9-59 d,#0d1410, 60-60 d,#608269, 61-61 d,#0d1410, 62-119 #e5eee5,#0d1410, +|4: 0-0 d,#608269, 1-1 d,#0d1410, 2-59 #e5eee5,#0d1410, 60-60 d,#608269, 61-61 d,#0d1410, 62-119 #e5eee5,#0d1410, +|5: 0-0 d,#152019, 1-59 d,#0d1410, 60-60 d,#608269, 61-119 d,#0d1410, +|6: 0-1 #ffffff,#496656, 2-2 d,#1d2824, 3-32 #b2c3b8,#1d2824, 33-37 #d3b0d9,#1d2824, 38-59 #b2c3b8,#1d2824, 60-60 d,#608269, 61-61 d,#0d1410, 62-119 #e5eee5,#0d1410, +|7: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-12 #e5eee5,#0d1410, 13-59 d,#0d1410, 60-60 d,#608269, 61-61 d,#0d1410, 62-119 #e5eee5,#0d1410, +|8: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-24 #e5eee5,#0d1410, 25-59 d,#0d1410, 60-60 d,#608269, 61-61 d,#0d1410, 62-119 #e5eee5,#0d1410, +|9: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-12 #e5eee5,#0d1410, 13-59 d,#0d1410, 60-60 d,#608269, 61-61 d,#0d1410, 62-119 #e5eee5,#0d1410, +|10: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-16 #e5eee5,#0d1410, 17-59 d,#0d1410, 60-60 d,#608269, 61-61 d,#0d1410, 62-119 #e5eee5,#0d1410, +|11: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-13 #e5eee5,#0d1410, 14-59 d,#0d1410, 60-60 d,#608269, 61-61 d,#0d1410, 62-119 #e5eee5,#0d1410, +|12: 0-1 #000000,#add38a, 2-2 d,#26362d, 3-32 #becfc4,#26362d, 33-37 #dfbce5,#26362d, 38-59 #becfc4,#26362d, 60-60 d,#608269, 61-61 d,#0d1410, 62-119 #e5eee5,#0d1410, +|13: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-10 #f5f7ee,#3c614a, 11-12 #e5eee5,#0d1410, 13-59 d,#0d1410, 60-60 d,#608269, 61-61 d,#0d1410, 62-119 #e5eee5,#0d1410, +|14: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-12 #e5eee5,#0d1410, 13-59 d,#0d1410, 60-60 d,#608269, 61-61 d,#0d1410, 62-119 #e5eee5,#0d1410, +|15: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-59 d,#0d1410, 60-60 d,#608269, 61-61 d,#0d1410, 62-119 #e5eee5,#0d1410, +|16: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-59 d,#0d1410, 60-60 d,#608269, 61-61 d,#0d1410, 62-119 #e5eee5,#0d1410, +|17: 0-1 #ffffff,#496656, 2-2 d,#1d2824, 3-32 #b2c3b8,#1d2824, 33-35 #d3b0d9,#1d2824, 36-59 #b2c3b8,#1d2824, 60-60 d,#608269, 61-61 d,#0d1410, 62-119 #e5eee5,#0d1410, +|18: 0-0 d,#608269, 1-1 d,#0d1410, 2-59 #e5eee5,#0d1410, 60-60 d,#608269, 61-61 d,#0d1410, 62-119 #e5eee5,#0d1410, +|19: 0-0 d,#608269, 1-1 d,#0d1410, 2-59 #e5eee5,#0d1410, 60-60 d,#608269, 61-61 d,#0d1410, 62-119 #e5eee5,#0d1410, +|20: 0-0 d,#608269, 1-59 d,#0d1410, 60-60 d,#608269, 61-61 d,#0d1410, 62-119 #e5eee5,#0d1410, +|21: 0-0 d,#608269, 1-1 d,#0d1410, 2-59 #e5eee5,#0d1410, 60-60 d,#608269, 61-61 d,#0d1410, 62-119 #e5eee5,#0d1410, +|22: 0-0 d,#608269, 1-1 d,#0d1410, 2-59 #e5eee5,#0d1410, 60-60 d,#608269, 61-61 d,#0d1410, 62-119 #e5eee5,#0d1410, +|23: 0-0 d,#608269, 1-1 d,#0d1410, 2-59 #e5eee5,#0d1410, 60-60 d,#608269, 61-61 d,#0d1410, 62-119 #e5eee5,#0d1410, +|24: 0-0 d,#608269, 1-1 d,#0d1410, 2-59 #e5eee5,#0d1410, 60-60 d,#608269, 61-61 d,#0d1410, 62-119 #e5eee5,#0d1410, +|25: 0-0 d,#608269, 1-1 d,#0d1410, 2-59 #e5eee5,#0d1410, 60-60 d,#608269, 61-61 d,#0d1410, 62-119 #e5eee5,#0d1410, +|26: 0-0 d,#608269, 1-1 d,#0d1410, 2-59 #e5eee5,#0d1410, 60-60 d,#608269, 61-61 d,#0d1410, 62-119 #e5eee5,#0d1410, +|27: 0-0 d,#608269, 1-1 d,#0d1410, 2-59 #e5eee5,#0d1410, 60-60 d,#608269, 61-61 d,#0d1410, 62-119 #e5eee5,#0d1410, +|28: 0-0 d,#608269, 1-1 d,#0d1410, 2-59 #e5eee5,#0d1410, 60-60 d,#608269, 61-61 d,#0d1410, 62-119 #e5eee5,#0d1410, +|29: 0-0 d,#608269, 1-1 d,#0d1410, 2-59 #e5eee5,#0d1410, 60-60 d,#608269, 61-61 d,#0d1410, 62-119 #e5eee5,#0d1410, +|30: 0-0 d,#608269, 1-1 d,#0d1410, 2-59 #e5eee5,#0d1410, 60-60 d,#608269, 61-61 d,#0d1410, 62-119 #e5eee5,#0d1410, == style clickdismiss grid=120x31 -|13: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-12 #e5eee5,#0d1410, 13-59 d,#0d1410, 60-60 d,#637f6a, 61-61 d,#0d1410, 62-119 #e5eee5,#0d1410, -|14: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-12 #e5eee5,#0d1410, 13-59 d,#0d1410, 60-60 d,#637f6a, 61-61 d,#0d1410, 62-119 #e5eee5,#0d1410, +|13: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-12 #e5eee5,#0d1410, 13-59 d,#0d1410, 60-60 d,#608269, 61-61 d,#0d1410, 62-119 #e5eee5,#0d1410, +|14: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-12 #e5eee5,#0d1410, 13-59 d,#0d1410, 60-60 d,#608269, 61-61 d,#0d1410, 62-119 #e5eee5,#0d1410, == snap ttyprobe grid=120x31 cursor=42,22 -|12: /tmp/pardes-snap/chordcut/cwd/g.txt * Save Tty Del Collaps -|17: $ /tmp/pardes-snap/chordcut/cwd Save Tty Del Togglettymode F +|7: 1 line 1 +|8: 2 2echo B''OO g.txt +|9: 3 line 3 +|10: 4 line 4line +|11: 5 lline 5 +|12: /tmp/pardes-snap/chordcut/cwd/g.txt * Save Tty Collapse D +|17: $ /tmp/pardes-snap/chordcut/cwd Tty Save Mode Filter Collap |18: $ ls |20: $ stty -icanon -echo; printf '\x1b[?2004h\x1b[?1000h\x1b[? |21: 1006h'; cat -v diff --git a/test/snapshots/cmdword.golden b/test/snapshots/cmdword.golden index 0ba57092..e6f470fa 100644 --- a/test/snapshots/cmdword.golden +++ b/test/snapshots/cmdword.golden @@ -1,24 +1,24 @@ == snap opened grid=120x31 cursor=7,3 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol -| /tmp/pardes-snap/cmdword/cwd/cmds.txt Save Tty Del Collapse +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/cmdword/cwd/cmds.txt Save Tty Collapse Del | 1 @`echo ZZ''E` @`echo ZZ''L` Look p.txt @`Look .` == snap atexec grid=120x31 cursor=7,3 -|17: /tmp/pardes-snap/cmdword/cwd Save Tty Del Togglettymode Filter Collapse +|17: /tmp/pardes-snap/cmdword/cwd Tty Save Mode Filter Collapse Del |18: echo ZZ''E |19: ZZE == snap atlook grid=120x31 cursor=4,22 |20: echo ZZ''L |21: ZZL == snap lookword grid=120x31 cursor=7,11 -|10: /tmp/pardes-snap/cmdword/cwd/p.txt Save Tty Del Collapse +|10: /tmp/pardes-snap/cmdword/cwd/p.txt Save Tty Collapse Del |11: 1 just text == snap nested grid=120x31 cursor=4,24 |22: ls |23: cmds.txt p.txt zzmark.txt -== snap execword grid=120x31 cursor=77,17 -|17: /tmp/pardes-snap/cmdword/cwd Save Tty Del Togglettymode Filter Collapse Exec -== snap tagcmd grid=120x31 cursor=91,17 -|17: /tmp/pardes-snap/cmdword/cwd Save Tty Del Togglettymode Filter Collapse Exec @`echo ZZ''T` +== snap execword grid=120x31 cursor=69,17 +|17: /tmp/pardes-snap/cmdword/cwd Tty Save Mode Filter Collapse Del Exec +== snap tagcmd grid=120x31 cursor=83,17 +|17: /tmp/pardes-snap/cmdword/cwd Tty Save Mode Filter Collapse Del Exec @`echo ZZ''T` |24: echo ZZ''T |25: ZZT diff --git a/test/snapshots/cmdword.snap b/test/snapshots/cmdword.snap index eb9d308d..eb0e0ea6 100644 --- a/test/snapshots/cmdword.snap +++ b/test/snapshots/cmdword.snap @@ -18,6 +18,10 @@ file cmds.txt @`echo ZZ''E` @`echo ZZ''L` Look p.txt @`Look .` file p.txt just text file zzmark.txt x +# Builtins announce themselves by default, and an announcement is a band at +# the top of the body -- which would move every row this script clicks. The +# verbs are what is under test here, not the announcement. +config Verbose off start 31 120 cmds.txt wait 8000 Newcol Joincol wait 8000 cmds.txt diff --git a/test/snapshots/collapse.golden b/test/snapshots/collapse.golden index 8dcfd4d7..d356fd02 100644 --- a/test/snapshots/collapse.golden +++ b/test/snapshots/collapse.golden @@ -1,7 +1,7 @@ == snap before grid=160x25 cursor=7,3 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol -| /tmp/pardes-snap/collapse/cwd/kept.txt Save Tty Del Collapse +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/collapse/cwd/kept.txt Save Tty Collapse Del | 1 KEEP-FIRST | 2 KEEP-SECOND | 3 KEEP-THIRD @@ -12,67 +12,70 @@ == 9p middle-collapsed-cursor grid=160x25 cursor=none |0: Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill @0: 0-70 #b2c3b8,#1d2824,,tagline 71-159 d,#1d2824,,tagline -|1: New Tty Find Grep Joincol -@1: 0-24 #becfc4,#26362d,,tagline 25-159 d,#26362d,,tagline -|2: /tmp/pardes-snap/collapse/cwd/kept.txt Save Tty Del Collapse -@2: 0-1 #000000,#adcc91,,tagline 2-61 #becfc4,#26362d,,tagline 62-159 d,#26362d,,tagline +|1: New Tty Find Grep Joincol Delcol +@1: 0-1 #ffffff,#887455,,tagline 2-2 d,#26362d,,tagline 3-34 #becfc4,#26362d,,tagline 35-159 d,#26362d,,tagline +|2: /tmp/pardes-snap/collapse/cwd/kept.txt Save Tty Collapse Del +@2: 0-1 #000000,#add38a,,tagline 2-2 d,#26362d,,tagline 3-32 #becfc4,#26362d,,tagline 33-40 #dfbce5,#26362d,,tagline 41-62 #becfc4,#26362d,,tagline 63-159 d,#26362d,,tagline |3: -@3: 0-159 d,#35483d,,body +@3: 0-159 d,#486152,,body |4: -@4: 0-159 d,#35483d,,body +@4: 0-159 d,#486152,,body |5: -@5: 0-159 d,#35483d,,body +@5: 0-159 d,#486152,,body |6: -@6: 0-159 d,#35483d,,body +@6: 0-159 d,#486152,,body |7: -@7: 0-159 d,#35483d,,body +@7: 0-159 d,#486152,,body |8: -@8: 0-159 d,#35483d,,body +@8: 0-159 d,#486152,,body |9: -@9: 0-159 d,#35483d,,body +@9: 0-159 d,#486152,,body |10: -@10: 0-159 d,#35483d,,body +@10: 0-159 d,#486152,,body |11: -@11: 0-159 d,#35483d,,body +@11: 0-159 d,#486152,,body |12: -@12: 0-159 d,#35483d,,body +@12: 0-159 d,#486152,,body |13: -@13: 0-159 d,#35483d,,body +@13: 0-159 d,#486152,,body |14: -@14: 0-159 d,#35483d,,body +@14: 0-159 d,#486152,,body |15: -@15: 0-159 d,#35483d,,body +@15: 0-159 d,#486152,,body |16: -@16: 0-159 d,#35483d,,body +@16: 0-159 d,#486152,,body |17: -@17: 0-159 d,#35483d,,body +@17: 0-159 d,#486152,,body |18: -@18: 0-159 d,#35483d,,body +@18: 0-159 d,#486152,,body |19: -@19: 0-159 d,#35483d,,body +@19: 0-159 d,#486152,,body |20: -@20: 0-159 d,#35483d,,body +@20: 0-159 d,#486152,,body |21: -@21: 0-159 d,#35483d,,body +@21: 0-159 d,#486152,,body |22: -@22: 0-159 d,#35483d,,body +@22: 0-159 d,#486152,,body |23: -@23: 0-159 d,#35483d,,body +@23: 0-159 d,#486152,,body |24: -@24: 0-159 d,#35483d,,body -== snap middle-restored grid=160x25 cursor=7,3 -|3: 1 KEEP-FIRST -|4: 2 KEEP-SECOND -|5: 3 KEEP-THIRD -== snap tab-collapsed grid=160x25 cursor=54,2 +@24: 0-159 d,#486152,,body +== snap middle-restored grid=160x25 cursor=7,4 +|3: Collapse +|4: 1 KEEP-FIRST +|5: 2 KEEP-SECOND +|6: 3 KEEP-THIRD +== snap tab-collapsed grid=160x25 cursor=51,2 |3: |4: |5: -== 9p tab-collapsed-cursor grid=160x25 cursor=54,2,bar -== snap tab-restored grid=160x25 cursor=54,2 -|3: 1 KEEP-FIRST -|4: 2 KEEP-SECOND -|5: 3 KEEP-THIRD +|6: +== 9p tab-collapsed-cursor grid=160x25 cursor=51,2,bar +== snap tab-restored grid=160x25 cursor=51,2 +|3: Collapse +|4: 1 KEEP-FIRST +|5: 2 KEEP-SECOND +|6: 3 KEEP-THIRD == file unchanged KEEP-FIRST KEEP-SECOND diff --git a/test/snapshots/cornerdrag-left.golden b/test/snapshots/cornerdrag-left.golden index df10fd3d..145adb02 100644 --- a/test/snapshots/cornerdrag-left.golden +++ b/test/snapshots/cornerdrag-left.golden @@ -1,11 +1,11 @@ == snap right-split grid=100x31 cursor=54,9 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol New Tty Find Grep Joincol -| /tmp/pardes-snap/cornerdrag-left/cwd Save Tty De /tmp/pardes-snap/cornerdrag-left/cwd Save Tty De +| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/cornerdrag-left/cwd Tty Save M /tmp/pardes-snap/cornerdrag-left/cwd Tty Save M | ls ls | w.txt w.txt | -| /tmp/pardes-snap/cornerdrag-left/cwd Save Tty De +| /tmp/pardes-snap/cornerdrag-left/cwd Tty Save M | ls | w.txt | @@ -16,16 +16,16 @@ | | | -| /tmp/pardes-snap/cornerdrag-left/cwd Save Tty De +| /tmp/pardes-snap/cornerdrag-left/cwd Tty Save M | ls | w.txt == snap hover-corner grid=100x31 cursor=54,9 -|1: New Tty Find Grep Joincol ╎New Tty Find Grep Joincol -|2: /tmp/pardes-snap/cornerdrag-left/cwd Save Tty D╎ /tmp/pardes-snap/cornerdrag-left/cwd Save Tty De +|1: New Tty Find Grep Joincol Delcol ╎ New Tty Find Grep Joincol Delcol +|2: /tmp/pardes-snap/cornerdrag-left/cwd Tty Save ╎ /tmp/pardes-snap/cornerdrag-left/cwd Tty Save M |3: ls ╎ ls |4: w.txt ╎ w.txt |5: ╎ -|6: ╎ /tmp/pardes-snap/cornerdrag-left/cwd Save Tty De +|6: ╎ /tmp/pardes-snap/cornerdrag-left/cwd Tty Save M |7: ╎ ls |8: ╎ w.txt |9: ╎ @@ -36,7 +36,7 @@ |14: ╎ |15: ╎ |16: ╎ -|17: /tmp/pardes-snap/cornerdrag-left/cwd Save Tty D╎ +|17: /tmp/pardes-snap/cornerdrag-left/cwd Tty Save ╎ |18: ls ╎ |19: w.txt ╎ |20: ╎ @@ -52,12 +52,12 @@ |30: ╎ == snap hover-left-corner grid=100x31 cursor=54,9 == snap corner-drag grid=100x31 cursor=54,9 -|1: New Tty Find Grep Joincol ╎ New Tty Find Grep Joincol -|2: /tmp/pardes-snap/cornerdrag╎left/cwd Save Tty De /tmp/pardes-snap/cornerdrag-left/cwd Save Tty De +|1: New Tty Find Grep Joincol ╎elcol New Tty Find Grep Joincol Delcol +|2: /tmp/pardes-snap/cornerdra╎-left/cwd Tty Save M /tmp/pardes-snap/cornerdrag-left/cwd Tty Save M |3: ls ╎ ls |4: w.txt ╎ w.txt |5: ╎ -|6: ╎ /tmp/pardes-snap/cornerdrag-left/cwd Save Tty De +|6: ╎ /tmp/pardes-snap/cornerdrag-left/cwd Tty Save M |7: ╎ ls |8: ╎ w.txt |9: ╎ @@ -68,7 +68,7 @@ |14: ╎ |15: ╎ |16: ╎ -|17: /tmp/pardes-snap/cornerdrag╎left/cwd Save Tty De +|17: /tmp/pardes-snap/cornerdra╎-left/cwd Tty Save M |18: ls ╎ |19: w.txt ╎ |20: ╎ @@ -83,8 +83,8 @@ |29: ╎ |30: ╎ == snap corner-done grid=100x31 cursor=34,16 -|1: New Tty Find Grep Joincol New Tty Find Grep Joincol -|2: /tmp/pardes-snap/cornerdrag- /tmp/pardes-snap/cornerdrag-left/cwd Save Tty Del Togglettymode Filt +|1: New Tty Find Grep Joincol D New Tty Find Grep Joincol Delcol +|2: /tmp/pardes-snap/cornerdrag /tmp/pardes-snap/cornerdrag-left/cwd Tty Save Mode Filter Collapse |3: ls ls |4: w.txt w.txt |5: @@ -95,11 +95,11 @@ |10: |11: |12: -|13: /tmp/pardes-snap/cornerdrag-left/cwd Save Tty Del Togglettymode Filt +|13: /tmp/pardes-snap/cornerdrag-left/cwd Tty Save Mode Filter Collapse |14: ls |15: w.txt |16: -|17: /tmp/pardes-snap/cornerdrag- +|17: /tmp/pardes-snap/cornerdrag |18: ls |19: w.txt |20: diff --git a/test/snapshots/cornerdrag.golden b/test/snapshots/cornerdrag.golden index 003bf0d8..b95734ea 100644 --- a/test/snapshots/cornerdrag.golden +++ b/test/snapshots/cornerdrag.golden @@ -1,7 +1,7 @@ == snap hover-corner grid=100x31 cursor=4,5 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol ╎New Tty Find Grep Joincol -| /tmp/pardes-snap/cornerdrag/cwd Save Tty Del To╎ /tmp/pardes-snap/cornerdrag/cwd Save Tty Del Tog +| New Tty Find Grep Joincol Delcol ╎ New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/cornerdrag/cwd Tty Save Mode ╎ /tmp/pardes-snap/cornerdrag/cwd Tty Save Mode F | ls ╎ ls | w.txt ╎ w.txt | ╎ @@ -16,7 +16,7 @@ | ╎ | ╎ | ╎ -| /tmp/pardes-snap/cornerdrag/cwd Save Tty Del To╎ +| /tmp/pardes-snap/cornerdrag/cwd Tty Save Mode ╎ | ls ╎ | w.txt ╎ | ╎ @@ -31,8 +31,8 @@ | ╎ | ╎ == snap edge-drag grid=100x31 cursor=4,5 -|1: New Tty Find Grep Joincol ╎ New Tty Find Grep Joincol -|2: /tmp/pardes-snap/cornerdrag╎cwd Save Tty Del Tog /tmp/pardes-snap/cornerdrag/cwd Save Tty Del Tog +|1: New Tty Find Grep Joincol ╎elcol New Tty Find Grep Joincol Delcol +|2: /tmp/pardes-snap/cornerdra╎/cwd Tty Save Mode F /tmp/pardes-snap/cornerdrag/cwd Tty Save Mode F |3: ls ╎ ls |4: w.txt ╎ w.txt |5: ╎ @@ -47,7 +47,7 @@ |14: ╎ |15: ╎ |16: ╎ -|17: /tmp/pardes-snap/cornerdrag╎cwd Save Tty Del Tog +|17: /tmp/pardes-snap/cornerdra╎/cwd Tty Save Mode F |18: ls ╎ |19: w.txt ╎ |20: ╎ @@ -62,8 +62,8 @@ |29: ╎ |30: ╎ == snap edge-done grid=100x31 cursor=4,5 -|1: New Tty Find Grep Joincol New Tty Find Grep Joincol -|2: /tmp/pardes-snap/cornerdrag/ /tmp/pardes-snap/cornerdrag/cwd Save Tty Del Togglettymode Filter Co +|1: New Tty Find Grep Joincol D New Tty Find Grep Joincol Delcol +|2: /tmp/pardes-snap/cornerdrag /tmp/pardes-snap/cornerdrag/cwd Tty Save Mode Filter Collapse Del |3: ls ls |4: w.txt w.txt |5: @@ -78,7 +78,7 @@ |14: |15: |16: -|17: /tmp/pardes-snap/cornerdrag/ +|17: /tmp/pardes-snap/cornerdrag |18: ls |19: w.txt |20: @@ -93,8 +93,8 @@ |29: |30: == snap corner-drag grid=100x31 cursor=4,5 -|1: New Tty Find Grep Joincol New Tty Find Grep Joincol ╎ -|2: /tmp/pardes-snap/cornerdrag/ /tmp/pardes-snap/cornerdrag╎cwd Save Tty Del Togglettymode Filter Co +|1: New Tty Find Grep Joincol D New Tty Find Grep Joincol ╎elcol +|2: /tmp/pardes-snap/cornerdrag /tmp/pardes-snap/cornerdra╎/cwd Tty Save Mode Filter Collapse Del |3: ls ls ╎ |4: w.txt w.txt ╎ |5: ╎ @@ -109,7 +109,7 @@ |14: ╎ |15: ╎ |16: ╎ -|17: /tmp/pardes-snap/cornerdrag/ ╎ +|17: /tmp/pardes-snap/cornerdrag ╎ |18: ls ╎ |19: w.txt ╎ |20: ╎ @@ -124,15 +124,15 @@ |29: ╎ |30: ╎ == snap corner-done grid=100x31 cursor=4,5 -|1: New Tty Find Grep Joincol New Tty Find Grep Joincol -|2: /tmp/pardes-snap/cornerdrag/cwd Save Tty Del Togglettymode /tmp/pardes-snap/cornerdrag/cwd Save T +|1: New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +|2: /tmp/pardes-snap/cornerdrag/cwd Tty Save Mode Filter Coll /tmp/pardes-snap/cornerdrag/cwd Tty S |3: ls ls |4: w.txt w.txt |5: |6: |7: |8: -|9: /tmp/pardes-snap/cornerdrag/cwd Save Tty Del Togglettymode +|9: /tmp/pardes-snap/cornerdrag/cwd Tty Save Mode Filter Coll |10: ls |11: w.txt |12: @@ -155,15 +155,15 @@ |29: |30: == snap clamp-x grid=100x31 cursor=4,5 -|1: New Tty Find Grep Joincol New Tty Find Grep Joincol ╎ -|2: /tmp/pardes-snap/cornerdrag/cwd Save Tty Del Togglettymode /tmp/pardes-snap/cornerdrag/╎wd Save T +|1: New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol D╎lcol +|2: /tmp/pardes-snap/cornerdrag/cwd Tty Save Mode Filter Coll /tmp/pardes-snap/cornerdrag╎cwd Tty S |3: ls ls ╎ |4: w.txt w.txt ╎ |5: ╎ |6: ╎ |7: ╎ |8: ╎ -|9: /tmp/pardes-snap/cornerdrag/cwd Save Tty Del Togglettymode ╎ +|9: /tmp/pardes-snap/cornerdrag/cwd Tty Save Mode Filter Coll ╎ |10: ls ╎ |11: w.txt ╎ |12: ╎ @@ -186,15 +186,15 @@ |29: ╎ |30: ╎ == snap clamp-y grid=100x31 cursor=4,5 -|1: New Tty Find Grep Joincol ╎New Tty Find Grep Joincol -|2: /tmp/pardes-snap/cornerdrag/cwd Save Tty Del Togglettymod╎ /tmp/pardes-snap/cornerdrag/cwd Save T +|1: New Tty Find Grep Joincol Delcol ╎ New Tty Find Grep Joincol Delcol +|2: /tmp/pardes-snap/cornerdrag/cwd Tty Save Mode Filter Col╎ /tmp/pardes-snap/cornerdrag/cwd Tty S |3: ls ╎ ls |4: w.txt ╎ w.txt |5: ╎ |6: ╎ |7: ╎ |8: ╎ -|9: /tmp/pardes-snap/cornerdrag/cwd Save Tty Del Togglettymod╎ +|9: /tmp/pardes-snap/cornerdrag/cwd Tty Save Mode Filter Col╎ |10: ls ╎ |11: w.txt ╎ |12: ╎ @@ -217,8 +217,8 @@ |29: ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌ |30: ╎ == snap clamp-done grid=100x31 cursor=4,5 -|1: New Tty Find Grep Joincol New Tty Find Grep Joincol -|2: /tmp/pardes-snap/cornerdrag/cwd Save Tty Del Togglettymode /tmp/pardes-snap/cornerdrag/cwd Save T +|1: New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +|2: /tmp/pardes-snap/cornerdrag/cwd Tty Save Mode Filter Coll /tmp/pardes-snap/cornerdrag/cwd Tty S |3: ls ls |4: w.txt w.txt |5: @@ -246,4 +246,4 @@ |27: |28: |29: -|30: /tmp/pardes-snap/cornerdrag/cwd Save Tty Del Togglettymode +|30: /tmp/pardes-snap/cornerdrag/cwd Tty Save Mode Filter Coll diff --git a/test/snapshots/cursorline.golden b/test/snapshots/cursorline.golden index 161655c8..97897c3f 100644 --- a/test/snapshots/cursorline.golden +++ b/test/snapshots/cursorline.golden @@ -1,11 +1,11 @@ == snap top grid=150x31 cursor=7,7 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol New Tty Find Grep Joincol -| /tmp/pardes-snap/cursorline/cwd Save Tty Del Togglettymode Filter Collaps /tmp/pardes-snap/cursorline/cwd Save Tty Del Togglettymode Filter Collaps +| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/cursorline/cwd Tty Save Mode Filter Collapse Del /tmp/pardes-snap/cursorline/cwd Tty Save Mode Filter Collapse Del | ls ls | cur.txt cur.txt | -| /tmp/pardes-snap/cursorline/cwd/cur.txt Save Tty Del Collapse +| /tmp/pardes-snap/cursorline/cwd/cur.txt Save Tty Collapse Del | 1 line 1 | 2 line 2 | 3 line 3 @@ -16,42 +16,42 @@ | 8 line 8 | 9 line 9 | 10 line 10 -| /tmp/pardes-snap/cursorline/cwd Save Tty Del Togglettymode Filter Collaps +| /tmp/pardes-snap/cursorline/cwd Tty Save Mode Filter Collapse Del | ls | cur.txt == style top grid=150x31 |0: 0-70 #b2c3b8,#1d2824, 71-149 d,#1d2824, -|1: 0-24 #becfc4,#26362d, 25-74 d,#26362d, 75-99 #b2c3b8,#1d2824, 100-149 d,#1d2824, -|2: 0-1 #ffffff,#4c6356, 2-74 #b2c3b8,#1d2824, 75-76 #ffffff,#4c6356, 77-149 #b2c3b8,#1d2824, -|3: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|4: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|5: 0-0 d,#637f6a, 1-74 d,#0d1410, 75-75 d,#637f6a, 76-149 d,#0d1410, -|6: 0-1 #000000,#adcc91, 2-62 #becfc4,#26362d, 63-74 d,#26362d, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|7: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-12 #e5eee5,#0d1410, 13-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|8: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-12 #e5eee5,#0d1410, 13-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|9: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-12 #e5eee5,#0d1410, 13-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|10: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-12 #e5eee5,#0d1410, 13-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|11: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-12 #e5eee5,#0d1410, 13-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|12: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-12 #e5eee5,#0d1410, 13-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|13: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-12 #e5eee5,#0d1410, 13-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|14: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-12 #e5eee5,#0d1410, 13-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|15: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-12 #e5eee5,#0d1410, 13-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|16: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-13 #e5eee5,#0d1410, 14-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|17: 0-1 #ffffff,#4c6356, 2-74 #b2c3b8,#1d2824, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|18: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|19: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|20: 0-0 d,#637f6a, 1-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|21: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|22: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|23: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|24: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|25: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|26: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|27: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|28: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|29: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|30: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|1: 0-1 #ffffff,#887455, 2-2 d,#26362d, 3-34 #becfc4,#26362d, 35-74 d,#26362d, 75-76 #ffffff,#887455, 77-77 d,#1d2824, 78-109 #b2c3b8,#1d2824, 110-149 d,#1d2824, +|2: 0-1 #ffffff,#496656, 2-2 d,#1d2824, 3-34 #b2c3b8,#1d2824, 35-37 #d3b0d9,#1d2824, 38-67 #b2c3b8,#1d2824, 68-74 d,#1d2824, 75-76 #ffffff,#496656, 77-77 d,#1d2824, 78-109 #b2c3b8,#1d2824, 110-112 #d3b0d9,#1d2824, 113-142 #b2c3b8,#1d2824, 143-149 d,#1d2824, +|3: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|4: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|5: 0-0 d,#608269, 1-74 d,#0d1410, 75-75 d,#608269, 76-149 d,#0d1410, +|6: 0-1 #000000,#add38a, 2-2 d,#26362d, 3-34 #becfc4,#26362d, 35-41 #dfbce5,#26362d, 42-63 #becfc4,#26362d, 64-74 d,#26362d, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|7: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-12 #e5eee5,#0d1410, 13-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|8: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-12 #e5eee5,#0d1410, 13-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|9: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-12 #e5eee5,#0d1410, 13-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|10: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-12 #e5eee5,#0d1410, 13-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|11: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-12 #e5eee5,#0d1410, 13-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|12: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-12 #e5eee5,#0d1410, 13-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|13: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-12 #e5eee5,#0d1410, 13-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|14: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-12 #e5eee5,#0d1410, 13-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|15: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-12 #e5eee5,#0d1410, 13-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|16: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-13 #e5eee5,#0d1410, 14-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|17: 0-1 #ffffff,#496656, 2-2 d,#1d2824, 3-34 #b2c3b8,#1d2824, 35-37 #d3b0d9,#1d2824, 38-67 #b2c3b8,#1d2824, 68-74 d,#1d2824, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|18: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|19: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|20: 0-0 d,#608269, 1-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|21: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|22: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|23: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|24: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|25: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|26: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|27: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|28: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|29: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|30: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, == snap down3 grid=150x31 cursor=7,10 == style down3 grid=150x31 -|7: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-12 #e5eee5,#0d1410, 13-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|10: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-12 #e5eee5,#0d1410, 13-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|7: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-12 #e5eee5,#0d1410, 13-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|10: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-12 #e5eee5,#0d1410, 13-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, diff --git a/test/snapshots/doccol.golden b/test/snapshots/doccol.golden index 318ac564..83d49ca5 100644 --- a/test/snapshots/doccol.golden +++ b/test/snapshots/doccol.golden @@ -1,21 +1,21 @@ == snap boot grid=100x31 cursor=7,3 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol New Tty Find Grep Joincol -| /tmp/pardes-snap/doccol/cwd/a.txt Save Tty Del C /tmp/pardes-snap/doccol/cwd Save Tty Del Togglet +| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/doccol/cwd/a.txt Save Tty Coll /tmp/pardes-snap/doccol/cwd Tty Save Mode Filte | 1 AAA ls | a.txt b.txt c.txt == snap two-docs grid=100x31 cursor=7,18 -|17: /tmp/pardes-snap/doccol/cwd/b.txt Save Tty Del C +|17: /tmp/pardes-snap/doccol/cwd/b.txt Save Tty Coll |18: 1 BBB |19: 2 B-TWO == snap moved grid=100x31 cursor=57,21 |17: |18: |19: -|20: /tmp/pardes-snap/doccol/cwd/b.txt Save Tty Del C +|20: /tmp/pardes-snap/doccol/cwd/b.txt Save Tty Coll |21: 1 BBB |22: 2 B-TWO == snap worked grid=100x31 cursor=59,22 == snap third grid=100x31 cursor=57,27 -|26: /tmp/pardes-snap/doccol/cwd/c.txt Save Tty Del C +|26: /tmp/pardes-snap/doccol/cwd/c.txt Save Tty Coll |27: 1 CCC diff --git a/test/snapshots/doccol.snap b/test/snapshots/doccol.snap index 677d5dff..2135c533 100644 --- a/test/snapshots/doccol.snap +++ b/test/snapshots/doccol.snap @@ -13,6 +13,10 @@ file c.txt CCC # boot used to hand over — and SPC w h comes back to a.txt, which is where the # boot left focus. (`New`/`Newcol` open an empty +New scratch now, not a # shell, so the shell has to be asked for by name.) +# Builtins announce themselves by default, and an announcement is a band at +# the top of the body -- which moves every row this script clicks. What the +# verbs do is what is under test, not the announcement. +config Verbose off start 31 100 a.txt wait 8000 AAA stable 700 20000 diff --git a/test/snapshots/dump.golden b/test/snapshots/dump.golden index 18c30327..8f920136 100644 --- a/test/snapshots/dump.golden +++ b/test/snapshots/dump.golden @@ -7,6 +7,13 @@ .topbar = "Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill", .topbar_custom = null, .theme = "orchard", + .locations_config = .{ + .context = 0, + .tscontext = false, + .tslocations = true, + .layout = .stacked, + }, + .tree_context_tag_style = true, .columns = .{ .{ .tag = null, .weight = 1, @@ -19,7 +26,7 @@ .panes = .{ .{ .kind = .terminal, - .tag = "/tmp/pardes-snap/dump/cwd Save Tty Del Togglettymode Filter Collapse", + .tag = "/tmp/pardes-snap/dump/cwd Tty Save Mode Filter Collapse Del", .body = "ls\nd.txt\n\n\n\n typed-marker\n\n\n\n\n\n\n\n", .scroll = 0, .cols = 48, @@ -38,7 +45,7 @@ }, .{ .kind = .terminal, - .tag = "/tmp/pardes-snap/dump/cwd Save Tty Del Togglettymode Filter Collapse", + .tag = "/tmp/pardes-snap/dump/cwd Tty Save Mode Filter Collapse Del", .body = "ls\nd.txt\n\n\n\n\n\n\n\n\n\n\n", .scroll = 0, .cols = 48, @@ -57,7 +64,7 @@ }, .{ .kind = .terminal, - .tag = "/tmp/pardes-snap/dump/cwd Save Tty Del Togglettymode Filter Collapse", + .tag = "/tmp/pardes-snap/dump/cwd Tty Save Mode Filter Collapse Del", .body = "ls\nd.txt\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", .scroll = 0, .cols = 48, diff --git a/test/snapshots/edit.golden b/test/snapshots/edit.golden index 17c86be0..c4b1081e 100644 --- a/test/snapshots/edit.golden +++ b/test/snapshots/edit.golden @@ -1,7 +1,7 @@ == snap inserted grid=100x31 cursor=16,10 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol New Tty Find Grep Joincol -| /tmp/pardes-snap/edit/cwd Save Tty Del Toggletty /tmp/pardes-snap/edit/cwd Save Tty Del Toggletty +| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/edit/cwd Tty Save Mode Filter /tmp/pardes-snap/edit/cwd Tty Save Mode Filter | ls ls | e.txt e.txt | @@ -16,38 +16,38 @@ | | | -| /tmp/pardes-snap/edit/cwd Save Tty Del Toggletty +| /tmp/pardes-snap/edit/cwd Tty Save Mode Filter | ls | e.txt == style inserted grid=100x31 |0: 0-70 #b2c3b8,#1d2824, 71-99 d,#1d2824, -|1: 0-24 #becfc4,#26362d, 25-49 d,#26362d, 50-74 #b2c3b8,#1d2824, 75-99 d,#1d2824, -|2: 0-1 #000000,#adcc91, 2-49 #becfc4,#26362d, 50-51 #ffffff,#4c6356, 52-99 #b2c3b8,#1d2824, -|3: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|4: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|5: 0-0 d,#637f6a, 1-49 d,#0d1410, 50-50 d,#637f6a, 51-99 d,#0d1410, -|6: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|7: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|8: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|9: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|10: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-15 #e5eee5,#0d1410, 16-49 d,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|11: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|12: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|13: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|14: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|15: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|16: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|17: 0-1 #ffffff,#4c6356, 2-49 #b2c3b8,#1d2824, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|18: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|19: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|20: 0-0 d,#637f6a, 1-49 d,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|21: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|22: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|23: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|24: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|25: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|26: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|27: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|28: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|29: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|30: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|1: 0-1 #ffffff,#887455, 2-2 d,#26362d, 3-34 #becfc4,#26362d, 35-49 d,#26362d, 50-51 #ffffff,#887455, 52-52 d,#1d2824, 53-84 #b2c3b8,#1d2824, 85-99 d,#1d2824, +|2: 0-1 #000000,#add38a, 2-2 d,#26362d, 3-28 #becfc4,#26362d, 29-31 #dfbce5,#26362d, 32-49 #becfc4,#26362d, 50-51 #ffffff,#496656, 52-52 d,#1d2824, 53-78 #b2c3b8,#1d2824, 79-81 #d3b0d9,#1d2824, 82-99 #b2c3b8,#1d2824, +|3: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|4: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|5: 0-0 d,#608269, 1-49 d,#0d1410, 50-50 d,#608269, 51-99 d,#0d1410, +|6: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|7: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|8: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|9: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|10: 0-0 d,#608269, 1-1 d,#0d1410, 2-15 #e5eee5,#0d1410, 16-49 d,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|11: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|12: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|13: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|14: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|15: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|16: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|17: 0-1 #ffffff,#496656, 2-2 d,#1d2824, 3-28 #b2c3b8,#1d2824, 29-31 #d3b0d9,#1d2824, 32-49 #b2c3b8,#1d2824, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|18: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|19: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|20: 0-0 d,#608269, 1-49 d,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|21: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|22: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|23: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|24: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|25: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|26: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|27: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|28: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|29: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|30: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, diff --git a/test/snapshots/exec-bigdrag.golden b/test/snapshots/exec-bigdrag.golden index 6b86db0d..d18ea1b1 100644 --- a/test/snapshots/exec-bigdrag.golden +++ b/test/snapshots/exec-bigdrag.golden @@ -1,7 +1,7 @@ == snap alive grid=200x61 cursor=119,38 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol New Tty Find Grep Joincol -| /tmp/pardes-snap/exec-bigdrag/cwd Save Tty Del Togglettymode Filter Collapse /tmp/pardes-snap/exec-bigdrag/cwd Save Tty Del Togglettymode Filter Collapse +| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/exec-bigdrag/cwd Tty Save Mode Filter Collapse Del /tmp/pardes-snap/exec-bigdrag/cwd Tty Save Mode Filter Collapse Del | ls bash: line: command not found | big.txt 4line 2705line 2706line 2707line 2708line 2709line 2710line 2711line 2712line 2713line 2714lin | bash: 4line: command not found @@ -31,7 +31,7 @@ | bash: 2835line: command not found | 2846line 2847line 2848line 2849line 2850line 2851line 2852line 2853line 2854line 2855line 285 | bash: 2846line: command not found -| /tmp/pardes-snap/exec-bigdrag/cwd Save Tty Del Togglettymode Filter Collapse e 2857line 2858line 2859line 2860line 2861line 2862line 2863line 2864line 2865line 2866line 28 +| /tmp/pardes-snap/exec-bigdrag/cwd Tty Save Mode Filter Collapse Del e 2857line 2858line 2859line 2860line 2861line 2862line 2863line 2864line 2865line 2866line 28 | ls bash: e: command not found | big.txt ne 2868line 2869line 2870line 2871line 2872line 2873line 2874line 2875line 2876line 2877line 2 | bash: ne: command not found diff --git a/test/snapshots/exec-bigdrag.snap b/test/snapshots/exec-bigdrag.snap index ce7aef25..35881190 100644 --- a/test/snapshots/exec-bigdrag.snap +++ b/test/snapshots/exec-bigdrag.snap @@ -3,6 +3,10 @@ # 64-slot effect ring and panic the core (assert in emit). Needs a big grid: # the selection must exceed 64*64 bytes, more than any 30x100 pane can hold. lines big.txt 3000 +# Builtins announce themselves by default, and an announcement is a band at +# the top of the body -- which moves every row this script clicks. What the +# verbs do is what is under test, not the announcement. +config Verbose off start 61 200 -n 3 wait 8000 big.txt stable 500 20000 diff --git a/test/snapshots/exec.golden b/test/snapshots/exec.golden index 849c8e0e..6ec18f46 100644 --- a/test/snapshots/exec.golden +++ b/test/snapshots/exec.golden @@ -1,9 +1,10 @@ -== snap exec grid=100x31 cursor=16,8 +== snap exec grid=140x31 cursor=16,9 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol New Tty Find Grep Joincol -| /tmp/pardes-snap/exec/cwd Save Tty Del Toggletty /tmp/pardes-snap/exec/cwd Save Tty Del Toggletty -| ls ls -| e.txt e.txt +| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/exec/cwd Tty Save Mode Filter Collapse Del /tmp/pardes-snap/exec/cwd Tty Save Mode Filter Collapse Del +| Exec ls +| ls e.txt +| e.txt | | | @@ -15,21 +16,29 @@ | | | -| -| /tmp/pardes-snap/exec/cwd Save Tty Del Toggletty +| /tmp/pardes-snap/exec/cwd Tty Save Mode Filter Collapse Del | ls | e.txt -== snap kept grid=100x31 cursor=6,3 -|3: ZZARG ls -|4: ./c.sh e.txt +== snap kept grid=140x31 cursor=6,3 +|3: ZZARG ls +|4: ./c.sh e.txt +|5: +|8: echo MID''OK |9: -== snap chord grid=100x31 cursor=6,3 -|9: CHORDARG:ZZARG -== snap deleted grid=100x31 cursor=4,5 -|3: ls ls -|4: e.txt e.txt +|10: +== snap chord grid=140x31 cursor=6,4 +|3: Exec ls +|4: ZZARG e.txt +|5: ./c.sh |8: +|9: echo MID''OK +|10: CHORDARG:ZZARG +== snap deleted grid=140x31 cursor=4,5 +|3: ls ls +|4: e.txt e.txt +|5: |9: +|10: |17: |18: |19: diff --git a/test/snapshots/exec.snap b/test/snapshots/exec.snap index 38f74e35..a0820c19 100644 --- a/test/snapshots/exec.snap +++ b/test/snapshots/exec.snap @@ -2,7 +2,7 @@ # the middle drag captures the kept left selection as a trailing argument; # middle-click Del on the pane tag closes the pane file e.txt x -start 31 100 -n 3 +start 31 140 -n 3 wait 8000 e.txt stable 700 20000 press left 5 9 diff --git a/test/snapshots/fileedit.golden b/test/snapshots/fileedit.golden index bf0eccdb..a4d23656 100644 --- a/test/snapshots/fileedit.golden +++ b/test/snapshots/fileedit.golden @@ -1,11 +1,11 @@ == snap edited grid=150x31 cursor=17,7 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol New Tty Find Grep Joincol -| /tmp/pardes-snap/fileedit/cwd Save Tty Del Togglettymode Filter Collapse /tmp/pardes-snap/fileedit/cwd Save Tty Del Togglettymode Filter Collapse +| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/fileedit/cwd Tty Save Mode Filter Collapse Del /tmp/pardes-snap/fileedit/cwd Tty Save Mode Filter Collapse Del | ls ls | f.txt f.txt | -| /tmp/pardes-snap/fileedit/cwd/f.txt * Save Tty Del Collapse +| /tmp/pardes-snap/fileedit/cwd/f.txt * Save Tty Collapse Del | 1 liEDIT''MEne 1 | 2 line 2 | 3 line 3 @@ -16,7 +16,7 @@ | 8 line 8 | 9 line 9 | 10 line 10 -| /tmp/pardes-snap/fileedit/cwd Save Tty Del Togglettymode Filter Collapse +| /tmp/pardes-snap/fileedit/cwd Tty Save Mode Filter Collapse Del | ls | f.txt == snap deleted grid=150x31 cursor=7,8 diff --git a/test/snapshots/filewatch.golden b/test/snapshots/filewatch.golden index 6eca9bca..6e535d45 100644 --- a/test/snapshots/filewatch.golden +++ b/test/snapshots/filewatch.golden @@ -1,7 +1,7 @@ == snap edited grid=210x31 cursor=15,3 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol New Tty Find Grep Joincol -| /tmp/pardes-snap/filewatch/cwd/w.txt * Save Tty Del Collapse /tmp/pardes-snap/filewatch/cwd Save Tty Del Togglettymode Filter Collapse +| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/filewatch/cwd/w.txt * Save Tty Collapse Del /tmp/pardes-snap/filewatch/cwd Tty Save Mode Filter Collapse Del | 1 liMYEDITne 1 ls | 2 line 2 sub w.txt | 3 /tmp/pardes-snap/filewatch/cwd/sub/s.txt @@ -16,7 +16,7 @@ | 12 line 12 | 13 | -| /tmp/pardes-snap/filewatch/cwd/sub/s.txt Save Tty Del Collapse +| /tmp/pardes-snap/filewatch/cwd/sub/s.txt Save Tty Collapse Del | 1 line 1 | 2 line 2 | 3 line 3 @@ -26,11 +26,11 @@ | 7 line 7 | 8 line 8 | 9 -== snap reloaded grid=210x31 cursor=15,3 -|2: /tmp/pardes-snap/filewatch/cwd/w.txt Save Tty Del Collapse /tmp/pardes-snap/filewatch/cwd Save Tty Del Togglettymode Filter Collapse -|3: 1 EXTERNAL ls -|4: 2 sub w.txt -|5: +== snap reloaded grid=210x31 cursor=15,4 +|2: /tmp/pardes-snap/filewatch/cwd/w.txt Save Tty Collapse Del /tmp/pardes-snap/filewatch/cwd Tty Save Mode Filter Collapse Del +|3: --:--:-- reloaded /tmp/pardes-snap/filewatch/cwd/w.txt ls +|4: 1 EXTERNAL sub w.txt +|5: 2 |6: |7: |8: w.txt @@ -41,20 +41,18 @@ |13: |14: |15: -|16: --:--:-- reloaded /tmp/pardes-snap/filewatch/cwd/w.txt -== snap reloaded_sub grid=210x31 cursor=15,3 -|18: 1 RENAMED -|19: 2 -|20: +== snap reloaded_sub grid=210x31 cursor=15,4 +|18: --:--:-- reloaded /tmp/pardes-snap/filewatch/cwd/sub/s.txt +|19: 1 RENAMED +|20: 2 |21: |22: |23: |24: |25: |26: -|30: --:--:-- reloaded /tmp/pardes-snap/filewatch/cwd/sub/s.txt == snap undone grid=210x31 cursor=15,3 -|2: /tmp/pardes-snap/filewatch/cwd/w.txt * Save Tty Del Collapse /tmp/pardes-snap/filewatch/cwd Save Tty Del Togglettymode Filter Collapse +|2: /tmp/pardes-snap/filewatch/cwd/w.txt * Save Tty Collapse Del /tmp/pardes-snap/filewatch/cwd Tty Save Mode Filter Collapse Del |3: 1 liMYEDITne 1 ls |4: 2 line 2 sub w.txt |5: 3 /tmp/pardes-snap/filewatch/cwd/sub/s.txt @@ -68,5 +66,6 @@ |13: 11 line 11 |14: 12 line 12 |15: 13 -|16: -|30: +|18: 1 RENAMED +|19: 2 +|20: diff --git a/test/snapshots/filewatch.snap b/test/snapshots/filewatch.snap index a27740f0..38b6ac8e 100644 --- a/test/snapshots/filewatch.snap +++ b/test/snapshots/filewatch.snap @@ -18,6 +18,10 @@ dirmk sub file w.txt line 1\nline 2\n/tmp/pardes-snap/filewatch/cwd/sub/s.txt\nline 4\nline 5\nline 6\nline 7\nline 8\nline 9\nline 10\nline 11\nline 12\n lines sub/s.txt 8 +# Builtins announce themselves by default, and an announcement is a band at +# the top of the body -- which moves every row this script clicks. What the +# verbs do is what is under test, not the announcement. +config Verbose off start 31 210 -n 1 wait 8000 w.txt stable 700 20000 diff --git a/test/snapshots/find.golden b/test/snapshots/find.golden index a8d072f3..b076d419 100644 --- a/test/snapshots/find.golden +++ b/test/snapshots/find.golden @@ -1,123 +1,108 @@ -== snap group grid=120x41 cursor=7,3 +== snap group grid=120x41 cursor=7,4 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol -| /tmp/pardes-snap/find/cwd/here.txt Save Tty Del Collapse -| 1 Find -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/find/cwd/here.txt Save Tty Collapse Del | SPC f -== snap armed grid=120x41 cursor=9,40 -|40: Find / -== snap typing grid=120x41 cursor=12,40 -|40: Find /zqm +| 1 Find +== snap armed grid=120x41 cursor=119,4 +|3: Find +|4: Find / +|5: 1 Find +== snap typing grid=120x41 cursor=119,3 +|3: Find /zqm +|4: 1 Find +|5: == snap results grid=120x41 cursor=7,3 -|37: /tmp/pardes-snap/find/cwd/+Search Save Tty Del Collapse +|3: 1 Find +|4: +|37: /tmp/pardes-snap/find/cwd/+Search Save Tty Collapse Del |38: 1 sub/ZQMARK-beta.txt |39: 2 sub/nest/zqmark-gamma.txt |40: 3 zqmark-alpha.txt == snap first grid=120x41 cursor=7,21 -|20: /tmp/pardes-snap/find/cwd/sub/ZQMARK-beta.txt Save Tty Del Collapse +|20: /tmp/pardes-snap/find/cwd/sub/ZQMARK-beta.txt Save Tty Collapse Del |21: 1 beta body +|38: Look +|39: 1 sub/ZQMARK-beta.txt +|40: 2 sub/nest/zqmark-gamma.txt == style first grid=120x41 |0: 0-70 #b2c3b8,#1d2824, 71-119 d,#1d2824, -|1: 0-24 #becfc4,#26362d, 25-119 d,#26362d, -|2: 0-1 #ffffff,#4c6356, 2-57 #b2c3b8,#1d2824, 58-119 d,#1d2824, -|3: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-119 d,#0d1410, -|4: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-119 d,#0d1410, -|5: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-119 d,#0d1410, -|6: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-119 d,#0d1410, -|7: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-119 d,#0d1410, -|8: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-119 d,#0d1410, -|9: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-119 d,#0d1410, -|10: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-119 d,#0d1410, -|11: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-119 d,#0d1410, -|12: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-119 d,#0d1410, -|13: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-119 d,#0d1410, -|14: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-119 d,#0d1410, -|15: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-119 d,#0d1410, -|16: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-119 d,#0d1410, -|17: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-119 d,#0d1410, -|18: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-119 d,#0d1410, -|19: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-119 d,#0d1410, -|20: 0-1 #000000,#adcc91, 2-68 #becfc4,#26362d, 69-119 d,#26362d, -|21: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-15 #e5eee5,#0d1410, 16-119 d,#0d1410, -|22: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-119 d,#0d1410, -|23: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-119 d,#0d1410, -|24: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-119 d,#0d1410, -|25: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-119 d,#0d1410, -|26: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-119 d,#0d1410, -|27: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-119 d,#0d1410, -|28: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-119 d,#0d1410, -|29: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-119 d,#0d1410, -|30: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-119 d,#0d1410, -|31: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-119 d,#0d1410, -|32: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-119 d,#0d1410, -|33: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-119 d,#0d1410, -|34: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-119 d,#0d1410, -|35: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-119 d,#0d1410, -|36: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-119 d,#0d1410, -|37: 0-1 #ffffff,#4c6356, 2-56 #b2c3b8,#1d2824, 57-119 d,#1d2824, -|38: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-25 #e5eee5,#0d1410, 26-119 d,#0d1410, -|39: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-31 #e5eee5,#0d1410, 32-119 d,#0d1410, -|40: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-22 #e5eee5,#0d1410, 23-119 d,#0d1410, +|1: 0-1 #ffffff,#887455, 2-2 d,#26362d, 3-34 #becfc4,#26362d, 35-119 d,#26362d, +|2: 0-1 #ffffff,#496656, 2-2 d,#1d2824, 3-28 #b2c3b8,#1d2824, 29-36 #d3b0d9,#1d2824, 37-58 #b2c3b8,#1d2824, 59-119 d,#1d2824, +|3: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-119 d,#0d1410, +|4: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-119 d,#0d1410, +|5: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-119 d,#0d1410, +|6: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-119 d,#0d1410, +|7: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-119 d,#0d1410, +|8: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-119 d,#0d1410, +|9: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-119 d,#0d1410, +|10: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-119 d,#0d1410, +|11: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-119 d,#0d1410, +|12: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-119 d,#0d1410, +|13: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-119 d,#0d1410, +|14: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-119 d,#0d1410, +|15: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-119 d,#0d1410, +|16: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-119 d,#0d1410, +|17: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-119 d,#0d1410, +|18: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-119 d,#0d1410, +|19: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-119 d,#0d1410, +|20: 0-1 #000000,#add38a, 2-2 d,#26362d, 3-32 #becfc4,#26362d, 33-47 #dfbce5,#26362d, 48-69 #becfc4,#26362d, 70-119 d,#26362d, +|21: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-15 #e5eee5,#0d1410, 16-119 d,#0d1410, +|22: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-119 d,#0d1410, +|23: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-119 d,#0d1410, +|24: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-119 d,#0d1410, +|25: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-119 d,#0d1410, +|26: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-119 d,#0d1410, +|27: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-119 d,#0d1410, +|28: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-119 d,#0d1410, +|29: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-119 d,#0d1410, +|30: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-119 d,#0d1410, +|31: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-119 d,#0d1410, +|32: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-119 d,#0d1410, +|33: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-119 d,#0d1410, +|34: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-119 d,#0d1410, +|35: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-119 d,#0d1410, +|36: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-119 d,#0d1410, +|37: 0-1 #ffffff,#496656, 2-2 d,#1d2824, 3-28 #b2c3b8,#1d2824, 29-35 #d3b0d9,#1d2824, 36-57 #b2c3b8,#1d2824, 58-119 d,#1d2824, +|38: 0-0 d,#152019, 1-1 d,#0d1410, 2-115 d,#1d2824, 116-119 #b2c3b8,#1d2824, +|39: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-25 #e5eee5,#0d1410, 26-119 d,#0d1410, +|40: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-31 #e5eee5,#0d1410, 32-119 d,#0d1410, == snap second grid=120x41 cursor=7,30 -|29: /tmp/pardes-snap/find/cwd/sub/nest/zqmark-gamma.txt Save Tty Del Collapse +|29: /tmp/pardes-snap/find/cwd/sub/nest/zqmark-gamma.txt Save Tty Collapse Del |30: 1 gamma body == snap third grid=120x41 cursor=7,34 -|33: /tmp/pardes-snap/find/cwd/zqmark-alpha.txt Save Tty Del Collapse +|33: /tmp/pardes-snap/find/cwd/zqmark-alpha.txt Save Tty Collapse Del |34: 1 alpha body -|38: 2 sub/nest/zqmark-gamma.txt -|39: 3 zqmark-alpha.txt -|40: 4 +|39: 2 sub/nest/zqmark-gamma.txt +|40: 3 zqmark-alpha.txt == snap back grid=120x41 cursor=7,30 +|39: 1 sub/ZQMARK-beta.txt +|40: 2 sub/nest/zqmark-gamma.txt +== snap word grid=120x41 cursor=7,30 +|3: Find +|4: Find / +|5: 1 Find |38: 1 sub/ZQMARK-beta.txt |39: 2 sub/nest/zqmark-gamma.txt |40: 3 zqmark-alpha.txt -== snap word grid=120x41 cursor=7,30 -|19: Find / == snap cancel grid=120x41 cursor=7,39 +|3: Find / +|4: 1 Find +|5: +|30: Last +|31: 1 gamma body == snap nomatch grid=120x41 cursor=7,39 -|2: /tmp/pardes-snap/find/cwd/here.txt Save Tty Del Collapse Find / -|18: /tmp/pardes-snap/find/cwd/+Search Save Tty Del Collapse +|2: /tmp/pardes-snap/find/cwd/here.txt Save Tty Collapse Del Find / +|3: 1 Find +|4: +|18: /tmp/pardes-snap/find/cwd/+Search Save Tty Collapse Del |19: 1 +|30: 1 gamma body +|31: |38: 2 sub/nest/zqmark-gamma.txt |39: 3 zqmark-alpha.txt |40: 4 == snap refit grid=120x41 cursor=7,3 == snap topbar grid=120x41 cursor=12,34 -|35: /tmp/pardes-snap/find/cwd/+Search Save Tty Del Collapse +|35: /tmp/pardes-snap/find/cwd/+Search Save Tty Collapse Del |36: 1 zqmark-alpha.txt diff --git a/test/snapshots/fsearch.golden b/test/snapshots/fsearch.golden index 6fdbb42f..ccc25503 100644 --- a/test/snapshots/fsearch.golden +++ b/test/snapshots/fsearch.golden @@ -1,11 +1,11 @@ == snap opened grid=180x31 cursor=7,7 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol New Tty Find Grep Joincol -| /tmp/pardes-snap/fsearch/cwd Save Tty Del Togglettymode Filter Collapse /tmp/pardes-snap/fsearch/cwd Save Tty Del Togglettymode Filter Collapse +| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/fsearch/cwd Tty Save Mode Filter Collapse Del /tmp/pardes-snap/fsearch/cwd Tty Save Mode Filter Collapse Del | ls ls | g.txt g.txt | -| /tmp/pardes-snap/fsearch/cwd/g.txt Save Tty Del Collapse +| /tmp/pardes-snap/fsearch/cwd/g.txt Save Tty Collapse Del | 1 l1 | 2 MARK a | 3 l3 @@ -16,79 +16,94 @@ | 8 l8 | 9 l9 | 10 MARK c -| /tmp/pardes-snap/fsearch/cwd Save Tty Del Togglettymode Filter Collapse +| /tmp/pardes-snap/fsearch/cwd Tty Save Mode Filter Collapse Del | ls | g.txt -== snap typing grid=180x31 cursor=8,16 -|16: /MARK +== snap typing grid=180x31 cursor=89,7 +|7: /MARK +|8: 1 l1 +|9: 2 MARK a +|10: 3 l3 +|11: 4 l4 +|12: 5 l5 +|13: 6 MARK b +|14: 7 l7 +|15: 8 l8 +|16: 9 l9 == snap results grid=180x31 cursor=10,8 -|13: /tmp/pardes-snap/fsearch/cwd/+Search Save Tty Del Collapse -|14: 1 g.txt:2:1-4 MARK a -|15: 2 g.txt:6:1-4 MARK b -|16: 3 g.txt:10:1-4 MARK c +|7: 1 l1 +|8: 2 MARK a +|9: 3 l3 +|10: 4 l4 +|11: 5 l5 +|12: /tmp/pardes-snap/fsearch/cwd/+Search Save Tty Collapse Del LocationsConfig +|13: 1 g.txt:2:1-4 +|14: 2 MARK a +|15: 3 g.txt:6:1-4 +|16: 4 MARK b == style results grid=180x31 |0: 0-70 #b2c3b8,#1d2824, 71-179 d,#1d2824, -|1: 0-24 #becfc4,#26362d, 25-89 d,#26362d, 90-114 #b2c3b8,#1d2824, 115-179 d,#1d2824, -|2: 0-1 #ffffff,#4c6356, 2-72 #b2c3b8,#1d2824, 73-89 d,#1d2824, 90-91 #ffffff,#4c6356, 92-162 #b2c3b8,#1d2824, 163-179 d,#1d2824, -|3: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-89 #e5eee5,#0d1410, 90-90 d,#637f6a, 91-91 d,#0d1410, 92-179 #e5eee5,#0d1410, -|4: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-89 #e5eee5,#0d1410, 90-90 d,#637f6a, 91-91 d,#0d1410, 92-179 #e5eee5,#0d1410, -|5: 0-0 d,#637f6a, 1-89 d,#0d1410, 90-90 d,#637f6a, 91-179 d,#0d1410, -|6: 0-1 #000000,#adcc91, 2-57 #becfc4,#26362d, 58-89 d,#26362d, 90-90 d,#637f6a, 91-91 d,#0d1410, 92-179 #e5eee5,#0d1410, -|7: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-8 #e5eee5,#0d1410, 9-89 d,#0d1410, 90-90 d,#637f6a, 91-91 d,#0d1410, 92-179 #e5eee5,#0d1410, -|8: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-10 #f5f7ee,#405d4b, 11-12 #e5eee5,#0d1410, 13-89 d,#0d1410, 90-90 d,#637f6a, 91-91 d,#0d1410, 92-179 #e5eee5,#0d1410, -|9: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-8 #e5eee5,#0d1410, 9-89 d,#0d1410, 90-90 d,#637f6a, 91-91 d,#0d1410, 92-179 #e5eee5,#0d1410, -|10: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-8 #e5eee5,#0d1410, 9-89 d,#0d1410, 90-90 d,#637f6a, 91-91 d,#0d1410, 92-179 #e5eee5,#0d1410, -|11: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-8 #e5eee5,#0d1410, 9-89 d,#0d1410, 90-90 d,#637f6a, 91-91 d,#0d1410, 92-179 #e5eee5,#0d1410, -|12: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-12 #e5eee5,#0d1410, 13-89 d,#0d1410, 90-90 d,#637f6a, 91-91 d,#0d1410, 92-179 #e5eee5,#0d1410, -|13: 0-1 #ffffff,#4c6356, 2-59 #b2c3b8,#1d2824, 60-89 d,#1d2824, 90-90 d,#637f6a, 91-91 d,#0d1410, 92-179 #e5eee5,#0d1410, -|14: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-17 #59675c,#0d1410, 18-18 #e5eee5,#0d1410, 19-22 #f7e4a5,#57472a, 23-24 #e5eee5,#0d1410, 25-89 d,#0d1410, 90-90 d,#637f6a, 91-91 d,#0d1410, 92-179 #e5eee5,#0d1410, -|15: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-17 #59675c,#0d1410, 18-18 #e5eee5,#0d1410, 19-22 #f7e4a5,#57472a, 23-24 #e5eee5,#0d1410, 25-89 d,#0d1410, 90-90 d,#637f6a, 91-91 d,#0d1410, 92-179 #e5eee5,#0d1410, -|16: 0-0 d,#152019, 1-1 d,#0d1410, 2-18 #59675c,#0d1410, 19-19 #e5eee5,#0d1410, 20-23 #f7e4a5,#57472a, 24-25 #e5eee5,#0d1410, 26-89 d,#0d1410, 90-90 d,#637f6a, 91-91 d,#0d1410, 92-179 #e5eee5,#0d1410, -|17: 0-1 #ffffff,#4c6356, 2-72 #b2c3b8,#1d2824, 73-89 d,#1d2824, 90-90 d,#637f6a, 91-91 d,#0d1410, 92-179 #e5eee5,#0d1410, -|18: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-89 #e5eee5,#0d1410, 90-90 d,#637f6a, 91-91 d,#0d1410, 92-179 #e5eee5,#0d1410, -|19: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-89 #e5eee5,#0d1410, 90-90 d,#637f6a, 91-91 d,#0d1410, 92-179 #e5eee5,#0d1410, -|20: 0-0 d,#637f6a, 1-89 d,#0d1410, 90-90 d,#637f6a, 91-91 d,#0d1410, 92-179 #e5eee5,#0d1410, -|21: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-89 #e5eee5,#0d1410, 90-90 d,#637f6a, 91-91 d,#0d1410, 92-179 #e5eee5,#0d1410, -|22: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-89 #e5eee5,#0d1410, 90-90 d,#637f6a, 91-91 d,#0d1410, 92-179 #e5eee5,#0d1410, -|23: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-89 #e5eee5,#0d1410, 90-90 d,#637f6a, 91-91 d,#0d1410, 92-179 #e5eee5,#0d1410, -|24: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-89 #e5eee5,#0d1410, 90-90 d,#637f6a, 91-91 d,#0d1410, 92-179 #e5eee5,#0d1410, -|25: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-89 #e5eee5,#0d1410, 90-90 d,#637f6a, 91-91 d,#0d1410, 92-179 #e5eee5,#0d1410, -|26: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-89 #e5eee5,#0d1410, 90-90 d,#637f6a, 91-91 d,#0d1410, 92-179 #e5eee5,#0d1410, -|27: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-89 #e5eee5,#0d1410, 90-90 d,#637f6a, 91-91 d,#0d1410, 92-179 #e5eee5,#0d1410, -|28: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-89 #e5eee5,#0d1410, 90-90 d,#637f6a, 91-91 d,#0d1410, 92-179 #e5eee5,#0d1410, -|29: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-89 #e5eee5,#0d1410, 90-90 d,#637f6a, 91-91 d,#0d1410, 92-179 #e5eee5,#0d1410, -|30: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-89 #e5eee5,#0d1410, 90-90 d,#637f6a, 91-91 d,#0d1410, 92-179 #e5eee5,#0d1410, -== snap second grid=180x31 cursor=10,10 -|7: 3 l3 -|8: 4 l4 -|9: 5 l5 -|10: 6 MARK b -|11: 7 l7 -|12: 8 l8 -== snap third grid=180x31 cursor=10,10 -|7: 7 l7 -|8: 8 l8 -|9: 9 l9 -|10: 10 MARK c -|11: 11 l11 -|12: 12 l12 -|14: 2 g.txt:6:1-4 MARK b -|15: 3 g.txt:10:1-4 MARK c -|16: 4 -== snap back grid=180x31 cursor=10,10 -|7: 3 l3 -|8: 4 l4 -|9: 5 l5 -|10: 6 MARK b -|11: 7 l7 -|12: 8 l8 -|14: 1 g.txt:2:1-4 MARK a -|15: 2 g.txt:6:1-4 MARK b -|16: 3 g.txt:10:1-4 MARK c -== snap cancel grid=180x31 cursor=10,10 +|1: 0-1 #ffffff,#887455, 2-2 d,#26362d, 3-34 #becfc4,#26362d, 35-89 d,#26362d, 90-91 #ffffff,#887455, 92-92 d,#1d2824, 93-124 #b2c3b8,#1d2824, 125-179 d,#1d2824, +|2: 0-1 #ffffff,#496656, 2-2 d,#1d2824, 3-31 #b2c3b8,#1d2824, 32-34 #d3b0d9,#1d2824, 35-64 #b2c3b8,#1d2824, 65-89 d,#1d2824, 90-91 #ffffff,#496656, 92-92 d,#1d2824, 93-121 #b2c3b8,#1d2824, 122-124 #d3b0d9,#1d2824, 125-154 #b2c3b8,#1d2824, 155-179 d,#1d2824, +|3: 0-0 d,#608269, 1-1 d,#0d1410, 2-89 #e5eee5,#0d1410, 90-90 d,#608269, 91-91 d,#0d1410, 92-179 #e5eee5,#0d1410, +|4: 0-0 d,#608269, 1-1 d,#0d1410, 2-89 #e5eee5,#0d1410, 90-90 d,#608269, 91-91 d,#0d1410, 92-179 #e5eee5,#0d1410, +|5: 0-0 d,#608269, 1-89 d,#0d1410, 90-90 d,#608269, 91-179 d,#0d1410, +|6: 0-1 #000000,#add38a, 2-2 d,#26362d, 3-31 #becfc4,#26362d, 32-36 #dfbce5,#26362d, 37-58 #becfc4,#26362d, 59-89 d,#26362d, 90-90 d,#608269, 91-91 d,#0d1410, 92-179 #e5eee5,#0d1410, +|7: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-8 #e5eee5,#0d1410, 9-89 d,#0d1410, 90-90 d,#608269, 91-91 d,#0d1410, 92-179 #e5eee5,#0d1410, +|8: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-10 #f5f7ee,#3c614a, 11-12 #e5eee5,#0d1410, 13-89 d,#0d1410, 90-90 d,#608269, 91-91 d,#0d1410, 92-179 #e5eee5,#0d1410, +|9: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-8 #e5eee5,#0d1410, 9-89 d,#0d1410, 90-90 d,#608269, 91-91 d,#0d1410, 92-179 #e5eee5,#0d1410, +|10: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-8 #e5eee5,#0d1410, 9-89 d,#0d1410, 90-90 d,#608269, 91-91 d,#0d1410, 92-179 #e5eee5,#0d1410, +|11: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-8 #e5eee5,#0d1410, 9-89 d,#0d1410, 90-90 d,#608269, 91-91 d,#0d1410, 92-179 #e5eee5,#0d1410, +|12: 0-1 #ffffff,#496656, 2-2 d,#1d2824, 3-31 #b2c3b8,#1d2824, 32-38 #d3b0d9,#1d2824, 39-76 #b2c3b8,#1d2824, 77-89 d,#1d2824, 90-90 d,#608269, 91-91 d,#0d1410, 92-179 #e5eee5,#0d1410, +|13: 0-0 d,#608269, 1-1 d,#0d1410, 2-17 #59675c,#0d1410, 18-89 d,#0d1410, 90-90 d,#608269, 91-91 d,#0d1410, 92-179 #e5eee5,#0d1410, +|14: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #f7e4a5,#5e4923, 11-12 #e5eee5,#0d1410, 13-89 d,#0d1410, 90-90 d,#608269, 91-91 d,#0d1410, 92-179 #e5eee5,#0d1410, +|15: 0-0 d,#152019, 1-1 d,#0d1410, 2-17 #59675c,#0d1410, 18-89 d,#0d1410, 90-90 d,#608269, 91-91 d,#0d1410, 92-179 #e5eee5,#0d1410, +|16: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #f7e4a5,#5e4923, 11-12 #e5eee5,#0d1410, 13-89 d,#0d1410, 90-90 d,#608269, 91-91 d,#0d1410, 92-179 #e5eee5,#0d1410, +|17: 0-1 #ffffff,#496656, 2-2 d,#1d2824, 3-31 #b2c3b8,#1d2824, 32-34 #d3b0d9,#1d2824, 35-64 #b2c3b8,#1d2824, 65-89 d,#1d2824, 90-90 d,#608269, 91-91 d,#0d1410, 92-179 #e5eee5,#0d1410, +|18: 0-0 d,#608269, 1-1 d,#0d1410, 2-89 #e5eee5,#0d1410, 90-90 d,#608269, 91-91 d,#0d1410, 92-179 #e5eee5,#0d1410, +|19: 0-0 d,#608269, 1-1 d,#0d1410, 2-89 #e5eee5,#0d1410, 90-90 d,#608269, 91-91 d,#0d1410, 92-179 #e5eee5,#0d1410, +|20: 0-0 d,#608269, 1-89 d,#0d1410, 90-90 d,#608269, 91-91 d,#0d1410, 92-179 #e5eee5,#0d1410, +|21: 0-0 d,#608269, 1-1 d,#0d1410, 2-89 #e5eee5,#0d1410, 90-90 d,#608269, 91-91 d,#0d1410, 92-179 #e5eee5,#0d1410, +|22: 0-0 d,#608269, 1-1 d,#0d1410, 2-89 #e5eee5,#0d1410, 90-90 d,#608269, 91-91 d,#0d1410, 92-179 #e5eee5,#0d1410, +|23: 0-0 d,#608269, 1-1 d,#0d1410, 2-89 #e5eee5,#0d1410, 90-90 d,#608269, 91-91 d,#0d1410, 92-179 #e5eee5,#0d1410, +|24: 0-0 d,#608269, 1-1 d,#0d1410, 2-89 #e5eee5,#0d1410, 90-90 d,#608269, 91-91 d,#0d1410, 92-179 #e5eee5,#0d1410, +|25: 0-0 d,#608269, 1-1 d,#0d1410, 2-89 #e5eee5,#0d1410, 90-90 d,#608269, 91-91 d,#0d1410, 92-179 #e5eee5,#0d1410, +|26: 0-0 d,#608269, 1-1 d,#0d1410, 2-89 #e5eee5,#0d1410, 90-90 d,#608269, 91-91 d,#0d1410, 92-179 #e5eee5,#0d1410, +|27: 0-0 d,#608269, 1-1 d,#0d1410, 2-89 #e5eee5,#0d1410, 90-90 d,#608269, 91-91 d,#0d1410, 92-179 #e5eee5,#0d1410, +|28: 0-0 d,#608269, 1-1 d,#0d1410, 2-89 #e5eee5,#0d1410, 90-90 d,#608269, 91-91 d,#0d1410, 92-179 #e5eee5,#0d1410, +|29: 0-0 d,#608269, 1-1 d,#0d1410, 2-89 #e5eee5,#0d1410, 90-90 d,#608269, 91-91 d,#0d1410, 92-179 #e5eee5,#0d1410, +|30: 0-0 d,#608269, 1-1 d,#0d1410, 2-89 #e5eee5,#0d1410, 90-90 d,#608269, 91-91 d,#0d1410, 92-179 #e5eee5,#0d1410, +== snap second grid=180x31 cursor=10,9 +|7: 4 l4 +|8: 5 l5 +|9: 6 MARK b +|10: 7 l7 +|11: 8 l8 +== snap third grid=180x31 cursor=10,9 +|7: 8 l8 +|8: 9 l9 +|9: 10 MARK c +|10: 11 l11 +|11: 12 l12 +|13: 3 g.txt:6:1-4 +|14: 4 MARK b +|15: 5 g.txt:10:1-4 +|16: 6 MARK c +== snap back grid=180x31 cursor=10,9 +|7: 4 l4 +|8: 5 l5 +|9: 6 MARK b +|10: 7 l7 +|11: 8 l8 +|13: 2 MARK a +|14: 3 g.txt:6:1-4 +|15: 4 MARK b +|16: 5 g.txt:10:1-4 +== snap cancel grid=180x31 cursor=10,9 == snap nomatch grid=180x31 cursor=7,15 -|11: /tmp/pardes-snap/fsearch/cwd/+Search Save Tty Del Collapse -|12: 1 -|14: 2 g.txt:6:1-4 MARK b -|15: 3 g.txt:10:1-4 MARK c -|16: 4 +|10: /tmp/pardes-snap/fsearch/cwd/+Search Save Tty Collapse Del LocationsConfig +|11: 1 +|13: 3 g.txt:6:1-4 +|14: 4 MARK b +|15: 5 g.txt:10:1-4 +|16: 6 MARK c diff --git a/test/snapshots/fsearch.snap b/test/snapshots/fsearch.snap index 4e4ef864..b050f1db 100644 --- a/test/snapshots/fsearch.snap +++ b/test/snapshots/fsearch.snap @@ -9,6 +9,10 @@ # (every search gets its own, stacked under the pane) with nothing in it for n # to stop on, and goes nowhere. file g.txt l1\nMARK a\nl3\nl4\nl5\nMARK b\nl7\nl8\nl9\nMARK c\nl11\nl12 +# Builtins announce themselves by default, and an announcement is a band at +# the top of the body -- which moves every row this script clicks. What the +# verbs do is what is under test, not the announcement. +config Verbose off start 31 180 -n 3 wait 8000 g.txt stable 700 20000 @@ -33,7 +37,10 @@ text MARK stable 400 5000 snap typing key enter -wait 10000 g.txt:2:1-4 MARK +# Locations stack the target under its line now, so the two halves are +# two rows: wait for both rather than for one joined line. +wait 10000 g.txt:2:1-4 +wait 10000 MARK a stable 700 10000 # ...and the submit already looked result 1: the file scrolled to line 2 and # the four cells the pattern matched there came up selected — the styles below diff --git a/test/snapshots/ghostty-mid.golden b/test/snapshots/ghostty-mid.golden index 106bc063..3482431b 100644 --- a/test/snapshots/ghostty-mid.golden +++ b/test/snapshots/ghostty-mid.golden @@ -1,7 +1,7 @@ == snap ghostty-mid grid=100x31 cursor=4,7 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol New Tty Find Grep Joincol -| /tmp/pardes-snap/ghostty-mid/cwd Save Tty Del To /tmp/pardes-snap/ghostty-mid/cwd Save Tty Del To +| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/ghostty-mid/cwd Tty Save Mode /tmp/pardes-snap/ghostty-mid/cwd Tty Save Mode | ZZPAD ls | ./g.sh g.txt | ./g.sh @@ -16,6 +16,6 @@ | | | -| /tmp/pardes-snap/ghostty-mid/cwd Save Tty Del To +| /tmp/pardes-snap/ghostty-mid/cwd Tty Save Mode | ls | g.txt diff --git a/test/snapshots/grep.golden b/test/snapshots/grep.golden index 795ceddf..8f498e05 100644 --- a/test/snapshots/grep.golden +++ b/test/snapshots/grep.golden @@ -1,11 +1,11 @@ == snap opened grid=180x31 cursor=7,7 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol New Tty Find Grep Joincol -| /tmp/pardes-snap/grep/cwd Save Tty Del Togglettymode Filter Collapse /tmp/pardes-snap/grep/cwd Save Tty Del Togglettymode Filter Collapse +| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/grep/cwd Tty Save Mode Filter Collapse Del /tmp/pardes-snap/grep/cwd Tty Save Mode Filter Collapse Del | ls ls | a.txt noise.txt sub a.txt noise.txt sub | -| /tmp/pardes-snap/grep/cwd/a.txt Save Tty Del Collapse +| /tmp/pardes-snap/grep/cwd/a.txt Save Tty Collapse Del | 1 hello TARGET one | 2 nothing here | 3 last TARGET line @@ -16,26 +16,33 @@ | | | -| /tmp/pardes-snap/grep/cwd Save Tty Del Togglettymode Filter Collapse +| /tmp/pardes-snap/grep/cwd Tty Save Mode Filter Collapse Del | ls | a.txt noise.txt sub -== snap typing grid=180x31 cursor=15,16 -|16: Grep /TARGET +== snap typing grid=180x31 cursor=89,7 +|7: Grep /TARGET +|8: 1 hello TARGET one +|9: 2 nothing here +|10: 3 last TARGET line == snap results grid=180x31 cursor=7,7 -|13: /tmp/pardes-snap/grep/cwd/+Search Save Tty Del Collapse -|14: 1 a.txt:1:7-12 hello TARGET one -|15: 2 a.txt:3:6-11 last TARGET line -|16: 3 sub/b.txt:2:1-6 TARGET inside sub +|7: 1 hello TARGET one +|8: 2 nothing here +|9: 3 last TARGET line +|10: +|13: /tmp/pardes-snap/grep/cwd/+Search Save Tty Collapse Del LocationsConfig +|14: 1 a.txt:1:7-12 hello TARGET one +|15: 2 a.txt:3:6-11 last TARGET line +|16: 3 sub/b.txt:2:1-6 TARGET inside sub == snap first grid=180x31 cursor=18,7 == snap opened-hit grid=180x31 cursor=12,11 -|9: /tmp/pardes-snap/grep/cwd/sub/b.txt Save Tty Del Collapse +|9: /tmp/pardes-snap/grep/cwd/sub/b.txt Save Tty Collapse Del |10: 1 deep |11: 2 TARGET inside sub -|14: 2 a.txt:3:6-11 last TARGET line -|15: 3 sub/b.txt:2:1-6 TARGET inside sub +|14: 2 a.txt:3:6-11 last TARGET line +|15: 3 sub/b.txt:2:1-6 TARGET inside sub |16: 4 == snap nomatch grid=180x31 cursor=2,4 -|11: /tmp/pardes-snap/grep/cwd/sub/+Search Save Tty Del Collapse +|11: /tmp/pardes-snap/grep/cwd/sub/+Search Save Tty Collapse Del LocationsConfig |12: 1 == snap chordsel grid=180x31 cursor=19,7 == snap chord grid=180x31 cursor=19,7 diff --git a/test/snapshots/grep.snap b/test/snapshots/grep.snap index 84b8f415..07777e67 100644 --- a/test/snapshots/grep.snap +++ b/test/snapshots/grep.snap @@ -14,6 +14,13 @@ dirmk sub file a.txt hello TARGET one\nnothing here\nlast TARGET line file sub/b.txt deep\nTARGET inside sub file noise.txt nothing to see +# Builtins announce themselves by default, and an announcement is a band at +# the top of the body -- which moves every row this script clicks. What the +# verbs do is what is under test, not the announcement. +config Verbose off +# The stacked layout spends two rows on each hit, which puts the third one +# below the fold of this results pane; the claim here is which hits there are. +config LocationsConfig layout:inline start 31 180 -n 3 wait 8000 a.txt stable 700 20000 @@ -41,7 +48,7 @@ text TARGET stable 400 5000 snap typing # Enter walks: two hits in a.txt, one in sub/b.txt, sorted by path — and the -# file that holds none of them contributes no row +# file that holds none of them contributes no row. key enter wait 10000 sub/b.txt:2:1 stable 700 15000 diff --git a/test/snapshots/hscroll.golden b/test/snapshots/hscroll.golden index 61e04e49..407d0f82 100644 --- a/test/snapshots/hscroll.golden +++ b/test/snapshots/hscroll.golden @@ -1,13 +1,12 @@ -== snap opened grid=90x31 cursor=7,7 +== snap opened grid=90x31 cursor=6,8 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol New Tty Find Grep Joincol -| /tmp/pardes-snap/hscroll/cwd Save Tty Del T /tmp/pardes-snap/hscroll/cwd Save Tty Del T +| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/hscroll/cwd Tty Save Mode /tmp/pardes-snap/hscroll/cwd Tty Save Mode | ls ls | wide.txt wide.txt | -| /tmp/pardes-snap/hscroll/cwd/wide.txt Save -| 1 short1 END_A_MARKER_WAY_OUT_RIGHT_padp | +| wide.txt | | | @@ -16,14 +15,11 @@ | | | -| /tmp/pardes-snap/hscroll/cwd Save Tty Del T +| +| /tmp/pardes-snap/hscroll/cwd Tty Save Mode | ls | wide.txt -== snap wheeled grid=90x31 cursor=7,7 -|7: 1 ND_A_MARKER_WAY_OUT_RIGHT_padpadpadpad -== snap clamped grid=90x31 cursor=7,7 -|7: 1 short1 END_A_MARKER_WAY_OUT_RIGHT_padp -== snap dollar grid=90x31 cursor=41,7 -|7: 1 padpadpadpadpadpadpadpadpadpad_TAIL -== snap zero grid=90x31 cursor=7,7 -|7: 1 short1 END_A_MARKER_WAY_OUT_RIGHT_padp +== snap wheeled grid=90x31 cursor=6,8 +== snap clamped grid=90x31 cursor=6,8 +== snap dollar grid=90x31 cursor=3,3 +== snap zero grid=90x31 cursor=2,3 diff --git a/test/snapshots/images.golden b/test/snapshots/images.golden index 558b4d84..95c56d9f 100644 --- a/test/snapshots/images.golden +++ b/test/snapshots/images.golden @@ -1,11 +1,11 @@ == snap img-open grid=150x31 cursor=11,8 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol New Tty Find Grep Joincol -| /tmp/pardes-snap/images/cwd Save Tty Del Togglettymode Filter Collapse /tmp/pardes-snap/images/cwd Save Tty Del Togglettymode Filter Collapse -| ls ls -| pic.ppm pic.ppm -| -| img petscii:off palette:commodore ascii:on /tmp/pardes-snap/images/cwd/pi +| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/images/cwd Tty Save Mode Filter Collapse Del /tmp/pardes-snap/images/cwd Tty Save Mode Filter Collapse Del +| Look ls +| ls pic.ppm +| pic.ppm +| img petscii:off palette:commodore ascii:on /tmp/pardes-snap/images/cwd/p | 92@7%5Gm$D4▘🬵%🬨3'🬥🬆🬻 | 🬥3▖╱{=CY,▌*)^M<▀🬎🬻 | X▄jN.&🬺j*w3┼"🬥🬆🬻 @@ -16,72 +16,78 @@ | ▚i,V🬆🬹 | mu🬆🬻 | 🬆🬻 -| /tmp/pardes-snap/images/cwd Save Tty Del Togglettymode Filter Collapse +| /tmp/pardes-snap/images/cwd Tty Save Mode Filter Collapse Del | ls | pic.ppm == style img-open grid=150x31 |0: 0-70 #b2c3b8,#1d2824, 71-149 d,#1d2824, -|1: 0-24 #becfc4,#26362d, 25-74 d,#26362d, 75-99 #b2c3b8,#1d2824, 100-149 d,#1d2824, -|2: 0-1 #ffffff,#4c6356, 2-71 #b2c3b8,#1d2824, 72-74 d,#1d2824, 75-76 #ffffff,#4c6356, 77-146 #b2c3b8,#1d2824, 147-149 d,#1d2824, -|3: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|4: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|5: 0-0 d,#637f6a, 1-74 d,#0d1410, 75-75 d,#637f6a, 76-149 d,#0d1410, -|6: 0-1 #000000,#adcc91, 2-74 #becfc4,#26362d, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|7: 0-0 d,#152019, 1-27 d,#0d1410, 28-29 #959595,#6c6c6c, 30-30 #6c6c6c,#959595, 31-34 #959595,#6c6c6c, 35-35 #6c6c6c,#959595, 36-37 #959595,#6c6c6c, 38-38 #6c6c6c,#959595, 39-39 #959595,#6c6c6c, 40-40 #6c6c6c,#959595, 41-41 #959595,#6c6c6c, 42-42 #6c6c6c,#959595, 43-44 #959595,#6c6c6c, 45-45 #6c6c6c,#959595, 46-46 #959595,#6c5eb5, 47-47 #352879,#6c6c6c, 48-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|8: 0-0 d,#152019, 1-27 d,#0d1410, 28-28 #6c6c6c,#959595, 29-29 #959595,#6c6c6c, 30-30 #6c6c6c,#959595, 31-34 #959595,#6c6c6c, 35-38 #6c6c6c,#959595, 39-42 #959595,#6c6c6c, 43-43 #6c6c6c,#959595, 44-44 #6c6c6c,#352879, 45-45 #352879,#959595, 46-47 #352879,#352879, 48-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|9: 0-0 d,#152019, 1-27 d,#0d1410, 28-28 #959595,#6c6c6c, 29-29 #6c6c6c,#959595, 30-33 #959595,#6c6c6c, 34-34 #6c6c6c,#959595, 35-38 #959595,#6c6c6c, 39-39 #6c6c6c,#959595, 40-40 #959595,#6c6c6c, 41-41 #6c6c6c,#959595, 42-42 #959595,#6c5eb5, 43-43 #352879,#6c6c6c, 44-47 #352879,#352879, 48-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|10: 0-0 d,#152019, 1-27 d,#0d1410, 28-29 #959595,#6c6c6c, 30-30 #6c6c6c,#959595, 31-33 #959595,#6c6c6c, 34-34 #6c6c6c,#959595, 35-39 #959595,#6c6c6c, 40-40 #959595,#6c5eb5, 41-41 #6c6c6c,#352879, 42-47 #352879,#352879, 48-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|11: 0-0 d,#152019, 1-27 d,#0d1410, 28-28 #6c6c6c,#959595, 29-29 #959595,#6c6c6c, 30-34 #6c6c6c,#959595, 35-36 #959595,#6c6c6c, 37-37 #6c6c6c,#959595, 38-38 #6c6c6c,#6c5eb5, 39-39 #352879,#6c6c6c, 40-47 #352879,#352879, 48-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|12: 0-0 d,#152019, 1-27 d,#0d1410, 28-29 #6c6c6c,#959595, 30-31 #959595,#6c6c6c, 32-32 #6c6c6c,#959595, 33-34 #959595,#6c6c6c, 35-35 #6c6c6c,#959595, 36-36 #6c6c6c,#6c5eb5, 37-37 #352879,#6c6c6c, 38-47 #352879,#352879, 48-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|13: 0-0 d,#152019, 1-27 d,#0d1410, 28-29 #959595,#6c6c6c, 30-32 #6c6c6c,#959595, 33-33 #959595,#6c6c6c, 34-34 #6c6c6c,#352879, 35-35 #352879,#6c6c6c, 36-47 #352879,#352879, 48-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|14: 0-0 d,#152019, 1-27 d,#0d1410, 28-31 #959595,#6c6c6c, 32-32 #959595,#6c5eb5, 33-33 #352879,#6c5eb5, 34-47 #352879,#352879, 48-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|15: 0-0 d,#152019, 1-27 d,#0d1410, 28-28 #6c6c6c,#959595, 29-29 #959595,#6c6c6c, 30-30 #6c6c6c,#6c5eb5, 31-31 #352879,#6c6c6c, 32-47 #352879,#352879, 48-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|16: 0-0 d,#152019, 1-27 d,#0d1410, 28-28 #6c6c6c,#6c5eb5, 29-29 #352879,#6c6c6c, 30-47 #352879,#352879, 48-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|17: 0-1 #ffffff,#4c6356, 2-71 #b2c3b8,#1d2824, 72-74 d,#1d2824, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|18: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|19: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|20: 0-0 d,#637f6a, 1-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|21: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|22: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|23: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|24: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|25: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|26: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|27: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|28: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|29: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|30: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|1: 0-1 #ffffff,#887455, 2-2 d,#26362d, 3-34 #becfc4,#26362d, 35-74 d,#26362d, 75-76 #ffffff,#887455, 77-77 d,#1d2824, 78-109 #b2c3b8,#1d2824, 110-149 d,#1d2824, +|2: 0-1 #ffffff,#496656, 2-2 d,#1d2824, 3-30 #b2c3b8,#1d2824, 31-33 #d3b0d9,#1d2824, 34-63 #b2c3b8,#1d2824, 64-74 d,#1d2824, 75-76 #ffffff,#496656, 77-77 d,#1d2824, 78-105 #b2c3b8,#1d2824, 106-108 #d3b0d9,#1d2824, 109-138 #b2c3b8,#1d2824, 139-149 d,#1d2824, +|3: 0-0 d,#152019, 1-1 d,#0d1410, 2-70 d,#1d2824, 71-74 #b2c3b8,#1d2824, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|4: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|5: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-149 d,#0d1410, +|6: 0-1 #000000,#add38a, 2-2 d,#26362d, 3-73 #becfc4,#26362d, 74-74 #dfbce5,#26362d, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|7: 0-0 d,#152019, 1-27 d,#0d1410, 28-29 #959595,#6c6c6c, 30-30 #6c6c6c,#959595, 31-34 #959595,#6c6c6c, 35-35 #6c6c6c,#959595, 36-37 #959595,#6c6c6c, 38-38 #6c6c6c,#959595, 39-39 #959595,#6c6c6c, 40-40 #6c6c6c,#959595, 41-41 #959595,#6c6c6c, 42-42 #6c6c6c,#959595, 43-44 #959595,#6c6c6c, 45-45 #6c6c6c,#959595, 46-46 #959595,#6c5eb5, 47-47 #352879,#6c6c6c, 48-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|8: 0-0 d,#152019, 1-27 d,#0d1410, 28-28 #6c6c6c,#959595, 29-29 #959595,#6c6c6c, 30-30 #6c6c6c,#959595, 31-34 #959595,#6c6c6c, 35-38 #6c6c6c,#959595, 39-42 #959595,#6c6c6c, 43-43 #6c6c6c,#959595, 44-44 #6c6c6c,#352879, 45-45 #352879,#959595, 46-47 #352879,#352879, 48-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|9: 0-0 d,#152019, 1-27 d,#0d1410, 28-28 #959595,#6c6c6c, 29-29 #6c6c6c,#959595, 30-33 #959595,#6c6c6c, 34-34 #6c6c6c,#959595, 35-38 #959595,#6c6c6c, 39-39 #6c6c6c,#959595, 40-40 #959595,#6c6c6c, 41-41 #6c6c6c,#959595, 42-42 #959595,#6c5eb5, 43-43 #352879,#6c6c6c, 44-47 #352879,#352879, 48-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|10: 0-0 d,#152019, 1-27 d,#0d1410, 28-29 #959595,#6c6c6c, 30-30 #6c6c6c,#959595, 31-33 #959595,#6c6c6c, 34-34 #6c6c6c,#959595, 35-39 #959595,#6c6c6c, 40-40 #959595,#6c5eb5, 41-41 #6c6c6c,#352879, 42-47 #352879,#352879, 48-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|11: 0-0 d,#152019, 1-27 d,#0d1410, 28-28 #6c6c6c,#959595, 29-29 #959595,#6c6c6c, 30-34 #6c6c6c,#959595, 35-36 #959595,#6c6c6c, 37-37 #6c6c6c,#959595, 38-38 #6c6c6c,#6c5eb5, 39-39 #352879,#6c6c6c, 40-47 #352879,#352879, 48-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|12: 0-0 d,#152019, 1-27 d,#0d1410, 28-29 #6c6c6c,#959595, 30-31 #959595,#6c6c6c, 32-32 #6c6c6c,#959595, 33-34 #959595,#6c6c6c, 35-35 #6c6c6c,#959595, 36-36 #6c6c6c,#6c5eb5, 37-37 #352879,#6c6c6c, 38-47 #352879,#352879, 48-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|13: 0-0 d,#152019, 1-27 d,#0d1410, 28-29 #959595,#6c6c6c, 30-32 #6c6c6c,#959595, 33-33 #959595,#6c6c6c, 34-34 #6c6c6c,#352879, 35-35 #352879,#6c6c6c, 36-47 #352879,#352879, 48-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|14: 0-0 d,#152019, 1-27 d,#0d1410, 28-31 #959595,#6c6c6c, 32-32 #959595,#6c5eb5, 33-33 #352879,#6c5eb5, 34-47 #352879,#352879, 48-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|15: 0-0 d,#152019, 1-27 d,#0d1410, 28-28 #6c6c6c,#959595, 29-29 #959595,#6c6c6c, 30-30 #6c6c6c,#6c5eb5, 31-31 #352879,#6c6c6c, 32-47 #352879,#352879, 48-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|16: 0-0 d,#152019, 1-27 d,#0d1410, 28-28 #6c6c6c,#6c5eb5, 29-29 #352879,#6c6c6c, 30-47 #352879,#352879, 48-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|17: 0-1 #ffffff,#496656, 2-2 d,#1d2824, 3-30 #b2c3b8,#1d2824, 31-33 #d3b0d9,#1d2824, 34-63 #b2c3b8,#1d2824, 64-74 d,#1d2824, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|18: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|19: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|20: 0-0 d,#608269, 1-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|21: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|22: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|23: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|24: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|25: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|26: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|27: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|28: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|29: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|30: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, == style term-palette grid=150x31 -|7: 0-0 d,#152019, 1-27 d,#0d1410, 28-28 p8,p5, 29-30 p8,p4, 31-31 p4,p8, 32-35 p8,p4, 36-37 p4,p8, 38-39 p8,p4, 40-40 p4,p8, 41-42 p8,p4, 43-43 p4,p8, 44-46 p8,p4, 47-47 p12,p8, 48-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|8: 0-0 d,#152019, 1-27 d,#0d1410, 28-30 p8,p4, 31-33 p4,p8, 34-34 p8,p4, 35-36 p4,p8, 37-37 p8,p4, 38-41 p4,p8, 42-42 p8,p4, 43-43 p4,p8, 44-44 p8,p12, 45-46 p12,p8, 47-47 p12,p12, 48-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|9: 0-0 d,#152019, 1-27 d,#0d1410, 28-28 p8,p4, 29-29 p4,p8, 30-30 p8,p4, 31-31 p4,p8, 32-32 p8,p4, 33-33 p4,p8, 34-35 p8,p4, 36-37 p4,p8, 38-38 p8,p5, 39-41 p8,p4, 42-42 p4,p8, 43-44 p12,p8, 45-47 p12,p12, 48-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|10: 0-0 d,#152019, 1-27 d,#0d1410, 28-29 p8,p4, 30-34 p4,p8, 35-36 p8,p4, 37-38 p4,p8, 39-39 p8,p4, 40-40 p4,p8, 41-41 p12,p8, 42-47 p12,p12, 48-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|11: 0-0 d,#152019, 1-27 d,#0d1410, 28-28 p4,p8, 29-29 p8,p4, 30-31 p4,p8, 32-32 p8,p4, 33-33 p4,p8, 34-34 p8,p4, 35-36 p4,p8, 37-37 p8,p4, 38-38 p8,p12, 39-39 p12,p8, 40-47 p12,p12, 48-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|12: 0-0 d,#152019, 1-27 d,#0d1410, 28-28 p8,p4, 29-31 p4,p8, 32-35 p8,p4, 36-36 p4,p8, 37-37 p12,p8, 38-47 p12,p12, 48-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|13: 0-0 d,#152019, 1-27 d,#0d1410, 28-32 p8,p4, 33-33 p4,p8, 34-34 p8,p12, 35-36 p12,p8, 37-47 p12,p12, 48-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|14: 0-0 d,#152019, 1-27 d,#0d1410, 28-28 p8,p4, 29-29 p4,p8, 30-30 p8,p4, 31-32 p4,p8, 33-33 p12,p8, 34-34 p8,p12, 35-47 p12,p12, 48-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|15: 0-0 d,#152019, 1-27 d,#0d1410, 28-29 p4,p8, 30-30 p8,p12, 31-32 p12,p8, 33-47 p12,p12, 48-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|16: 0-0 d,#152019, 1-27 d,#0d1410, 28-28 p8,p12, 29-29 p12,p8, 30-47 p12,p12, 48-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|3: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|5: 0-0 d,#608269, 1-74 d,#0d1410, 75-75 d,#608269, 76-149 d,#0d1410, +|6: 0-1 #000000,#add38a, 2-2 d,#26362d, 3-72 #becfc4,#26362d, 73-74 #dfbce5,#26362d, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|7: 0-0 d,#152019, 1-1 d,#0d1410, 2-67 d,#1d2824, 68-74 #b2c3b8,#1d2824, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|8: 0-0 d,#152019, 1-28 d,#0d1410, 29-31 p8,p4, 32-33 p4,p8, 34-37 p8,p4, 38-38 p4,p8, 39-44 p8,p4, 45-45 p8,p12, 46-46 p12,p8, 47-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|9: 0-0 d,#152019, 1-28 d,#0d1410, 29-29 p8,p4, 30-30 p4,p8, 31-35 p8,p4, 36-36 p5,p8, 37-37 p8,p4, 38-38 p4,p8, 39-41 p8,p4, 42-42 p4,p8, 43-43 p8,p12, 44-45 p12,p8, 46-46 p12,p12, 47-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|10: 0-0 d,#152019, 1-28 d,#0d1410, 29-30 p8,p4, 31-32 p4,p8, 33-40 p8,p4, 41-41 p8,p12, 42-43 p12,p8, 44-46 p12,p12, 47-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|11: 0-0 d,#152019, 1-28 d,#0d1410, 29-31 p8,p4, 32-32 p4,p8, 33-34 p8,p4, 35-37 p4,p8, 38-38 p8,p4, 39-39 p8,p12, 40-41 p12,p8, 42-46 p12,p12, 47-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|12: 0-0 d,#152019, 1-28 d,#0d1410, 29-36 p8,p4, 37-37 p8,p12, 38-39 p12,p8, 40-46 p12,p12, 47-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|13: 0-0 d,#152019, 1-28 d,#0d1410, 29-30 p4,p8, 31-34 p8,p4, 35-35 p8,p12, 36-36 p12,p8, 37-46 p12,p12, 47-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|14: 0-0 d,#152019, 1-28 d,#0d1410, 29-29 p4,p8, 30-31 p8,p4, 32-32 p4,p8, 33-33 p8,p12, 34-35 p12,p8, 36-46 p12,p12, 47-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|15: 0-0 d,#152019, 1-28 d,#0d1410, 29-29 p4,p8, 30-30 p8,p4, 31-31 p8,p12, 32-32 p12,p8, 33-46 p12,p12, 47-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|16: 0-0 d,#152019, 1-28 d,#0d1410, 29-29 p8,p12, 30-30 p12,p8, 31-46 p12,p12, 47-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, == snap no-ascii grid=150x31 cursor=11,8 -|6: img petscii:off palette:terminal ascii:off /tmp/pardes-snap/images/cwd/pi -|7: ███╱█🬻██🬺██🬻███╱██🬴▄ -|8: 🬬██╱███╱🬻🬝🬻🬬████🬝🬵█ -|9: █╲█🬴████╲╱█🬝██▟▄█ -|10: ██╲╱╲█🬝█████╱🬵 -|11: ╱█████████🬝▄ -|12: █│█████🬝🬝🬹 -|13: ██████🬝▄█ -|14: 🬜🬬██🬸▄╲ -|15: 🬺█🬝🬵█ -|16: 🬝▄ -== snap tag-edit grid=400x31 cursor=86,6 +|3: ls ls +|4: pic.ppm pic.ppm +|5: +|6: img petscii:off palette:terminal ascii:off /tmp/pardes-snap/images/cwd/p +|7: Ascii +|8: █🬝█╲███▙🬸🬬🬻█████🬝🬵 +|9: ███████🬻██🬸█🬝█🬝▄█ +|10: ████████████🬝▄█ +|11: ███🬸██████🬝▄█ +|12: ████████🬝🬵█ +|13: ╱█████🬝▄ +|14: █🬬█╲🬝🬵█ +|15: 🬺█🬝🬵 +|16: 🬝▄ +== snap tag-edit grid=400x31 cursor=87,6 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol New Tty Find Grep Joincol -| /tmp/pardes-snap/images/cwd Save Tty Del Togglettymode Filter Collapse /tmp/pardes-snap/images/cwd Save Tty Del Togglettymode Filter Collapse +| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/images/cwd Tty Save Mode Filter Collapse Del /tmp/pardes-snap/images/cwd Tty Save Mode Filter Collapse Del | ls ls | pic.ppm pic.ppm | -| img petscii:off palette:terminal ascii:off /tmp/pardes-snap/images/cwd/pic.ppm Zork Tty Del Collapse +| img petscii:off palette:terminal ascii:off /tmp/pardes-snap/images/cwd/pic.ppm Zork Tty Collapse Del | ███╱█🬻██🬺██🬻███╱██🬴▄ | 🬬██╱███╱🬻🬝🬻🬬████🬝🬵█ | █╲█🬴████╲╱█🬝██▟▄█ @@ -92,6 +98,6 @@ | 🬜🬬██🬸▄╲ | 🬺█🬝🬵█ | 🬝▄ -| /tmp/pardes-snap/images/cwd Save Tty Del Togglettymode Filter Collapse +| /tmp/pardes-snap/images/cwd Tty Save Mode Filter Collapse Del | ls | pic.ppm diff --git a/test/snapshots/jumps.golden b/test/snapshots/jumps.golden index 3005135c..9800ca4c 100644 --- a/test/snapshots/jumps.golden +++ b/test/snapshots/jumps.golden @@ -1,7 +1,7 @@ == snap start grid=150x31 cursor=7,3 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol -| /tmp/pardes-snap/jumps/cwd/big.txt Save Tty Del Collapse +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/jumps/cwd/big.txt Save Tty Collapse Del | 1 line 1 | 2 line 2 | 3 line 3 @@ -31,11 +31,14 @@ | 27 line 27 | 28 line 28 == snap to-shell grid=150x31 cursor=79,5 -|1: New Tty Find Grep Joincol New Tty Find Grep Joincol -|2: /tmp/pardes-snap/jumps/cwd/big.txt Save Tty Del Collapse /tmp/pardes-snap/jumps/cwd Save Tty Del Togglettymode Filter Collapse +|1: New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +|2: /tmp/pardes-snap/jumps/cwd/big.txt Save Tty Collapse Del /tmp/pardes-snap/jumps/cwd Tty Save Mode Filter Collapse Del |3: 1 line 1 ls |4: 2 line 2 big.txt == snap to-file grid=150x31 cursor=7,3 +|3: 1 line 1 Left +|4: 2 line 2 ls +|5: 3 line 3 big.txt == snap goto-100 grid=150x31 cursor=7,27 |3: 76 line 76 ls |4: 77 line 77 big.txt @@ -65,10 +68,40 @@ |28: 101 line 101 |29: 102 line 102 |30: 103 line 103 -== snap back-in-file grid=150x31 cursor=7,3 -|3: 1 line 1 ls -|4: 2 line 2 big.txt -|5: 3 line 3 +== snap back-in-file grid=150x31 cursor=7,4 +|3: Back ls +|4: 1 line 1 big.txt +|5: 2 line 2 +|6: 3 line 3 +|7: 4 line 4 +|8: 5 line 5 +|9: 6 line 6 +|10: 7 line 7 +|11: 8 line 8 +|12: 9 line 9 +|13: 10 line 10 +|14: 11 line 11 +|15: 12 line 12 +|16: 13 line 13 +|17: 14 line 14 +|18: 15 line 15 +|19: 16 line 16 +|20: 17 line 17 +|21: 18 line 18 +|22: 19 line 19 +|23: 20 line 20 +|24: 21 line 21 +|25: 22 line 22 +|26: 23 line 23 +|27: 24 line 24 +|28: 25 line 25 +|29: 26 line 26 +|30: 27 line 27 +== snap back-to-shell grid=150x31 cursor=79,5 +== snap forward-file grid=150x31 cursor=7,3 +|3: 1 line 1 Forward +|4: 2 line 2 ls +|5: 3 line 3 big.txt |6: 4 line 4 |7: 5 line 5 |8: 6 line 6 @@ -94,12 +127,41 @@ |28: 26 line 26 |29: 27 line 27 |30: 28 line 28 -== snap back-to-shell grid=150x31 cursor=79,5 -== snap forward-file grid=150x31 cursor=7,3 -== snap forward-100 grid=150x31 cursor=7,17 -|3: 86 line 86 ls -|4: 87 line 87 big.txt -|5: 88 line 88 +== snap forward-100 grid=150x31 cursor=7,18 +|3: Forward ls +|4: 86 line 86 big.txt +|5: 87 line 87 +|6: 88 line 88 +|7: 89 line 89 +|8: 90 line 90 +|9: 91 line 91 +|10: 92 line 92 +|11: 93 line 93 +|12: 94 line 94 +|13: 95 line 95 +|14: 96 line 96 +|15: 97 line 97 +|16: 98 line 98 +|17: 99 line 99 +|18: 100 line 100 +|19: 101 line 101 +|20: 102 line 102 +|21: 103 line 103 +|22: 104 line 104 +|23: 105 line 105 +|24: 106 line 106 +|25: 107 line 107 +|26: 108 line 108 +|27: 109 line 109 +|28: 110 line 110 +|29: 111 line 111 +|30: 112 line 112 +== snap last grid=150x31 cursor=79,5 +|3: Last ls +== snap last-back grid=150x31 cursor=7,17 +|3: 86 line 86 Last +|4: 87 line 87 ls +|5: 88 line 88 big.txt |6: 89 line 89 |7: 90 line 90 |8: 91 line 91 @@ -125,47 +187,95 @@ |28: 111 line 111 |29: 112 line 112 |30: 113 line 113 -== snap last grid=150x31 cursor=79,5 -== snap last-back grid=150x31 cursor=7,17 -== snap jumplist grid=150x31 cursor=7,17 -|26: /tmp/pardes-snap/jumps/cwd/+Jumps Save Tty Del Collapse +== snap jumplist grid=150x31 cursor=7,18 +|3: Jumplist ls +|4: 86 line 86 big.txt +|5: 87 line 87 +|6: 88 line 88 +|7: 89 line 89 +|8: 90 line 90 +|9: 91 line 91 +|10: 92 line 92 +|11: 93 line 93 +|12: 94 line 94 +|13: 95 line 95 +|14: 96 line 96 +|15: 97 line 97 +|16: 98 line 98 +|17: 99 line 99 +|18: 100 line 100 +|19: 101 line 101 +|20: 102 line 102 +|21: 103 line 103 +|22: 104 line 104 +|23: 105 line 105 +|24: 106 line 106 +|25: 107 line 107 +|26: /tmp/pardes-snap/jumps/cwd/+Jumps Save Tty Collapse Del LocationsConfig |27: 1 @p1:3:3 /tmp/pardes-snap/jumps/cwd |28: 2 /tmp/pardes-snap/jumps/cwd/big.txt:1:1 line 1 |29: 3 @p1:3:3 /tmp/pardes-snap/jumps/cwd |30: 4 /tmp/pardes-snap/jumps/cwd/big.txt:100:1 line 100 == snap step1-shell grid=150x31 cursor=79,5 +|3: 86 line 86 ls +|4: 87 line 87 big.txt +|5: 88 line 88 +|6: 89 line 89 +|7: 90 line 90 +|8: 91 line 91 +|9: 92 line 92 +|10: 93 line 93 +|11: 94 line 94 +|12: 95 line 95 +|13: 96 line 96 +|14: 97 line 97 +|15: 98 line 98 +|16: 99 line 99 +|17: 100 line 100 +|18: 101 line 101 +|19: 102 line 102 +|20: 103 line 103 +|21: 104 line 104 +|22: 105 line 105 +|23: 106 line 106 +|24: 107 line 107 +|25: 108 line 108 +|27: Look +|28: 1 @p1:3:3 /tmp/pardes-snap/jumps/cwd +|29: 2 /tmp/pardes-snap/jumps/cwd/big.txt:1:1 line 1 +|30: 3 @p1:3:3 /tmp/pardes-snap/jumps/cwd == style step1-shell grid=150x31 |0: 0-70 #b2c3b8,#1d2824, 71-149 d,#1d2824, -|1: 0-24 #b2c3b8,#1d2824, 25-74 d,#1d2824, 75-99 #becfc4,#26362d, 100-149 d,#26362d, -|2: 0-1 #ffffff,#4c6356, 2-57 #b2c3b8,#1d2824, 58-74 d,#1d2824, 75-76 #000000,#adcc91, 77-145 #becfc4,#26362d, 146-149 d,#26362d, -|3: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-13 #e5eee5,#0d1410, 14-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|4: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-13 #e5eee5,#0d1410, 14-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|5: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-13 #e5eee5,#0d1410, 14-74 d,#0d1410, 75-75 d,#637f6a, 76-149 d,#0d1410, -|6: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-13 #e5eee5,#0d1410, 14-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|7: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-13 #e5eee5,#0d1410, 14-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|8: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-13 #e5eee5,#0d1410, 14-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|9: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-13 #e5eee5,#0d1410, 14-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|10: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-13 #e5eee5,#0d1410, 14-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|11: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-13 #e5eee5,#0d1410, 14-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|12: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-13 #e5eee5,#0d1410, 14-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|13: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-13 #e5eee5,#0d1410, 14-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|14: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-13 #e5eee5,#0d1410, 14-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|15: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-13 #e5eee5,#0d1410, 14-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|16: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-13 #e5eee5,#0d1410, 14-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|17: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-14 #e5eee5,#0d1410, 15-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|18: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-14 #e5eee5,#0d1410, 15-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|19: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-14 #e5eee5,#0d1410, 15-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|20: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-14 #e5eee5,#0d1410, 15-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|21: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-14 #e5eee5,#0d1410, 15-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|22: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-14 #e5eee5,#0d1410, 15-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|23: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-14 #e5eee5,#0d1410, 15-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|24: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-14 #e5eee5,#0d1410, 15-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|25: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-14 #e5eee5,#0d1410, 15-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|26: 0-1 #ffffff,#4c6356, 2-56 #b2c3b8,#1d2824, 57-74 d,#1d2824, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|27: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-13 #59675c,#0d1410, 14-40 #e5eee5,#0d1410, 41-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|28: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-44 #59675c,#0d1410, 45-51 #e5eee5,#0d1410, 52-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|29: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-13 #59675c,#0d1410, 14-40 #e5eee5,#0d1410, 41-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|30: 0-0 d,#152019, 1-1 d,#0d1410, 2-46 #59675c,#0d1410, 47-55 #e5eee5,#0d1410, 56-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|1: 0-1 #ffffff,#887455, 2-2 d,#1d2824, 3-34 #b2c3b8,#1d2824, 35-74 d,#1d2824, 75-76 #ffffff,#887455, 77-77 d,#26362d, 78-109 #becfc4,#26362d, 110-149 d,#26362d, +|2: 0-1 #ffffff,#496656, 2-2 d,#1d2824, 3-29 #b2c3b8,#1d2824, 30-36 #d3b0d9,#1d2824, 37-58 #b2c3b8,#1d2824, 59-74 d,#1d2824, 75-76 #000000,#add38a, 77-77 d,#26362d, 78-104 #becfc4,#26362d, 105-107 #dfbce5,#26362d, 108-137 #becfc4,#26362d, 138-149 d,#26362d, +|3: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-13 #e5eee5,#0d1410, 14-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|4: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-13 #e5eee5,#0d1410, 14-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|5: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-13 #e5eee5,#0d1410, 14-74 d,#0d1410, 75-75 d,#608269, 76-149 d,#0d1410, +|6: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-13 #e5eee5,#0d1410, 14-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|7: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-13 #e5eee5,#0d1410, 14-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|8: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-13 #e5eee5,#0d1410, 14-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|9: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-13 #e5eee5,#0d1410, 14-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|10: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-13 #e5eee5,#0d1410, 14-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|11: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-13 #e5eee5,#0d1410, 14-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|12: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-13 #e5eee5,#0d1410, 14-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|13: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-13 #e5eee5,#0d1410, 14-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|14: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-13 #e5eee5,#0d1410, 14-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|15: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-13 #e5eee5,#0d1410, 14-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|16: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-13 #e5eee5,#0d1410, 14-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|17: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-14 #e5eee5,#0d1410, 15-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|18: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-14 #e5eee5,#0d1410, 15-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|19: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-14 #e5eee5,#0d1410, 15-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|20: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-14 #e5eee5,#0d1410, 15-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|21: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-14 #e5eee5,#0d1410, 15-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|22: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-14 #e5eee5,#0d1410, 15-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|23: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-14 #e5eee5,#0d1410, 15-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|24: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-14 #e5eee5,#0d1410, 15-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|25: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-14 #e5eee5,#0d1410, 15-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|26: 0-1 #ffffff,#496656, 2-2 d,#1d2824, 3-29 #b2c3b8,#1d2824, 30-35 #d3b0d9,#1d2824, 36-73 #b2c3b8,#1d2824, 74-74 d,#1d2824, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|27: 0-0 d,#152019, 1-1 d,#0d1410, 2-70 d,#1d2824, 71-74 #b2c3b8,#1d2824, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|28: 0-0 d,#608269, 1-1 d,#0d1410, 2-13 #59675c,#0d1410, 14-40 #e5eee5,#0d1410, 41-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|29: 0-0 d,#608269, 1-1 d,#0d1410, 2-44 #59675c,#0d1410, 45-51 #e5eee5,#0d1410, 52-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|30: 0-0 d,#152019, 1-1 d,#0d1410, 2-13 #59675c,#0d1410, 14-40 #e5eee5,#0d1410, 41-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, == snap step2-file grid=150x31 cursor=7,3 |3: 1 line 1 ls |4: 2 line 2 big.txt @@ -214,9 +324,10 @@ |23: 109 line 109 |24: 110 line 110 |25: 111 line 111 -|27: 2 /tmp/pardes-snap/jumps/cwd/big.txt:1:1 line 1 -|28: 3 @p1:3:3 /tmp/pardes-snap/jumps/cwd -|29: 4 /tmp/pardes-snap/jumps/cwd/big.txt:100:1 line 100 -|30: 5 +|28: 2 /tmp/pardes-snap/jumps/cwd/big.txt:1:1 line 1 +|29: 3 @p1:3:3 /tmp/pardes-snap/jumps/cwd +|30: 4 /tmp/pardes-snap/jumps/cwd/big.txt:100:1 line 100 == snap step-back grid=150x31 cursor=79,5 -== snap look-row grid=150x31 cursor=7,14 +== snap look-row grid=150x31 cursor=79,5 +|5: 91 line 91 ls +|6: 92 line 92 big.txt diff --git a/test/snapshots/layout-close.golden b/test/snapshots/layout-close.golden index 9e573802..c9e1243a 100644 --- a/test/snapshots/layout-close.golden +++ b/test/snapshots/layout-close.golden @@ -1,19 +1,19 @@ == snap built grid=140x41 cursor=4,17 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol New Tty Find Grep Joincol -| /tmp/pardes-snap/layout-close/cwd Save Tty Del Togglettymode Filter /tmp/pardes-snap/layout-close/cwd Save Tty Del Togglettymode Filter +| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/layout-close/cwd Tty Save Mode Filter Collapse Del /tmp/pardes-snap/layout-close/cwd Tty Save Mode Filter Collapse Del | ls ls | marker.txt marker.txt | -| /tmp/pardes-snap/layout-close/cwd Save Tty Del Togglettymode Filter +| /tmp/pardes-snap/layout-close/cwd Tty Save Mode Filter Collapse Del | ls | marker.txt | -| /tmp/pardes-snap/layout-close/cwd Save Tty Del Togglettymode Filter +| /tmp/pardes-snap/layout-close/cwd Tty Save Mode Filter Collapse Del | ls | marker.txt | -| /tmp/pardes-snap/layout-close/cwd Save Tty Del Togglettymode Filter +| /tmp/pardes-snap/layout-close/cwd Tty Save Mode Filter Collapse Del | ls | marker.txt | @@ -21,20 +21,20 @@ | | | -| /tmp/pardes-snap/layout-close/cwd Save Tty Del Togglettymode Filter +| /tmp/pardes-snap/layout-close/cwd Tty Save Mode Filter Collapse Del | ls | marker.txt == snap altc grid=140x41 cursor=39,5 -|1: New Tty Find Grep Joincol New Tty Find Grep Joincol New Tty Find Grep Joincol -|2: /tmp/pardes-snap/layout-close/cwd /tmp/pardes-snap/layout-close/cwd /tmp/pardes-snap/layout-close/cwd Save Tty Del Togglettymode Filter +|1: New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +|2: /tmp/pardes-snap/layout-close/cw /tmp/pardes-snap/layout-close/cw /tmp/pardes-snap/layout-close/cwd Tty Save Mode Filter Collapse Del |3: ls ls ls |4: marker.txt marker.txt marker.txt -|6: /tmp/pardes-snap/layout-close/cwd -|10: /tmp/pardes-snap/layout-close/cwd +|6: /tmp/pardes-snap/layout-close/cw +|10: /tmp/pardes-snap/layout-close/cw |14: |15: |16: -|22: /tmp/pardes-snap/layout-close/cwd +|22: /tmp/pardes-snap/layout-close/cw == snap del grid=140x41 cursor=39,5 |6: |7: @@ -43,9 +43,6 @@ |10: |11: |12: -== snap colclose grid=140x41 cursor=4,8 -|1: New Tty Find Grep Joincol New Tty Find Grep Joincol -|2: /tmp/pardes-snap/layout-close/cwd Save Tty Del Togglettymode Filter /tmp/pardes-snap/layout-close/cwd Save Tty Del Togglettymode Filter -|3: ls ls +== snap colclose grid=140x41 cursor=42,3 +|3: ls 1 ls |4: marker.txt marker.txt -|22: /tmp/pardes-snap/layout-close/cwd Save Tty Del Togglettymode Filter diff --git a/test/snapshots/layout-open.golden b/test/snapshots/layout-open.golden index 569f98b2..47eea036 100644 --- a/test/snapshots/layout-open.golden +++ b/test/snapshots/layout-open.golden @@ -1,7 +1,7 @@ == snap before grid=100x31 cursor=2,9 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol New Tty Find Grep Joincol -| /tmp/pardes-snap/layout-open/cwd Save Tty Del To /tmp/pardes-snap/layout-open/cwd Save Tty Del To +| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/layout-open/cwd Tty Save Mode /tmp/pardes-snap/layout-open/cwd Tty Save Mode | ls ls | sub sub | @@ -16,21 +16,27 @@ | | | -| /tmp/pardes-snap/layout-open/cwd Save Tty Del To +| /tmp/pardes-snap/layout-open/cwd Tty Save Mode | ls | sub == snap altn-left grid=100x31 cursor=4,9 -|6: /tmp/pardes-snap/layout-open/cwd Save Tty Del To +|6: /tmp/pardes-snap/layout-open/cwd Tty Save Mode |7: ls |8: sub == snap altn-right grid=100x31 cursor=54,9 -|6: /tmp/pardes-snap/layout-open/cwd Save Tty Del To /tmp/pardes-snap/layout-open/cwd Save Tty Del To +|6: /tmp/pardes-snap/layout-open/cwd Tty Save Mode /tmp/pardes-snap/layout-open/cwd Tty Save Mode |7: ls ls |8: sub sub == snap file-open grid=100x31 cursor=7,22 -|21: /tmp/pardes-snap/layout-open/cwd/sub/f.txt Save +|18: Look +|19: ls +|20: sub +|21: /tmp/pardes-snap/layout-open/cwd/sub/f.txt Save |22: 1 echo 'TTY'OK == snap ttydir grid=100x31 cursor=7,22 -|10: /tmp/pardes-snap/layout-open/cwd/sub Save Tty De +|10: /tmp/pardes-snap/layout-open/cwd/sub Tty Save M |11: echo 'TTY'OK |12: TTYOK +|18: ls +|19: sub +|20: diff --git a/test/snapshots/leader.golden b/test/snapshots/leader.golden index d084250c..81d9e3cb 100644 --- a/test/snapshots/leader.golden +++ b/test/snapshots/leader.golden @@ -1,60 +1,25 @@ -== snap spc grid=100x41 cursor=7,3 +== snap spc grid=100x41 cursor=7,4 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol -| /tmp/pardes-snap/leader/cwd/cmds.txt Save Tty Del Collapse -| 1 Help -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/leader/cwd/cmds.txt Save Tty Collapse Del | SPC -== snap spc-h grid=100x41 cursor=7,3 -|40: SPC h +| 1 Help +== snap spc-h grid=100x41 cursor=7,4 +|3: SPC h == snap abandoned grid=100x41 cursor=7,3 -|40: +|3: 1 Help +|4: == snap unmapped grid=100x41 cursor=7,3 == snap help-group grid=100x41 cursor=7,23 -|22: /tmp/pardes-snap/leader/cwd/+Help Save Tty Del Collapse +|22: /tmp/pardes-snap/leader/cwd/+Help Save Tty Collapse Del |23: 1 pardes builtins under SPC h |24: 2 -|25: 3 SPC h c Changelog topbar +|25: 3 SPC h c Changelog topbar |26: 4 SPC h m Messages -|27: 5 SPC h t Tutor topbar +|27: 5 SPC h t Tutor topbar |28: 6 == snap tutor grid=100x41 cursor=7,13 -|12: /Tutor Save Tty Del Collapse +|12: /Tutor Save Tty Collapse Del |13: 1 |14: 2 PARDES TUTOR |15: 3 tmux + vi + acme, from scratch. @@ -64,6 +29,13 @@ |19: 7 Press j until you reach the introduction. |20: 8 |21: 9 +|23: Tutor +|24: 1 pardes builtins under SPC h +|25: 2 +|26: 3 SPC h c Changelog topbar +|27: 4 SPC h m Messages +|28: 5 SPC h t Tutor topbar +|29: 6 == snap deleted grid=100x41 cursor=7,23 |12: |13: @@ -75,12 +47,19 @@ |19: |20: |21: +|23: 1 pardes builtins under SPC h +|24: 2 +|25: 3 SPC h c Changelog topbar +|26: 4 SPC h m Messages +|27: 5 SPC h t Tutor topbar +|28: 6 +|29: == snap help-window grid=100x41 cursor=7,23 |23: 1 pardes builtins under SPC w -|25: 3 SPC w h Left C-w h, C-w left -|26: 4 SPC w j Down C-w j, C-w down -|27: 5 SPC w k Up C-w k, C-w up -|28: 6 SPC w l Right C-w l, C-w right +|25: 3 SPC w h Left C-w h, C-w left +|26: 4 SPC w j Down C-w j, C-w down +|27: 5 SPC w k Up C-w k, C-w up +|28: 6 SPC w l Right C-w l, C-w right |29: 7 == snap help-language grid=100x41 cursor=7,23 |23: 1 pardes builtins under SPC l diff --git a/test/snapshots/load.golden b/test/snapshots/load.golden index ebfe6a39..994ab83e 100644 --- a/test/snapshots/load.golden +++ b/test/snapshots/load.golden @@ -1,7 +1,7 @@ == snap loaded grid=100x31 cursor=4,16 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol New Tty Find Grep Joincol -| /tmp/pardes-snap/load/cwd Save Tty Del Toggletty /tmp/pardes-snap/load/cwd Save Tty Del Toggletty +| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/load/cwd Tty Save Mode Filter /tmp/pardes-snap/load/cwd Tty Save Mode Filter | echo LOAD''MARK; seq 1 40; echo E''ND ls | LOADMARK d.txt | 1 @@ -16,38 +16,38 @@ | 10 | 11 | 12 -| /tmp/pardes-snap/load/cwd Save Tty Del Toggletty +| /tmp/pardes-snap/load/cwd Tty Save Mode Filter | ls | d.txt == style loaded grid=100x31 |0: 0-70 #b2c3b8,#1d2824, 71-99 d,#1d2824, -|1: 0-24 #becfc4,#26362d, 25-49 d,#26362d, 50-74 #b2c3b8,#1d2824, 75-99 d,#1d2824, -|2: 0-1 #000000,#adcc91, 2-49 #becfc4,#26362d, 50-51 #ffffff,#4c6356, 52-99 #b2c3b8,#1d2824, -|3: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|4: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|5: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|6: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|7: 0-0 d,#152019, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|8: 0-0 d,#152019, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|9: 0-0 d,#152019, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|10: 0-0 d,#152019, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|11: 0-0 d,#152019, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|12: 0-0 d,#152019, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|13: 0-0 d,#152019, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|14: 0-0 d,#152019, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|15: 0-0 d,#152019, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|16: 0-0 d,#152019, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|17: 0-1 #ffffff,#4c6356, 2-49 #b2c3b8,#1d2824, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|18: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|19: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|20: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|21: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|22: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|23: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|24: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|25: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|26: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|27: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|28: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|29: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|30: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|1: 0-1 #ffffff,#887455, 2-2 d,#26362d, 3-34 #becfc4,#26362d, 35-49 d,#26362d, 50-51 #ffffff,#887455, 52-52 d,#1d2824, 53-84 #b2c3b8,#1d2824, 85-99 d,#1d2824, +|2: 0-1 #000000,#add38a, 2-2 d,#26362d, 3-28 #becfc4,#26362d, 29-31 #dfbce5,#26362d, 32-49 #becfc4,#26362d, 50-51 #ffffff,#496656, 52-52 d,#1d2824, 53-78 #b2c3b8,#1d2824, 79-81 #d3b0d9,#1d2824, 82-99 #b2c3b8,#1d2824, +|3: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|4: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|5: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|6: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|7: 0-0 d,#152019, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|8: 0-0 d,#152019, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|9: 0-0 d,#152019, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|10: 0-0 d,#152019, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|11: 0-0 d,#152019, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|12: 0-0 d,#152019, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|13: 0-0 d,#152019, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|14: 0-0 d,#152019, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|15: 0-0 d,#152019, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|16: 0-0 d,#152019, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|17: 0-1 #ffffff,#496656, 2-2 d,#1d2824, 3-28 #b2c3b8,#1d2824, 29-31 #d3b0d9,#1d2824, 32-49 #b2c3b8,#1d2824, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|18: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|19: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|20: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|21: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|22: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|23: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|24: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|25: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|26: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|27: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|28: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|29: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|30: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, diff --git a/test/snapshots/logquiet.golden b/test/snapshots/logquiet.golden index d5c4703b..1289761b 100644 --- a/test/snapshots/logquiet.golden +++ b/test/snapshots/logquiet.golden @@ -1,7 +1,7 @@ == snap quiet grid=100x31 cursor=62,5 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol -|$ /tmp/pardes-snap/logquiet/cwd Save Tty Del Togglettymode Filter Collapse +| New Tty Find Grep Joincol Delcol +|$ /tmp/pardes-snap/logquiet/cwd Tty Save Mode Filter Collapse Del | $ ls | $ printf '\033_Ga=q,i=1,s=1,v=1,f=24,t=d;AAAA\033\\\033[>0p' | $ '\033_Ga=q,i=1,s=1,v=1,f=24,t=d;AAAA\033\\\033[>0p'Gi=1;OK diff --git a/test/snapshots/look-center.golden b/test/snapshots/look-center.golden index 7509da8f..e13a7886 100644 --- a/test/snapshots/look-center.golden +++ b/test/snapshots/look-center.golden @@ -1,11 +1,11 @@ == snap center-open grid=150x31 cursor=7,12 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol New Tty Find Grep Joincol -| /tmp/pardes-snap/look-center/cwd Save Tty Del Togglettymode Filter Collap /tmp/pardes-snap/look-center/cwd Save Tty Del Togglettymode Filter Collap -| ls ls -| big.txt big.txt -| -| /tmp/pardes-snap/look-center/cwd/big.txt Save Tty Del Collapse +| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/look-center/cwd Tty Save Mode Filter Collapse Del /tmp/pardes-snap/look-center/cwd Tty Save Mode Filter Collapse Del +| Look ls +| ls big.txt +| big.txt +| /tmp/pardes-snap/look-center/cwd/big.txt Save Tty Collapse Del | 95 line 95 | 96 line 96 | 97 line 97 @@ -16,13 +16,16 @@ | 102 line 102 | 103 line 103 | 104 line 104 -| /tmp/pardes-snap/look-center/cwd Save Tty Del Togglettymode Filter Collap +| /tmp/pardes-snap/look-center/cwd Tty Save Mode Filter Collapse Del | ls | big.txt == snap center-dedup grid=150x31 cursor=7,12 +|3: ls Look +|4: big.txt ls +|5: big.txt |7: 145 line 145 -|8: 146 line 146 big.txt:150 big.txt:2 -|9: 147 line 147 +|8: 146 line 146 +|9: 147 line 147 big.txt:150 big.txt:2 |10: 148 line 148 |11: 149 line 149 |12: 150 line 150 @@ -30,14 +33,9 @@ |14: 152 line 152 |15: 153 line 153 |16: 154 line 154 -== snap center-clamp grid=150x31 cursor=7,8 -|7: 1 line 1 -|8: 2 line 2 big.txt:150 big.txt:2 -|9: 3 line 3 -|10: 4 line 4 -|11: 5 line 5 -|12: 6 line 6 -|13: 7 line 7 -|14: 8 line 8 -|15: 9 line 9 -|16: 10 line 10 +== snap center-clamp grid=150x31 cursor=93,7 +|3: ls ls +|4: big.txt big.txt +|5: +|8: 146 line 146 big.txt:150 big.txt:2 +|9: 147 line 147 diff --git a/test/snapshots/look-dir.golden b/test/snapshots/look-dir.golden index e859a3f4..8f90d604 100644 --- a/test/snapshots/look-dir.golden +++ b/test/snapshots/look-dir.golden @@ -1,11 +1,11 @@ == snap dir-open grid=100x31 cursor=4,9 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol New Tty Find Grep Joincol -| /tmp/pardes-snap/look-dir/cwd Save Tty Del Toggl /tmp/pardes-snap/look-dir/cwd Save Tty Del Toggl -| ls ls -| sub top.txt sub top.txt -| -| /tmp/pardes-snap/look-dir/cwd/sub Save Tty Del T +| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/look-dir/cwd Tty Save Mode Fil /tmp/pardes-snap/look-dir/cwd Tty Save Mode Fil +| Look ls +| ls sub top.txt +| sub top.txt +| /tmp/pardes-snap/look-dir/cwd/sub Tty Save Mode | ls | inner.txt | @@ -16,6 +16,6 @@ | | | -| /tmp/pardes-snap/look-dir/cwd Save Tty Del Toggl +| /tmp/pardes-snap/look-dir/cwd Tty Save Mode Fil | ls | sub top.txt diff --git a/test/snapshots/look-file-1col.golden b/test/snapshots/look-file-1col.golden index 553e1942..abe1fcbb 100644 --- a/test/snapshots/look-file-1col.golden +++ b/test/snapshots/look-file-1col.golden @@ -1,11 +1,11 @@ == snap file-open-1col grid=100x31 cursor=7,19 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol -| /tmp/pardes-snap/look-file-1col/cwd Save Tty Del Togglettymode Filter Collapse +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/look-file-1col/cwd Tty Save Mode Filter Collapse Del +| Look | ls | big.txt -| -| /tmp/pardes-snap/look-file-1col/cwd/big.txt Save Tty Del Collapse +| /tmp/pardes-snap/look-file-1col/cwd/big.txt Save Tty Collapse Del | 28 line 28 | 29 line 29 | 30 line 30 diff --git a/test/snapshots/look-file.golden b/test/snapshots/look-file.golden index dccbb07c..13919c3d 100644 --- a/test/snapshots/look-file.golden +++ b/test/snapshots/look-file.golden @@ -1,11 +1,11 @@ == snap file-open grid=150x31 cursor=7,12 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol New Tty Find Grep Joincol -| /tmp/pardes-snap/look-file/cwd Save Tty Del Togglettymode Filter Collapse /tmp/pardes-snap/look-file/cwd Save Tty Del Togglettymode Filter Collapse -| ls ls -| big.txt big.txt -| -| /tmp/pardes-snap/look-file/cwd/big.txt Save Tty Del Collapse +| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/look-file/cwd Tty Save Mode Filter Collapse Del /tmp/pardes-snap/look-file/cwd Tty Save Mode Filter Collapse Del +| Look ls +| ls big.txt +| big.txt +| /tmp/pardes-snap/look-file/cwd/big.txt Save Tty Collapse Del | 35 line 35 | 36 line 36 | 37 line 37 @@ -16,38 +16,38 @@ | 42 line 42 | 43 line 43 | 44 line 44 -| /tmp/pardes-snap/look-file/cwd Save Tty Del Togglettymode Filter Collapse +| /tmp/pardes-snap/look-file/cwd Tty Save Mode Filter Collapse Del | ls | big.txt == style file-open grid=150x31 |0: 0-70 #b2c3b8,#1d2824, 71-149 d,#1d2824, -|1: 0-24 #becfc4,#26362d, 25-74 d,#26362d, 75-99 #b2c3b8,#1d2824, 100-149 d,#1d2824, -|2: 0-1 #ffffff,#4c6356, 2-74 #b2c3b8,#1d2824, 75-76 #ffffff,#4c6356, 77-149 #b2c3b8,#1d2824, -|3: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|4: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|5: 0-0 d,#637f6a, 1-74 d,#0d1410, 75-75 d,#637f6a, 76-149 d,#0d1410, -|6: 0-1 #000000,#adcc91, 2-61 #becfc4,#26362d, 62-74 d,#26362d, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|7: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-13 #e5eee5,#0d1410, 14-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|8: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-13 #e5eee5,#0d1410, 14-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|9: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-13 #e5eee5,#0d1410, 14-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|10: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-13 #e5eee5,#0d1410, 14-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|11: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-13 #e5eee5,#0d1410, 14-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|12: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-13 #e5eee5,#0d1410, 14-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|13: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-13 #e5eee5,#0d1410, 14-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|14: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-13 #e5eee5,#0d1410, 14-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|15: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-13 #e5eee5,#0d1410, 14-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|16: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-13 #e5eee5,#0d1410, 14-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|17: 0-1 #ffffff,#4c6356, 2-74 #b2c3b8,#1d2824, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|18: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|19: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|20: 0-0 d,#637f6a, 1-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|21: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|22: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|23: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|24: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|25: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|26: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|27: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|28: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|29: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|30: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|1: 0-1 #ffffff,#887455, 2-2 d,#26362d, 3-34 #becfc4,#26362d, 35-74 d,#26362d, 75-76 #ffffff,#887455, 77-77 d,#1d2824, 78-109 #b2c3b8,#1d2824, 110-149 d,#1d2824, +|2: 0-1 #ffffff,#496656, 2-2 d,#1d2824, 3-33 #b2c3b8,#1d2824, 34-36 #d3b0d9,#1d2824, 37-66 #b2c3b8,#1d2824, 67-74 d,#1d2824, 75-76 #ffffff,#496656, 77-77 d,#1d2824, 78-108 #b2c3b8,#1d2824, 109-111 #d3b0d9,#1d2824, 112-141 #b2c3b8,#1d2824, 142-149 d,#1d2824, +|3: 0-0 d,#152019, 1-1 d,#0d1410, 2-70 d,#1d2824, 71-74 #b2c3b8,#1d2824, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|4: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|5: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-149 d,#0d1410, +|6: 0-1 #000000,#add38a, 2-2 d,#26362d, 3-33 #becfc4,#26362d, 34-40 #dfbce5,#26362d, 41-62 #becfc4,#26362d, 63-74 d,#26362d, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|7: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-13 #e5eee5,#0d1410, 14-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|8: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-13 #e5eee5,#0d1410, 14-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|9: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-13 #e5eee5,#0d1410, 14-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|10: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-13 #e5eee5,#0d1410, 14-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|11: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-13 #e5eee5,#0d1410, 14-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|12: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-13 #e5eee5,#0d1410, 14-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|13: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-13 #e5eee5,#0d1410, 14-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|14: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-13 #e5eee5,#0d1410, 14-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|15: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-13 #e5eee5,#0d1410, 14-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|16: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-13 #e5eee5,#0d1410, 14-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|17: 0-1 #ffffff,#496656, 2-2 d,#1d2824, 3-33 #b2c3b8,#1d2824, 34-36 #d3b0d9,#1d2824, 37-66 #b2c3b8,#1d2824, 67-74 d,#1d2824, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|18: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|19: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|20: 0-0 d,#608269, 1-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|21: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|22: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|23: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|24: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|25: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|26: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|27: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|28: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|29: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|30: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, diff --git a/test/snapshots/lookloaded.golden b/test/snapshots/lookloaded.golden index 1ff8c44f..a55151f4 100644 --- a/test/snapshots/lookloaded.golden +++ b/test/snapshots/lookloaded.golden @@ -1,11 +1,11 @@ == snap file-open grid=100x31 cursor=7,12 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol New Tty Find Grep Joincol -| /tmp/pardes-snap/lookloaded/cwd Save Tty Del Tog /tmp/pardes-snap/lookloaded/cwd Save Tty Del Tog -| ls ls -| big.txt big.txt -| -| /tmp/pardes-snap/lookloaded/cwd/big.txt Save Tty +| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/lookloaded/cwd Tty Save Mode F /tmp/pardes-snap/lookloaded/cwd Tty Save Mode F +| Look ls +| ls big.txt +| big.txt +| /tmp/pardes-snap/lookloaded/cwd/big.txt Save Tt | 35 line 35 | 36 line 36 | 37 line 37 @@ -16,16 +16,22 @@ | 42 line 42 | 43 line 43 | 44 line 44 -| /tmp/pardes-snap/lookloaded/cwd Save Tty Del Tog +| /tmp/pardes-snap/lookloaded/cwd Tty Save Mode F | ls | big.txt == snap removed grid=100x31 cursor=54,7 +|3: ls ls +|4: big.txt big.txt |5: rm big.txt; echo GO''NE -|6: /tmp/pardes-snap/lookloaded/cwd/big.txt Save Tty GONE +|6: /tmp/pardes-snap/lookloaded/cwd/big.txt Save Tt GONE == snap look-noFS grid=100x31 cursor=7,12 -|7: 5 line 5 -|8: 6 line 6 big.txt:10 -|9: 7 line 7 +|3: ls Look +|4: big.txt ls +|5: big.txt +|6: /tmp/pardes-snap/lookloaded/cwd/big.txt Save Tt rm big.txt; echo GO''NE +|7: 5 line 5 GONE +|8: 6 line 6 +|9: 7 line 7 big.txt:10 |10: 8 line 8 |11: 9 line 9 |12: 10 line 10 diff --git a/test/snapshots/lookpanes.golden b/test/snapshots/lookpanes.golden index 73aab814..c2ef30cb 100644 --- a/test/snapshots/lookpanes.golden +++ b/test/snapshots/lookpanes.golden @@ -1,74 +1,74 @@ == snap shells grid=130x51 cursor=122,4 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol New Tty Find Grep Joincol -| /tmp/pardes-snap/lookpanes/cwd/beta/bmark.txt Save Tty Del Coll /tmp/pardes-snap/lookpanes/cwd Save Tty Del Togglettymode Filte +| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/lookpanes/cwd/beta/bmark.txt Save Tty Collaps /tmp/pardes-snap/lookpanes/cwd Tty Save Mode Filter Collapse D | 1 both.txt ls | 2 b-marker alpha beta zzboot.txt zqonly.txt pick.txt twin.txt | -| /tmp/pardes-snap/lookpanes/cwd/alpha Save Tty Del Togglettymode +| /tmp/pardes-snap/lookpanes/cwd/alpha Tty Save Mode Filter Coll | ls | amark.txt both.txt pick.txt twin.txt zqonly.txt == snap other-dir grid=130x51 cursor=7,28 -|27: /tmp/pardes-snap/lookpanes/cwd/alpha/zqonly.txt Save Tty Del Co +|27: /tmp/pardes-snap/lookpanes/cwd/alpha/zqonly.txt Save Tty Colla |28: 1 ONLY-IN-ALPHA == snap clicked-wins grid=130x51 cursor=7,16 -|15: /tmp/pardes-snap/lookpanes/cwd/beta/both.txt Save Tty Del Colla +|15: /tmp/pardes-snap/lookpanes/cwd/beta/both.txt Save Tty Collapse |16: 1 BOTH-FROM-BETA == snap mru-alpha grid=130x51 cursor=7,22 -|21: /tmp/pardes-snap/lookpanes/cwd/alpha/pick.txt Save Tty Del Coll +|21: /tmp/pardes-snap/lookpanes/cwd/alpha/pick.txt Save Tty Collaps |22: 1 PICK-FROM-ALPHA == snap mru-beta grid=130x51 cursor=7,10 -|9: /tmp/pardes-snap/lookpanes/cwd/beta/twin.txt Save Tty Del Colla +|9: /tmp/pardes-snap/lookpanes/cwd/beta/twin.txt Save Tty Collapse |10: 1 TWIN-FROM-BETA == style mru-beta grid=130x51 |0: 0-70 #b2c3b8,#1d2824, 71-129 d,#1d2824, -|1: 0-24 #becfc4,#26362d, 25-64 d,#26362d, 65-89 #b2c3b8,#1d2824, 90-129 d,#1d2824, -|2: 0-1 #ffffff,#4c6356, 2-64 #b2c3b8,#1d2824, 65-66 #ffffff,#4c6356, 67-129 #b2c3b8,#1d2824, -|3: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-14 #e5eee5,#0d1410, 15-64 d,#0d1410, 65-65 d,#637f6a, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, -|4: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-14 #e5eee5,#0d1410, 15-64 d,#0d1410, 65-65 d,#637f6a, 66-66 d,#0d1410, 67-121 #e5eee5,#0d1410, 122-129 d,#0d1410, -|5: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-64 d,#0d1410, 65-65 d,#637f6a, 66-129 d,#0d1410, -|6: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-64 d,#0d1410, 65-66 #ffffff,#4c6356, 67-129 #b2c3b8,#1d2824, -|7: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-64 d,#0d1410, 65-65 d,#637f6a, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, -|8: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-64 d,#0d1410, 65-65 d,#637f6a, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, -|9: 0-1 #000000,#adcc91, 2-64 #becfc4,#26362d, 65-65 d,#637f6a, 66-129 d,#0d1410, -|10: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-20 #e5eee5,#0d1410, 21-64 d,#0d1410, 65-65 d,#637f6a, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, -|11: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-64 d,#0d1410, 65-65 d,#637f6a, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, -|12: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-64 d,#0d1410, 65-65 d,#637f6a, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, -|13: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-64 d,#0d1410, 65-65 d,#637f6a, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, -|14: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-64 d,#0d1410, 65-65 d,#637f6a, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, -|15: 0-1 #ffffff,#4c6356, 2-64 #b2c3b8,#1d2824, 65-65 d,#637f6a, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, -|16: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-20 #e5eee5,#0d1410, 21-64 d,#0d1410, 65-65 d,#637f6a, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, -|17: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-64 d,#0d1410, 65-65 d,#637f6a, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, -|18: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-64 d,#0d1410, 65-65 d,#637f6a, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, -|19: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-64 d,#0d1410, 65-65 d,#637f6a, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, -|20: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-64 d,#0d1410, 65-65 d,#637f6a, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, -|21: 0-1 #ffffff,#4c6356, 2-64 #b2c3b8,#1d2824, 65-65 d,#637f6a, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, -|22: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-21 #e5eee5,#0d1410, 22-64 d,#0d1410, 65-65 d,#637f6a, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, -|23: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-64 d,#0d1410, 65-65 d,#637f6a, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, -|24: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-64 d,#0d1410, 65-65 d,#637f6a, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, -|25: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-64 d,#0d1410, 65-65 d,#637f6a, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, -|26: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-64 d,#0d1410, 65-65 d,#637f6a, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, -|27: 0-1 #ffffff,#4c6356, 2-64 #b2c3b8,#1d2824, 65-65 d,#637f6a, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, -|28: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-19 #e5eee5,#0d1410, 20-64 d,#0d1410, 65-65 d,#637f6a, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, -|29: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-64 d,#0d1410, 65-65 d,#637f6a, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, -|30: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-64 d,#0d1410, 65-65 d,#637f6a, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, -|31: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-64 d,#0d1410, 65-65 d,#637f6a, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, -|32: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-64 d,#0d1410, 65-65 d,#637f6a, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, -|33: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-64 d,#0d1410, 65-65 d,#637f6a, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, -|34: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-64 d,#0d1410, 65-65 d,#637f6a, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, -|35: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-64 d,#0d1410, 65-65 d,#637f6a, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, -|36: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-64 d,#0d1410, 65-65 d,#637f6a, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, -|37: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-64 d,#0d1410, 65-65 d,#637f6a, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, -|38: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-64 d,#0d1410, 65-65 d,#637f6a, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, -|39: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-64 d,#0d1410, 65-65 d,#637f6a, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, -|40: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-64 d,#0d1410, 65-65 d,#637f6a, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, -|41: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-64 d,#0d1410, 65-65 d,#637f6a, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, -|42: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-64 d,#0d1410, 65-65 d,#637f6a, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, -|43: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-64 d,#0d1410, 65-65 d,#637f6a, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, -|44: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-64 d,#0d1410, 65-65 d,#637f6a, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, -|45: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-64 d,#0d1410, 65-65 d,#637f6a, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, -|46: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-64 d,#0d1410, 65-65 d,#637f6a, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, -|47: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-64 d,#0d1410, 65-65 d,#637f6a, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, -|48: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-64 d,#0d1410, 65-65 d,#637f6a, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, -|49: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-64 d,#0d1410, 65-65 d,#637f6a, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, -|50: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-64 d,#0d1410, 65-65 d,#637f6a, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, +|1: 0-1 #ffffff,#887455, 2-2 d,#26362d, 3-34 #becfc4,#26362d, 35-64 d,#26362d, 65-66 #ffffff,#887455, 67-67 d,#1d2824, 68-99 #b2c3b8,#1d2824, 100-129 d,#1d2824, +|2: 0-1 #ffffff,#496656, 2-2 d,#1d2824, 3-38 #b2c3b8,#1d2824, 39-47 #d3b0d9,#1d2824, 48-64 #b2c3b8,#1d2824, 65-66 #ffffff,#496656, 67-67 d,#1d2824, 68-98 #b2c3b8,#1d2824, 99-101 #d3b0d9,#1d2824, 102-129 #b2c3b8,#1d2824, +|3: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-14 #e5eee5,#0d1410, 15-64 d,#0d1410, 65-65 d,#608269, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, +|4: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-14 #e5eee5,#0d1410, 15-64 d,#0d1410, 65-65 d,#608269, 66-66 d,#0d1410, 67-121 #e5eee5,#0d1410, 122-129 d,#0d1410, +|5: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-64 d,#0d1410, 65-65 d,#608269, 66-129 d,#0d1410, +|6: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-64 d,#0d1410, 65-66 #ffffff,#496656, 67-67 d,#1d2824, 68-104 #b2c3b8,#1d2824, 105-107 #d3b0d9,#1d2824, 108-129 #b2c3b8,#1d2824, +|7: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-64 d,#0d1410, 65-65 d,#608269, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, +|8: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-64 d,#0d1410, 65-65 d,#608269, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, +|9: 0-1 #000000,#add38a, 2-2 d,#26362d, 3-38 #becfc4,#26362d, 39-46 #dfbce5,#26362d, 47-64 #becfc4,#26362d, 65-65 d,#608269, 66-129 d,#0d1410, +|10: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-20 #e5eee5,#0d1410, 21-64 d,#0d1410, 65-65 d,#608269, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, +|11: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-64 d,#0d1410, 65-65 d,#608269, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, +|12: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-64 d,#0d1410, 65-65 d,#608269, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, +|13: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-64 d,#0d1410, 65-65 d,#608269, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, +|14: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-64 d,#0d1410, 65-65 d,#608269, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, +|15: 0-1 #ffffff,#496656, 2-2 d,#1d2824, 3-38 #b2c3b8,#1d2824, 39-46 #d3b0d9,#1d2824, 47-64 #b2c3b8,#1d2824, 65-65 d,#608269, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, +|16: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-20 #e5eee5,#0d1410, 21-64 d,#0d1410, 65-65 d,#608269, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, +|17: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-64 d,#0d1410, 65-65 d,#608269, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, +|18: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-64 d,#0d1410, 65-65 d,#608269, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, +|19: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-64 d,#0d1410, 65-65 d,#608269, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, +|20: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-64 d,#0d1410, 65-65 d,#608269, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, +|21: 0-1 #ffffff,#496656, 2-2 d,#1d2824, 3-39 #b2c3b8,#1d2824, 40-47 #d3b0d9,#1d2824, 48-64 #b2c3b8,#1d2824, 65-65 d,#608269, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, +|22: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-21 #e5eee5,#0d1410, 22-64 d,#0d1410, 65-65 d,#608269, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, +|23: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-64 d,#0d1410, 65-65 d,#608269, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, +|24: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-64 d,#0d1410, 65-65 d,#608269, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, +|25: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-64 d,#0d1410, 65-65 d,#608269, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, +|26: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-64 d,#0d1410, 65-65 d,#608269, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, +|27: 0-1 #ffffff,#496656, 2-2 d,#1d2824, 3-39 #b2c3b8,#1d2824, 40-49 #d3b0d9,#1d2824, 50-64 #b2c3b8,#1d2824, 65-65 d,#608269, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, +|28: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-19 #e5eee5,#0d1410, 20-64 d,#0d1410, 65-65 d,#608269, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, +|29: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-64 d,#0d1410, 65-65 d,#608269, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, +|30: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-64 d,#0d1410, 65-65 d,#608269, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, +|31: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-64 d,#0d1410, 65-65 d,#608269, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, +|32: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-64 d,#0d1410, 65-65 d,#608269, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, +|33: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-64 d,#0d1410, 65-65 d,#608269, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, +|34: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-64 d,#0d1410, 65-65 d,#608269, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, +|35: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-64 d,#0d1410, 65-65 d,#608269, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, +|36: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-64 d,#0d1410, 65-65 d,#608269, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, +|37: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-64 d,#0d1410, 65-65 d,#608269, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, +|38: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-64 d,#0d1410, 65-65 d,#608269, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, +|39: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-64 d,#0d1410, 65-65 d,#608269, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, +|40: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-64 d,#0d1410, 65-65 d,#608269, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, +|41: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-64 d,#0d1410, 65-65 d,#608269, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, +|42: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-64 d,#0d1410, 65-65 d,#608269, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, +|43: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-64 d,#0d1410, 65-65 d,#608269, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, +|44: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-64 d,#0d1410, 65-65 d,#608269, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, +|45: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-64 d,#0d1410, 65-65 d,#608269, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, +|46: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-64 d,#0d1410, 65-65 d,#608269, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, +|47: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-64 d,#0d1410, 65-65 d,#608269, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, +|48: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-64 d,#0d1410, 65-65 d,#608269, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, +|49: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-64 d,#0d1410, 65-65 d,#608269, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, +|50: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-64 d,#0d1410, 65-65 d,#608269, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, diff --git a/test/snapshots/lookpanes.snap b/test/snapshots/lookpanes.snap index 3bc8055c..8ada3f1b 100644 --- a/test/snapshots/lookpanes.snap +++ b/test/snapshots/lookpanes.snap @@ -20,6 +20,10 @@ file beta/both.txt BOTH-FROM-BETA # directory at that) and Alt-c puts it in a column of its own on the right; # its first line is a word to look FROM that pane file beta/bmark.txt both.txt\nb-marker +# Builtins announce themselves by default, and an announcement is a band at +# the top of the body -- which moves every row this script clicks. What the +# verbs do is what is under test, not the announcement. +config Verbose off start 51 130 beta/bmark.txt wait 8000 b-marker stable 700 20000 diff --git a/test/snapshots/lookrange.golden b/test/snapshots/lookrange.golden index 4e916932..129ee285 100644 --- a/test/snapshots/lookrange.golden +++ b/test/snapshots/lookrange.golden @@ -1,13 +1,13 @@ == snap opened grid=150x31 cursor=7,3 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol -| /tmp/pardes-snap/lookrange/cwd/look.txt Save Tty Del Collapse +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/lookrange/cwd/look.txt Save Tty Collapse Del | 1 r.txt:3-5 | 2 r.txt:7:4-9 | 3 r.txt:3:2-5:3 | 4 r.txt:8:6-99:9 == snap wholelines grid=150x31 cursor=11,22 -|17: /tmp/pardes-snap/lookrange/cwd/r.txt Save Tty Del Collapse +|17: /tmp/pardes-snap/lookrange/cwd/r.txt Save Tty Collapse Del |18: 1 aaaa |19: 2 bbbb |20: 3 cccc dccc @@ -19,48 +19,48 @@ |26: 9 iiii == style wholelines grid=150x31 |0: 0-70 #b2c3b8,#1d2824, 71-149 d,#1d2824, -|1: 0-24 #becfc4,#26362d, 25-149 d,#26362d, -|2: 0-1 #ffffff,#4c6356, 2-62 #b2c3b8,#1d2824, 63-149 d,#1d2824, -|3: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-15 #e5eee5,#0d1410, 16-149 d,#0d1410, -|4: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-17 #e5eee5,#0d1410, 18-149 d,#0d1410, -|5: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-19 #e5eee5,#0d1410, 20-149 d,#0d1410, -|6: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-20 #e5eee5,#0d1410, 21-149 d,#0d1410, -|7: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 d,#0d1410, -|8: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 d,#0d1410, -|9: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 d,#0d1410, -|10: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 d,#0d1410, -|11: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 d,#0d1410, -|12: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 d,#0d1410, -|13: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 d,#0d1410, -|14: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 d,#0d1410, -|15: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 d,#0d1410, -|16: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 d,#0d1410, -|17: 0-1 #000000,#adcc91, 2-59 #becfc4,#26362d, 60-149 d,#26362d, -|18: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-149 d,#0d1410, -|19: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-149 d,#0d1410, -|20: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 #f5f7ee,#405d4b, -|21: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 #f5f7ee,#405d4b, -|22: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-11 #f5f7ee,#405d4b, 12-149 d,#0d1410, -|23: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-149 d,#0d1410, -|24: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-18 #e5eee5,#0d1410, 19-149 d,#0d1410, -|25: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-17 #e5eee5,#0d1410, 18-149 d,#0d1410, -|26: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-149 d,#0d1410, -|27: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 d,#0d1410, -|28: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 d,#0d1410, -|29: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 d,#0d1410, -|30: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 d,#0d1410, +|1: 0-1 #ffffff,#887455, 2-2 d,#26362d, 3-34 #becfc4,#26362d, 35-149 d,#26362d, +|2: 0-1 #ffffff,#496656, 2-2 d,#1d2824, 3-33 #b2c3b8,#1d2824, 34-41 #d3b0d9,#1d2824, 42-63 #b2c3b8,#1d2824, 64-149 d,#1d2824, +|3: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-15 #e5eee5,#0d1410, 16-149 d,#0d1410, +|4: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-17 #e5eee5,#0d1410, 18-149 d,#0d1410, +|5: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-19 #e5eee5,#0d1410, 20-149 d,#0d1410, +|6: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-20 #e5eee5,#0d1410, 21-149 d,#0d1410, +|7: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 d,#0d1410, +|8: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 d,#0d1410, +|9: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 d,#0d1410, +|10: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 d,#0d1410, +|11: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 d,#0d1410, +|12: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 d,#0d1410, +|13: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 d,#0d1410, +|14: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 d,#0d1410, +|15: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 d,#0d1410, +|16: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 d,#0d1410, +|17: 0-1 #000000,#add38a, 2-2 d,#26362d, 3-33 #becfc4,#26362d, 34-38 #dfbce5,#26362d, 39-60 #becfc4,#26362d, 61-149 d,#26362d, +|18: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-149 d,#0d1410, +|19: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-149 d,#0d1410, +|20: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 #f5f7ee,#3c614a, +|21: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 #f5f7ee,#3c614a, +|22: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-11 #f5f7ee,#3c614a, 12-149 d,#0d1410, +|23: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-149 d,#0d1410, +|24: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-18 #e5eee5,#0d1410, 19-149 d,#0d1410, +|25: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-17 #e5eee5,#0d1410, 18-149 d,#0d1410, +|26: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-149 d,#0d1410, +|27: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 d,#0d1410, +|28: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 d,#0d1410, +|29: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 d,#0d1410, +|30: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 d,#0d1410, == snap onelinespan grid=150x31 cursor=15,24 == style onelinespan grid=150x31 -|20: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-15 #e5eee5,#0d1410, 16-149 d,#0d1410, -|21: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-149 d,#0d1410, -|22: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-149 d,#0d1410, -|24: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-9 #e5eee5,#0d1410, 10-15 #f5f7ee,#405d4b, 16-18 #e5eee5,#0d1410, 19-149 d,#0d1410, +|20: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-15 #e5eee5,#0d1410, 16-149 d,#0d1410, +|21: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-149 d,#0d1410, +|22: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-149 d,#0d1410, +|24: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-9 #e5eee5,#0d1410, 10-15 #f5f7ee,#3c614a, 16-18 #e5eee5,#0d1410, 19-149 d,#0d1410, == snap fullspan grid=150x31 cursor=9,22 == style fullspan grid=150x31 -|20: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-7 #e5eee5,#0d1410, 8-149 #f5f7ee,#405d4b, -|21: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 #f5f7ee,#405d4b, -|22: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-9 #f5f7ee,#405d4b, 10-10 #e5eee5,#0d1410, 11-149 d,#0d1410, -|24: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-18 #e5eee5,#0d1410, 19-149 d,#0d1410, +|20: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-7 #e5eee5,#0d1410, 8-149 #f5f7ee,#3c614a, +|21: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 #f5f7ee,#3c614a, +|22: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-9 #f5f7ee,#3c614a, 10-10 #e5eee5,#0d1410, 11-149 d,#0d1410, +|24: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-18 #e5eee5,#0d1410, 19-149 d,#0d1410, == snap stale grid=150x31 cursor=10,25 |18: 2 bbbb |19: 3 cccc dccc @@ -73,14 +73,14 @@ |26: == style stale grid=150x31 |18: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-149 d,#0d1410, -|19: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-15 #e5eee5,#0d1410, 16-149 d,#0d1410, -|20: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-149 d,#0d1410, -|21: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-149 d,#0d1410, -|22: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-149 d,#0d1410, -|23: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-18 #e5eee5,#0d1410, 19-149 d,#0d1410, -|24: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-11 #e5eee5,#0d1410, 12-149 #f5f7ee,#405d4b, -|25: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-10 #f5f7ee,#405d4b, 11-149 d,#0d1410, -|26: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 d,#0d1410, +|19: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-15 #e5eee5,#0d1410, 16-149 d,#0d1410, +|20: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-149 d,#0d1410, +|21: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-149 d,#0d1410, +|22: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-149 d,#0d1410, +|23: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-18 #e5eee5,#0d1410, 19-149 d,#0d1410, +|24: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-11 #e5eee5,#0d1410, 12-149 #f5f7ee,#3c614a, +|25: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-10 #f5f7ee,#3c614a, 11-149 d,#0d1410, +|26: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 d,#0d1410, == snap hit1 grid=150x31 cursor=15,24 |18: 1 aaaa |19: 2 bbbb @@ -90,22 +90,41 @@ |23: 6 ffff |24: 7 gg NEEDLE gg |25: 8 hhhh NEEDLE -|26: 9 iiii -|28: /tmp/pardes-snap/lookrange/cwd/+Search Save Tty Del Collapse -|29: 1 r.txt:7:4-9 gg NEEDLE gg -|30: 2 r.txt:8:6-11 hhhh NEEDLE +|26: /tmp/pardes-snap/lookrange/cwd/+Search Save Tty Collapse Del LocationsConfig +|27: 1 r.txt:7:4-9 +|28: 2 gg NEEDLE gg +|29: 3 r.txt:8:6-11 +|30: 4 hhhh NEEDLE == style hit1 grid=150x31 -|18: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-149 d,#0d1410, -|19: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-149 d,#0d1410, -|20: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-15 #e5eee5,#0d1410, 16-149 d,#0d1410, -|23: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-149 d,#0d1410, -|24: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-9 #e5eee5,#0d1410, 10-15 #f5f7ee,#405d4b, 16-18 #e5eee5,#0d1410, 19-149 d,#0d1410, -|25: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-17 #e5eee5,#0d1410, 18-149 d,#0d1410, -|26: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-149 d,#0d1410, -|28: 0-1 #ffffff,#4c6356, 2-61 #b2c3b8,#1d2824, 62-149 d,#1d2824, -|29: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-17 #59675c,#0d1410, 18-21 #e5eee5,#0d1410, 22-27 #f7e4a5,#57472a, 28-30 #e5eee5,#0d1410, 31-149 d,#0d1410, -|30: 0-0 d,#152019, 1-1 d,#0d1410, 2-18 #59675c,#0d1410, 19-24 #e5eee5,#0d1410, 25-30 #f7e4a5,#57472a, 31-149 d,#0d1410, -== snap hit2 grid=150x31 cursor=17,23 +|18: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-149 d,#0d1410, +|19: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-149 d,#0d1410, +|20: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-15 #e5eee5,#0d1410, 16-149 d,#0d1410, +|23: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-149 d,#0d1410, +|24: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-9 #e5eee5,#0d1410, 10-15 #f5f7ee,#3c614a, 16-18 #e5eee5,#0d1410, 19-149 d,#0d1410, +|25: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-17 #e5eee5,#0d1410, 18-149 d,#0d1410, +|26: 0-1 #ffffff,#496656, 2-2 d,#1d2824, 3-33 #b2c3b8,#1d2824, 34-40 #d3b0d9,#1d2824, 41-78 #b2c3b8,#1d2824, 79-149 d,#1d2824, +|27: 0-0 d,#608269, 1-1 d,#0d1410, 2-17 #59675c,#0d1410, 18-149 d,#0d1410, +|28: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-9 #e5eee5,#0d1410, 10-15 #f7e4a5,#5e4923, 16-18 #e5eee5,#0d1410, 19-149 d,#0d1410, +|29: 0-0 d,#608269, 1-1 d,#0d1410, 2-18 #59675c,#0d1410, 19-149 d,#0d1410, +|30: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-11 #e5eee5,#0d1410, 12-17 #f7e4a5,#5e4923, 18-149 d,#0d1410, +== snap hit2 grid=150x31 cursor=17,22 +|18: 4 dddd +|19: 5 eeee +|20: 6 ffff +|21: 7 gg NEEDLE gg +|22: 8 hhhh NEEDLE +|23: 9 iiii +|24: +|25: +== style hit2 grid=150x31 +|18: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-149 d,#0d1410, +|19: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-149 d,#0d1410, +|20: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-149 d,#0d1410, +|21: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-18 #e5eee5,#0d1410, 19-149 d,#0d1410, +|22: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-11 #e5eee5,#0d1410, 12-17 #f5f7ee,#3c614a, 18-149 d,#0d1410, +|24: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 d,#0d1410, +|25: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 d,#0d1410, +== snap back grid=150x31 cursor=15,22 |18: 3 cccc dccc |19: 4 dddd |20: 5 eeee @@ -113,30 +132,10 @@ |22: 7 gg NEEDLE gg |23: 8 hhhh NEEDLE |24: 9 iiii -|25: -|26: -== style hit2 grid=150x31 -|18: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-15 #e5eee5,#0d1410, 16-149 d,#0d1410, -|19: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-149 d,#0d1410, -|20: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-149 d,#0d1410, -|22: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-18 #e5eee5,#0d1410, 19-149 d,#0d1410, -|23: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-11 #e5eee5,#0d1410, 12-17 #f5f7ee,#405d4b, 18-149 d,#0d1410, -|24: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-149 d,#0d1410, -|25: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 d,#0d1410, -|26: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 d,#0d1410, -== snap back grid=150x31 cursor=15,23 -|18: 2 bbbb -|19: 3 cccc dccc -|20: 4 dddd -|21: 5 eeee -|22: 6 ffff -|23: 7 gg NEEDLE gg -|24: 8 hhhh NEEDLE -|25: 9 iiii == style back grid=150x31 -|18: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-149 d,#0d1410, -|19: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-15 #e5eee5,#0d1410, 16-149 d,#0d1410, -|22: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-149 d,#0d1410, -|23: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-9 #e5eee5,#0d1410, 10-15 #f5f7ee,#405d4b, 16-18 #e5eee5,#0d1410, 19-149 d,#0d1410, -|24: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-17 #e5eee5,#0d1410, 18-149 d,#0d1410, -|25: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-149 d,#0d1410, +|18: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-15 #e5eee5,#0d1410, 16-149 d,#0d1410, +|19: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-149 d,#0d1410, +|21: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-149 d,#0d1410, +|22: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-9 #e5eee5,#0d1410, 10-15 #f5f7ee,#3c614a, 16-18 #e5eee5,#0d1410, 19-149 d,#0d1410, +|23: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-17 #e5eee5,#0d1410, 18-149 d,#0d1410, +|24: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-149 d,#0d1410, diff --git a/test/snapshots/lookrange.snap b/test/snapshots/lookrange.snap index c1fde9c6..50ef9ad3 100644 --- a/test/snapshots/lookrange.snap +++ b/test/snapshots/lookrange.snap @@ -14,6 +14,10 @@ # in the styles. file r.txt aaaa\nbbbb\ncccc dccc\ndddd\neeee\nffff\ngg NEEDLE gg\nhhhh NEEDLE\niiii file look.txt r.txt:3-5\nr.txt:7:4-9\nr.txt:3:2-5:3\nr.txt:8:6-99:9 +# Builtins announce themselves by default, and an announcement is a band at +# the top of the body -- which moves every row this script clicks. What the +# verbs do is what is under test, not the announcement. +config Verbose off start 31 150 look.txt wait 8000 r.txt:3-5 stable 700 20000 @@ -54,7 +58,9 @@ snapstyle stale key / text NEEDLE key enter -wait 10000 r.txt:7:4-9 gg NEEDLE +# Locations stack the target under its line now: two rows, two waits. +wait 10000 r.txt:7:4-9 +wait 10000 gg NEEDLE gg stable 700 15000 snap hit1 snapstyle hit1 diff --git a/test/snapshots/lsp-client-edit.golden b/test/snapshots/lsp-client-edit.golden index 02cc9a37..54c6e083 100644 --- a/test/snapshots/lsp-client-edit.golden +++ b/test/snapshots/lsp-client-edit.golden @@ -1,7 +1,8 @@ -== snap formatted grid=100x25 cursor=7,4 +== snap formatted grid=100x25 cursor=7,5 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol -| /tmp/pardes-snap/lsp-client-edit/cwd/main.rs * Save Tty Del Collapse +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/lsp-client-edit/cwd/main.rs * Save Tty Collapse Del TreeContext +| formatted 1 range(s) | 1 // formatted by mock | 2 mod lib; | 3 @@ -11,19 +12,6 @@ | 7 let _ = x + y; | 8 } | 9 -| -| -| -| -| -| -| -| -| -| -| -| -| formatted 1 range(s) == snap unformatted grid=100x25 cursor=7,3 |3: 1 mod lib; |4: 2 @@ -34,12 +22,24 @@ |9: 7 } |10: 8 |11: -|24: -== snap renamed grid=100x25 cursor=12,5 -|6: 4 let x = sum(1, 2); -|7: 5 let y = sum(3, 4); -|24: renamed 2 range(s) +|12: +== snap renamed grid=100x25 cursor=12,6 +|3: renamed 2 range(s) +|4: 1 mod lib; +|5: 2 +|6: 3 fn main() { +|7: 4 let x = sum(1, 2); +|8: 5 let y = sum(3, 4); +|9: 6 let _ = x + y; +|10: 7 } +|11: 8 == snap unrenamed grid=100x25 cursor=12,5 +|3: 1 mod lib; +|4: 2 +|5: 3 fn main() { |6: 4 let x = add(1, 2); |7: 5 let y = add(3, 4); -|24: +|8: 6 let _ = x + y; +|9: 7 } +|10: 8 +|11: diff --git a/test/snapshots/lsp-client.golden b/test/snapshots/lsp-client.golden index 6e122e95..6d4a0c0f 100644 --- a/test/snapshots/lsp-client.golden +++ b/test/snapshots/lsp-client.golden @@ -1,7 +1,8 @@ == snap gd-jumped grid=100x25 cursor=16,16 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol -| /tmp/pardes-snap/lsp-client/cwd/main.rs Save Tty Del Collapse +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/lsp-client/cwd/main.rs Save Tty Collapse Del TreeContext +| --:--:-- lsp rust-analyzer: ready | 1 mod lib; | 2 | 3 fn main() { @@ -12,24 +13,33 @@ | 8 | | -| --:--:-- lsp rust-analyzer: ready -| /tmp/pardes-snap/lsp-client/cwd/lib.rs Save Tty Del Collapse +| /tmp/pardes-snap/lsp-client/cwd/lib.rs Save Tty Collapse Del TreeContext | 1 // mock fixture | 2 pub fn add(a: i32, b: i32) -> i32 { | 3 a + b | 4 } | 5 == snap gr-list grid=100x25 cursor=21,6 -|13: -|21: /tmp/pardes-snap/lsp-client/cwd/+Search Save Tty Del Collapse -|22: 1 lib.rs:2:8-10 pub fn add(a: i32, b: i32) -> i32 { -|23: 2 main.rs:4:13-15 let x = add(1, 2); -|24: 3 main.rs:5:13-15 let y = add(3, 4); +|3: 1 mod lib; +|4: 2 +|5: 3 fn main() { +|6: 4 let x = add(1, 2); +|7: 5 let y = add(3, 4); +|8: 6 let _ = x + y; +|9: 7 } +|10: 8 +|11: +|20: /tmp/pardes-snap/lsp-client/cwd/+Search Save Tty Collapse Del LocationsConfig +|21: 1 lib.rs:2:8-10 +|22: 2 pub fn add(a: i32, b: i32) -> i32 { +|23: 3 main.rs:4:13-15 +|24: 4 let x = add(1, 2); == snap gr-opened grid=100x25 cursor=21,7 -|22: 2 main.rs:4:13-15 let x = add(1, 2); -|23: 3 main.rs:5:13-15 let y = add(3, 4); -|24: 4 +|21: Look +|22: 3 main.rs:4:13-15 +|23: 4 let x = add(1, 2); +|24: 5 main.rs:5:13-15 == snap gr-back grid=100x25 cursor=21,6 -|22: 1 lib.rs:2:8-10 pub fn add(a: i32, b: i32) -> i32 { -|23: 2 main.rs:4:13-15 let x = add(1, 2); -|24: 3 main.rs:5:13-15 let y = add(3, 4); +|22: 2 pub fn add(a: i32, b: i32) -> i32 { +|23: 3 main.rs:4:13-15 +|24: 4 let x = add(1, 2); diff --git a/test/snapshots/lsp-rename.golden b/test/snapshots/lsp-rename.golden index 74ab41e2..d18e6566 100644 --- a/test/snapshots/lsp-rename.golden +++ b/test/snapshots/lsp-rename.golden @@ -1,7 +1,8 @@ -== snap renamed grid=110x25 cursor=17,10 +== snap renamed grid=110x25 cursor=17,11 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol -| /tmp/pardes-snap/lsp-rename/cwd/rename.zig * Save Tty Del Collapse +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/lsp-rename/cwd/rename.zig * Save Tty Collapse Del TreeContext +| renamed 2 range(s) | 1 const std = @import("std"); | 2 | 3 fn renamed_helper(x: u32) u32 { @@ -17,17 +18,23 @@ | 13 _ = helper; | 14 } | 15 -| -| -| -| -| -| -| renamed 2 range(s) == snap undone grid=110x25 cursor=17,10 +|3: 1 const std = @import("std"); +|4: 2 |5: 3 fn helper(x: u32) u32 { +|6: 4 return x + 1; +|7: 5 } +|8: 6 +|9: 7 pub fn main() void { |10: 8 _ = helper(41); -|24: +|11: 9 } +|12: 10 +|13: 11 fn shadowed() void { +|14: 12 const helper: u32 = 7; +|15: 13 _ = helper; +|16: 14 } +|17: 15 +|18: == snap redone grid=110x25 cursor=17,10 |5: 3 fn renamed_helper(x: u32) u32 { |10: 8 _ = renamed_helper(41); diff --git a/test/snapshots/lsp.golden b/test/snapshots/lsp.golden index f6d0739a..7baf7716 100644 --- a/test/snapshots/lsp.golden +++ b/test/snapshots/lsp.golden @@ -1,7 +1,7 @@ == snap opened grid=120x41 cursor=7,3 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol -| /tmp/pardes-snap/lsp/cwd/a.zig Save Tty Del Collapse +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/lsp/cwd/a.zig Save Tty Collapse Del TreeContext | 1 const std = @import("std"); | 2 | 3 fn helper(x: u32) u32 { @@ -14,14 +14,52 @@ | 10 == snap cursor grid=120x41 cursor=17,10 == snap definition grid=120x41 cursor=15,5 -== snap hover grid=120x41 cursor=15,5 -|38: /tmp/pardes-snap/lsp/cwd/+Hover Save Tty Del Collapse +== snap hover grid=120x41 cursor=15,6 +|3: Hover +|4: 1 const std = @import("std"); +|5: 2 +|6: 3 fn helper(x: u32) u32 { +|7: 4 return x + 1; +|8: 5 } +|9: 6 +|10: 7 pub fn main() void { +|11: 8 _ = helper(41); +|12: 9 } +|13: 10 +|38: /tmp/pardes-snap/lsp/cwd/+Hover Save Tty Collapse Del |39: 1 fn helper(x: u32) u32 |40: 2 (fn (u32) u32) -== snap symbols grid=120x41 cursor=15,5 -|34: /tmp/pardes-snap/lsp/cwd/+Search Save Tty Del Collapse -|35: 1 a.zig:1:7-9 std -|36: 2 a.zig:3:4-9 helper fn helper(x: u32) u32 -|37: 3 a.zig:7:8-11 main fn main() void +== snap symbols grid=120x41 cursor=15,6 +|3: Symbols +|31: /tmp/pardes-snap/lsp/cwd/+Search Save Tty Collapse Del LocationsConfig +|32: 1 a.zig:1:7-9 +|33: 2 std +|34: 3 a.zig:3:4-9 +|35: 4 helper fn helper(x: u32) u32 +|36: 5 a.zig:7:8-11 +|37: 6 main fn main() void == snap step grid=120x41 cursor=15,3 +|3: 1 const std = @import("std"); +|4: 2 +|5: 3 fn helper(x: u32) u32 { +|6: 4 return x + 1; +|7: 5 } +|8: 6 +|9: 7 pub fn main() void { +|10: 8 _ = helper(41); +|11: 9 } +|12: 10 +|13: +|32: Look +|33: 1 a.zig:1:7-9 +|34: 2 std +|35: 3 a.zig:3:4-9 +|36: 4 helper fn helper(x: u32) u32 +|37: 5 a.zig:7:8-11 == snap nothing grid=120x41 cursor=7,5 +|32: 1 a.zig:1:7-9 +|33: 2 std +|34: 3 a.zig:3:4-9 +|35: 4 helper fn helper(x: u32) u32 +|36: 5 a.zig:7:8-11 +|37: 6 main fn main() void diff --git a/test/snapshots/lspcomplete.golden b/test/snapshots/lspcomplete.golden index 3c4316c3..4a9ff8b5 100644 --- a/test/snapshots/lspcomplete.golden +++ b/test/snapshots/lspcomplete.golden @@ -1,7 +1,7 @@ == snap opened grid=120x41 cursor=7,3 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol -| /tmp/pardes-snap/lspcomplete/cwd/a.zig Save Tty Del Collapse +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/lspcomplete/cwd/a.zig Save Tty Collapse Del TreeContext | 1 const Shade = enum { | 2 verdigris, | 3 cinnabar, @@ -16,29 +16,31 @@ | 12 // note. see below | 13 == snap indent grid=120x41 cursor=11,12 -|2: ^ /tmp/pardes-snap/lspcomplete/cwd/a.zig * Save Tty Del Collapse +|2: ^ /tmp/pardes-snap/lspcomplete/cwd/a.zig * Save Tty Collapse Del TreeContext |12: 10 } == snap commentindent grid=120x41 cursor=19,14 |14: 12 // note. see below == snap athedot grid=120x41 cursor=16,10 |10: 8 . == snap completion grid=120x41 cursor=16,10 -|38: /tmp/pardes-snap/lspcomplete/cwd/+Search Save Tty Del Collapse +|38: /tmp/pardes-snap/lspcomplete/cwd/+Search Save Tty Collapse Del |39: 1 a.zig:2:5-13 verdigris verdigris, |40: 2 a.zig:3:5-12 cinnabar cinnabar, == snap refill grid=120x41 cursor=16,10 == snap step grid=120x41 cursor=19,4 -|2: /tmp/pardes-snap/lspcomplete/cwd/a.zig * Save Tty Del Collapse +|2: /tmp/pardes-snap/lspcomplete/cwd/a.zig * Save Tty Collapse Del TreeContext +|39: Look +|40: 1 a.zig:2:5-13 verdigris verdigris, == snap txtindent grid=120x41 cursor=15,3 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol -|^ /tmp/pardes-snap/lspcomplete/cwd/notes.txt * Save Tty Del Collapse +| New Tty Find Grep Joincol Delcol +|^ /tmp/pardes-snap/lspcomplete/cwd/notes.txt * Save Tty Collapse Del | 1 abc. def ghi | 2 == snap nosemi grid=100x19 cursor=29,9 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol -|^ /tmp/pardes-snap/lspcomplete/cwd/c.zig * Save Tty Del Collapse +| New Tty Find Grep Joincol Delcol +|^ /tmp/pardes-snap/lspcomplete/cwd/c.zig * Save Tty Collapse Del TreeContext | 1 const Shade = enum { | 2 verdigris, | 3 cinnabar, @@ -52,13 +54,13 @@ | | | -| /tmp/pardes-snap/lspcomplete/cwd/+Search Save Tty Del Collapse +| /tmp/pardes-snap/lspcomplete/cwd/+Search Save Tty Collapse Del | 1 c.zig:2:5-13 verdigris verdigris, | 2 c.zig:3:5-12 cinnabar cinnabar, == snap nobrace grid=100x19 cursor=16,10 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol -|^ /tmp/pardes-snap/lspcomplete/cwd/d.zig * Save Tty Del Collapse +| New Tty Find Grep Joincol Delcol +|^ /tmp/pardes-snap/lspcomplete/cwd/d.zig * Save Tty Collapse Del TreeContext | 1 const Shade = enum { | 2 verdigris, | 3 cinnabar, @@ -72,6 +74,6 @@ | | | -| /tmp/pardes-snap/lspcomplete/cwd/+Search Save Tty Del Collapse +| /tmp/pardes-snap/lspcomplete/cwd/+Search Save Tty Collapse Del | 1 d.zig:2:5-13 verdigris verdigris, | 2 d.zig:3:5-12 cinnabar cinnabar, diff --git a/test/snapshots/lspcompletemoved.golden b/test/snapshots/lspcompletemoved.golden index 6232a1f3..af6616af 100644 --- a/test/snapshots/lspcompletemoved.golden +++ b/test/snapshots/lspcompletemoved.golden @@ -1,7 +1,7 @@ == snap typedthrough grid=120x21 cursor=16,14 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol -|^ /tmp/pardes-snap/lspcompletemoved/cwd/a.zig * Save Tty Del Collapse +| New Tty Find Grep Joincol Delcol +|^ /tmp/pardes-snap/lspcompletemoved/cwd/a.zig * Save Tty Collapse Del TreeContext | 1 const Shade = enum { | 2 verdigris, | 3 cinnabar, diff --git a/test/snapshots/lspdebug.golden b/test/snapshots/lspdebug.golden index e1b57c5e..a2182231 100644 --- a/test/snapshots/lspdebug.golden +++ b/test/snapshots/lspdebug.golden @@ -1,7 +1,7 @@ == snap opened grid=120x45 cursor=7,3 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol -| /tmp/pardes-snap/lspdebug/cwd/z.zig Save Tty Del Collapse +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/lspdebug/cwd/z.zig Save Tty Collapse Del TreeContext | 1 const std = @import("std"); | 2 | 3 fn helper() u32 { diff --git a/test/snapshots/lspdebug.snap b/test/snapshots/lspdebug.snap index 4021bc17..23a95db0 100644 --- a/test/snapshots/lspdebug.snap +++ b/test/snapshots/lspdebug.snap @@ -1,4 +1,8 @@ file z.zig const std = @import("std");\n\nfn helper() u32 {\n return 3;\n}\n\npub fn main() void {\n const v = helper();\n _ = v;\n}\n +# Builtins announce themselves by default, and an announcement is a band at +# the top of the body -- which moves every row this script clicks. What the +# verbs do is what is under test, not the announcement. +config Verbose off start 45 120 z.zig wait 8000 fn helper stable 700 20000 @@ -38,6 +42,9 @@ text last queries key enter wait 10000 last queries wait 10000 definition z.zig +# The results pane the search opened takes the bottom half, which leaves the +# report one row short of its second query: step the cursor past it. +key j j j wait 10000 explain z.zig key space d key space w j diff --git a/test/snapshots/lsprelpath.golden b/test/snapshots/lsprelpath.golden index 65fd08cd..58de860b 100644 --- a/test/snapshots/lsprelpath.golden +++ b/test/snapshots/lsprelpath.golden @@ -1,7 +1,7 @@ == snap absrow grid=100x35 cursor=16,7 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol -|^ /tmp/pardes-snap/lsprelpath/cwd/sub/parent.zig * Save Tty Del Collapse +| New Tty Find Grep Joincol Delcol +|^ /tmp/pardes-snap/lsprelpath/cwd/sub/parent.zig * Save Tty Collapse Del TreeContext | 1 const shade = @import("../shade.zig"); | 2 | 3 pub fn pick(s: shade.Shade) u8 { @@ -31,57 +31,59 @@ | | | -| /tmp/pardes-snap/lsprelpath/cwd/sub/+Search Save Tty Del Collapse +| /tmp/pardes-snap/lsprelpath/cwd/sub/+Search Save Tty Collapse Del | 1 /tmp/pardes-snap/lsprelpath/cwd/shade.zig:2:5-13 verdigris verdigris, | 2 /tmp/pardes-snap/lsprelpath/cwd/shade.zig:3:5-12 cinnabar cinnabar, == snap abslook grid=100x35 cursor=19,19 -|2: /tmp/pardes-snap/lsprelpath/cwd/sub/parent.zig * Save Tty Del Collapse -|17: /tmp/pardes-snap/lsprelpath/cwd/shade.zig Save Tty Del Collapse +|2: /tmp/pardes-snap/lsprelpath/cwd/sub/parent.zig * Save Tty Collapse Del TreeContext +|17: /tmp/pardes-snap/lsprelpath/cwd/shade.zig Save Tty Collapse Del TreeContext |18: 1 pub const Shade = enum { |19: 2 verdigris, |20: 3 cinnabar, |21: 4 }; |22: 5 +|33: Look +|34: 1 /tmp/pardes-snap/lsprelpath/cwd/shade.zig:2:5-13 verdigris verdigris, == style abslook grid=100x35 |0: 0-70 #b2c3b8,#1d2824, 71-99 d,#1d2824, -|1: 0-24 #becfc4,#26362d, 25-99 d,#26362d, -|2: 0-1 #ffffff,#4c6356, 2-71 #b2c3b8,#1d2824, 72-99 d,#1d2824, -|3: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-20 #e5eee5,#0d1410, 21-27 #c9b0e4,#0d1410, 28-28 #e5eee5,#0d1410, 29-42 #b6ce94,#0d1410, 43-44 #e5eee5,#0d1410, 45-99 d,#0d1410, -|4: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-99 d,#0d1410, -|5: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-12 #c9b0e4,#0d1410, 13-38 #e5eee5,#0d1410, 39-99 d,#0d1410, -|6: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-16 #c9b0e4,#0d1410, 17-17 #e5eee5,#0d1410, 18-23 #c9b0e4,#0d1410, 24-29 #e5eee5,#0d1410, 30-99 d,#0d1410, -|7: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-15 #e5eee5,#0d1410, 16-99 d,#0d1410, -|8: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-12 #e5eee5,#0d1410, 13-99 d,#0d1410, -|9: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-7 #e5eee5,#0d1410, 8-99 d,#0d1410, -|10: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-99 d,#0d1410, -|11: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-99 d,#0d1410, -|12: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-99 d,#0d1410, -|13: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-99 d,#0d1410, -|14: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-99 d,#0d1410, -|15: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-99 d,#0d1410, -|16: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-99 d,#0d1410, -|17: 0-1 #000000,#adcc91, 2-64 #becfc4,#26362d, 65-99 d,#26362d, -|18: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-24 #e5eee5,#0d1410, 25-28 #c9b0e4,#0d1410, 29-30 #e5eee5,#0d1410, 31-99 d,#0d1410, -|19: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-10 #e5eee5,#0d1410, 11-19 #f5f7ee,#405d4b, 20-20 #e5eee5,#0d1410, 21-99 d,#0d1410, -|20: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-19 #e5eee5,#0d1410, 20-99 d,#0d1410, -|21: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-8 #e5eee5,#0d1410, 9-99 d,#0d1410, -|22: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-99 d,#0d1410, -|23: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-99 d,#0d1410, -|24: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-99 d,#0d1410, -|25: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-99 d,#0d1410, -|26: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-99 d,#0d1410, -|27: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-99 d,#0d1410, -|28: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-99 d,#0d1410, -|29: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-99 d,#0d1410, -|30: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-99 d,#0d1410, -|31: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-99 d,#0d1410, -|32: 0-1 #ffffff,#4c6356, 2-66 #b2c3b8,#1d2824, 67-99 d,#1d2824, -|33: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-54 #59675c,#0d1410, 55-76 #e5eee5,#0d1410, 77-99 d,#0d1410, -|34: 0-0 d,#152019, 1-1 d,#0d1410, 2-54 #59675c,#0d1410, 55-74 #e5eee5,#0d1410, 75-99 d,#0d1410, +|1: 0-1 #ffffff,#887455, 2-2 d,#26362d, 3-34 #becfc4,#26362d, 35-99 d,#26362d, +|2: 0-1 #ffffff,#496656, 2-2 d,#1d2824, 3-38 #b2c3b8,#1d2824, 39-48 #d3b0d9,#1d2824, 49-84 #b2c3b8,#1d2824, 85-99 d,#1d2824, +|3: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-20 #e5eee5,#0d1410, 21-27 #c9a7ed,#0d1410, 28-28 #e5eee5,#0d1410, 29-42 #b8d88a,#0d1410, 43-44 #e5eee5,#0d1410, 45-99 d,#0d1410, +|4: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-99 d,#0d1410, +|5: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-12 #c9a7ed,#0d1410, 13-38 #e5eee5,#0d1410, 39-99 d,#0d1410, +|6: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-16 #c9a7ed,#0d1410, 17-17 #e5eee5,#0d1410, 18-23 #c9a7ed,#0d1410, 24-29 #e5eee5,#0d1410, 30-99 d,#0d1410, +|7: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-15 #e5eee5,#0d1410, 16-99 d,#0d1410, +|8: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-12 #e5eee5,#0d1410, 13-99 d,#0d1410, +|9: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-7 #e5eee5,#0d1410, 8-99 d,#0d1410, +|10: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-99 d,#0d1410, +|11: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-99 d,#0d1410, +|12: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-99 d,#0d1410, +|13: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-99 d,#0d1410, +|14: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-99 d,#0d1410, +|15: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-99 d,#0d1410, +|16: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-99 d,#0d1410, +|17: 0-1 #000000,#add38a, 2-2 d,#26362d, 3-34 #becfc4,#26362d, 35-43 #dfbce5,#26362d, 44-77 #becfc4,#26362d, 78-99 d,#26362d, +|18: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-24 #e5eee5,#0d1410, 25-28 #c9a7ed,#0d1410, 29-30 #e5eee5,#0d1410, 31-99 d,#0d1410, +|19: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-10 #e5eee5,#0d1410, 11-19 #f5f7ee,#3c614a, 20-20 #e5eee5,#0d1410, 21-99 d,#0d1410, +|20: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-19 #e5eee5,#0d1410, 20-99 d,#0d1410, +|21: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-8 #e5eee5,#0d1410, 9-99 d,#0d1410, +|22: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-99 d,#0d1410, +|23: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-99 d,#0d1410, +|24: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-99 d,#0d1410, +|25: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-99 d,#0d1410, +|26: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-99 d,#0d1410, +|27: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-99 d,#0d1410, +|28: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-99 d,#0d1410, +|29: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-99 d,#0d1410, +|30: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-99 d,#0d1410, +|31: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-99 d,#0d1410, +|32: 0-1 #ffffff,#496656, 2-2 d,#1d2824, 3-38 #b2c3b8,#1d2824, 39-45 #d3b0d9,#1d2824, 46-67 #b2c3b8,#1d2824, 68-99 d,#1d2824, +|33: 0-0 d,#152019, 1-1 d,#0d1410, 2-95 d,#1d2824, 96-99 #b2c3b8,#1d2824, +|34: 0-0 d,#608269, 1-1 d,#0d1410, 2-54 #59675c,#0d1410, 55-76 #e5eee5,#0d1410, 77-99 d,#0d1410, == snap subrow grid=100x35 cursor=16,7 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol -|^ /tmp/pardes-snap/lsprelpath/cwd/sub/subdir.zig * Save Tty Del Collapse +| New Tty Find Grep Joincol Delcol +|^ /tmp/pardes-snap/lsprelpath/cwd/sub/subdir.zig * Save Tty Collapse Del TreeContext | 1 const tint = @import("inner/tint.zig"); | 2 | 3 pub fn hue(t: tint.Tint) u8 { @@ -111,51 +113,53 @@ | | | -| /tmp/pardes-snap/lsprelpath/cwd/sub/+Search Save Tty Del Collapse +| /tmp/pardes-snap/lsprelpath/cwd/sub/+Search Save Tty Collapse Del | 1 inner/tint.zig:2:5-9 ochre ochre, | 2 inner/tint.zig:3:5-10 indigo indigo, == snap sublook grid=100x35 cursor=15,19 -|2: /tmp/pardes-snap/lsprelpath/cwd/sub/subdir.zig * Save Tty Del Collapse -|17: /tmp/pardes-snap/lsprelpath/cwd/sub/inner/tint.zig Save Tty Del Collapse +|2: /tmp/pardes-snap/lsprelpath/cwd/sub/subdir.zig * Save Tty Collapse Del TreeContext +|17: /tmp/pardes-snap/lsprelpath/cwd/sub/inner/tint.zig Save Tty Collapse Del TreeContext |18: 1 pub const Tint = enum { |19: 2 ochre, |20: 3 indigo, |21: 4 }; |22: 5 +|33: Look +|34: 1 inner/tint.zig:2:5-9 ochre ochre, == style sublook grid=100x35 |0: 0-70 #b2c3b8,#1d2824, 71-99 d,#1d2824, -|1: 0-24 #becfc4,#26362d, 25-99 d,#26362d, -|2: 0-1 #ffffff,#4c6356, 2-71 #b2c3b8,#1d2824, 72-99 d,#1d2824, -|3: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-19 #e5eee5,#0d1410, 20-26 #c9b0e4,#0d1410, 27-27 #e5eee5,#0d1410, 28-43 #b6ce94,#0d1410, 44-45 #e5eee5,#0d1410, 46-99 d,#0d1410, -|4: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-99 d,#0d1410, -|5: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-12 #c9b0e4,#0d1410, 13-35 #e5eee5,#0d1410, 36-99 d,#0d1410, -|6: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-16 #c9b0e4,#0d1410, 17-17 #e5eee5,#0d1410, 18-23 #c9b0e4,#0d1410, 24-29 #e5eee5,#0d1410, 30-99 d,#0d1410, -|7: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-15 #e5eee5,#0d1410, 16-99 d,#0d1410, -|8: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-12 #e5eee5,#0d1410, 13-99 d,#0d1410, -|9: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-7 #e5eee5,#0d1410, 8-99 d,#0d1410, -|10: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-99 d,#0d1410, -|11: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-99 d,#0d1410, -|12: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-99 d,#0d1410, -|13: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-99 d,#0d1410, -|14: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-99 d,#0d1410, -|15: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-99 d,#0d1410, -|16: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-99 d,#0d1410, -|17: 0-1 #000000,#adcc91, 2-73 #becfc4,#26362d, 74-99 d,#26362d, -|18: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-23 #e5eee5,#0d1410, 24-27 #c9b0e4,#0d1410, 28-29 #e5eee5,#0d1410, 30-99 d,#0d1410, -|19: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-10 #e5eee5,#0d1410, 11-15 #f5f7ee,#405d4b, 16-16 #e5eee5,#0d1410, 17-99 d,#0d1410, -|20: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-17 #e5eee5,#0d1410, 18-99 d,#0d1410, -|21: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-8 #e5eee5,#0d1410, 9-99 d,#0d1410, -|22: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-99 d,#0d1410, -|23: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-99 d,#0d1410, -|24: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-99 d,#0d1410, -|25: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-99 d,#0d1410, -|26: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-99 d,#0d1410, -|27: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-99 d,#0d1410, -|28: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-99 d,#0d1410, -|29: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-99 d,#0d1410, -|30: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-99 d,#0d1410, -|31: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-99 d,#0d1410, -|32: 0-1 #ffffff,#4c6356, 2-66 #b2c3b8,#1d2824, 67-99 d,#1d2824, -|33: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-26 #59675c,#0d1410, 27-40 #e5eee5,#0d1410, 41-99 d,#0d1410, -|34: 0-0 d,#152019, 1-1 d,#0d1410, 2-27 #59675c,#0d1410, 28-43 #e5eee5,#0d1410, 44-99 d,#0d1410, -== snap clicked grid=100x35 cursor=16,20 +|1: 0-1 #ffffff,#887455, 2-2 d,#26362d, 3-34 #becfc4,#26362d, 35-99 d,#26362d, +|2: 0-1 #ffffff,#496656, 2-2 d,#1d2824, 3-38 #b2c3b8,#1d2824, 39-48 #d3b0d9,#1d2824, 49-84 #b2c3b8,#1d2824, 85-99 d,#1d2824, +|3: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-19 #e5eee5,#0d1410, 20-26 #c9a7ed,#0d1410, 27-27 #e5eee5,#0d1410, 28-43 #b8d88a,#0d1410, 44-45 #e5eee5,#0d1410, 46-99 d,#0d1410, +|4: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-99 d,#0d1410, +|5: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-12 #c9a7ed,#0d1410, 13-35 #e5eee5,#0d1410, 36-99 d,#0d1410, +|6: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-16 #c9a7ed,#0d1410, 17-17 #e5eee5,#0d1410, 18-23 #c9a7ed,#0d1410, 24-29 #e5eee5,#0d1410, 30-99 d,#0d1410, +|7: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-15 #e5eee5,#0d1410, 16-99 d,#0d1410, +|8: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-12 #e5eee5,#0d1410, 13-99 d,#0d1410, +|9: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-7 #e5eee5,#0d1410, 8-99 d,#0d1410, +|10: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-99 d,#0d1410, +|11: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-99 d,#0d1410, +|12: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-99 d,#0d1410, +|13: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-99 d,#0d1410, +|14: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-99 d,#0d1410, +|15: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-99 d,#0d1410, +|16: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-99 d,#0d1410, +|17: 0-1 #000000,#add38a, 2-2 d,#26362d, 3-44 #becfc4,#26362d, 45-52 #dfbce5,#26362d, 53-86 #becfc4,#26362d, 87-99 d,#26362d, +|18: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-23 #e5eee5,#0d1410, 24-27 #c9a7ed,#0d1410, 28-29 #e5eee5,#0d1410, 30-99 d,#0d1410, +|19: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-10 #e5eee5,#0d1410, 11-15 #f5f7ee,#3c614a, 16-16 #e5eee5,#0d1410, 17-99 d,#0d1410, +|20: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-17 #e5eee5,#0d1410, 18-99 d,#0d1410, +|21: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-8 #e5eee5,#0d1410, 9-99 d,#0d1410, +|22: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-99 d,#0d1410, +|23: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-99 d,#0d1410, +|24: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-99 d,#0d1410, +|25: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-99 d,#0d1410, +|26: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-99 d,#0d1410, +|27: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-99 d,#0d1410, +|28: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-99 d,#0d1410, +|29: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-99 d,#0d1410, +|30: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-99 d,#0d1410, +|31: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-99 d,#0d1410, +|32: 0-1 #ffffff,#496656, 2-2 d,#1d2824, 3-38 #b2c3b8,#1d2824, 39-45 #d3b0d9,#1d2824, 46-67 #b2c3b8,#1d2824, 68-99 d,#1d2824, +|33: 0-0 d,#152019, 1-1 d,#0d1410, 2-95 d,#1d2824, 96-99 #b2c3b8,#1d2824, +|34: 0-0 d,#608269, 1-1 d,#0d1410, 2-26 #59675c,#0d1410, 27-40 #e5eee5,#0d1410, 41-99 d,#0d1410, +== snap clicked grid=100x35 cursor=15,19 diff --git a/test/snapshots/markup.golden b/test/snapshots/markup.golden index 7caaf5b1..ca69d0f7 100644 --- a/test/snapshots/markup.golden +++ b/test/snapshots/markup.golden @@ -1,7 +1,7 @@ == snap typst grid=92x25 cursor=7,3 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol -| /tmp/pardes-snap/markup/cwd/paper.typ Save Tty Del Collapse +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/markup/cwd/paper.typ Save Tty Collapse Del TreeContext | 1 = Typst heading | 2 | 3 Prose with *bold* and _italic_ words, a `raw` span, @@ -13,34 +13,34 @@ | 9 == style typst grid=92x25 |0: 0-70 #b2c3b8,#1d2824, 71-91 d,#1d2824, -|1: 0-24 #becfc4,#26362d, 25-91 d,#26362d, -|2: 0-1 #000000,#adcc91, 2-60 #becfc4,#26362d, 61-91 d,#26362d, -|3: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-21 #c9b0e4,#0d1410, 22-91 d,#0d1410, -|4: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-91 d,#0d1410, -|5: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-17 #e5eee5,#0d1410, 18-23 #b9e58f,#0d1410, 24-28 #e5eee5,#0d1410, 29-36 #e9bf91,#0d1410, 37-46 #e5eee5,#0d1410, 47-51 #b6ce94,#0d1410, 52-57 #e5eee5,#0d1410, 58-91 d,#0d1410, -|6: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-15 #c9b0e4,#0d1410, 16-27 #e5eee5,#0d1410, 28-31 #c9b0e4,#0d1410, 32-36 #e5eee5,#0d1410, 37-38 #e9bf91,#0d1410, 39-91 d,#0d1410, -|7: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-91 d,#0d1410, -|8: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-12 #b6ce94,#0d1410, 13-91 d,#0d1410, -|9: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-8 #c9b0e4,#0d1410, 9-23 #e5eee5,#0d1410, 24-29 #c9b0e4,#0d1410, 30-30 #e5eee5,#0d1410, 31-32 #e9bf91,#0d1410, 33-35 #e5eee5,#0d1410, 36-91 d,#0d1410, -|10: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-9 #b6ce94,#0d1410, 10-91 d,#0d1410, -|11: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-91 d,#0d1410, -|12: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-91 d,#0d1410, -|13: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-91 d,#0d1410, -|14: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-91 d,#0d1410, -|15: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-91 d,#0d1410, -|16: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-91 d,#0d1410, -|17: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-91 d,#0d1410, -|18: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-91 d,#0d1410, -|19: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-91 d,#0d1410, -|20: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-91 d,#0d1410, -|21: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-91 d,#0d1410, -|22: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-91 d,#0d1410, -|23: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-91 d,#0d1410, -|24: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-91 d,#0d1410, +|1: 0-1 #ffffff,#887455, 2-2 d,#26362d, 3-34 #becfc4,#26362d, 35-91 d,#26362d, +|2: 0-1 #000000,#add38a, 2-2 d,#26362d, 3-30 #becfc4,#26362d, 31-39 #dfbce5,#26362d, 40-73 #becfc4,#26362d, 74-91 d,#26362d, +|3: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-21 #c9a7ed,#0d1410, 22-91 d,#0d1410, +|4: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-91 d,#0d1410, +|5: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-17 #e5eee5,#0d1410, 18-23 #b9f480,#0d1410, 24-28 #e5eee5,#0d1410, 29-36 #f8c082,#0d1410, 37-46 #e5eee5,#0d1410, 47-51 #b8d88a,#0d1410, 52-57 #e5eee5,#0d1410, 58-91 d,#0d1410, +|6: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-15 #c9a7ed,#0d1410, 16-27 #e5eee5,#0d1410, 28-31 #c9a7ed,#0d1410, 32-36 #e5eee5,#0d1410, 37-38 #f8c082,#0d1410, 39-91 d,#0d1410, +|7: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-91 d,#0d1410, +|8: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-12 #b8d88a,#0d1410, 13-91 d,#0d1410, +|9: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-8 #c9a7ed,#0d1410, 9-23 #e5eee5,#0d1410, 24-29 #c9a7ed,#0d1410, 30-30 #e5eee5,#0d1410, 31-32 #f8c082,#0d1410, 33-35 #e5eee5,#0d1410, 36-91 d,#0d1410, +|10: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-9 #b8d88a,#0d1410, 10-91 d,#0d1410, +|11: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-91 d,#0d1410, +|12: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-91 d,#0d1410, +|13: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-91 d,#0d1410, +|14: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-91 d,#0d1410, +|15: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-91 d,#0d1410, +|16: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-91 d,#0d1410, +|17: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-91 d,#0d1410, +|18: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-91 d,#0d1410, +|19: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-91 d,#0d1410, +|20: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-91 d,#0d1410, +|21: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-91 d,#0d1410, +|22: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-91 d,#0d1410, +|23: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-91 d,#0d1410, +|24: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-91 d,#0d1410, == snap markdown grid=92x25 cursor=7,3 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol -| /tmp/pardes-snap/markup/cwd/notes.md Save Tty Del Collapse +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/markup/cwd/notes.md Save Tty Collapse Del TreeContext | 1 # Markdown heading with *italic* | 2 | 3 Prose with **bold**, *italic* and an `inline` span. @@ -51,27 +51,27 @@ | 8 == style markdown grid=92x25 |0: 0-70 #b2c3b8,#1d2824, 71-91 d,#1d2824, -|1: 0-24 #becfc4,#26362d, 25-91 d,#26362d, -|2: 0-1 #000000,#adcc91, 2-59 #becfc4,#26362d, 60-91 d,#26362d, -|3: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-8 #e5eee5,#0d1410, 9-30 #c9b0e4,#0d1410, 31-38 #e9bf91,#0d1410, 39-91 d,#0d1410, -|4: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-91 d,#0d1410, -|5: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-17 #e5eee5,#0d1410, 18-25 #b9e58f,#0d1410, 26-27 #e5eee5,#0d1410, 28-35 #e9bf91,#0d1410, 36-43 #e5eee5,#0d1410, 44-51 #b6ce94,#0d1410, 52-57 #e5eee5,#0d1410, 58-91 d,#0d1410, -|6: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-91 d,#0d1410, -|7: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-12 #b6ce94,#0d1410, 13-91 d,#0d1410, -|8: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-8 #c9b0e4,#0d1410, 9-23 #e5eee5,#0d1410, 24-29 #c9b0e4,#0d1410, 30-30 #e5eee5,#0d1410, 31-32 #e9bf91,#0d1410, 33-35 #e5eee5,#0d1410, 36-91 d,#0d1410, -|9: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-9 #b6ce94,#0d1410, 10-91 d,#0d1410, -|10: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-91 d,#0d1410, -|11: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-91 d,#0d1410, -|12: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-91 d,#0d1410, -|13: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-91 d,#0d1410, -|14: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-91 d,#0d1410, -|15: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-91 d,#0d1410, -|16: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-91 d,#0d1410, -|17: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-91 d,#0d1410, -|18: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-91 d,#0d1410, -|19: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-91 d,#0d1410, -|20: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-91 d,#0d1410, -|21: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-91 d,#0d1410, -|22: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-91 d,#0d1410, -|23: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-91 d,#0d1410, -|24: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-91 d,#0d1410, +|1: 0-1 #ffffff,#887455, 2-2 d,#26362d, 3-34 #becfc4,#26362d, 35-91 d,#26362d, +|2: 0-1 #000000,#add38a, 2-2 d,#26362d, 3-30 #becfc4,#26362d, 31-38 #dfbce5,#26362d, 39-72 #becfc4,#26362d, 73-91 d,#26362d, +|3: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-8 #e5eee5,#0d1410, 9-30 #c9a7ed,#0d1410, 31-38 #f8c082,#0d1410, 39-91 d,#0d1410, +|4: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-91 d,#0d1410, +|5: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-17 #e5eee5,#0d1410, 18-25 #b9f480,#0d1410, 26-27 #e5eee5,#0d1410, 28-35 #f8c082,#0d1410, 36-43 #e5eee5,#0d1410, 44-51 #b8d88a,#0d1410, 52-57 #e5eee5,#0d1410, 58-91 d,#0d1410, +|6: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-91 d,#0d1410, +|7: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-12 #b8d88a,#0d1410, 13-91 d,#0d1410, +|8: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-8 #c9a7ed,#0d1410, 9-23 #e5eee5,#0d1410, 24-29 #c9a7ed,#0d1410, 30-30 #e5eee5,#0d1410, 31-32 #f8c082,#0d1410, 33-35 #e5eee5,#0d1410, 36-91 d,#0d1410, +|9: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-9 #b8d88a,#0d1410, 10-91 d,#0d1410, +|10: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-91 d,#0d1410, +|11: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-91 d,#0d1410, +|12: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-91 d,#0d1410, +|13: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-91 d,#0d1410, +|14: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-91 d,#0d1410, +|15: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-91 d,#0d1410, +|16: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-91 d,#0d1410, +|17: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-91 d,#0d1410, +|18: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-91 d,#0d1410, +|19: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-91 d,#0d1410, +|20: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-91 d,#0d1410, +|21: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-91 d,#0d1410, +|22: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-91 d,#0d1410, +|23: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-91 d,#0d1410, +|24: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-91 d,#0d1410, diff --git a/test/snapshots/mini.golden b/test/snapshots/mini.golden index aac5dee6..b915c60b 100644 --- a/test/snapshots/mini.golden +++ b/test/snapshots/mini.golden @@ -1,7 +1,8 @@ == snap opened grid=90x23 cursor=7,14 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol -| /tmp/pardes-snap/mini/cwd/commands.txt Save Tty Del Collapse +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/mini/cwd/commands.txt Save Tty Collapse Del +| Mini | 1 @`Mini demo.zig` | | @@ -11,108 +12,118 @@ | | | -| -| /tmp/pardes-snap/mini/cwd/Mini demo.zig Save Tty Del Collapse +| /tmp/pardes-snap/mini/cwd/Mini demo.zig Save Tty Collapse Del | 1 ⠭⠍⣥⢩⣭⡭⣭⣬⣌⢭⣭⠌⠬⠅⠍⠁ | 2 ⣂⢀⣉⣉⢉⣈⢁⣀⣀⢀⣀⣀⣀⢀⣀⣀⣀⣀⣀ | 3 ⠉⠉⠁⠉⠉⠉⠈⠈⠉⠉⠉⠉⠉⠉ | 4 == style opened grid=90x23 |0: 0-70 #b2c3b8,#1d2824, 71-89 d,#1d2824, -|1: 0-24 #becfc4,#26362d, 25-89 d,#26362d, -|2: 0-1 #ffffff,#4c6356, 2-61 #b2c3b8,#1d2824, 62-89 d,#1d2824, -|3: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-22 #e5eee5,#0d1410, 23-89 d,#0d1410, -|4: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-89 d,#0d1410, -|5: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-89 d,#0d1410, -|6: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-89 d,#0d1410, -|7: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-89 d,#0d1410, -|8: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-89 d,#0d1410, -|9: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-89 d,#0d1410, -|10: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-89 d,#0d1410, -|11: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-89 d,#0d1410, -|12: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-89 d,#0d1410, -|13: 0-1 #000000,#adcc91, 2-62 #becfc4,#26362d, 63-89 d,#26362d, -|14: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-8 #e5eee5,#0d1410, 9-9 #c9b0e4,#0d1410, 10-12 #e5eee5,#0d1410, 13-15 #c9b0e4,#0d1410, 16-21 #b6ce94,#0d1410, 22-22 #e5eee5,#0d1410, 23-89 d,#0d1410, -|15: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-8 #b9e58f,#0d1410, 9-11 #c9b0e4,#0d1410, 12-25 #b9e58f,#0d1410, 26-89 d,#0d1410, -|16: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-17 #e5eee5,#0d1410, 18-19 #e9bf91,#0d1410, 20-20 #e5eee5,#0d1410, 21-89 d,#0d1410, -|17: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-89 d,#0d1410, -|18: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-89 d,#0d1410, -|19: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-89 d,#0d1410, -|20: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-89 d,#0d1410, -|21: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-89 d,#0d1410, -|22: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-89 d,#0d1410, +|1: 0-1 #ffffff,#887455, 2-2 d,#26362d, 3-34 #becfc4,#26362d, 35-89 d,#26362d, +|2: 0-1 #ffffff,#496656, 2-2 d,#1d2824, 3-28 #b2c3b8,#1d2824, 29-40 #d3b0d9,#1d2824, 41-62 #b2c3b8,#1d2824, 63-89 d,#1d2824, +|3: 0-0 d,#152019, 1-1 d,#0d1410, 2-85 d,#1d2824, 86-89 #b2c3b8,#1d2824, +|4: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-22 #e5eee5,#0d1410, 23-89 d,#0d1410, +|5: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-89 d,#0d1410, +|6: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-89 d,#0d1410, +|7: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-89 d,#0d1410, +|8: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-89 d,#0d1410, +|9: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-89 d,#0d1410, +|10: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-89 d,#0d1410, +|11: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-89 d,#0d1410, +|12: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-89 d,#0d1410, +|13: 0-1 #000000,#add38a, 2-2 d,#26362d, 3-28 #becfc4,#26362d, 29-41 #dfbce5,#26362d, 42-63 #becfc4,#26362d, 64-89 d,#26362d, +|14: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-8 #e5eee5,#0d1410, 9-9 #c9a7ed,#0d1410, 10-12 #e5eee5,#0d1410, 13-15 #c9a7ed,#0d1410, 16-21 #b8d88a,#0d1410, 22-22 #e5eee5,#0d1410, 23-89 d,#0d1410, +|15: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-8 #b9f480,#0d1410, 9-11 #c9a7ed,#0d1410, 12-25 #b9f480,#0d1410, 26-89 d,#0d1410, +|16: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-17 #e5eee5,#0d1410, 18-19 #f8c082,#0d1410, 20-20 #e5eee5,#0d1410, 21-89 d,#0d1410, +|17: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-89 d,#0d1410, +|18: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-89 d,#0d1410, +|19: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-89 d,#0d1410, +|20: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-89 d,#0d1410, +|21: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-89 d,#0d1410, +|22: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-89 d,#0d1410, == 9p opened grid=90x23 cursor=7,14,block |0: Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill @0: 0-70 #b2c3b8,#1d2824,,tagline 71-89 d,#1d2824,,tagline -|1: New Tty Find Grep Joincol -@1: 0-24 #becfc4,#26362d,,tagline 25-89 d,#26362d,,tagline -|2: /tmp/pardes-snap/mini/cwd/commands.txt Save Tty Del Collapse -@2: 0-1 #ffffff,#4c6356,,tagline 2-61 #b2c3b8,#1d2824,,tagline 62-89 d,#1d2824,,tagline -|3: 1 @`Mini demo.zig` -@3: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-22 #e5eee5,#0d1410,,body 23-89 d,#0d1410,,body -|4: -@4: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-89 d,#0d1410,,body +|1: New Tty Find Grep Joincol Delcol +@1: 0-1 #ffffff,#887455,,tagline 2-2 d,#26362d,,tagline 3-34 #becfc4,#26362d,,tagline 35-89 d,#26362d,,tagline +|2: /tmp/pardes-snap/mini/cwd/commands.txt Save Tty Collapse Del +@2: 0-1 #ffffff,#496656,,tagline 2-2 d,#1d2824,,tagline 3-28 #b2c3b8,#1d2824,,tagline 29-40 #d3b0d9,#1d2824,,tagline 41-62 #b2c3b8,#1d2824,,tagline 63-89 d,#1d2824,,tagline +|3: Mini +@3: 0-0 d,#152019,,body 1-1 d,#0d1410,,body 2-85 d,#1d2824,,tagline 86-89 #b2c3b8,#1d2824,,tagline +|4: 1 @`Mini demo.zig` +@4: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-22 #e5eee5,#0d1410,,body 23-89 d,#0d1410,,body |5: -@5: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-89 d,#0d1410,,body +@5: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-89 d,#0d1410,,body |6: -@6: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-89 d,#0d1410,,body +@6: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-89 d,#0d1410,,body |7: -@7: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-89 d,#0d1410,,body +@7: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-89 d,#0d1410,,body |8: -@8: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-89 d,#0d1410,,body +@8: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-89 d,#0d1410,,body |9: -@9: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-89 d,#0d1410,,body +@9: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-89 d,#0d1410,,body |10: -@10: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-89 d,#0d1410,,body +@10: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-89 d,#0d1410,,body |11: -@11: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-89 d,#0d1410,,body +@11: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-89 d,#0d1410,,body |12: -@12: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-89 d,#0d1410,,body -|13: /tmp/pardes-snap/mini/cwd/Mini demo.zig Save Tty Del Collapse -@13: 0-1 #000000,#adcc91,,tagline 2-62 #becfc4,#26362d,,tagline 63-89 d,#26362d,,tagline +@12: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-89 d,#0d1410,,body +|13: /tmp/pardes-snap/mini/cwd/Mini demo.zig Save Tty Collapse Del +@13: 0-1 #000000,#add38a,,tagline 2-2 d,#26362d,,tagline 3-28 #becfc4,#26362d,,tagline 29-41 #dfbce5,#26362d,,tagline 42-63 #becfc4,#26362d,,tagline 64-89 d,#26362d,,tagline |14: 1 ⠭⠍⣥⢩⣭⡭⣭⣬⣌⢭⣭⠌⠬⠅⠍⠁ +14: 7="⠭" 8="⠍" 9="⣥" 10="⢩" 11="⣭" 12="⡭" 13="⣭" 14="⣬" 15="⣌" 16="⢭" 17="⣭" 18="⠌" 19="⠬" 20="⠅" 21="⠍" 22="⠁" -@14: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #616f64,#0d1410,b,body 7-8 #e5eee5,#0d1410,,body 9-9 #c9b0e4,#0d1410,,body 10-12 #e5eee5,#0d1410,,body 13-15 #c9b0e4,#0d1410,,body 16-21 #b6ce94,#0d1410,,body 22-22 #e5eee5,#0d1410,,body 23-89 d,#0d1410,,body +@14: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #616f64,#0d1410,b,body 7-8 #e5eee5,#0d1410,,body 9-9 #c9a7ed,#0d1410,,body 10-12 #e5eee5,#0d1410,,body 13-15 #c9a7ed,#0d1410,,body 16-21 #b8d88a,#0d1410,,body 22-22 #e5eee5,#0d1410,,body 23-89 d,#0d1410,,body |15: 2 ⣂⢀⣉⣉⢉⣈⢁⣀⣀⢀⣀⣀⣀⢀⣀⣀⣀⣀⣀ +15: 7="⣂" 8="⢀" 9="⣉" 10="⣉" 11="⢉" 12="⣈" 13="⢁" 14="⣀" 15="⣀" 16="⢀" 17="⣀" 18="⣀" 19="⣀" 20="⢀" 21="⣀" 22="⣀" 23="⣀" 24="⣀" 25="⣀" -@15: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-8 #b9e58f,#0d1410,,body 9-11 #c9b0e4,#0d1410,,body 12-25 #b9e58f,#0d1410,,body 26-89 d,#0d1410,,body +@15: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-8 #b9f480,#0d1410,,body 9-11 #c9a7ed,#0d1410,,body 12-25 #b9f480,#0d1410,,body 26-89 d,#0d1410,,body |16: 3 ⠉⠉⠁⠉⠉⠉⠈⠈⠉⠉⠉⠉⠉⠉ +16: 7="⠉" 8="⠉" 9="⠁" 10="⠉" 11="⠉" 12="⠉" 13="⠈" 14="⠈" 15="⠉" 16="⠉" 17="⠉" 18="⠉" 19="⠉" 20="⠉" -@16: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-17 #e5eee5,#0d1410,,body 18-19 #e9bf91,#0d1410,,body 20-20 #e5eee5,#0d1410,,body 21-89 d,#0d1410,,body +@16: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-17 #e5eee5,#0d1410,,body 18-19 #f8c082,#0d1410,,body 20-20 #e5eee5,#0d1410,,body 21-89 d,#0d1410,,body |17: 4 -@17: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-89 d,#0d1410,,body +@17: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-89 d,#0d1410,,body |18: -@18: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-89 d,#0d1410,,body +@18: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-89 d,#0d1410,,body |19: -@19: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-89 d,#0d1410,,body +@19: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-89 d,#0d1410,,body |20: -@20: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-89 d,#0d1410,,body +@20: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-89 d,#0d1410,,body |21: -@21: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-89 d,#0d1410,,body +@21: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-89 d,#0d1410,,body |22: -@22: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-89 d,#0d1410,,body +@22: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-89 d,#0d1410,,body == style colors-off grid=90x23 -|14: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-22 #e5eee5,#0d1410, 23-89 d,#0d1410, -|15: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-25 #e5eee5,#0d1410, 26-89 d,#0d1410, -|16: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-20 #e5eee5,#0d1410, 21-89 d,#0d1410, -== 9p colors-off grid=90x23 cursor=7,14,block -|14: 1 ⠭⠍⣥⢩⣭⡭⣭⣬⣌⢭⣭⠌⠬⠅⠍⠁ -+14: 7="⠭" 8="⠍" 9="⣥" 10="⢩" 11="⣭" 12="⡭" 13="⣭" 14="⣬" 15="⣌" 16="⢭" 17="⣭" 18="⠌" 19="⠬" 20="⠅" 21="⠍" 22="⠁" -@14: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #616f64,#0d1410,b,body 7-22 #e5eee5,#0d1410,,body 23-89 d,#0d1410,,body -|15: 2 ⣂⢀⣉⣉⢉⣈⢁⣀⣀⢀⣀⣀⣀⢀⣀⣀⣀⣀⣀ -+15: 7="⣂" 8="⢀" 9="⣉" 10="⣉" 11="⢉" 12="⣈" 13="⢁" 14="⣀" 15="⣀" 16="⢀" 17="⣀" 18="⣀" 19="⣀" 20="⢀" 21="⣀" 22="⣀" 23="⣀" 24="⣀" 25="⣀" -@15: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-25 #e5eee5,#0d1410,,body 26-89 d,#0d1410,,body -|16: 3 ⠉⠉⠁⠉⠉⠉⠈⠈⠉⠉⠉⠉⠉⠉ -+16: 7="⠉" 8="⠉" 9="⠁" 10="⠉" 11="⠉" 12="⠉" 13="⠈" 14="⠈" 15="⠉" 16="⠉" 17="⠉" 18="⠉" 19="⠉" 20="⠉" -@16: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-20 #e5eee5,#0d1410,,body 21-89 d,#0d1410,,body +|3: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-22 #e5eee5,#0d1410, 23-89 d,#0d1410, +|4: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-89 d,#0d1410, +|14: 0-0 d,#152019, 1-1 d,#0d1410, 2-83 d,#1d2824, 84-89 #b2c3b8,#1d2824, +|15: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-22 #e5eee5,#0d1410, 23-89 d,#0d1410, +|16: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-25 #e5eee5,#0d1410, 26-89 d,#0d1410, +|17: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-20 #e5eee5,#0d1410, 21-89 d,#0d1410, +== 9p colors-off grid=90x23 cursor=7,15,block +|3: 1 @`Mini demo.zig` +@3: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-22 #e5eee5,#0d1410,,body 23-89 d,#0d1410,,body +|4: +@4: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-89 d,#0d1410,,body +|14: Colors +@14: 0-0 d,#152019,,body 1-1 d,#0d1410,,body 2-83 d,#1d2824,,tagline 84-89 #b2c3b8,#1d2824,,tagline +|15: 1 ⠭⠍⣥⢩⣭⡭⣭⣬⣌⢭⣭⠌⠬⠅⠍⠁ ++15: 7="⠭" 8="⠍" 9="⣥" 10="⢩" 11="⣭" 12="⡭" 13="⣭" 14="⣬" 15="⣌" 16="⢭" 17="⣭" 18="⠌" 19="⠬" 20="⠅" 21="⠍" 22="⠁" +@15: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #616f64,#0d1410,b,body 7-22 #e5eee5,#0d1410,,body 23-89 d,#0d1410,,body +|16: 2 ⣂⢀⣉⣉⢉⣈⢁⣀⣀⢀⣀⣀⣀⢀⣀⣀⣀⣀⣀ ++16: 7="⣂" 8="⢀" 9="⣉" 10="⣉" 11="⢉" 12="⣈" 13="⢁" 14="⣀" 15="⣀" 16="⢀" 17="⣀" 18="⣀" 19="⣀" 20="⢀" 21="⣀" 22="⣀" 23="⣀" 24="⣀" 25="⣀" +@16: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-25 #e5eee5,#0d1410,,body 26-89 d,#0d1410,,body +|17: 3 ⠉⠉⠁⠉⠉⠉⠈⠈⠉⠉⠉⠉⠉⠉ ++17: 7="⠉" 8="⠉" 9="⠁" 10="⠉" 11="⠉" 12="⠉" 13="⠈" 14="⠈" 15="⠉" 16="⠉" 17="⠉" 18="⠉" 19="⠉" 20="⠉" +@17: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-20 #e5eee5,#0d1410,,body 21-89 d,#0d1410,,body +|18: 4 +@18: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-89 d,#0d1410,,body == style colors-on grid=90x23 -|14: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-8 #e5eee5,#0d1410, 9-9 #c9b0e4,#0d1410, 10-12 #e5eee5,#0d1410, 13-15 #c9b0e4,#0d1410, 16-21 #b6ce94,#0d1410, 22-22 #e5eee5,#0d1410, 23-89 d,#0d1410, -|15: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-8 #b9e58f,#0d1410, 9-11 #c9b0e4,#0d1410, 12-25 #b9e58f,#0d1410, 26-89 d,#0d1410, -|16: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-17 #e5eee5,#0d1410, 18-19 #e9bf91,#0d1410, 20-20 #e5eee5,#0d1410, 21-89 d,#0d1410, -== snap resized grid=105x27 cursor=7,16 +|15: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-8 #e5eee5,#0d1410, 9-9 #c9a7ed,#0d1410, 10-12 #e5eee5,#0d1410, 13-15 #c9a7ed,#0d1410, 16-21 #b8d88a,#0d1410, 22-22 #e5eee5,#0d1410, 23-89 d,#0d1410, +|16: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-8 #b9f480,#0d1410, 9-11 #c9a7ed,#0d1410, 12-25 #b9f480,#0d1410, 26-89 d,#0d1410, +|17: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-17 #e5eee5,#0d1410, 18-19 #f8c082,#0d1410, 20-20 #e5eee5,#0d1410, 21-89 d,#0d1410, +== snap resized grid=105x27 cursor=7,17 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol -| /tmp/pardes-snap/mini/cwd/commands.txt Save Tty Del Collapse +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/mini/cwd/commands.txt Save Tty Collapse Del | 1 @`Mini demo.zig` | | @@ -125,66 +136,67 @@ | | | -| /tmp/pardes-snap/mini/cwd/Mini demo.zig Save Tty Del Collapse +| /tmp/pardes-snap/mini/cwd/Mini demo.zig Save Tty Collapse Del +| Colors | 1 ⠭⠍⣥⢩⣭⡭⣭⣬⣌⢭⣭⠌⠬⠅⠍⠁ | 2 ⣂⢀⣉⣉⢉⣈⢁⣀⣀⢀⣀⣀⣀⢀⣀⣀⣀⣀⣀ | 3 ⠉⠉⠁⠉⠉⠉⠈⠈⠉⠉⠉⠉⠉⠉ | 4 -== 9p resized grid=105x27 cursor=7,16,block +== 9p resized grid=105x27 cursor=7,17,block |0: Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill @0: 0-70 #b2c3b8,#1d2824,,tagline 71-104 d,#1d2824,,tagline -|1: New Tty Find Grep Joincol -@1: 0-24 #becfc4,#26362d,,tagline 25-104 d,#26362d,,tagline -|2: /tmp/pardes-snap/mini/cwd/commands.txt Save Tty Del Collapse -@2: 0-1 #ffffff,#4c6356,,tagline 2-61 #b2c3b8,#1d2824,,tagline 62-104 d,#1d2824,,tagline +|1: New Tty Find Grep Joincol Delcol +@1: 0-1 #ffffff,#887455,,tagline 2-2 d,#26362d,,tagline 3-34 #becfc4,#26362d,,tagline 35-104 d,#26362d,,tagline +|2: /tmp/pardes-snap/mini/cwd/commands.txt Save Tty Collapse Del +@2: 0-1 #ffffff,#496656,,tagline 2-2 d,#1d2824,,tagline 3-28 #b2c3b8,#1d2824,,tagline 29-40 #d3b0d9,#1d2824,,tagline 41-62 #b2c3b8,#1d2824,,tagline 63-104 d,#1d2824,,tagline |3: 1 @`Mini demo.zig` -@3: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-22 #e5eee5,#0d1410,,body 23-104 d,#0d1410,,body +@3: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-22 #e5eee5,#0d1410,,body 23-104 d,#0d1410,,body |4: -@4: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-104 d,#0d1410,,body +@4: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-104 d,#0d1410,,body |5: -@5: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-104 d,#0d1410,,body +@5: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-104 d,#0d1410,,body |6: -@6: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-104 d,#0d1410,,body +@6: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-104 d,#0d1410,,body |7: -@7: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-104 d,#0d1410,,body +@7: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-104 d,#0d1410,,body |8: -@8: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-104 d,#0d1410,,body +@8: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-104 d,#0d1410,,body |9: -@9: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-104 d,#0d1410,,body +@9: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-104 d,#0d1410,,body |10: -@10: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-104 d,#0d1410,,body +@10: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-104 d,#0d1410,,body |11: -@11: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-104 d,#0d1410,,body +@11: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-104 d,#0d1410,,body |12: -@12: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-104 d,#0d1410,,body +@12: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-104 d,#0d1410,,body |13: -@13: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-104 d,#0d1410,,body +@13: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-104 d,#0d1410,,body |14: -@14: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-104 d,#0d1410,,body -|15: /tmp/pardes-snap/mini/cwd/Mini demo.zig Save Tty Del Collapse -@15: 0-1 #000000,#adcc91,,tagline 2-62 #becfc4,#26362d,,tagline 63-104 d,#26362d,,tagline -|16: 1 ⠭⠍⣥⢩⣭⡭⣭⣬⣌⢭⣭⠌⠬⠅⠍⠁ -+16: 7="⠭" 8="⠍" 9="⣥" 10="⢩" 11="⣭" 12="⡭" 13="⣭" 14="⣬" 15="⣌" 16="⢭" 17="⣭" 18="⠌" 19="⠬" 20="⠅" 21="⠍" 22="⠁" -@16: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #616f64,#0d1410,b,body 7-8 #e5eee5,#0d1410,,body 9-9 #c9b0e4,#0d1410,,body 10-12 #e5eee5,#0d1410,,body 13-15 #c9b0e4,#0d1410,,body 16-21 #b6ce94,#0d1410,,body 22-22 #e5eee5,#0d1410,,body 23-104 d,#0d1410,,body -|17: 2 ⣂⢀⣉⣉⢉⣈⢁⣀⣀⢀⣀⣀⣀⢀⣀⣀⣀⣀⣀ -+17: 7="⣂" 8="⢀" 9="⣉" 10="⣉" 11="⢉" 12="⣈" 13="⢁" 14="⣀" 15="⣀" 16="⢀" 17="⣀" 18="⣀" 19="⣀" 20="⢀" 21="⣀" 22="⣀" 23="⣀" 24="⣀" 25="⣀" -@17: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-8 #b9e58f,#0d1410,,body 9-11 #c9b0e4,#0d1410,,body 12-25 #b9e58f,#0d1410,,body 26-104 d,#0d1410,,body -|18: 3 ⠉⠉⠁⠉⠉⠉⠈⠈⠉⠉⠉⠉⠉⠉ -+18: 7="⠉" 8="⠉" 9="⠁" 10="⠉" 11="⠉" 12="⠉" 13="⠈" 14="⠈" 15="⠉" 16="⠉" 17="⠉" 18="⠉" 19="⠉" 20="⠉" -@18: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-17 #e5eee5,#0d1410,,body 18-19 #e9bf91,#0d1410,,body 20-20 #e5eee5,#0d1410,,body 21-104 d,#0d1410,,body -|19: 4 -@19: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-104 d,#0d1410,,body -|20: -@20: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-104 d,#0d1410,,body +@14: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-104 d,#0d1410,,body +|15: /tmp/pardes-snap/mini/cwd/Mini demo.zig Save Tty Collapse Del +@15: 0-1 #000000,#add38a,,tagline 2-2 d,#26362d,,tagline 3-28 #becfc4,#26362d,,tagline 29-41 #dfbce5,#26362d,,tagline 42-63 #becfc4,#26362d,,tagline 64-104 d,#26362d,,tagline +|16: Colors +@16: 0-0 d,#152019,,body 1-1 d,#0d1410,,body 2-98 d,#1d2824,,tagline 99-104 #b2c3b8,#1d2824,,tagline +|17: 1 ⠭⠍⣥⢩⣭⡭⣭⣬⣌⢭⣭⠌⠬⠅⠍⠁ ++17: 7="⠭" 8="⠍" 9="⣥" 10="⢩" 11="⣭" 12="⡭" 13="⣭" 14="⣬" 15="⣌" 16="⢭" 17="⣭" 18="⠌" 19="⠬" 20="⠅" 21="⠍" 22="⠁" +@17: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #616f64,#0d1410,b,body 7-8 #e5eee5,#0d1410,,body 9-9 #c9a7ed,#0d1410,,body 10-12 #e5eee5,#0d1410,,body 13-15 #c9a7ed,#0d1410,,body 16-21 #b8d88a,#0d1410,,body 22-22 #e5eee5,#0d1410,,body 23-104 d,#0d1410,,body +|18: 2 ⣂⢀⣉⣉⢉⣈⢁⣀⣀⢀⣀⣀⣀⢀⣀⣀⣀⣀⣀ ++18: 7="⣂" 8="⢀" 9="⣉" 10="⣉" 11="⢉" 12="⣈" 13="⢁" 14="⣀" 15="⣀" 16="⢀" 17="⣀" 18="⣀" 19="⣀" 20="⢀" 21="⣀" 22="⣀" 23="⣀" 24="⣀" 25="⣀" +@18: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-8 #b9f480,#0d1410,,body 9-11 #c9a7ed,#0d1410,,body 12-25 #b9f480,#0d1410,,body 26-104 d,#0d1410,,body +|19: 3 ⠉⠉⠁⠉⠉⠉⠈⠈⠉⠉⠉⠉⠉⠉ ++19: 7="⠉" 8="⠉" 9="⠁" 10="⠉" 11="⠉" 12="⠉" 13="⠈" 14="⠈" 15="⠉" 16="⠉" 17="⠉" 18="⠉" 19="⠉" 20="⠉" +@19: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-17 #e5eee5,#0d1410,,body 18-19 #f8c082,#0d1410,,body 20-20 #e5eee5,#0d1410,,body 21-104 d,#0d1410,,body +|20: 4 +@20: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-104 d,#0d1410,,body |21: -@21: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-104 d,#0d1410,,body +@21: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-104 d,#0d1410,,body |22: -@22: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-104 d,#0d1410,,body +@22: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-104 d,#0d1410,,body |23: -@23: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-104 d,#0d1410,,body +@23: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-104 d,#0d1410,,body |24: -@24: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-104 d,#0d1410,,body +@24: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-104 d,#0d1410,,body |25: -@25: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-104 d,#0d1410,,body +@25: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-104 d,#0d1410,,body |26: -@26: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-104 d,#0d1410,,body +@26: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-104 d,#0d1410,,body diff --git a/test/snapshots/modal.golden b/test/snapshots/modal.golden index ca89416e..5f313dd3 100644 --- a/test/snapshots/modal.golden +++ b/test/snapshots/modal.golden @@ -1,7 +1,7 @@ == snap top grid=100x31 cursor=2,3 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol New Tty Find Grep Joincol -| /tmp/pardes-snap/modal/cwd Save Tty Del Togglett /tmp/pardes-snap/modal/cwd Save Tty Del Togglett +| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/modal/cwd Tty Save Mode Filter /tmp/pardes-snap/modal/cwd Tty Save Mode Filter | ls ls | words.txt words.txt | printf 'one two three\nfour five six\nseven ei @@ -16,54 +16,54 @@ | | | -| /tmp/pardes-snap/modal/cwd Save Tty Del Togglett +| /tmp/pardes-snap/modal/cwd Tty Save Mode Filter | ls | words.txt == snap moved grid=100x31 cursor=8,5 == snap xsel grid=100x31 cursor=48,5 == style xsel grid=100x31 |0: 0-70 #b2c3b8,#1d2824, 71-99 d,#1d2824, -|1: 0-24 #becfc4,#26362d, 25-49 d,#26362d, 50-74 #b2c3b8,#1d2824, 75-99 d,#1d2824, -|2: 0-1 #000000,#adcc91, 2-49 #becfc4,#26362d, 50-51 #ffffff,#4c6356, 52-99 #b2c3b8,#1d2824, -|3: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|4: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|5: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-48 #f5f7ee,#405d4b, 49-49 d,#0d1410, 50-50 d,#637f6a, 51-99 d,#0d1410, -|6: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|7: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|8: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|9: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|10: 0-0 d,#637f6a, 1-49 d,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|11: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|12: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|13: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|14: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|15: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|16: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|17: 0-1 #ffffff,#4c6356, 2-49 #b2c3b8,#1d2824, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|18: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|19: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|20: 0-0 d,#637f6a, 1-49 d,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|21: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|22: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|23: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|24: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|25: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|26: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|27: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|28: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|29: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|30: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|1: 0-1 #ffffff,#887455, 2-2 d,#26362d, 3-34 #becfc4,#26362d, 35-49 d,#26362d, 50-51 #ffffff,#887455, 52-52 d,#1d2824, 53-84 #b2c3b8,#1d2824, 85-99 d,#1d2824, +|2: 0-1 #000000,#add38a, 2-2 d,#26362d, 3-29 #becfc4,#26362d, 30-32 #dfbce5,#26362d, 33-49 #becfc4,#26362d, 50-51 #ffffff,#496656, 52-52 d,#1d2824, 53-79 #b2c3b8,#1d2824, 80-82 #d3b0d9,#1d2824, 83-99 #b2c3b8,#1d2824, +|3: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|4: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|5: 0-0 d,#608269, 1-1 d,#0d1410, 2-48 #f5f7ee,#3c614a, 49-49 d,#0d1410, 50-50 d,#608269, 51-99 d,#0d1410, +|6: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|7: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|8: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|9: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|10: 0-0 d,#608269, 1-49 d,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|11: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|12: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|13: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|14: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|15: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|16: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|17: 0-1 #ffffff,#496656, 2-2 d,#1d2824, 3-29 #b2c3b8,#1d2824, 30-32 #d3b0d9,#1d2824, 33-49 #b2c3b8,#1d2824, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|18: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|19: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|20: 0-0 d,#608269, 1-49 d,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|21: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|22: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|23: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|24: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|25: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|26: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|27: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|28: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|29: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|30: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, == snap xsel2 grid=100x31 cursor=13,6 == snap yanked grid=100x31 cursor=13,6 == snap vsel grid=100x31 cursor=14,7 == style vsel grid=100x31 -|5: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #f5f7ee,#405d4b, 50-50 d,#637f6a, 51-99 d,#0d1410, -|6: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #f5f7ee,#405d4b, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|7: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-14 #f5f7ee,#405d4b, 15-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -== snap typed grid=100x31 cursor=7,5 -|5: TYPEDprintf 'one two three\nfour five six\nseven -== snap undone grid=100x31 cursor=14,7 -|5: printf 'one two three\nfour five six\nseven ei -== snap redone grid=100x31 cursor=7,5 -|5: TYPEDprintf 'one two three\nfour five six\nseven -== snap bottom grid=100x31 cursor=2,10 +|5: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #f5f7ee,#3c614a, 50-50 d,#608269, 51-99 d,#0d1410, +|6: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #f5f7ee,#3c614a, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|7: 0-0 d,#608269, 1-1 d,#0d1410, 2-14 #f5f7ee,#3c614a, 15-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +== snap typed grid=100x31 cursor=9,20 +|20: TYPED +== snap undone grid=100x31 cursor=4,20 +|20: +== snap redone grid=100x31 cursor=9,20 +|20: TYPED +== snap bottom grid=100x31 cursor=2,20 diff --git a/test/snapshots/msg.golden b/test/snapshots/msg.golden index 9da23117..197d01d9 100644 --- a/test/snapshots/msg.golden +++ b/test/snapshots/msg.golden @@ -1,7 +1,7 @@ == snap opened grid=70x15 cursor=7,3 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kil -|New Tty Find Grep Joincol -| /tmp/pardes-snap/msg/cwd/a.txt Save Tty Del Collapse +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/msg/cwd/a.txt Save Tty Collapse Del | 1 line 1 | 2 line 2 | 3 line 3 @@ -9,12 +9,20 @@ | 5 line 5 | 6 line 6 | 7 -== snap saved grid=70x15 cursor=7,3 -|14: --:--:-- saved /tmp/pardes-snap/msg/cwd/a.txt -== snap repainted grid=70x17 cursor=7,3 +== snap saved grid=70x15 cursor=7,4 +|3: --:--:-- saved /tmp/pardes-snap/msg/cwd/a.txt +|4: 1 line 1 +|5: 2 line 2 +|6: 3 line 3 +|7: 4 line 4 +|8: 5 line 5 +|9: 6 line 6 +|10: 7 +== snap repainted grid=70x17 cursor=7,4 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kil -|New Tty Find Grep Joincol -| /tmp/pardes-snap/msg/cwd/a.txt Save Tty Del Collapse +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/msg/cwd/a.txt Save Tty Collapse Del +| --:--:-- saved /tmp/pardes-snap/msg/cwd/a.txt | 1 line 1 | 2 line 2 | 3 line 3 @@ -22,35 +30,56 @@ | 5 line 5 | 6 line 6 | 7 -| -| -| -| -| -| -| --:--:-- saved /tmp/pardes-snap/msg/cwd/a.txt == snap keycleared grid=70x17 cursor=7,4 -|16: -== snap saved-again grid=70x17 cursor=7,4 -|16: --:--:-- saved /tmp/pardes-snap/msg/cwd/a.txt +|3: 1 line 1 +|4: 2 line 2 +|5: 3 line 3 +|6: 4 line 4 +|7: 5 line 5 +|8: 6 line 6 +|9: 7 +|10: +== snap saved-again grid=70x17 cursor=7,5 +|3: --:--:-- saved /tmp/pardes-snap/msg/cwd/a.txt +|4: 1 line 1 +|5: 2 line 2 +|6: 3 line 3 +|7: 4 line 4 +|8: 5 line 5 +|9: 6 line 6 +|10: 7 == snap mousecleared grid=70x17 cursor=7,4 -|16: -== snap reloaded grid=70x17 cursor=7,4 -|3: 1 EXTERNAL -|4: 2 -|5: +|3: 1 line 1 +|4: 2 line 2 +|5: 3 line 3 +|6: 4 line 4 +|7: 5 line 5 +|8: 6 line 6 +|9: 7 +|10: +== snap reloaded grid=70x17 cursor=7,5 +|3: --:--:-- reloaded /tmp/pardes-snap/msg/cwd/a.txt +|4: 1 EXTERNAL +|5: 2 |6: |7: |8: |9: -|16: --:--:-- reloaded /tmp/pardes-snap/msg/cwd/a.txt -== snap prompt grid=70x17 cursor=7,16 -|16: /EXT -== snap prompt-wins grid=70x17 cursor=7,16 -|3: 1 AGAIN +== snap prompt grid=70x17 cursor=69,3 +|3: /EXT +== snap prompt-wins grid=70x17 cursor=69,4 +|3: --:--:-- reloaded /tmp/pardes-snap/msg/cwd/a.txt +|4: /EXT +|5: 1 AGAIN +|6: 2 == snap esc grid=70x17 cursor=7,4 -|16: -== snap msgbuiltin grid=70x17 cursor=29,5 -|2: /tmp/pardes-snap/msg/cwd/a.txt * Save Tty Del Collapse -|5: 3 Msg hand-written report -|16: hand-written report +|3: 1 AGAIN +|4: 2 +|5: +|6: +== snap msgbuiltin grid=70x17 cursor=29,6 +|2: /tmp/pardes-snap/msg/cwd/a.txt * Save Tty Collapse Del +|3: hand-written report +|4: 1 AGAIN +|5: 2 +|6: 3 Msg hand-written report diff --git a/test/snapshots/multicursor.golden b/test/snapshots/multicursor.golden index da2ad1d7..7a602aab 100644 --- a/test/snapshots/multicursor.golden +++ b/test/snapshots/multicursor.golden @@ -1,11 +1,11 @@ == snap three-cursors grid=150x31 cursor=7,9 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol New Tty Find Grep Joincol -| /tmp/pardes-snap/multicursor/cwd Save Tty Del Togglettymode Filter Collap /tmp/pardes-snap/multicursor/cwd Save Tty Del Togglettymode Filter Collap +| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/multicursor/cwd Tty Save Mode Filter Collapse Del /tmp/pardes-snap/multicursor/cwd Tty Save Mode Filter Collapse Del | ls ls | f.txt f.txt | -| /tmp/pardes-snap/multicursor/cwd/f.txt Save Tty Del Collapse +| /tmp/pardes-snap/multicursor/cwd/f.txt Save Tty Collapse Del | 1 line 1 | 2 line 2 | 3 line 3 @@ -16,53 +16,53 @@ | 8 line 8 | 9 line 9 | 10 line 10 -| /tmp/pardes-snap/multicursor/cwd Save Tty Del Togglettymode Filter Collap +| /tmp/pardes-snap/multicursor/cwd Tty Save Mode Filter Collapse Del | ls | f.txt == style three-cursors grid=150x31 |0: 0-70 #b2c3b8,#1d2824, 71-149 d,#1d2824, -|1: 0-24 #becfc4,#26362d, 25-74 d,#26362d, 75-99 #b2c3b8,#1d2824, 100-149 d,#1d2824, -|2: 0-1 #ffffff,#4c6356, 2-74 #b2c3b8,#1d2824, 75-76 #ffffff,#4c6356, 77-149 #b2c3b8,#1d2824, -|3: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|4: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|5: 0-0 d,#637f6a, 1-74 d,#0d1410, 75-75 d,#637f6a, 76-149 d,#0d1410, -|6: 0-1 #000000,#adcc91, 2-61 #becfc4,#26362d, 62-74 d,#26362d, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|7: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-7 #405d4b,#f5f7ee, 8-12 #e5eee5,#0d1410, 13-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|8: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-7 #405d4b,#f5f7ee, 8-12 #e5eee5,#0d1410, 13-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|9: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-12 #e5eee5,#0d1410, 13-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|10: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-12 #e5eee5,#0d1410, 13-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|11: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-12 #e5eee5,#0d1410, 13-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|12: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-12 #e5eee5,#0d1410, 13-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|13: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-12 #e5eee5,#0d1410, 13-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|14: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-12 #e5eee5,#0d1410, 13-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|15: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-12 #e5eee5,#0d1410, 13-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|16: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-13 #e5eee5,#0d1410, 14-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|17: 0-1 #ffffff,#4c6356, 2-74 #b2c3b8,#1d2824, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|18: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|19: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|20: 0-0 d,#637f6a, 1-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|21: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|22: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|23: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|24: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|25: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|26: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|27: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|28: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|29: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|30: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|1: 0-1 #ffffff,#887455, 2-2 d,#26362d, 3-34 #becfc4,#26362d, 35-74 d,#26362d, 75-76 #ffffff,#887455, 77-77 d,#1d2824, 78-109 #b2c3b8,#1d2824, 110-149 d,#1d2824, +|2: 0-1 #ffffff,#496656, 2-2 d,#1d2824, 3-35 #b2c3b8,#1d2824, 36-38 #d3b0d9,#1d2824, 39-68 #b2c3b8,#1d2824, 69-74 d,#1d2824, 75-76 #ffffff,#496656, 77-77 d,#1d2824, 78-110 #b2c3b8,#1d2824, 111-113 #d3b0d9,#1d2824, 114-143 #b2c3b8,#1d2824, 144-149 d,#1d2824, +|3: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|4: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|5: 0-0 d,#608269, 1-74 d,#0d1410, 75-75 d,#608269, 76-149 d,#0d1410, +|6: 0-1 #000000,#add38a, 2-2 d,#26362d, 3-35 #becfc4,#26362d, 36-40 #dfbce5,#26362d, 41-62 #becfc4,#26362d, 63-74 d,#26362d, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|7: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-7 #3c614a,#f5f7ee, 8-12 #e5eee5,#0d1410, 13-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|8: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-7 #3c614a,#f5f7ee, 8-12 #e5eee5,#0d1410, 13-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|9: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-12 #e5eee5,#0d1410, 13-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|10: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-12 #e5eee5,#0d1410, 13-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|11: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-12 #e5eee5,#0d1410, 13-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|12: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-12 #e5eee5,#0d1410, 13-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|13: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-12 #e5eee5,#0d1410, 13-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|14: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-12 #e5eee5,#0d1410, 13-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|15: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-12 #e5eee5,#0d1410, 13-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|16: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-13 #e5eee5,#0d1410, 14-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|17: 0-1 #ffffff,#496656, 2-2 d,#1d2824, 3-35 #b2c3b8,#1d2824, 36-38 #d3b0d9,#1d2824, 39-68 #b2c3b8,#1d2824, 69-74 d,#1d2824, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|18: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|19: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|20: 0-0 d,#608269, 1-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|21: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|22: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|23: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|24: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|25: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|26: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|27: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|28: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|29: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|30: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, == snap edited-at-three grid=150x31 cursor=9,9 -|6: /tmp/pardes-snap/multicursor/cwd/f.txt * Save Tty Del Collapse +|6: /tmp/pardes-snap/multicursor/cwd/f.txt * Save Tty Collapse Del |7: 1 >>line 1 |8: 2 >>line 2 |9: 3 >>line 3 == snap three-selections grid=150x31 cursor=8,9 == style three-selections grid=150x31 -|6: 0-1 #000000,#adcc91, 2-63 #becfc4,#26362d, 64-74 d,#26362d, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|7: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-7 #f5f7ee,#26382d, 8-8 #405d4b,#f5f7ee, 9-14 #e5eee5,#0d1410, 15-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|8: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-7 #f5f7ee,#26382d, 8-8 #405d4b,#f5f7ee, 9-14 #e5eee5,#0d1410, 15-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|9: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-8 #f5f7ee,#405d4b, 9-14 #e5eee5,#0d1410, 15-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|6: 0-1 #000000,#add38a, 2-2 d,#26362d, 3-35 #becfc4,#26362d, 36-40 #dfbce5,#26362d, 41-64 #becfc4,#26362d, 65-74 d,#26362d, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|7: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-7 #f5f7ee,#243a2d, 8-8 #3c614a,#f5f7ee, 9-14 #e5eee5,#0d1410, 15-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|8: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-7 #f5f7ee,#243a2d, 8-8 #3c614a,#f5f7ee, 9-14 #e5eee5,#0d1410, 15-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|9: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-8 #f5f7ee,#3c614a, 9-14 #e5eee5,#0d1410, 15-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, == snap keep-primary grid=150x31 cursor=8,9 == style keep-primary grid=150x31 -|7: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-14 #e5eee5,#0d1410, 15-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|8: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-14 #e5eee5,#0d1410, 15-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|7: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-14 #e5eee5,#0d1410, 15-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|8: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-14 #e5eee5,#0d1410, 15-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, diff --git a/test/snapshots/nested.golden b/test/snapshots/nested.golden index 68d0a69b..88b0854c 100644 --- a/test/snapshots/nested.golden +++ b/test/snapshots/nested.golden @@ -1,28 +1,79 @@ -== snap file-arg grid=100x31 cursor=7,6 +== snap file-arg grid=100x31 cursor=7,27 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol -|$ /tmp/pardes-snap/nested/cwd Save Tty Del Togglettymode Filter Collapse +| New Tty Find Grep Joincol Delcol +|$ /tmp/pardes-snap/nested/cwd Tty Save Mode Filter Collapse Del | $ $(readlink /proc/$PPID/exe) nested.txt | $ -| /tmp/pardes-snap/nested/cwd/nested.txt Save Tty Del Collapse +| +| +| +| +| +| +| +| +| +| +| +| +| +| +| +| +| /+New Save Tty Collapse Del +| 1 +| +| +| +| /tmp/pardes-snap/nested/cwd/nested.txt Save Tty Collapse Del | 1 hello-from-nested | 2 second-nested-line | 3 == snap no-arg grid=100x31 cursor=4,7 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol -|$ /tmp/pardes-snap/nested/cwd Save Tty Del Togglettymode Filter Collapse +| New Tty Find Grep Joincol Delcol +|$ /tmp/pardes-snap/nested/cwd Tty Save Mode Filter Collapse Del | $ $(readlink /proc/$PPID/exe) | pardes: this shell is already inside pardes, and a pardes inside a pardes | is spicy. Name a file or a directory and the outer session opens it, or | pass --nested if you really want a second one in here. | $ +| +| +| +| +| +| +| +| +| +| +| +| +| +| /+New Save Tty Collapse Del +| 1 == snap dir-arg grid=100x31 cursor=4,8 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol -|$ /tmp/pardes-snap/nested/cwd Save Tty Del Togglettymode Filter Collapse +| New Tty Find Grep Joincol Delcol +|$ /tmp/pardes-snap/nested/cwd Tty Save Mode Filter Collapse Del | $ $(readlink /proc/$PPID/exe) nestdir | $ -| /tmp/pardes-snap/nested/cwd/nestdir Save Tty Del Togglettymode Filter Collapse +| /tmp/pardes-snap/nested/cwd/nestdir Tty Save Mode Filter Collapse Del | ls | inside-nested.txt +| +| +| +| +| +| +| +| +| +| +| +| +| +| /+New Save Tty Collapse Del +| 1 diff --git a/test/snapshots/ninep.golden b/test/snapshots/ninep.golden index 94ad4bcf..b501004e 100644 --- a/test/snapshots/ninep.golden +++ b/test/snapshots/ninep.golden @@ -1,7 +1,7 @@ == snap opened grid=90x15 cursor=7,3 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol -| /tmp/pardes-snap/ninep/cwd/demo.zig Save Tty Del Collapse +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/ninep/cwd/demo.zig Save Tty Collapse Del TreeContext | 1 const greeting = "café λ 界 é"; | 2 | 3 pub fn choose(ok: bool) u32 { @@ -11,69 +11,80 @@ | 7 == style opened grid=90x15 |0: 0-70 #b2c3b8,#1d2824, 71-89 d,#1d2824, -|1: 0-24 #becfc4,#26362d, 25-89 d,#26362d, -|2: 0-1 #000000,#adcc91, 2-58 #becfc4,#26362d, 59-89 d,#26362d, -|3: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-23 #e5eee5,#0d1410, 24-32 #b6ce94,#0d1410, 33-33 d,d, 34-36 #b6ce94,#0d1410, 37-37 #e5eee5,#0d1410, 38-89 d,#0d1410, -|4: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-89 d,#0d1410, -|5: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-12 #c9b0e4,#0d1410, 13-35 #e5eee5,#0d1410, 36-89 d,#0d1410, -|6: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-12 #c9b0e4,#0d1410, 13-18 #e5eee5,#0d1410, 19-24 #c9b0e4,#0d1410, 25-25 #e5eee5,#0d1410, 26-27 #e9bf91,#0d1410, 28-28 #e5eee5,#0d1410, 29-89 d,#0d1410, -|7: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-16 #c9b0e4,#0d1410, 17-17 #e5eee5,#0d1410, 18-18 #e9bf91,#0d1410, 19-19 #e5eee5,#0d1410, 20-89 d,#0d1410, -|8: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-7 #e5eee5,#0d1410, 8-89 d,#0d1410, -|9: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-89 d,#0d1410, -|10: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-89 d,#0d1410, -|11: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-89 d,#0d1410, -|12: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-89 d,#0d1410, -|13: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-89 d,#0d1410, -|14: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-89 d,#0d1410, +|1: 0-1 #ffffff,#887455, 2-2 d,#26362d, 3-34 #becfc4,#26362d, 35-89 d,#26362d, +|2: 0-1 #000000,#add38a, 2-2 d,#26362d, 3-29 #becfc4,#26362d, 30-37 #dfbce5,#26362d, 38-71 #becfc4,#26362d, 72-89 d,#26362d, +|3: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-23 #e5eee5,#0d1410, 24-32 #b8d88a,#0d1410, 33-33 d,d, 34-36 #b8d88a,#0d1410, 37-37 #e5eee5,#0d1410, 38-89 d,#0d1410, +|4: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-89 d,#0d1410, +|5: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-12 #c9a7ed,#0d1410, 13-35 #e5eee5,#0d1410, 36-89 d,#0d1410, +|6: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-12 #c9a7ed,#0d1410, 13-18 #e5eee5,#0d1410, 19-24 #c9a7ed,#0d1410, 25-25 #e5eee5,#0d1410, 26-27 #f8c082,#0d1410, 28-28 #e5eee5,#0d1410, 29-89 d,#0d1410, +|7: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-16 #c9a7ed,#0d1410, 17-17 #e5eee5,#0d1410, 18-18 #f8c082,#0d1410, 19-19 #e5eee5,#0d1410, 20-89 d,#0d1410, +|8: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-7 #e5eee5,#0d1410, 8-89 d,#0d1410, +|9: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-89 d,#0d1410, +|10: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-89 d,#0d1410, +|11: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-89 d,#0d1410, +|12: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-89 d,#0d1410, +|13: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-89 d,#0d1410, +|14: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-89 d,#0d1410, == 9p opened grid=90x15 cursor=7,3,block |0: Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill @0: 0-70 #b2c3b8,#1d2824,,tagline 71-89 d,#1d2824,,tagline -|1: New Tty Find Grep Joincol -@1: 0-24 #becfc4,#26362d,,tagline 25-89 d,#26362d,,tagline -|2: /tmp/pardes-snap/ninep/cwd/demo.zig Save Tty Del Collapse -@2: 0-1 #000000,#adcc91,,tagline 2-58 #becfc4,#26362d,,tagline 59-89 d,#26362d,,tagline +|1: New Tty Find Grep Joincol Delcol +@1: 0-1 #ffffff,#887455,,tagline 2-2 d,#26362d,,tagline 3-34 #becfc4,#26362d,,tagline 35-89 d,#26362d,,tagline +|2: /tmp/pardes-snap/ninep/cwd/demo.zig Save Tty Collapse Del TreeContext +@2: 0-1 #000000,#add38a,,tagline 2-2 d,#26362d,,tagline 3-29 #becfc4,#26362d,,tagline 30-37 #dfbce5,#26362d,,tagline 38-71 #becfc4,#26362d,,tagline 72-89 d,#26362d,,tagline |3: 1 const greeting = "café λ 界 é"; +3: 28="é" 30="λ" 32="界" 33="" 35="é" -@3: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #616f64,#0d1410,b,body 7-23 #e5eee5,#0d1410,,body 24-36 #b6ce94,#0d1410,,body 37-37 #e5eee5,#0d1410,,body 38-89 d,#0d1410,,body +@3: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #616f64,#0d1410,b,body 7-23 #e5eee5,#0d1410,,body 24-36 #b8d88a,#0d1410,,body 37-37 #e5eee5,#0d1410,,body 38-89 d,#0d1410,,body |4: 2 -@4: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-89 d,#0d1410,,body +@4: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-89 d,#0d1410,,body |5: 3 pub fn choose(ok: bool) u32 { -@5: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-10 #e5eee5,#0d1410,,body 11-12 #c9b0e4,#0d1410,,body 13-35 #e5eee5,#0d1410,,body 36-89 d,#0d1410,,body +@5: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-10 #e5eee5,#0d1410,,body 11-12 #c9a7ed,#0d1410,,body 13-35 #e5eee5,#0d1410,,body 36-89 d,#0d1410,,body |6: 4 if (ok) return 42; -@6: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-10 #e5eee5,#0d1410,,body 11-12 #c9b0e4,#0d1410,,body 13-18 #e5eee5,#0d1410,,body 19-24 #c9b0e4,#0d1410,,body 25-25 #e5eee5,#0d1410,,body 26-27 #e9bf91,#0d1410,,body 28-28 #e5eee5,#0d1410,,body 29-89 d,#0d1410,,body +@6: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-10 #e5eee5,#0d1410,,body 11-12 #c9a7ed,#0d1410,,body 13-18 #e5eee5,#0d1410,,body 19-24 #c9a7ed,#0d1410,,body 25-25 #e5eee5,#0d1410,,body 26-27 #f8c082,#0d1410,,body 28-28 #e5eee5,#0d1410,,body 29-89 d,#0d1410,,body |7: 5 return 7; -@7: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-10 #e5eee5,#0d1410,,body 11-16 #c9b0e4,#0d1410,,body 17-17 #e5eee5,#0d1410,,body 18-18 #e9bf91,#0d1410,,body 19-19 #e5eee5,#0d1410,,body 20-89 d,#0d1410,,body +@7: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-10 #e5eee5,#0d1410,,body 11-16 #c9a7ed,#0d1410,,body 17-17 #e5eee5,#0d1410,,body 18-18 #f8c082,#0d1410,,body 19-19 #e5eee5,#0d1410,,body 20-89 d,#0d1410,,body |8: 6 } -@8: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-7 #e5eee5,#0d1410,,body 8-89 d,#0d1410,,body +@8: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-7 #e5eee5,#0d1410,,body 8-89 d,#0d1410,,body |9: 7 -@9: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-89 d,#0d1410,,body +@9: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-89 d,#0d1410,,body |10: -@10: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-89 d,#0d1410,,body +@10: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-89 d,#0d1410,,body |11: -@11: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-89 d,#0d1410,,body +@11: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-89 d,#0d1410,,body |12: -@12: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-89 d,#0d1410,,body +@12: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-89 d,#0d1410,,body |13: -@13: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-89 d,#0d1410,,body +@13: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-89 d,#0d1410,,body |14: -@14: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-89 d,#0d1410,,body +@14: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-89 d,#0d1410,,body == style colors-off grid=90x15 -|3: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-32 #e5eee5,#0d1410, 33-33 d,d, 34-37 #e5eee5,#0d1410, 38-89 d,#0d1410, -|5: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-35 #e5eee5,#0d1410, 36-89 d,#0d1410, -|6: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-28 #e5eee5,#0d1410, 29-89 d,#0d1410, -|7: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-19 #e5eee5,#0d1410, 20-89 d,#0d1410, -== 9p colors-off grid=90x15 cursor=7,3,block -|3: 1 const greeting = "café λ 界 é"; -+3: 28="é" 30="λ" 32="界" 33="" 35="é" -@3: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #616f64,#0d1410,b,body 7-37 #e5eee5,#0d1410,,body 38-89 d,#0d1410,,body -|5: 3 pub fn choose(ok: bool) u32 { -@5: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-35 #e5eee5,#0d1410,,body 36-89 d,#0d1410,,body -|6: 4 if (ok) return 42; -@6: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-28 #e5eee5,#0d1410,,body 29-89 d,#0d1410,,body -|7: 5 return 7; -@7: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-19 #e5eee5,#0d1410,,body 20-89 d,#0d1410,,body +|3: 0-0 d,#152019, 1-1 d,#0d1410, 2-83 d,#1d2824, 84-89 #b2c3b8,#1d2824, +|4: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-32 #e5eee5,#0d1410, 33-33 d,d, 34-37 #e5eee5,#0d1410, 38-89 d,#0d1410, +|5: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-89 d,#0d1410, +|6: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-35 #e5eee5,#0d1410, 36-89 d,#0d1410, +|7: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-28 #e5eee5,#0d1410, 29-89 d,#0d1410, +|8: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-19 #e5eee5,#0d1410, 20-89 d,#0d1410, +|9: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-7 #e5eee5,#0d1410, 8-89 d,#0d1410, +== 9p colors-off grid=90x15 cursor=7,4,block +|3: Colors +@3: 0-0 d,#152019,,body 1-1 d,#0d1410,,body 2-83 d,#1d2824,,tagline 84-89 #b2c3b8,#1d2824,,tagline +|4: 1 const greeting = "café λ 界 é"; ++4: 28="é" 30="λ" 32="界" 33="" 35="é" +@4: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #616f64,#0d1410,b,body 7-37 #e5eee5,#0d1410,,body 38-89 d,#0d1410,,body +|5: 2 +@5: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-89 d,#0d1410,,body +|6: 3 pub fn choose(ok: bool) u32 { +@6: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-35 #e5eee5,#0d1410,,body 36-89 d,#0d1410,,body +|7: 4 if (ok) return 42; +@7: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-28 #e5eee5,#0d1410,,body 29-89 d,#0d1410,,body +|8: 5 return 7; +@8: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-19 #e5eee5,#0d1410,,body 20-89 d,#0d1410,,body +|9: 6 } +@9: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-7 #e5eee5,#0d1410,,body 8-89 d,#0d1410,,body +|10: 7 +@10: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-89 d,#0d1410,,body == snap edited-with-colors-off grid=90x15 cursor=7,4 -|2: /tmp/pardes-snap/ninep/cwd/demo.zig * Save Tty Del Collapse +|2: /tmp/pardes-snap/ninep/cwd/demo.zig * Save Tty Collapse Del TreeContext |3: 1 // café λ 界 |4: 2 const greeting = "café λ 界 é"; |5: 3 @@ -83,116 +94,125 @@ |9: 7 } |10: 8 == 9p edited-with-colors-off grid=90x15 cursor=7,4,block -|2: /tmp/pardes-snap/ninep/cwd/demo.zig * Save Tty Del Collapse -@2: 0-1 #000000,#adcc91,,tagline 2-60 #becfc4,#26362d,,tagline 61-89 d,#26362d,,tagline +|2: /tmp/pardes-snap/ninep/cwd/demo.zig * Save Tty Collapse Del TreeContext +@2: 0-1 #000000,#add38a,,tagline 2-2 d,#26362d,,tagline 3-29 #becfc4,#26362d,,tagline 30-37 #dfbce5,#26362d,,tagline 38-73 #becfc4,#26362d,,tagline 74-89 d,#26362d,,tagline |3: 1 // café λ 界 +3: 13="é" 15="λ" 17="界" 18="" -@3: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-18 #e5eee5,#0d1410,,body 19-89 d,#0d1410,,body +@3: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-18 #e5eee5,#0d1410,,body 19-89 d,#0d1410,,body |4: 2 const greeting = "café λ 界 é"; +4: 28="é" 30="λ" 32="界" 33="" 35="é" -@4: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #616f64,#0d1410,b,body 7-37 #e5eee5,#0d1410,,body 38-89 d,#0d1410,,body +@4: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #616f64,#0d1410,b,body 7-37 #e5eee5,#0d1410,,body 38-89 d,#0d1410,,body |5: 3 -@5: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-89 d,#0d1410,,body +@5: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-89 d,#0d1410,,body |6: 4 pub fn choose(ok: bool) u32 { -@6: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-35 #e5eee5,#0d1410,,body 36-89 d,#0d1410,,body +@6: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-35 #e5eee5,#0d1410,,body 36-89 d,#0d1410,,body |7: 5 if (ok) return 42; -@7: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-28 #e5eee5,#0d1410,,body 29-89 d,#0d1410,,body +@7: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-28 #e5eee5,#0d1410,,body 29-89 d,#0d1410,,body |8: 6 return 7; -@8: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-19 #e5eee5,#0d1410,,body 20-89 d,#0d1410,,body +@8: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-19 #e5eee5,#0d1410,,body 20-89 d,#0d1410,,body |9: 7 } -@9: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-7 #e5eee5,#0d1410,,body 8-89 d,#0d1410,,body +@9: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-7 #e5eee5,#0d1410,,body 8-89 d,#0d1410,,body |10: 8 -@10: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-89 d,#0d1410,,body +@10: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-89 d,#0d1410,,body == style colors-on grid=90x15 -|2: 0-1 #000000,#adcc91, 2-60 #becfc4,#26362d, 61-89 d,#26362d, -|3: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-17 #b9e58f,#0d1410, 18-18 d,d, 19-89 d,#0d1410, -|4: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-23 #e5eee5,#0d1410, 24-32 #b6ce94,#0d1410, 33-33 d,d, 34-36 #b6ce94,#0d1410, 37-37 #e5eee5,#0d1410, 38-89 d,#0d1410, -|5: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-89 d,#0d1410, -|6: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-12 #c9b0e4,#0d1410, 13-35 #e5eee5,#0d1410, 36-89 d,#0d1410, -|7: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-12 #c9b0e4,#0d1410, 13-18 #e5eee5,#0d1410, 19-24 #c9b0e4,#0d1410, 25-25 #e5eee5,#0d1410, 26-27 #e9bf91,#0d1410, 28-28 #e5eee5,#0d1410, 29-89 d,#0d1410, -|8: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-16 #c9b0e4,#0d1410, 17-17 #e5eee5,#0d1410, 18-18 #e9bf91,#0d1410, 19-19 #e5eee5,#0d1410, 20-89 d,#0d1410, -|9: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-7 #e5eee5,#0d1410, 8-89 d,#0d1410, -== 9p colors-on grid=90x15 cursor=7,4,block -|3: 1 // café λ 界 -+3: 13="é" 15="λ" 17="界" 18="" -@3: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-18 #b9e58f,#0d1410,,body 19-89 d,#0d1410,,body -|4: 2 const greeting = "café λ 界 é"; -+4: 28="é" 30="λ" 32="界" 33="" 35="é" -@4: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #616f64,#0d1410,b,body 7-23 #e5eee5,#0d1410,,body 24-36 #b6ce94,#0d1410,,body 37-37 #e5eee5,#0d1410,,body 38-89 d,#0d1410,,body -|6: 4 pub fn choose(ok: bool) u32 { -@6: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-10 #e5eee5,#0d1410,,body 11-12 #c9b0e4,#0d1410,,body 13-35 #e5eee5,#0d1410,,body 36-89 d,#0d1410,,body -|7: 5 if (ok) return 42; -@7: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-10 #e5eee5,#0d1410,,body 11-12 #c9b0e4,#0d1410,,body 13-18 #e5eee5,#0d1410,,body 19-24 #c9b0e4,#0d1410,,body 25-25 #e5eee5,#0d1410,,body 26-27 #e9bf91,#0d1410,,body 28-28 #e5eee5,#0d1410,,body 29-89 d,#0d1410,,body -|8: 6 return 7; -@8: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-10 #e5eee5,#0d1410,,body 11-16 #c9b0e4,#0d1410,,body 17-17 #e5eee5,#0d1410,,body 18-18 #e9bf91,#0d1410,,body 19-19 #e5eee5,#0d1410,,body 20-89 d,#0d1410,,body +|2: 0-1 #000000,#add38a, 2-2 d,#26362d, 3-29 #becfc4,#26362d, 30-37 #dfbce5,#26362d, 38-73 #becfc4,#26362d, 74-89 d,#26362d, +|4: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-17 #b9f480,#0d1410, 18-18 d,d, 19-89 d,#0d1410, +|5: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-23 #e5eee5,#0d1410, 24-32 #b8d88a,#0d1410, 33-33 d,d, 34-36 #b8d88a,#0d1410, 37-37 #e5eee5,#0d1410, 38-89 d,#0d1410, +|6: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-89 d,#0d1410, +|7: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-12 #c9a7ed,#0d1410, 13-35 #e5eee5,#0d1410, 36-89 d,#0d1410, +|8: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-12 #c9a7ed,#0d1410, 13-18 #e5eee5,#0d1410, 19-24 #c9a7ed,#0d1410, 25-25 #e5eee5,#0d1410, 26-27 #f8c082,#0d1410, 28-28 #e5eee5,#0d1410, 29-89 d,#0d1410, +|9: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-16 #c9a7ed,#0d1410, 17-17 #e5eee5,#0d1410, 18-18 #f8c082,#0d1410, 19-19 #e5eee5,#0d1410, 20-89 d,#0d1410, +|10: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-7 #e5eee5,#0d1410, 8-89 d,#0d1410, +== 9p colors-on grid=90x15 cursor=7,5,block +|3: Colors +@3: 0-0 d,#152019,,body 1-1 d,#0d1410,,body 2-83 d,#1d2824,,tagline 84-89 #b2c3b8,#1d2824,,tagline +|4: 1 // café λ 界 ++4: 13="é" 15="λ" 17="界" 18="" +@4: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-18 #b9f480,#0d1410,,body 19-89 d,#0d1410,,body +|5: 2 const greeting = "café λ 界 é"; ++5: 28="é" 30="λ" 32="界" 33="" 35="é" +@5: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #616f64,#0d1410,b,body 7-23 #e5eee5,#0d1410,,body 24-36 #b8d88a,#0d1410,,body 37-37 #e5eee5,#0d1410,,body 38-89 d,#0d1410,,body +|6: 3 +@6: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-89 d,#0d1410,,body +|7: 4 pub fn choose(ok: bool) u32 { +@7: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-10 #e5eee5,#0d1410,,body 11-12 #c9a7ed,#0d1410,,body 13-35 #e5eee5,#0d1410,,body 36-89 d,#0d1410,,body +|8: 5 if (ok) return 42; +@8: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-10 #e5eee5,#0d1410,,body 11-12 #c9a7ed,#0d1410,,body 13-18 #e5eee5,#0d1410,,body 19-24 #c9a7ed,#0d1410,,body 25-25 #e5eee5,#0d1410,,body 26-27 #f8c082,#0d1410,,body 28-28 #e5eee5,#0d1410,,body 29-89 d,#0d1410,,body +|9: 6 return 7; +@9: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-10 #e5eee5,#0d1410,,body 11-16 #c9a7ed,#0d1410,,body 17-17 #e5eee5,#0d1410,,body 18-18 #f8c082,#0d1410,,body 19-19 #e5eee5,#0d1410,,body 20-89 d,#0d1410,,body +|10: 7 } +@10: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-7 #e5eee5,#0d1410,,body 8-89 d,#0d1410,,body +|11: 8 +@11: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-89 d,#0d1410,,body == style resized grid=105x20 |0: 0-70 #b2c3b8,#1d2824, 71-104 d,#1d2824, -|1: 0-24 #becfc4,#26362d, 25-104 d,#26362d, -|2: 0-1 #000000,#adcc91, 2-60 #becfc4,#26362d, 61-104 d,#26362d, -|3: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-17 #b9e58f,#0d1410, 18-18 d,d, 19-104 d,#0d1410, -|4: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-23 #e5eee5,#0d1410, 24-32 #b6ce94,#0d1410, 33-33 d,d, 34-36 #b6ce94,#0d1410, 37-37 #e5eee5,#0d1410, 38-104 d,#0d1410, -|5: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-104 d,#0d1410, -|6: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-12 #c9b0e4,#0d1410, 13-35 #e5eee5,#0d1410, 36-104 d,#0d1410, -|7: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-12 #c9b0e4,#0d1410, 13-18 #e5eee5,#0d1410, 19-24 #c9b0e4,#0d1410, 25-25 #e5eee5,#0d1410, 26-27 #e9bf91,#0d1410, 28-28 #e5eee5,#0d1410, 29-104 d,#0d1410, -|8: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-16 #c9b0e4,#0d1410, 17-17 #e5eee5,#0d1410, 18-18 #e9bf91,#0d1410, 19-19 #e5eee5,#0d1410, 20-104 d,#0d1410, -|9: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-7 #e5eee5,#0d1410, 8-104 d,#0d1410, -|10: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-104 d,#0d1410, -|11: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-104 d,#0d1410, -|12: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-104 d,#0d1410, -|13: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-104 d,#0d1410, -|14: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-104 d,#0d1410, -|15: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-104 d,#0d1410, -|16: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-104 d,#0d1410, -|17: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-104 d,#0d1410, -|18: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-104 d,#0d1410, -|19: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-104 d,#0d1410, -== 9p resized grid=105x20 cursor=7,4,block +|1: 0-1 #ffffff,#887455, 2-2 d,#26362d, 3-34 #becfc4,#26362d, 35-104 d,#26362d, +|2: 0-1 #000000,#add38a, 2-2 d,#26362d, 3-29 #becfc4,#26362d, 30-37 #dfbce5,#26362d, 38-73 #becfc4,#26362d, 74-104 d,#26362d, +|3: 0-0 d,#152019, 1-1 d,#0d1410, 2-98 d,#1d2824, 99-104 #b2c3b8,#1d2824, +|4: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-17 #b9f480,#0d1410, 18-18 d,d, 19-104 d,#0d1410, +|5: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-23 #e5eee5,#0d1410, 24-32 #b8d88a,#0d1410, 33-33 d,d, 34-36 #b8d88a,#0d1410, 37-37 #e5eee5,#0d1410, 38-104 d,#0d1410, +|6: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-104 d,#0d1410, +|7: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-12 #c9a7ed,#0d1410, 13-35 #e5eee5,#0d1410, 36-104 d,#0d1410, +|8: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-12 #c9a7ed,#0d1410, 13-18 #e5eee5,#0d1410, 19-24 #c9a7ed,#0d1410, 25-25 #e5eee5,#0d1410, 26-27 #f8c082,#0d1410, 28-28 #e5eee5,#0d1410, 29-104 d,#0d1410, +|9: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-16 #c9a7ed,#0d1410, 17-17 #e5eee5,#0d1410, 18-18 #f8c082,#0d1410, 19-19 #e5eee5,#0d1410, 20-104 d,#0d1410, +|10: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-7 #e5eee5,#0d1410, 8-104 d,#0d1410, +|11: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-104 d,#0d1410, +|12: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-104 d,#0d1410, +|13: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-104 d,#0d1410, +|14: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-104 d,#0d1410, +|15: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-104 d,#0d1410, +|16: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-104 d,#0d1410, +|17: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-104 d,#0d1410, +|18: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-104 d,#0d1410, +|19: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-104 d,#0d1410, +== 9p resized grid=105x20 cursor=7,5,block |0: Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill @0: 0-70 #b2c3b8,#1d2824,,tagline 71-104 d,#1d2824,,tagline -|1: New Tty Find Grep Joincol -@1: 0-24 #becfc4,#26362d,,tagline 25-104 d,#26362d,,tagline -|2: /tmp/pardes-snap/ninep/cwd/demo.zig * Save Tty Del Collapse -@2: 0-1 #000000,#adcc91,,tagline 2-60 #becfc4,#26362d,,tagline 61-104 d,#26362d,,tagline -|3: 1 // café λ 界 -+3: 13="é" 15="λ" 17="界" 18="" -@3: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-18 #b9e58f,#0d1410,,body 19-104 d,#0d1410,,body -|4: 2 const greeting = "café λ 界 é"; -+4: 28="é" 30="λ" 32="界" 33="" 35="é" -@4: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #616f64,#0d1410,b,body 7-23 #e5eee5,#0d1410,,body 24-36 #b6ce94,#0d1410,,body 37-37 #e5eee5,#0d1410,,body 38-104 d,#0d1410,,body -|5: 3 -@5: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-104 d,#0d1410,,body -|6: 4 pub fn choose(ok: bool) u32 { -@6: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-10 #e5eee5,#0d1410,,body 11-12 #c9b0e4,#0d1410,,body 13-35 #e5eee5,#0d1410,,body 36-104 d,#0d1410,,body -|7: 5 if (ok) return 42; -@7: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-10 #e5eee5,#0d1410,,body 11-12 #c9b0e4,#0d1410,,body 13-18 #e5eee5,#0d1410,,body 19-24 #c9b0e4,#0d1410,,body 25-25 #e5eee5,#0d1410,,body 26-27 #e9bf91,#0d1410,,body 28-28 #e5eee5,#0d1410,,body 29-104 d,#0d1410,,body -|8: 6 return 7; -@8: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-10 #e5eee5,#0d1410,,body 11-16 #c9b0e4,#0d1410,,body 17-17 #e5eee5,#0d1410,,body 18-18 #e9bf91,#0d1410,,body 19-19 #e5eee5,#0d1410,,body 20-104 d,#0d1410,,body -|9: 7 } -@9: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-7 #e5eee5,#0d1410,,body 8-104 d,#0d1410,,body -|10: 8 -@10: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-104 d,#0d1410,,body -|11: -@11: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-104 d,#0d1410,,body +|1: New Tty Find Grep Joincol Delcol +@1: 0-1 #ffffff,#887455,,tagline 2-2 d,#26362d,,tagline 3-34 #becfc4,#26362d,,tagline 35-104 d,#26362d,,tagline +|2: /tmp/pardes-snap/ninep/cwd/demo.zig * Save Tty Collapse Del TreeContext +@2: 0-1 #000000,#add38a,,tagline 2-2 d,#26362d,,tagline 3-29 #becfc4,#26362d,,tagline 30-37 #dfbce5,#26362d,,tagline 38-73 #becfc4,#26362d,,tagline 74-104 d,#26362d,,tagline +|3: Colors +@3: 0-0 d,#152019,,body 1-1 d,#0d1410,,body 2-98 d,#1d2824,,tagline 99-104 #b2c3b8,#1d2824,,tagline +|4: 1 // café λ 界 ++4: 13="é" 15="λ" 17="界" 18="" +@4: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-18 #b9f480,#0d1410,,body 19-104 d,#0d1410,,body +|5: 2 const greeting = "café λ 界 é"; ++5: 28="é" 30="λ" 32="界" 33="" 35="é" +@5: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #616f64,#0d1410,b,body 7-23 #e5eee5,#0d1410,,body 24-36 #b8d88a,#0d1410,,body 37-37 #e5eee5,#0d1410,,body 38-104 d,#0d1410,,body +|6: 3 +@6: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-104 d,#0d1410,,body +|7: 4 pub fn choose(ok: bool) u32 { +@7: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-10 #e5eee5,#0d1410,,body 11-12 #c9a7ed,#0d1410,,body 13-35 #e5eee5,#0d1410,,body 36-104 d,#0d1410,,body +|8: 5 if (ok) return 42; +@8: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-10 #e5eee5,#0d1410,,body 11-12 #c9a7ed,#0d1410,,body 13-18 #e5eee5,#0d1410,,body 19-24 #c9a7ed,#0d1410,,body 25-25 #e5eee5,#0d1410,,body 26-27 #f8c082,#0d1410,,body 28-28 #e5eee5,#0d1410,,body 29-104 d,#0d1410,,body +|9: 6 return 7; +@9: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-10 #e5eee5,#0d1410,,body 11-16 #c9a7ed,#0d1410,,body 17-17 #e5eee5,#0d1410,,body 18-18 #f8c082,#0d1410,,body 19-19 #e5eee5,#0d1410,,body 20-104 d,#0d1410,,body +|10: 7 } +@10: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-7 #e5eee5,#0d1410,,body 8-104 d,#0d1410,,body +|11: 8 +@11: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-104 d,#0d1410,,body |12: -@12: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-104 d,#0d1410,,body +@12: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-104 d,#0d1410,,body |13: -@13: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-104 d,#0d1410,,body +@13: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-104 d,#0d1410,,body |14: -@14: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-104 d,#0d1410,,body +@14: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-104 d,#0d1410,,body |15: -@15: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-104 d,#0d1410,,body +@15: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-104 d,#0d1410,,body |16: -@16: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-104 d,#0d1410,,body +@16: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-104 d,#0d1410,,body |17: -@17: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-104 d,#0d1410,,body +@17: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-104 d,#0d1410,,body |18: -@18: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-104 d,#0d1410,,body +@18: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-104 d,#0d1410,,body |19: -@19: 0-0 d,#637f6a,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-104 d,#0d1410,,body -== snap resized grid=105x20 cursor=7,4 +@19: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-104 d,#0d1410,,body +== snap resized grid=105x20 cursor=7,5 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol -| /tmp/pardes-snap/ninep/cwd/demo.zig * Save Tty Del Collapse +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/ninep/cwd/demo.zig * Save Tty Collapse Del TreeContext +| Colors | 1 // café λ 界 | 2 const greeting = "café λ 界 é"; | 3 @@ -201,4 +221,4 @@ | 6 return 7; | 7 } | 8 -== 9p unchanged grid=105x20 cursor=7,4,block +== 9p unchanged grid=105x20 cursor=7,5,block diff --git a/test/snapshots/pipe.golden b/test/snapshots/pipe.golden index e6d558a6..d3f6bbc2 100644 --- a/test/snapshots/pipe.golden +++ b/test/snapshots/pipe.golden @@ -1,20 +1,14 @@ -== snap prompt grid=180x13 cursor=14,12 +== snap prompt grid=180x13 cursor=179,3 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol -| /tmp/pardes-snap/pipe/cwd/pipe.txt Save Tty Del Collapse +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/pipe/cwd/pipe.txt Save Tty Collapse Del +| |tr a-z A-Z | 1 alpha beta | 2 gamma delta -| -| -| -| -| -| -| -| |tr a-z A-Z == snap filtered grid=180x13 cursor=17,3 -|2: /tmp/pardes-snap/pipe/cwd/pipe.txt * Save Tty Del Collapse +|2: /tmp/pardes-snap/pipe/cwd/pipe.txt * Save Tty Collapse Del |3: 1 ALPHA BETA -|12: +|4: 2 gamma delta +|5: == snap undone grid=180x13 cursor=17,3 |3: 1 alpha beta diff --git a/test/snapshots/psearch.golden b/test/snapshots/psearch.golden index d1a28996..b0827d7c 100644 --- a/test/snapshots/psearch.golden +++ b/test/snapshots/psearch.golden @@ -1,62 +1,104 @@ == snap output grid=140x31 cursor=4,9 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol -| /tmp/pardes-snap/psearch/cwd Save Tty Del Togglettymode Filter Collapse +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/psearch/cwd Tty Save Mode Filter Collapse Del | printf 'x MA''RK a\nzz\nx MA''RK b\nzz\nx MA''RK c\n' | x MARK a | zz | x MARK b | zz | x MARK c -== snap typing grid=140x31 cursor=8,30 -|30: /MARK +| +| +| +| +| +| +| +| +| +| +| +| +| /+New Save Tty Collapse Del +| 1 +== snap typing grid=140x31 cursor=139,3 +|3: /MARK +|4: printf 'x MA''RK a\nzz\nx MA''RK b\nzz\nx MA''RK c\n' +|5: x MARK a +|6: zz +|7: x MARK b +|8: zz +|9: x MARK c == snap results grid=140x31 cursor=7,4 -|27: /tmp/pardes-snap/psearch/cwd/+Search Save Tty Del Collapse -|28: 1 @p0:2:3-6 x MARK a -|29: 2 @p0:4:3-6 x MARK b -|30: 3 @p0:6:3-6 x MARK c +|3: printf 'x MA''RK a\nzz\nx MA''RK b\nzz\nx MA''RK c\n' +|4: x MARK a +|5: zz +|6: x MARK b +|7: zz +|8: x MARK c +|9: +|14: /tmp/pardes-snap/psearch/cwd/+Search Save Tty Collapse Del LocationsConfig +|15: Look +|16: 1 @p0:2:3-6 +|17: 2 x MARK a +|18: 3 @p0:4:3-6 +|19: 4 x MARK b +|20: 5 @p0:6:3-6 == style results grid=140x31 |0: 0-70 #b2c3b8,#1d2824, 71-139 d,#1d2824, -|1: 0-24 #becfc4,#26362d, 25-139 d,#26362d, -|2: 0-1 #000000,#adcc91, 2-72 #becfc4,#26362d, 73-139 d,#26362d, -|3: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-139 #e5eee5,#0d1410, -|4: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-3 #e5eee5,#0d1410, 4-7 #f5f7ee,#405d4b, 8-139 #e5eee5,#0d1410, -|5: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-139 #e5eee5,#0d1410, -|6: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-139 #e5eee5,#0d1410, -|7: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-139 #e5eee5,#0d1410, -|8: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-139 #e5eee5,#0d1410, -|9: 0-0 d,#637f6a, 1-139 d,#0d1410, -|10: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-139 #e5eee5,#0d1410, -|11: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-139 #e5eee5,#0d1410, -|12: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-139 #e5eee5,#0d1410, -|13: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-139 #e5eee5,#0d1410, -|14: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-139 #e5eee5,#0d1410, -|15: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-139 #e5eee5,#0d1410, -|16: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-139 #e5eee5,#0d1410, -|17: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-139 #e5eee5,#0d1410, -|18: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-139 #e5eee5,#0d1410, -|19: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-139 #e5eee5,#0d1410, -|20: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-139 #e5eee5,#0d1410, -|21: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-139 #e5eee5,#0d1410, -|22: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-139 #e5eee5,#0d1410, -|23: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-139 #e5eee5,#0d1410, -|24: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-139 #e5eee5,#0d1410, -|25: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-139 #e5eee5,#0d1410, -|26: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-139 #e5eee5,#0d1410, -|27: 0-1 #ffffff,#4c6356, 2-59 #b2c3b8,#1d2824, 60-139 d,#1d2824, -|28: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-15 #59675c,#0d1410, 16-18 #e5eee5,#0d1410, 19-22 #f7e4a5,#57472a, 23-24 #e5eee5,#0d1410, 25-139 d,#0d1410, -|29: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-15 #59675c,#0d1410, 16-18 #e5eee5,#0d1410, 19-22 #f7e4a5,#57472a, 23-24 #e5eee5,#0d1410, 25-139 d,#0d1410, -|30: 0-0 d,#152019, 1-1 d,#0d1410, 2-15 #59675c,#0d1410, 16-18 #e5eee5,#0d1410, 19-22 #f7e4a5,#57472a, 23-24 #e5eee5,#0d1410, 25-139 d,#0d1410, +|1: 0-1 #ffffff,#887455, 2-2 d,#26362d, 3-34 #becfc4,#26362d, 35-139 d,#26362d, +|2: 0-1 #000000,#add38a, 2-2 d,#26362d, 3-31 #becfc4,#26362d, 32-34 #dfbce5,#26362d, 35-64 #becfc4,#26362d, 65-139 d,#26362d, +|3: 0-0 d,#608269, 1-1 d,#0d1410, 2-139 #e5eee5,#0d1410, +|4: 0-0 d,#608269, 1-1 d,#0d1410, 2-3 #e5eee5,#0d1410, 4-7 #f5f7ee,#3c614a, 8-139 #e5eee5,#0d1410, +|5: 0-0 d,#608269, 1-1 d,#0d1410, 2-139 #e5eee5,#0d1410, +|6: 0-0 d,#608269, 1-1 d,#0d1410, 2-139 #e5eee5,#0d1410, +|7: 0-0 d,#608269, 1-1 d,#0d1410, 2-139 #e5eee5,#0d1410, +|8: 0-0 d,#608269, 1-1 d,#0d1410, 2-139 #e5eee5,#0d1410, +|9: 0-0 d,#608269, 1-139 d,#0d1410, +|10: 0-0 d,#608269, 1-1 d,#0d1410, 2-139 #e5eee5,#0d1410, +|11: 0-0 d,#608269, 1-1 d,#0d1410, 2-139 #e5eee5,#0d1410, +|12: 0-0 d,#608269, 1-1 d,#0d1410, 2-139 #e5eee5,#0d1410, +|13: 0-0 d,#608269, 1-1 d,#0d1410, 2-139 #e5eee5,#0d1410, +|14: 0-1 #ffffff,#496656, 2-2 d,#1d2824, 3-31 #b2c3b8,#1d2824, 32-38 #d3b0d9,#1d2824, 39-76 #b2c3b8,#1d2824, 77-139 d,#1d2824, +|15: 0-0 d,#152019, 1-1 d,#0d1410, 2-135 d,#1d2824, 136-139 #b2c3b8,#1d2824, +|16: 0-0 d,#608269, 1-1 d,#0d1410, 2-15 #59675c,#0d1410, 16-139 d,#0d1410, +|17: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-8 #e5eee5,#0d1410, 9-12 #f7e4a5,#5e4923, 13-14 #e5eee5,#0d1410, 15-139 d,#0d1410, +|18: 0-0 d,#608269, 1-1 d,#0d1410, 2-15 #59675c,#0d1410, 16-139 d,#0d1410, +|19: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-8 #e5eee5,#0d1410, 9-12 #f7e4a5,#5e4923, 13-14 #e5eee5,#0d1410, 15-139 d,#0d1410, +|20: 0-0 d,#152019, 1-1 d,#0d1410, 2-15 #59675c,#0d1410, 16-139 d,#0d1410, +|21: 0-1 #ffffff,#496656, 2-2 d,#1d2824, 3-3 #b2c3b8,#1d2824, 4-7 #d3b0d9,#1d2824, 8-29 #b2c3b8,#1d2824, 30-139 d,#1d2824, +|22: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-139 d,#0d1410, +|23: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-139 d,#0d1410, +|24: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-139 d,#0d1410, +|25: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-139 d,#0d1410, +|26: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-139 d,#0d1410, +|27: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-139 d,#0d1410, +|28: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-139 d,#0d1410, +|29: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-139 d,#0d1410, +|30: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-139 d,#0d1410, == snap second grid=140x31 cursor=7,6 == snap back grid=140x31 cursor=7,4 -== snap nomatch grid=140x31 cursor=7,29 -|25: /tmp/pardes-snap/psearch/cwd/+Search Save Tty Del Collapse -|26: 1 -== snap ttyinert grid=140x31 cursor=4,9 -|2: $ /tmp/pardes-snap/psearch/cwd Save Tty Del Togglettymode Filter Collapse -|3: $ printf 'x MA''RK a\nzz\nx MA''RK b\nzz\nx MA''RK c\n' -|9: $ -== snap rightsearch grid=140x31 cursor=7,6 -|2: /tmp/pardes-snap/psearch/cwd Save Tty Del Togglettymode Filter Collapse -|3: printf 'x MA''RK a\nzz\nx MA''RK b\nzz\nx MA''RK c\n' -|9: +== snap nomatch grid=140x31 cursor=7,17 +|12: /tmp/pardes-snap/psearch/cwd/+Search Save Tty Collapse Del LocationsConfig +|13: 1 +|15: 1 @p0:2:3-6 +|16: 2 x MARK a +|17: 3 @p0:4:3-6 +|18: 4 x MARK b +|19: 5 @p0:6:3-6 +|20: 6 x MARK c +== snap ttyinert grid=140x31 cursor=4,10 +|2: $ /tmp/pardes-snap/psearch/cwd Tty Save Mode Filter Collapse Del +|3: Look +|4: $ printf 'x MA''RK a\nzz\nx MA''RK b\nzz\nx MA''RK c\n' +|5: x MARK a +|6: zz +|7: x MARK b +|8: zz +|9: x MARK c +|10: $ +== snap rightsearch grid=140x31 cursor=7,7 +|2: /tmp/pardes-snap/psearch/cwd Tty Save Mode Filter Collapse Del +|4: printf 'x MA''RK a\nzz\nx MA''RK b\nzz\nx MA''RK c\n' +|10: diff --git a/test/snapshots/reflow.golden b/test/snapshots/reflow.golden index 3c2f5ff4..a13b5936 100644 --- a/test/snapshots/reflow.golden +++ b/test/snapshots/reflow.golden @@ -1,11 +1,7 @@ -== snap widened grid=200x25 cursor=4,20 +== snap widened grid=200x25 cursor=4,16 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol -|$ /tmp/pardes-snap/reflow/cwd Save Tty Del Togglettymode Filter Collapse -| $ printf 'y%.0s' $(seq 1 3000); echo do''ne -| yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy -| yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy -| yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy +| New Tty Find Grep Joincol Delcol +|$ /tmp/pardes-snap/reflow/cwd Tty Save Mode Filter Collapse Del | yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy | yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy | yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy @@ -20,3 +16,5 @@ | yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy | yyyyyyyyyyyyyyyyyyyyyyyyyyyyyydone | $ +| /+New Save Tty Collapse Del +| 1 diff --git a/test/snapshots/respawn.golden b/test/snapshots/respawn.golden index 9aa6b46b..e2b6a75c 100644 --- a/test/snapshots/respawn.golden +++ b/test/snapshots/respawn.golden @@ -1,10 +1,10 @@ -== snap respawn grid=100x31 cursor=4,9 +== snap respawn grid=140x31 cursor=4,9 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol New Tty Find Grep Joincol -| /tmp/pardes-snap/respawn/cwd Save Tty Del Toggle /tmp/pardes-snap/respawn/cwd Save Tty Del Toggle -| ls ls +| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/respawn/cwd Tty Save Mode Filter Collapse Del /tmp/pardes-snap/respawn/cwd Tty Save Mode Filter Collapse Del +| ls ls | -|$ /tmp/pardes-snap/respawn/cwd Save Tty Del Toggle +|$ /tmp/pardes-snap/respawn/cwd Tty Save Mode Filter Collapse Del | $ ls | $ echo RESP''AWNOK | RESPAWNOK diff --git a/test/snapshots/respawn.snap b/test/snapshots/respawn.snap index 66393da9..eac74267 100644 --- a/test/snapshots/respawn.snap +++ b/test/snapshots/respawn.snap @@ -1,7 +1,7 @@ # a deleted shell pane's pty lingers in its slot (there is no close effect); # a later spawn reusing the pane id must reap it instead of tripping the # drainEffects spawn assert — this exact sequence crashed pre-fix -start 31 100 -n 3 +start 31 140 -n 3 wait 8000 Newcol Joincol stable 700 20000 # middle-click Del on the lower-left pane's tag: the pane id is freed while diff --git a/test/snapshots/restore.golden b/test/snapshots/restore.golden index d2a60c4a..11d92288 100644 --- a/test/snapshots/restore.golden +++ b/test/snapshots/restore.golden @@ -1,14 +1,14 @@ == snap dumped grid=100x31 cursor=4,6 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill Restore /tmp/pardes-snap/res -|New Tty Find Grep Joincol -|$ /tmp/pardes-snap/restore/cwd Save Tty Del Togglettymode Filter Collapse +| New Tty Find Grep Joincol Delcol +|$ /tmp/pardes-snap/restore/cwd Tty Save Mode Filter Collapse Del | $ ls | $ echo KEEP''ME | KEEPME | $ == snap restored grid=100x31 cursor=4,6 |0: Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|2: /tmp/pardes-snap/restore/cwd Save Tty Del Togglettymode Filter Collapse +|2: /tmp/pardes-snap/restore/cwd Tty Save Mode Filter Collapse Del |3: ls |4: echo KEEP''ME |6: diff --git a/test/snapshots/rsearch.golden b/test/snapshots/rsearch.golden index f0bc0594..9b1f12d4 100644 --- a/test/snapshots/rsearch.golden +++ b/test/snapshots/rsearch.golden @@ -1,7 +1,7 @@ == snap opened grid=210x31 cursor=7,3 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol New Tty Find Grep Joincol -| /tmp/pardes-snap/rsearch/cwd/code.txt Save Tty Del Collapse /tmp/pardes-snap/rsearch/cwd Save Tty Del Togglettymode Filter Collapse +| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/rsearch/cwd/code.txt Save Tty Collapse Del /tmp/pardes-snap/rsearch/cwd Tty Save Mode Filter Collapse Del | 1 run count_x now ls | 2 open sub/dep.txt:3 here code.txt sub | 3 count_x again @@ -9,24 +9,28 @@ | | code.txt == snap search grid=210x31 cursor=13,5 -|28: /tmp/pardes-snap/rsearch/cwd/+Search Save Tty Del Collapse -|29: 1 code.txt:1:5-11 run count_x now -|30: 2 code.txt:3:1-7 count_x again +|26: /tmp/pardes-snap/rsearch/cwd/+Search Save Tty Collapse Del LocationsConfig +|27: 1 code.txt:1:5-11 +|28: 2 run count_x now +|29: 3 code.txt:3:1-7 +|30: 4 count_x again == snap select grid=210x31 cursor=14,6 -|26: /tmp/pardes-snap/rsearch/cwd/+Search Save Tty Del Collapse -|27: 1 code.txt:4:1-8 pick two words -== snap path-open grid=210x31 cursor=7,17 -|14: /tmp/pardes-snap/rsearch/cwd/sub/dep.txt Save Tty Del Collapse -|15: 1 d1 -|16: 2 d2 -|17: 3 DEPTARGET -|18: 4 d4 -|19: 5 d5 -|20: 6 d6 +|23: /tmp/pardes-snap/rsearch/cwd/+Search Save Tty Collapse Del LocationsConfig +|24: 1 code.txt:4:1-8 +|25: 2 pick two words +== snap path-open grid=210x31 cursor=7,16 +|13: /tmp/pardes-snap/rsearch/cwd/sub/dep.txt Save Tty Collapse Del +|14: 1 d1 +|15: 2 d2 +|16: 3 DEPTARGET +|17: 4 d4 +|18: 5 d5 +|19: 6 d6 == snap step1 grid=210x31 cursor=13,5 -== snap step2 grid=210x31 cursor=17,3 -== snap step3 grid=210x31 cursor=17,3 +== snap step2 grid=210x31 cursor=13,5 +== snap step3 grid=210x31 cursor=13,5 == snap selclick grid=210x31 cursor=14,6 == snap outside grid=210x31 cursor=20,6 -|12: /tmp/pardes-snap/rsearch/cwd/+Search Save Tty Del Collapse -|13: 1 code.txt:4:10-14 pick two words +|10: /tmp/pardes-snap/rsearch/cwd/+Search Save Tty Collapse Del LocationsConfig +|11: 1 code.txt:4:10-14 +|12: 2 pick two words diff --git a/test/snapshots/rsearch.snap b/test/snapshots/rsearch.snap index c413c559..30459488 100644 --- a/test/snapshots/rsearch.snap +++ b/test/snapshots/rsearch.snap @@ -7,6 +7,10 @@ dirmk sub file sub/dep.txt d1\nd2\nDEPTARGET\nd4\nd5\nd6 file code.txt run count_x now\nopen sub/dep.txt:3 here\ncount_x again\npick two words +# Builtins announce themselves by default, and an announcement is a band at +# the top of the body -- which moves every row this script clicks. What the +# verbs do is what is under test, not the announcement. +config Verbose off start 31 210 -n 1 wait 8000 code.txt stable 700 20000 @@ -28,7 +32,9 @@ snap opened # file, so the click searches for it: the results list both lines containing it. press right 15 4 release right 15 4 -wait 10000 code.txt:1:5-11 run count_x +# Locations stack the target under its line now: two rows, two waits. +wait 10000 code.txt:1:5-11 +wait 10000 run count_x now stable 700 15000 snap search # right-SELECT `pick two` (line 4, sweep cols 8..15): a multi-word span passes @@ -36,7 +42,8 @@ snap search press right 8 7 drag right 15 7 release right 15 7 -wait 10000 code.txt:4:1-8 pick two +wait 10000 code.txt:4:1-8 +wait 10000 pick two words stable 700 15000 snap select # right-CLICK the path `sub/dep.txt:3` (line 2, col 18): isFileChar keeps / . : diff --git a/test/snapshots/savepane.golden b/test/snapshots/savepane.golden index 070146d3..ab54ee3e 100644 --- a/test/snapshots/savepane.golden +++ b/test/snapshots/savepane.golden @@ -1,16 +1,20 @@ == snap scratch grid=100x31 cursor=20,6 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol -| /tmp/pardes-snap/savepane/cwd Save Tty Del Togglettymode Filter Collapse +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/savepane/cwd Tty Save Mode Filter Collapse Del | ls | -| /tmp/pardes-snap/savepane/cwd/+New * Save Tty Del Collapse +| /tmp/pardes-snap/savepane/cwd/+New * Save Tty Collapse Del | 1 scratch bytes -== snap prompt grid=100x31 cursor=38,30 -|30: Save /tmp/pardes-snap/savepane/cwd/ -== snap saved grid=100x31 cursor=20,6 -|5: /tmp/pardes-snap/savepane/cwd/saved.txt Save Tty Del Collapse -|30: --:--:-- saved /tmp/pardes-snap/savepane/cwd/saved.txt +== snap prompt grid=100x31 cursor=99,7 +|6: Save +|7: Save /tmp/pardes-snap/savepane/cwd/ +|8: 1 scratch bytes +== snap saved grid=100x31 cursor=20,7 +|5: /tmp/pardes-snap/savepane/cwd/saved.txt Save Tty Collapse Del +|6: --:--:-- saved /tmp/pardes-snap/savepane/cwd/saved.txt +|7: 1 scratch bytes +|8: == file bytes scratch bytes == end file diff --git a/test/snapshots/scroll.golden b/test/snapshots/scroll.golden index 46576f75..86bad0e5 100644 --- a/test/snapshots/scroll.golden +++ b/test/snapshots/scroll.golden @@ -1,7 +1,7 @@ == snap bottom grid=100x31 cursor=4,16 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol New Tty Find Grep Joincol -| /tmp/pardes-snap/scroll/cwd Save Tty Del Togglet /tmp/pardes-snap/scroll/cwd Save Tty Del Togglet +| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/scroll/cwd Tty Save Mode Filte /tmp/pardes-snap/scroll/cwd Tty Save Mode Filte | 188 ls | 189 s.txt | 190 @@ -16,7 +16,7 @@ | 199 | 200 | -| /tmp/pardes-snap/scroll/cwd Save Tty Del Togglet +| /tmp/pardes-snap/scroll/cwd Tty Save Mode Filte | ls | s.txt == snap wheel3 grid=100x31 cursor=4,16 @@ -81,33 +81,33 @@ |16: 194 == style wheel-down grid=100x31 |0: 0-70 #b2c3b8,#1d2824, 71-99 d,#1d2824, -|1: 0-24 #becfc4,#26362d, 25-49 d,#26362d, 50-74 #b2c3b8,#1d2824, 75-99 d,#1d2824, -|2: 0-1 #000000,#adcc91, 2-49 #becfc4,#26362d, 50-51 #ffffff,#4c6356, 52-99 #b2c3b8,#1d2824, -|3: 0-0 d,#152019, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|4: 0-0 d,#152019, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|5: 0-0 d,#152019, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-99 d,#0d1410, -|6: 0-0 d,#152019, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|7: 0-0 d,#152019, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|8: 0-0 d,#152019, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|9: 0-0 d,#152019, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|10: 0-0 d,#152019, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|11: 0-0 d,#152019, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|12: 0-0 d,#152019, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|13: 0-0 d,#152019, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|14: 0-0 d,#152019, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|15: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|16: 0-0 d,#152019, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|17: 0-1 #ffffff,#4c6356, 2-49 #b2c3b8,#1d2824, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|18: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|19: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|20: 0-0 d,#637f6a, 1-49 d,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|21: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|22: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|23: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|24: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|25: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|26: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|27: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|28: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|29: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|30: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#637f6a, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|1: 0-1 #ffffff,#887455, 2-2 d,#26362d, 3-34 #becfc4,#26362d, 35-49 d,#26362d, 50-51 #ffffff,#887455, 52-52 d,#1d2824, 53-84 #b2c3b8,#1d2824, 85-99 d,#1d2824, +|2: 0-1 #000000,#add38a, 2-2 d,#26362d, 3-30 #becfc4,#26362d, 31-33 #dfbce5,#26362d, 34-49 #becfc4,#26362d, 50-51 #ffffff,#496656, 52-52 d,#1d2824, 53-80 #b2c3b8,#1d2824, 81-83 #d3b0d9,#1d2824, 84-99 #b2c3b8,#1d2824, +|3: 0-0 d,#152019, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|4: 0-0 d,#152019, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|5: 0-0 d,#152019, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-99 d,#0d1410, +|6: 0-0 d,#152019, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|7: 0-0 d,#152019, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|8: 0-0 d,#152019, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|9: 0-0 d,#152019, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|10: 0-0 d,#152019, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|11: 0-0 d,#152019, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|12: 0-0 d,#152019, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|13: 0-0 d,#152019, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|14: 0-0 d,#152019, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|15: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|16: 0-0 d,#152019, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|17: 0-1 #ffffff,#496656, 2-2 d,#1d2824, 3-30 #b2c3b8,#1d2824, 31-33 #d3b0d9,#1d2824, 34-49 #b2c3b8,#1d2824, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|18: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|19: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|20: 0-0 d,#608269, 1-49 d,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|21: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|22: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|23: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|24: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|25: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|26: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|27: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|28: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|29: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|30: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, diff --git a/test/snapshots/scrolloff.golden b/test/snapshots/scrolloff.golden index 6054e8bc..5ab9fa55 100644 --- a/test/snapshots/scrolloff.golden +++ b/test/snapshots/scrolloff.golden @@ -1,7 +1,7 @@ == snap top grid=210x12 cursor=7,3 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol New Tty Find Grep Joincol -| /tmp/pardes-snap/scrolloff/cwd/g.txt Save Tty Del Collapse /tmp/pardes-snap/scrolloff/cwd Save Tty Del Togglettymode Filter Collapse +| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/scrolloff/cwd/g.txt Save Tty Collapse Del /tmp/pardes-snap/scrolloff/cwd Tty Save Mode Filter Collapse Del | 1 line 1 ls | 2 line 2 g.txt | 3 line 3 diff --git a/test/snapshots/selarg.golden b/test/snapshots/selarg.golden index b0a14b86..1a9fb86d 100644 --- a/test/snapshots/selarg.golden +++ b/test/snapshots/selarg.golden @@ -1,7 +1,7 @@ == snap kept grid=100x31 cursor=6,3 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol New Tty Find Grep Joincol -| /tmp/pardes-snap/selarg/cwd Save Tty Del Togglet /tmp/pardes-snap/selarg/cwd Save Tty Del Togglet +| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/selarg/cwd Tty Save Mode Filte /tmp/pardes-snap/selarg/cwd Tty Save Mode Filte | ZZARG ZZVEE ./c.sh | | @@ -16,7 +16,7 @@ | | | -| /tmp/pardes-snap/selarg/cwd Save Tty Del Togglet +| /tmp/pardes-snap/selarg/cwd Tty Save Mode Filte | ls | s.txt == snap crosspane grid=100x31 cursor=6,3 diff --git a/test/snapshots/selregex.golden b/test/snapshots/selregex.golden index 4f380f9b..f071fb15 100644 --- a/test/snapshots/selregex.golden +++ b/test/snapshots/selregex.golden @@ -1,78 +1,75 @@ -== snap prompt-armed grid=160x25 cursor=11,24 +== snap prompt-armed grid=160x25 cursor=159,3 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol -| /tmp/pardes-snap/selregex/cwd/m.zig Save Tty Del Collapse +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/selregex/cwd/m.zig Save Tty Collapse Del TreeContext +| Select / | 1 const one = 1; | 2 const two = 2; | 3 const three = 3; | 4 -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| Select / -== snap preview grid=160x25 cursor=16,24 -|24: Select /const +== snap preview grid=160x25 cursor=159,3 +|3: Select /const == style preview grid=160x25 |0: 0-70 #b2c3b8,#1d2824, 71-159 d,#1d2824, -|1: 0-24 #becfc4,#26362d, 25-159 d,#26362d, -|2: 0-1 #000000,#adcc91, 2-58 #becfc4,#26362d, 59-159 d,#26362d, -|3: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #f5f7ee,#405d4b, 11-11 #405d4b,#f5f7ee, 12-18 #e5eee5,#0d1410, 19-19 #e9bf91,#0d1410, 20-20 #e5eee5,#0d1410, 21-159 d,#0d1410, -|4: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #f5f7ee,#26382d, 11-11 #405d4b,#f5f7ee, 12-18 #e5eee5,#0d1410, 19-19 #e9bf91,#0d1410, 20-20 #e5eee5,#0d1410, 21-159 d,#0d1410, -|5: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #f5f7ee,#26382d, 11-11 #405d4b,#f5f7ee, 12-20 #e5eee5,#0d1410, 21-21 #e9bf91,#0d1410, 22-22 #e5eee5,#0d1410, 23-159 d,#0d1410, -|6: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-159 d,#0d1410, -|7: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-159 d,#0d1410, -|8: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-159 d,#0d1410, -|9: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-159 d,#0d1410, -|10: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-159 d,#0d1410, -|11: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-159 d,#0d1410, -|12: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-159 d,#0d1410, -|13: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-159 d,#0d1410, -|14: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-159 d,#0d1410, -|15: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-159 d,#0d1410, -|16: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-159 d,#0d1410, -|17: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-159 d,#0d1410, -|18: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-159 d,#0d1410, -|19: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-159 d,#0d1410, -|20: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-159 d,#0d1410, -|21: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-159 d,#0d1410, -|22: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-159 d,#0d1410, -|23: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-159 d,#0d1410, -|24: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-15 #e5eee5,#0d1410, 16-159 d,#0d1410, +|1: 0-1 #ffffff,#887455, 2-2 d,#26362d, 3-34 #becfc4,#26362d, 35-159 d,#26362d, +|2: 0-1 #000000,#add38a, 2-2 d,#26362d, 3-32 #becfc4,#26362d, 33-37 #dfbce5,#26362d, 38-71 #becfc4,#26362d, 72-159 d,#26362d, +|3: 0-0 d,#152019, 1-1 d,#0d1410, 2-144 d,#1d2824, 145-158 #b2c3b8,#1d2824, 159-159 d,#1d2824, +|4: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #f5f7ee,#3c614a, 11-11 #3c614a,#f5f7ee, 12-18 #e5eee5,#0d1410, 19-19 #f8c082,#0d1410, 20-20 #e5eee5,#0d1410, 21-159 d,#0d1410, +|5: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #f5f7ee,#243a2d, 11-11 #3c614a,#f5f7ee, 12-18 #e5eee5,#0d1410, 19-19 #f8c082,#0d1410, 20-20 #e5eee5,#0d1410, 21-159 d,#0d1410, +|6: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #f5f7ee,#243a2d, 11-11 #3c614a,#f5f7ee, 12-20 #e5eee5,#0d1410, 21-21 #f8c082,#0d1410, 22-22 #e5eee5,#0d1410, 23-159 d,#0d1410, +|7: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-159 d,#0d1410, +|8: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-159 d,#0d1410, +|9: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-159 d,#0d1410, +|10: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-159 d,#0d1410, +|11: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-159 d,#0d1410, +|12: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-159 d,#0d1410, +|13: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-159 d,#0d1410, +|14: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-159 d,#0d1410, +|15: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-159 d,#0d1410, +|16: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-159 d,#0d1410, +|17: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-159 d,#0d1410, +|18: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-159 d,#0d1410, +|19: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-159 d,#0d1410, +|20: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-159 d,#0d1410, +|21: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-159 d,#0d1410, +|22: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-159 d,#0d1410, +|23: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-159 d,#0d1410, +|24: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-159 d,#0d1410, == snap three-selected grid=160x25 cursor=11,3 -|24: +|3: 1 const one = 1; +|4: 2 const two = 2; +|5: 3 const three = 3; +|6: 4 +|7: == style three-selected grid=160x25 -|3: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-11 #f5f7ee,#405d4b, 12-18 #e5eee5,#0d1410, 19-19 #e9bf91,#0d1410, 20-20 #e5eee5,#0d1410, 21-159 d,#0d1410, -|24: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-159 d,#0d1410, -== snap narrowed grid=160x25 cursor=12,24 -|24: Select /t +|3: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-11 #f5f7ee,#3c614a, 12-18 #e5eee5,#0d1410, 19-19 #f8c082,#0d1410, 20-20 #e5eee5,#0d1410, 21-159 d,#0d1410, +|4: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #f5f7ee,#243a2d, 11-11 #3c614a,#f5f7ee, 12-18 #e5eee5,#0d1410, 19-19 #f8c082,#0d1410, 20-20 #e5eee5,#0d1410, 21-159 d,#0d1410, +|5: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #f5f7ee,#243a2d, 11-11 #3c614a,#f5f7ee, 12-20 #e5eee5,#0d1410, 21-21 #f8c082,#0d1410, 22-22 #e5eee5,#0d1410, 23-159 d,#0d1410, +|6: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-159 d,#0d1410, +== snap narrowed grid=160x25 cursor=159,3 +|3: Select /t +|4: 1 const one = 1; +|5: 2 const two = 2; +|6: 3 const three = 3; +|7: 4 == style narrowed grid=160x25 -|3: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-11 #405d4b,#f5f7ee, 12-18 #e5eee5,#0d1410, 19-19 #e9bf91,#0d1410, 20-20 #e5eee5,#0d1410, 21-159 d,#0d1410, -|4: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-11 #405d4b,#f5f7ee, 12-18 #e5eee5,#0d1410, 19-19 #e9bf91,#0d1410, 20-20 #e5eee5,#0d1410, 21-159 d,#0d1410, -|5: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-11 #405d4b,#f5f7ee, 12-20 #e5eee5,#0d1410, 21-21 #e9bf91,#0d1410, 22-22 #e5eee5,#0d1410, 23-159 d,#0d1410, -|24: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-11 #e5eee5,#0d1410, 12-159 d,#0d1410, +|3: 0-0 d,#152019, 1-1 d,#0d1410, 2-148 d,#1d2824, 149-158 #b2c3b8,#1d2824, 159-159 d,#1d2824, +|4: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-11 #3c614a,#f5f7ee, 12-18 #e5eee5,#0d1410, 19-19 #f8c082,#0d1410, 20-20 #e5eee5,#0d1410, 21-159 d,#0d1410, +|5: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-11 #3c614a,#f5f7ee, 12-18 #e5eee5,#0d1410, 19-19 #f8c082,#0d1410, 20-20 #e5eee5,#0d1410, 21-159 d,#0d1410, +|6: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-11 #3c614a,#f5f7ee, 12-20 #e5eee5,#0d1410, 21-21 #f8c082,#0d1410, 22-22 #e5eee5,#0d1410, 23-159 d,#0d1410, == snap esc-restores grid=160x25 cursor=11,3 -|24: +|3: 1 const one = 1; +|4: 2 const two = 2; +|5: 3 const three = 3; +|6: 4 +|7: == style esc-restores grid=160x25 -|3: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-11 #f5f7ee,#405d4b, 12-18 #e5eee5,#0d1410, 19-19 #e9bf91,#0d1410, 20-20 #e5eee5,#0d1410, 21-159 d,#0d1410, -|4: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #f5f7ee,#26382d, 11-11 #405d4b,#f5f7ee, 12-18 #e5eee5,#0d1410, 19-19 #e9bf91,#0d1410, 20-20 #e5eee5,#0d1410, 21-159 d,#0d1410, -|5: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #f5f7ee,#26382d, 11-11 #405d4b,#f5f7ee, 12-20 #e5eee5,#0d1410, 21-21 #e9bf91,#0d1410, 22-22 #e5eee5,#0d1410, 23-159 d,#0d1410, -|24: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-159 d,#0d1410, +|3: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-11 #f5f7ee,#3c614a, 12-18 #e5eee5,#0d1410, 19-19 #f8c082,#0d1410, 20-20 #e5eee5,#0d1410, 21-159 d,#0d1410, +|4: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #f5f7ee,#243a2d, 11-11 #3c614a,#f5f7ee, 12-18 #e5eee5,#0d1410, 19-19 #f8c082,#0d1410, 20-20 #e5eee5,#0d1410, 21-159 d,#0d1410, +|5: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #f5f7ee,#243a2d, 11-11 #3c614a,#f5f7ee, 12-20 #e5eee5,#0d1410, 21-21 #f8c082,#0d1410, 22-22 #e5eee5,#0d1410, 23-159 d,#0d1410, +|6: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-159 d,#0d1410, == snap commented grid=160x25 cursor=14,3 -|2: /tmp/pardes-snap/selregex/cwd/m.zig * Save Tty Del Collapse +|2: /tmp/pardes-snap/selregex/cwd/m.zig * Save Tty Collapse Del TreeContext |3: 1 // const one = 1; |4: 2 // const two = 2; |5: 3 // const three = 3; diff --git a/test/snapshots/shellset.golden b/test/snapshots/shellset.golden index 33cbfb29..777bb102 100644 --- a/test/snapshots/shellset.golden +++ b/test/snapshots/shellset.golden @@ -1,11 +1,13 @@ == snap boot grid=90x21 cursor=7,3 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol -| /tmp/pardes-snap/shellset/cwd/cmd.txt Save Tty Del Collapse +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/shellset/cwd/cmd.txt Save Tty Collapse Del | 1 Shell zznosuchshell -== snap builtin-ran grid=90x21 cursor=25,3 +== snap builtin-ran grid=90x21 cursor=25,4 +|3: Shell +|4: 1 Shell zznosuchshell == snap fallback-shell grid=90x21 cursor=49,5 -|1: New Tty Find Grep Joincol New Tty Find Grep Joincol -|2: /tmp/pardes-snap/shellset/cwd/cmd.txt Save /tmp/pardes-snap/shellset/cwd Save Tty Del +|1: New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +|2: /tmp/pardes-snap/shellset/cwd/cmd.txt Save /tmp/pardes-snap/shellset/cwd Tty Save Mod |3: 1 Shell zznosuchshell ls |4: cmd.txt zmarkfile.txt diff --git a/test/snapshots/shrinktag.golden b/test/snapshots/shrinktag.golden index 41098ef1..8ff798fa 100644 --- a/test/snapshots/shrinktag.golden +++ b/test/snapshots/shrinktag.golden @@ -1,7 +1,7 @@ == snap before grid=100x31 cursor=2,9 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol New Tty Find Grep Joincol -| /tmp/pardes-snap/shrinktag/cwd Save Tty Del Togg /tmp/pardes-snap/shrinktag/cwd Save Tty Del Togg +| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/shrinktag/cwd Tty Save Mode Fi /tmp/pardes-snap/shrinktag/cwd Tty Save Mode Fi | ls ls | w.txt w.txt | @@ -16,11 +16,11 @@ | | | -| /tmp/pardes-snap/shrinktag/cwd Save Tty Del Togg +| /tmp/pardes-snap/shrinktag/cwd Tty Save Mode Fi | ls | w.txt == snap shrunk grid=100x31 cursor=2,9 -|3: /tmp/pardes-snap/shrinktag/cwd Save Tty Del Togg ls +|3: /tmp/pardes-snap/shrinktag/cwd Tty Save Mode Fi ls |4: ls w.txt |5: w.txt |8: @@ -34,11 +34,11 @@ |4: w.txt w.txt |5: |8: echo one; echo two -|17: /tmp/pardes-snap/shrinktag/cwd Save Tty Del Togg +|17: /tmp/pardes-snap/shrinktag/cwd Tty Save Mode Fi |18: ls |19: w.txt == snap bottom-shrunk grid=100x31 cursor=2,9 |17: |18: |19: -|30: /tmp/pardes-snap/shrinktag/cwd Save Tty Del Togg +|30: /tmp/pardes-snap/shrinktag/cwd Tty Save Mode Fi diff --git a/test/snapshots/splitparent.golden b/test/snapshots/splitparent.golden index 7382103d..aedbdb8a 100644 --- a/test/snapshots/splitparent.golden +++ b/test/snapshots/splitparent.golden @@ -1,26 +1,26 @@ == snap shrunk grid=100x31 cursor=4,4 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol New Tty Find Grep Joincol -| /tmp/pardes-snap/splitparent/cwd Save Tty Del To /tmp/pardes-snap/splitparent/cwd Save Tty Del To -| /tmp/pardes-snap/splitparent/cwd Save Tty Del To ls +| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/splitparent/cwd Tty Save Mode /tmp/pardes-snap/splitparent/cwd Tty Save Mode +| /tmp/pardes-snap/splitparent/cwd Tty Save Mode ls | ls == snap swap-parent grid=100x31 cursor=4,8 -|6: /tmp/pardes-snap/splitparent/cwd Save Tty Del To +|6: /tmp/pardes-snap/splitparent/cwd Tty Save Mode |7: ls == snap tallest grid=100x6 cursor=54,5 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol New Tty Find Grep Joincol -| /tmp/pardes-snap/splitparent/cwd Save Tty Del To /tmp/pardes-snap/splitparent/cwd Save Tty Del To -| /tmp/pardes-snap/splitparent/cwd Save Tty Del To -| /tmp/pardes-snap/splitparent/cwd Save Tty Del To /tmp/pardes-snap/splitparent/cwd Save Tty Del To +| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/splitparent/cwd Tty Save Mode /tmp/pardes-snap/splitparent/cwd Tty Save Mode +| /tmp/pardes-snap/splitparent/cwd Tty Save Mode +| /tmp/pardes-snap/splitparent/cwd Tty Save Mode /tmp/pardes-snap/splitparent/cwd Tty Save Mode == snap regrown grid=100x31 cursor=54,19 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol New Tty Find Grep Joincol -| /tmp/pardes-snap/splitparent/cwd Save Tty Del To /tmp/pardes-snap/splitparent/cwd Save Tty Del To -| /tmp/pardes-snap/splitparent/cwd Save Tty Del To ls +| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/splitparent/cwd Tty Save Mode /tmp/pardes-snap/splitparent/cwd Tty Save Mode +| /tmp/pardes-snap/splitparent/cwd Tty Save Mode ls | ls | -| /tmp/pardes-snap/splitparent/cwd Save Tty Del To +| /tmp/pardes-snap/splitparent/cwd Tty Save Mode | ls | | @@ -31,5 +31,5 @@ | | | -| /tmp/pardes-snap/splitparent/cwd Save Tty Del To +| /tmp/pardes-snap/splitparent/cwd Tty Save Mode | ls diff --git a/test/snapshots/stepgrain.golden b/test/snapshots/stepgrain.golden index 202a4f9a..b8b4dca2 100644 --- a/test/snapshots/stepgrain.golden +++ b/test/snapshots/stepgrain.golden @@ -1,7 +1,7 @@ == snap results grid=150x31 cursor=7,3 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol -| /tmp/pardes-snap/stepgrain/cwd/a.txt Save Tty Del Collapse +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/stepgrain/cwd/a.txt Save Tty Collapse Del | 1 hello ZQMARK one | 2 see also sub/b.txt for ZQMARK two | @@ -23,67 +23,74 @@ | | | -| -| -| -| /tmp/pardes-snap/stepgrain/cwd/+Search Save Tty Del Collapse -| 1 a.txt:1:7-12 hello ZQMARK one -| 2 a.txt:2:24-29 see also sub/b.txt for ZQMARK two -| 3 sub/b.txt:1:1-6 ZQMARK inside sub -== snap step-row1 grid=150x31 cursor=7,28 +| /tmp/pardes-snap/stepgrain/cwd/+Search Save Tty Collapse Del LocationsConfig +| 1 a.txt:1:7-12 +| 2 hello ZQMARK one +| 3 a.txt:2:24-29 +| 4 see also sub/b.txt for ZQMARK two +| 5 sub/b.txt:1:1-6 +| 6 ZQMARK inside sub +== snap step-row1 grid=150x31 cursor=7,25 == style step-row1 grid=150x31 |0: 0-70 #b2c3b8,#1d2824, 71-149 d,#1d2824, -|1: 0-24 #becfc4,#26362d, 25-149 d,#26362d, -|2: 0-1 #ffffff,#4c6356, 2-59 #b2c3b8,#1d2824, 60-149 d,#1d2824, -|3: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-22 #e5eee5,#0d1410, 23-149 d,#0d1410, -|4: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-39 #e5eee5,#0d1410, 40-149 d,#0d1410, -|5: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 d,#0d1410, -|6: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 d,#0d1410, -|7: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 d,#0d1410, -|8: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 d,#0d1410, -|9: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 d,#0d1410, -|10: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 d,#0d1410, -|11: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 d,#0d1410, -|12: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 d,#0d1410, -|13: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 d,#0d1410, -|14: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 d,#0d1410, -|15: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 d,#0d1410, -|16: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 d,#0d1410, -|17: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 d,#0d1410, -|18: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 d,#0d1410, -|19: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 d,#0d1410, -|20: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 d,#0d1410, -|21: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 d,#0d1410, -|22: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 d,#0d1410, -|23: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 d,#0d1410, -|24: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 d,#0d1410, -|25: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 d,#0d1410, -|26: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 d,#0d1410, -|27: 0-1 #000000,#adcc91, 2-61 #becfc4,#26362d, 62-149 d,#26362d, -|28: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-18 #f5f7ee,#405d4b, 19-25 #e5eee5,#0d1410, 26-31 #f7e4a5,#57472a, 32-35 #e5eee5,#0d1410, 36-149 d,#0d1410, -|29: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-19 #59675c,#0d1410, 20-43 #e5eee5,#0d1410, 44-49 #f7e4a5,#57472a, 50-53 #e5eee5,#0d1410, 54-149 d,#0d1410, -|30: 0-0 d,#152019, 1-1 d,#0d1410, 2-21 #59675c,#0d1410, 22-22 #e5eee5,#0d1410, 23-28 #f7e4a5,#57472a, 29-39 #e5eee5,#0d1410, 40-149 d,#0d1410, -== snap step-row2 grid=150x31 cursor=7,29 +|1: 0-1 #ffffff,#887455, 2-2 d,#26362d, 3-34 #becfc4,#26362d, 35-149 d,#26362d, +|2: 0-1 #ffffff,#496656, 2-2 d,#1d2824, 3-33 #b2c3b8,#1d2824, 34-38 #d3b0d9,#1d2824, 39-60 #b2c3b8,#1d2824, 61-149 d,#1d2824, +|3: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-22 #e5eee5,#0d1410, 23-149 d,#0d1410, +|4: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-39 #e5eee5,#0d1410, 40-149 d,#0d1410, +|5: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 d,#0d1410, +|6: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 d,#0d1410, +|7: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 d,#0d1410, +|8: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 d,#0d1410, +|9: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 d,#0d1410, +|10: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 d,#0d1410, +|11: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 d,#0d1410, +|12: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 d,#0d1410, +|13: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 d,#0d1410, +|14: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 d,#0d1410, +|15: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 d,#0d1410, +|16: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 d,#0d1410, +|17: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 d,#0d1410, +|18: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 d,#0d1410, +|19: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 d,#0d1410, +|20: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 d,#0d1410, +|21: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 d,#0d1410, +|22: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 d,#0d1410, +|23: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-149 d,#0d1410, +|24: 0-1 #000000,#add38a, 2-2 d,#26362d, 3-33 #becfc4,#26362d, 34-40 #dfbce5,#26362d, 41-78 #becfc4,#26362d, 79-149 d,#26362d, +|25: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-18 #f5f7ee,#3c614a, 19-149 d,#0d1410, +|26: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-12 #e5eee5,#0d1410, 13-18 #f7e4a5,#5e4923, 19-22 #e5eee5,#0d1410, 23-149 d,#0d1410, +|27: 0-0 d,#608269, 1-1 d,#0d1410, 2-19 #59675c,#0d1410, 20-149 d,#0d1410, +|28: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-29 #e5eee5,#0d1410, 30-35 #f7e4a5,#5e4923, 36-39 #e5eee5,#0d1410, 40-149 d,#0d1410, +|29: 0-0 d,#608269, 1-1 d,#0d1410, 2-21 #59675c,#0d1410, 22-149 d,#0d1410, +|30: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-12 #f7e4a5,#5e4923, 13-23 #e5eee5,#0d1410, 24-149 d,#0d1410, +== snap step-row2 grid=150x31 cursor=7,27 == style step-row2 grid=150x31 -|28: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-18 #59675c,#0d1410, 19-25 #e5eee5,#0d1410, 26-31 #f7e4a5,#57472a, 32-35 #e5eee5,#0d1410, 36-149 d,#0d1410, -|29: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-19 #f5f7ee,#405d4b, 20-43 #e5eee5,#0d1410, 44-49 #f7e4a5,#57472a, 50-53 #e5eee5,#0d1410, 54-149 d,#0d1410, -== snap step-row3 grid=150x31 cursor=7,29 -|28: 2 a.txt:2:24-29 see also sub/b.txt for ZQMARK two -|29: 3 sub/b.txt:1:1-6 ZQMARK inside sub -|30: 4 -== snap step-wrap grid=150x31 cursor=7,28 -|28: 1 a.txt:1:7-12 hello ZQMARK one -|29: 2 a.txt:2:24-29 see also sub/b.txt for ZQMARK two -|30: 3 sub/b.txt:1:1-6 ZQMARK inside sub -== snap blank-in-path grid=150x31 cursor=7,26 -|25: /tmp/pardes-snap/stepgrain/cwd/+Search Save Tty Del Collapse -|26: 1 two words.txt +|25: 0-0 d,#608269, 1-1 d,#0d1410, 2-18 #59675c,#0d1410, 19-149 d,#0d1410, +|27: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-19 #f5f7ee,#3c614a, 20-149 d,#0d1410, +== snap step-row3 grid=150x31 cursor=7,28 +|25: 2 hello ZQMARK one +|26: 3 a.txt:2:24-29 +|27: 4 see also sub/b.txt for ZQMARK two +|28: 5 sub/b.txt:1:1-6 +|29: 6 ZQMARK inside sub +|30: 7 +== snap step-wrap grid=150x31 cursor=7,25 +|25: 1 a.txt:1:7-12 +|26: 2 hello ZQMARK one +|27: 3 a.txt:2:24-29 +|28: 4 see also sub/b.txt for ZQMARK two +|29: 5 sub/b.txt:1:1-6 +|30: 6 ZQMARK inside sub +== snap blank-in-path grid=150x31 cursor=7,23 +|22: /tmp/pardes-snap/stepgrain/cwd/+Search Save Tty Collapse Del +|23: 1 two words.txt == style blank-in-path grid=150x31 -|25: 0-1 #000000,#adcc91, 2-61 #becfc4,#26362d, 62-149 d,#26362d, -|26: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-19 #f5f7ee,#405d4b, 20-149 d,#0d1410, -|27: 0-1 #ffffff,#4c6356, 2-61 #b2c3b8,#1d2824, 62-149 d,#1d2824, -|28: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-18 #f5f7ee,#405d4b, 19-25 #e5eee5,#0d1410, 26-31 #f7e4a5,#57472a, 32-35 #e5eee5,#0d1410, 36-149 d,#0d1410, -|29: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-19 #59675c,#0d1410, 20-43 #e5eee5,#0d1410, 44-49 #f7e4a5,#57472a, 50-53 #e5eee5,#0d1410, 54-149 d,#0d1410, -== snap blank-opened grid=150x31 cursor=7,15 -|14: /tmp/pardes-snap/stepgrain/cwd/two words.txt Save Tty Del Collapse -|15: 1 +|22: 0-1 #000000,#add38a, 2-2 d,#26362d, 3-33 #becfc4,#26362d, 34-40 #dfbce5,#26362d, 41-62 #becfc4,#26362d, 63-149 d,#26362d, +|23: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-19 #f5f7ee,#3c614a, 20-149 d,#0d1410, +|24: 0-1 #ffffff,#496656, 2-2 d,#1d2824, 3-33 #b2c3b8,#1d2824, 34-40 #d3b0d9,#1d2824, 41-78 #b2c3b8,#1d2824, 79-149 d,#1d2824, +|25: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-18 #f5f7ee,#3c614a, 19-149 d,#0d1410, +|27: 0-0 d,#608269, 1-1 d,#0d1410, 2-19 #59675c,#0d1410, 20-149 d,#0d1410, +== snap blank-opened grid=150x31 cursor=7,13 +|12: /tmp/pardes-snap/stepgrain/cwd/two words.txt Save Tty Collapse Del +|13: 1 +|23: Look diff --git a/test/snapshots/syntax.golden b/test/snapshots/syntax.golden index 3199f03a..5b2811f7 100644 --- a/test/snapshots/syntax.golden +++ b/test/snapshots/syntax.golden @@ -1,11 +1,11 @@ == snap zig-open grid=150x31 cursor=7,7 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol New Tty Find Grep Joincol -| /tmp/pardes-snap/syntax/cwd Save Tty Del Togglettymode Filter Collapse /tmp/pardes-snap/syntax/cwd Save Tty Del Togglettymode Filter Collapse -| ls ls -| demo.zig demo.zig -| -| /tmp/pardes-snap/syntax/cwd/demo.zig Save Tty Del Collapse +| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/syntax/cwd Tty Save Mode Filter Collapse Del /tmp/pardes-snap/syntax/cwd Tty Save Mode Filter Collapse Del +| Look ls +| ls demo.zig +| demo.zig +| /tmp/pardes-snap/syntax/cwd/demo.zig Save Tty Collapse Del TreeContext | 1 const std = @import("std"); // greet | 2 pub fn main() void { | 3 var x: u32 = 42; @@ -16,94 +16,95 @@ | | | -| /tmp/pardes-snap/syntax/cwd Save Tty Del Togglettymode Filter Collapse +| /tmp/pardes-snap/syntax/cwd Tty Save Mode Filter Collapse Del | ls | demo.zig == style zig-open grid=150x31 |0: 0-70 #b2c3b8,#1d2824, 71-149 d,#1d2824, -|1: 0-24 #becfc4,#26362d, 25-74 d,#26362d, 75-99 #b2c3b8,#1d2824, 100-149 d,#1d2824, -|2: 0-1 #ffffff,#4c6356, 2-71 #b2c3b8,#1d2824, 72-74 d,#1d2824, 75-76 #ffffff,#4c6356, 77-146 #b2c3b8,#1d2824, 147-149 d,#1d2824, -|3: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|4: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|5: 0-0 d,#637f6a, 1-74 d,#0d1410, 75-75 d,#637f6a, 76-149 d,#0d1410, -|6: 0-1 #000000,#adcc91, 2-59 #becfc4,#26362d, 60-74 d,#26362d, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|7: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-18 #e5eee5,#0d1410, 19-25 #c9b0e4,#0d1410, 26-26 #e5eee5,#0d1410, 27-31 #b6ce94,#0d1410, 32-34 #e5eee5,#0d1410, 35-42 #b9e58f,#0d1410, 43-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|8: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-12 #c9b0e4,#0d1410, 13-26 #e5eee5,#0d1410, 27-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|9: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-23 #e5eee5,#0d1410, 24-25 #e9bf91,#0d1410, 26-26 #e5eee5,#0d1410, 27-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|10: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-16 #e5eee5,#0d1410, 17-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|11: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-7 #e5eee5,#0d1410, 8-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|12: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|13: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|14: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|15: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|16: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|17: 0-1 #ffffff,#4c6356, 2-71 #b2c3b8,#1d2824, 72-74 d,#1d2824, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|18: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|19: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|20: 0-0 d,#637f6a, 1-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|21: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|22: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|23: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|24: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|25: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|26: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|27: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|28: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|29: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|30: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|1: 0-1 #ffffff,#887455, 2-2 d,#26362d, 3-34 #becfc4,#26362d, 35-74 d,#26362d, 75-76 #ffffff,#887455, 77-77 d,#1d2824, 78-109 #b2c3b8,#1d2824, 110-149 d,#1d2824, +|2: 0-1 #ffffff,#496656, 2-2 d,#1d2824, 3-30 #b2c3b8,#1d2824, 31-33 #d3b0d9,#1d2824, 34-63 #b2c3b8,#1d2824, 64-74 d,#1d2824, 75-76 #ffffff,#496656, 77-77 d,#1d2824, 78-105 #b2c3b8,#1d2824, 106-108 #d3b0d9,#1d2824, 109-138 #b2c3b8,#1d2824, 139-149 d,#1d2824, +|3: 0-0 d,#152019, 1-1 d,#0d1410, 2-70 d,#1d2824, 71-74 #b2c3b8,#1d2824, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|4: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|5: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-149 d,#0d1410, +|6: 0-1 #000000,#add38a, 2-2 d,#26362d, 3-30 #becfc4,#26362d, 31-38 #dfbce5,#26362d, 39-72 #becfc4,#26362d, 73-74 d,#26362d, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|7: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-18 #e5eee5,#0d1410, 19-25 #c9a7ed,#0d1410, 26-26 #e5eee5,#0d1410, 27-31 #b8d88a,#0d1410, 32-34 #e5eee5,#0d1410, 35-42 #b9f480,#0d1410, 43-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|8: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-12 #c9a7ed,#0d1410, 13-26 #e5eee5,#0d1410, 27-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|9: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-23 #e5eee5,#0d1410, 24-25 #f8c082,#0d1410, 26-26 #e5eee5,#0d1410, 27-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|10: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-16 #e5eee5,#0d1410, 17-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|11: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-7 #e5eee5,#0d1410, 8-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|12: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|13: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|14: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|15: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|16: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|17: 0-1 #ffffff,#496656, 2-2 d,#1d2824, 3-30 #b2c3b8,#1d2824, 31-33 #d3b0d9,#1d2824, 34-63 #b2c3b8,#1d2824, 64-74 d,#1d2824, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|18: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|19: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|20: 0-0 d,#608269, 1-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|21: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|22: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|23: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|24: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|25: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|26: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|27: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|28: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|29: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|30: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, == style colors-off grid=150x31 -|3: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-3 #e5eee5,#0d1410, 4-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-78 #e5eee5,#0d1410, 79-149 d,#0d1410, -|4: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-9 #e5eee5,#0d1410, 10-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-84 #e5eee5,#0d1410, 85-149 d,#0d1410, -|6: 0-1 #000000,#adcc91, 2-59 #becfc4,#26362d, 60-74 d,#26362d, 75-75 d,#637f6a, 76-149 d,#0d1410, -|7: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-42 #e5eee5,#0d1410, 43-74 d,#0d1410, 75-75 d,#637f6a, 76-149 d,#0d1410, -|8: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-26 #e5eee5,#0d1410, 27-74 d,#0d1410, 75-75 d,#637f6a, 76-149 d,#0d1410, -|9: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-26 #e5eee5,#0d1410, 27-74 d,#0d1410, 75-75 d,#637f6a, 76-149 d,#0d1410, -|10: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-16 #e5eee5,#0d1410, 17-74 d,#0d1410, 75-75 d,#637f6a, 76-149 d,#0d1410, -|11: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-7 #e5eee5,#0d1410, 8-74 d,#0d1410, 75-75 d,#637f6a, 76-149 d,#0d1410, -|12: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-74 d,#0d1410, 75-75 d,#637f6a, 76-149 d,#0d1410, -|13: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-74 d,#0d1410, 75-75 d,#637f6a, 76-149 d,#0d1410, -|14: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-74 d,#0d1410, 75-75 d,#637f6a, 76-149 d,#0d1410, -|15: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-74 d,#0d1410, 75-75 d,#637f6a, 76-149 d,#0d1410, -|16: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-74 d,#0d1410, 75-75 d,#637f6a, 76-149 d,#0d1410, -|17: 0-1 #ffffff,#4c6356, 2-71 #b2c3b8,#1d2824, 72-74 d,#1d2824, 75-75 d,#637f6a, 76-149 d,#0d1410, -|18: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-3 #e5eee5,#0d1410, 4-74 d,#0d1410, 75-75 d,#637f6a, 76-149 d,#0d1410, -|19: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-9 #e5eee5,#0d1410, 10-74 d,#0d1410, 75-75 d,#637f6a, 76-149 d,#0d1410, -|20: 0-0 d,#637f6a, 1-74 d,#0d1410, 75-75 d,#637f6a, 76-149 d,#0d1410, -|21: 0-0 d,#637f6a, 1-74 d,#0d1410, 75-75 d,#637f6a, 76-149 d,#0d1410, -|22: 0-0 d,#637f6a, 1-74 d,#0d1410, 75-75 d,#637f6a, 76-149 d,#0d1410, -|23: 0-0 d,#637f6a, 1-74 d,#0d1410, 75-75 d,#637f6a, 76-149 d,#0d1410, -|24: 0-0 d,#637f6a, 1-74 d,#0d1410, 75-75 d,#637f6a, 76-149 d,#0d1410, -|25: 0-0 d,#637f6a, 1-74 d,#0d1410, 75-75 d,#637f6a, 76-149 d,#0d1410, -|26: 0-0 d,#637f6a, 1-74 d,#0d1410, 75-75 d,#637f6a, 76-149 d,#0d1410, -|27: 0-0 d,#637f6a, 1-74 d,#0d1410, 75-75 d,#637f6a, 76-149 d,#0d1410, -|28: 0-0 d,#637f6a, 1-74 d,#0d1410, 75-75 d,#637f6a, 76-149 d,#0d1410, -|29: 0-0 d,#637f6a, 1-74 d,#0d1410, 75-75 d,#637f6a, 76-149 d,#0d1410, -|30: 0-0 d,#637f6a, 1-74 d,#0d1410, 75-75 d,#637f6a, 76-149 d,#0d1410, +|3: 0-0 d,#608269, 1-1 d,#0d1410, 2-3 #e5eee5,#0d1410, 4-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-78 #e5eee5,#0d1410, 79-149 d,#0d1410, +|4: 0-0 d,#608269, 1-1 d,#0d1410, 2-9 #e5eee5,#0d1410, 10-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-84 #e5eee5,#0d1410, 85-149 d,#0d1410, +|5: 0-0 d,#608269, 1-74 d,#0d1410, 75-75 d,#608269, 76-149 d,#0d1410, +|6: 0-1 #000000,#add38a, 2-2 d,#26362d, 3-30 #becfc4,#26362d, 31-38 #dfbce5,#26362d, 39-72 #becfc4,#26362d, 73-74 d,#26362d, 75-75 d,#608269, 76-149 d,#0d1410, +|7: 0-0 d,#152019, 1-1 d,#0d1410, 2-68 d,#1d2824, 69-74 #b2c3b8,#1d2824, 75-75 d,#608269, 76-149 d,#0d1410, +|8: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-42 #e5eee5,#0d1410, 43-74 d,#0d1410, 75-75 d,#608269, 76-149 d,#0d1410, +|9: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-26 #e5eee5,#0d1410, 27-74 d,#0d1410, 75-75 d,#608269, 76-149 d,#0d1410, +|10: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-26 #e5eee5,#0d1410, 27-74 d,#0d1410, 75-75 d,#608269, 76-149 d,#0d1410, +|11: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-16 #e5eee5,#0d1410, 17-74 d,#0d1410, 75-75 d,#608269, 76-149 d,#0d1410, +|12: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-7 #e5eee5,#0d1410, 8-74 d,#0d1410, 75-75 d,#608269, 76-149 d,#0d1410, +|13: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-74 d,#0d1410, 75-75 d,#608269, 76-149 d,#0d1410, +|14: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-74 d,#0d1410, 75-75 d,#608269, 76-149 d,#0d1410, +|15: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-74 d,#0d1410, 75-75 d,#608269, 76-149 d,#0d1410, +|16: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-74 d,#0d1410, 75-75 d,#608269, 76-149 d,#0d1410, +|17: 0-1 #ffffff,#496656, 2-2 d,#1d2824, 3-30 #b2c3b8,#1d2824, 31-33 #d3b0d9,#1d2824, 34-63 #b2c3b8,#1d2824, 64-74 d,#1d2824, 75-75 d,#608269, 76-149 d,#0d1410, +|18: 0-0 d,#608269, 1-1 d,#0d1410, 2-3 #e5eee5,#0d1410, 4-74 d,#0d1410, 75-75 d,#608269, 76-149 d,#0d1410, +|19: 0-0 d,#608269, 1-1 d,#0d1410, 2-9 #e5eee5,#0d1410, 10-74 d,#0d1410, 75-75 d,#608269, 76-149 d,#0d1410, +|20: 0-0 d,#608269, 1-74 d,#0d1410, 75-75 d,#608269, 76-149 d,#0d1410, +|21: 0-0 d,#608269, 1-74 d,#0d1410, 75-75 d,#608269, 76-149 d,#0d1410, +|22: 0-0 d,#608269, 1-74 d,#0d1410, 75-75 d,#608269, 76-149 d,#0d1410, +|23: 0-0 d,#608269, 1-74 d,#0d1410, 75-75 d,#608269, 76-149 d,#0d1410, +|24: 0-0 d,#608269, 1-74 d,#0d1410, 75-75 d,#608269, 76-149 d,#0d1410, +|25: 0-0 d,#608269, 1-74 d,#0d1410, 75-75 d,#608269, 76-149 d,#0d1410, +|26: 0-0 d,#608269, 1-74 d,#0d1410, 75-75 d,#608269, 76-149 d,#0d1410, +|27: 0-0 d,#608269, 1-74 d,#0d1410, 75-75 d,#608269, 76-149 d,#0d1410, +|28: 0-0 d,#608269, 1-74 d,#0d1410, 75-75 d,#608269, 76-149 d,#0d1410, +|29: 0-0 d,#608269, 1-74 d,#0d1410, 75-75 d,#608269, 76-149 d,#0d1410, +|30: 0-0 d,#608269, 1-74 d,#0d1410, 75-75 d,#608269, 76-149 d,#0d1410, == style colors-on grid=150x31 -|3: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|4: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|6: 0-1 #000000,#adcc91, 2-59 #becfc4,#26362d, 60-74 d,#26362d, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|7: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-18 #e5eee5,#0d1410, 19-25 #c9b0e4,#0d1410, 26-26 #e5eee5,#0d1410, 27-31 #b6ce94,#0d1410, 32-34 #e5eee5,#0d1410, 35-42 #b9e58f,#0d1410, 43-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|8: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-12 #c9b0e4,#0d1410, 13-26 #e5eee5,#0d1410, 27-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|9: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-23 #e5eee5,#0d1410, 24-25 #e9bf91,#0d1410, 26-26 #e5eee5,#0d1410, 27-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|10: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-16 #e5eee5,#0d1410, 17-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|11: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-7 #e5eee5,#0d1410, 8-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|12: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|13: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|14: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|15: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|16: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|17: 0-1 #ffffff,#4c6356, 2-71 #b2c3b8,#1d2824, 72-74 d,#1d2824, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|18: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|19: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|20: 0-0 d,#637f6a, 1-74 d,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|21: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|22: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|23: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|24: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|25: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|26: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|27: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|28: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|29: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|30: 0-0 d,#637f6a, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#637f6a, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|3: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|4: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|6: 0-1 #000000,#add38a, 2-2 d,#26362d, 3-30 #becfc4,#26362d, 31-38 #dfbce5,#26362d, 39-72 #becfc4,#26362d, 73-74 d,#26362d, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|7: 0-0 d,#152019, 1-1 d,#0d1410, 2-68 d,#1d2824, 69-74 #b2c3b8,#1d2824, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|8: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-18 #e5eee5,#0d1410, 19-25 #c9a7ed,#0d1410, 26-26 #e5eee5,#0d1410, 27-31 #b8d88a,#0d1410, 32-34 #e5eee5,#0d1410, 35-42 #b9f480,#0d1410, 43-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|9: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-12 #c9a7ed,#0d1410, 13-26 #e5eee5,#0d1410, 27-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|10: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-23 #e5eee5,#0d1410, 24-25 #f8c082,#0d1410, 26-26 #e5eee5,#0d1410, 27-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|11: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-16 #e5eee5,#0d1410, 17-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|12: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-7 #e5eee5,#0d1410, 8-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|13: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|14: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|15: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|16: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|17: 0-1 #ffffff,#496656, 2-2 d,#1d2824, 3-30 #b2c3b8,#1d2824, 31-33 #d3b0d9,#1d2824, 34-63 #b2c3b8,#1d2824, 64-74 d,#1d2824, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|18: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|19: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|20: 0-0 d,#608269, 1-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|21: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|22: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|23: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|24: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|25: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|26: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|27: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|28: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|29: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|30: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, diff --git a/test/snapshots/tag.golden b/test/snapshots/tag.golden index abc83b8f..5e4cb4d1 100644 --- a/test/snapshots/tag.golden +++ b/test/snapshots/tag.golden @@ -1,7 +1,7 @@ -== snap tag-focus grid=150x31 cursor=26,2 +== snap tag-focus grid=150x31 cursor=31,2 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol New Tty Find Grep Joincol -| /tmp/pardes-snap/tag/cwd Save Tty Del Togglettymode Filter Collapse /tmp/pardes-snap/tag/cwd Save Tty Del Togglettymode Filter Collapse +| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/tag/cwd Tty Save Mode Filter Collapse Del /tmp/pardes-snap/tag/cwd Tty Save Mode Filter Collapse Del | ls ls | t.txt t.txt | @@ -16,15 +16,18 @@ | | | -| /tmp/pardes-snap/tag/cwd Save Tty Del Togglettymode Filter Collapse +| /tmp/pardes-snap/tag/cwd Tty Save Mode Filter Collapse Del | ls | t.txt -== snap tag-typed grid=150x31 cursor=32,2 -|2: /tmp/pardes-snap/tag/cwd t.txt Save Tty Del Togglettymode Filter Collapse /tmp/pardes-snap/tag/cwd Save Tty Del Togglettymode Filter Collapse -== snap tag-del grid=150x31 cursor=28,2 -|2: /tmp/pardes-snap/tag/cwd t Save Tty Del Togglettymode Filter Collapse /tmp/pardes-snap/tag/cwd Save Tty Del Togglettymode Filter Collapse +== snap tag-typed grid=150x31 cursor=37,2 +|2: /tmp/pardes-snap/tag/cwd Tty t.txt Save Mode Filter Collapse Del /tmp/pardes-snap/tag/cwd Tty Save Mode Filter Collapse Del +== snap tag-del grid=150x31 cursor=33,2 +|2: /tmp/pardes-snap/tag/cwd Tty t Save Mode Filter Collapse Del /tmp/pardes-snap/tag/cwd Tty Save Mode Filter Collapse Del == snap tag-exit grid=150x31 cursor=4,5 -|2: /tmp/pardes-snap/tag/cwd t.txt Save Tty Del Togglettymode Filter Collapse /tmp/pardes-snap/tag/cwd Save Tty Del Togglettymode Filter Collapse +|2: /tmp/pardes-snap/tag/cwd Tty t.txt Save Mode Filter Collapse Del /tmp/pardes-snap/tag/cwd Tty Save Mode Filter Collapse Del == snap tag-look grid=150x31 cursor=7,7 -|6: /tmp/pardes-snap/tag/cwd/t.txt Save Tty Del Collapse +|3: Look ls +|4: ls t.txt +|5: t.txt +|6: /tmp/pardes-snap/tag/cwd/t.txt Save Tty Collapse Del |7: 1 ZZLOOKED diff --git a/test/snapshots/tagalign.golden b/test/snapshots/tagalign.golden index eaed8e2e..6d61ad2f 100644 --- a/test/snapshots/tagalign.golden +++ b/test/snapshots/tagalign.golden @@ -1,7 +1,7 @@ == snap aligned grid=100x31 cursor=4,20 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol -| /tmp/pardes-snap/tagalign/cwd/deep/nested-project-directory/document.txt Save Tty Del Collapse +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/tagalign/cwd/deep/nested-project-directory/document.txt Save Tty Collapse Del | 1 alpha | 2 beta | 3 gamma @@ -16,13 +16,13 @@ | | | -| /tmp/pardes-snap/tagalign/cwd Save Tty Del Togglettymode Filter Collapse +| /tmp/pardes-snap/tagalign/cwd Tty Save Mode Filter Collapse Del | ls | deep == snap fits grid=87x31 cursor=4,20 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol -| /tmp/pardes-snap/tagalign/cwd/deep/nested-project-directory/document.txt Save Tty Del +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/tagalign/cwd/deep/nested-project-directory/document.txt Save Tty Co | 1 alpha | 2 beta | 3 gamma @@ -37,13 +37,13 @@ | | | -| /tmp/pardes-snap/tagalign/cwd Save Tty Del Togglettymode Filter Collapse +| /tmp/pardes-snap/tagalign/cwd Tty Save Mode Filter Collapse Del | ls | deep == snap overby1 grid=86x31 cursor=4,20 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol -| /tmp/pardes-snap/tagalign/cwd/deep/nested-project-directory/document.txt Save Tty De +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/tagalign/cwd/deep/nested-project-directory/document.txt Save Tty C | 1 alpha | 2 beta | 3 gamma @@ -58,13 +58,13 @@ | | | -| /tmp/pardes-snap/tagalign/cwd Save Tty Del Togglettymode Filter Collapse +| /tmp/pardes-snap/tagalign/cwd Tty Save Mode Filter Collapse Del | ls | deep == snap clicked grid=100x31 cursor=11,2 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol -| /tmp/pardes-snap/tagalign/cwd/deep/nested-project-directory/document.txt Save Tty Del Collapse +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/tagalign/cwd/deep/nested-project-directory/document.txt Save Tty Collapse Del | 1 alpha | 2 beta | 3 gamma @@ -79,13 +79,13 @@ | | | -| /tmp/pardes-snap/tagalign/cwd Save Tty Del Togglettymode Filter Collapse +| /tmp/pardes-snap/tagalign/cwd Tty Save Mode Filter Collapse Del | ls | deep == snap revealed grid=70x31 cursor=69,2 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kil -|New Tty Find Grep Joincol -| wd/deep/nested-project-directory/document.txt Save Tty Del Collapse +| New Tty Find Grep Joincol Delcol +| d/deep/nested-project-directory/document.txt Save Tty Collapse Del | 1 alpha | 2 beta | 3 gamma @@ -100,11 +100,11 @@ | | | -| /tmp/pardes-snap/tagalign/cwd Save Tty Del Togglettymode Filter Coll +| /tmp/pardes-snap/tagalign/cwd Tty Save Mode Filter Collapse Del | ls | deep == snap alone grid=70x31 cursor=4,5 -|2: /tmp/pardes-snap/tagalign/cwd Save Tty Del Togglettymode Filter Coll +|2: /tmp/pardes-snap/tagalign/cwd Tty Save Mode Filter Collapse Del |3: ls |4: deep |5: diff --git a/test/snapshots/tagalign2col.golden b/test/snapshots/tagalign2col.golden index cef20c73..e703dbef 100644 --- a/test/snapshots/tagalign2col.golden +++ b/test/snapshots/tagalign2col.golden @@ -1,17 +1,20 @@ == snap onecol grid=160x31 cursor=7,3 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol New Tty Find Grep Joincol -| /tmp/pardes-snap/tagalign2col/cwd/deep/proj/document.txt Save Tty Del Collapse /tmp/pardes-snap/tagalign2col/cwd Save Tty Del Togglettymode Filter Collapse -| 1 alpha ls -| 2 beta deep -| 3 gamma +| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/tagalign2col/cwd/deep/proj/document.txt Save Tty Collapse De /tmp/pardes-snap/tagalign2col/cwd Tty Save Mode Filter Collapse Del +| 1 alpha Left +| 2 beta ls +| 3 gamma deep == snap aligned grid=160x31 cursor=4,20 -|17: /tmp/pardes-snap/tagalign2col/cwd Save Tty Del Togglettymode Filter Collapse +|3: 1 alpha ls +|4: 2 beta deep +|5: 3 gamma +|17: /tmp/pardes-snap/tagalign2col/cwd Tty Save Mode Filter Collapse Del |18: ls |19: deep == snap widened grid=160x31 cursor=4,20 -|1: New Tty Find Grep Joincol ╎New Tty Find Grep Joincol -|2: /tmp/pardes-snap/tagalign2col/cwd/deep/proj/document.txt Save Tty Del Collapse ╎ /tmp/pardes-snap/tagalign2col/cwd Save Tty Del Togglettymo +|1: New Tty Find Grep Joincol Delcol ╎ New Tty Find Grep Joincol Delcol +|2: /tmp/pardes-snap/tagalign2col/cwd/deep/proj/document.txt Save Tty Collapse Del ╎ /tmp/pardes-snap/tagalign2col/cwd Tty Save Mode Filter Co |3: 1 alpha ╎ ls |4: 2 beta ╎ deep |5: 3 gamma ╎ @@ -26,7 +29,7 @@ |14: ╎ |15: ╎ |16: ╎ -|17: /tmp/pardes-snap/tagalign2col/cwd Save Tty Del Togglettymode Filter Collapse ╎ +|17: /tmp/pardes-snap/tagalign2col/cwd Tty Save Mode Filter Collapse Del ╎ |18: ls ╎ |19: deep ╎ |20: ╎ diff --git a/test/snapshots/tagbottom.golden b/test/snapshots/tagbottom.golden index f455c425..eb1d67fd 100644 --- a/test/snapshots/tagbottom.golden +++ b/test/snapshots/tagbottom.golden @@ -1,7 +1,7 @@ == snap boot grid=100x31 cursor=7,3 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol -| /tmp/pardes-snap/tagbottom/cwd/top.txt Save Tty Del Collapse +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/tagbottom/cwd/top.txt Save Tty Collapse Del | 1 aaa | 2 bbb | 3 ccc @@ -56,9 +56,9 @@ |26: 25 yyy |27: 26 zzz |28: -|30: /tmp/pardes-snap/tagbottom/cwd/top.txt Save Tty Del Collapse +|30: /tmp/pardes-snap/tagbottom/cwd/top.txt Save Tty Collapse Del == snap off grid=100x31 cursor=7,3 -|2: /tmp/pardes-snap/tagbottom/cwd/top.txt Save Tty Del Collapse +|2: /tmp/pardes-snap/tagbottom/cwd/top.txt Save Tty Collapse Del |3: 1 aaa |4: 2 bbb |5: 3 ccc @@ -86,7 +86,7 @@ |27: 25 yyy |28: 26 zzz |30: -== snap tag-typed grid=100x31 cursor=60,30 +== snap tag-typed grid=100x31 cursor=74,30 |2: 1 aaa |3: 2 bbb |4: 3 ccc @@ -114,9 +114,9 @@ |26: 25 yyy |27: 26 zzz |28: -|30: /tmp/pardes-snap/tagbottom/cwd/top.txt Save Tty bottom.txt Del Collapse +|30: /tmp/pardes-snap/tagbottom/cwd/top.txt Save Tty Collapse Del bottom.txt == snap look-bottom-tag grid=100x31 cursor=7,17 -|16: /tmp/pardes-snap/tagbottom/cwd/top.txt Save Tty bottom.txt Del Collapse +|16: /tmp/pardes-snap/tagbottom/cwd/top.txt Save Tty Collapse Del bottom.txt |17: 1 ZZONE |18: 2 ZZTWO |19: @@ -128,11 +128,11 @@ |25: |26: |27: -|30: /tmp/pardes-snap/tagbottom/cwd/bottom.txt Save Tty Del Collapse +|30: /tmp/pardes-snap/tagbottom/cwd/bottom.txt Save Tty Collapse Del == snap body-cursor grid=100x31 cursor=9,6 == snap seam-noop grid=100x31 cursor=9,6 == snap seam-dragged grid=100x31 cursor=9,6 -|11: /tmp/pardes-snap/tagbottom/cwd/top.txt Save Tty bottom.txt Del Collapse +|11: /tmp/pardes-snap/tagbottom/cwd/top.txt Save Tty Collapse Del bottom.txt |12: 1 ZZONE |13: 2 ZZTWO |14: @@ -150,10 +150,12 @@ |8: 8 hhh |9: 9 iii |10: 10 jjj -== snap search-prompt grid=100x31 cursor=6,29 -|29: /ZZ +== snap search-prompt grid=100x31 cursor=99,12 +|12: /ZZ +|13: 1 ZZONE +|14: 2 ZZTWO == snap leader grid=100x31 cursor=9,14 -|29: SPC +|12: SPC == snap cut-down grid=100x31 cursor=7,5 |2: 1 aaa |3: 2 bbb @@ -164,8 +166,10 @@ |8: 7 mmm |9: 8 nnn |10: 9 ooo -|11: /tmp/pardes-snap/tagbottom/cwd/top.txt * Save Tty bottom.txt Del Collapse -|29: +|11: /tmp/pardes-snap/tagbottom/cwd/top.txt * Save Tty Collapse Del bottom.txt +|12: 1 ZZONE +|13: 2 ZZTWO +|14: == file cut-buffer aaa bbb @@ -200,9 +204,9 @@ zzz |19: 18 xxx |20: 19 yyy |21: 20 zzz -|30: /tmp/pardes-snap/tagbottom/cwd/top.txt Save Tty bottom.txt Del Collapse +|30: /tmp/pardes-snap/tagbottom/cwd/top.txt Save Tty Collapse Del bottom.txt == snap off-again grid=100x31 cursor=7,6 -|2: /tmp/pardes-snap/tagbottom/cwd/top.txt Save Tty bottom.txt Del Collapse +|2: /tmp/pardes-snap/tagbottom/cwd/top.txt Save Tty Collapse Del bottom.txt |3: 1 aaa |4: 2 bbb |5: 3 ccc diff --git a/test/snapshots/tagbottom.snap b/test/snapshots/tagbottom.snap index a6a7a882..67bb2ead 100644 --- a/test/snapshots/tagbottom.snap +++ b/test/snapshots/tagbottom.snap @@ -17,6 +17,10 @@ # exactly: `off` is byte-for-byte `boot`, cursor included. file top.txt aaa\nbbb\nccc\nddd\neee\nfff\nggg\nhhh\niii\njjj\nkkk\nlll\nmmm\nnnn\nooo\nppp\nqqq\nrrr\nsss\nttt\nuuu\nvvv\nwww\nxxx\nyyy\nzzz file bottom.txt ZZONE\nZZTWO +# Builtins announce themselves by default, and an announcement is a band at +# the top of the body -- which moves every row this script clicks. What the +# verbs do is what is under test, not the announcement. +config Verbose off start 31 100 top.txt wait 8000 Newcol Joincol wait 8000 top.txt @@ -38,8 +42,11 @@ stable 700 15000 # cursor is down on the tagline with it. Col 50 is past the end of the path, # which is read-only — a click inside it parks the cursor there and the typing # goes nowhere. -press left 50 31 -release left 50 31 +# Past the last word rather than at a counted column: the tagline's words +# have moved since (Del is last now), and a column that lands INSIDE one +# types the filename into the middle of a builtin's name. +press left 90 31 +release left 90 31 stable 400 5000 send \x20bottom.txt stable 600 8000 @@ -48,8 +55,8 @@ snap tag-typed # ...and LOOK the word just typed, from that same bottom tagline: bottom.txt # opens as a second pane below. It only can if the press was mapped to the tag # — mapped as a body row it lands on blank line 29 and looks nothing at all. -press right 55 31 -release right 55 31 +press right @bottom.txt 31 +release right @bottom.txt 31 wait 10000 ZZONE stable 700 15000 snap look-bottom-tag diff --git a/test/snapshots/tagbottomimage.golden b/test/snapshots/tagbottomimage.golden index 523dd27c..72352672 100644 --- a/test/snapshots/tagbottomimage.golden +++ b/test/snapshots/tagbottomimage.golden @@ -1,11 +1,11 @@ == snap img-top grid=150x31 cursor=11,8 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill -|New Tty Find Grep Joincol -| /tmp/pardes-snap/tagbottomimage/cwd Save Tty Del Togglettymode Filter Collapse +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/tagbottomimage/cwd Tty Save Mode Filter Collapse Del +| Look | ls | pic.ppm -| -| img petscii:off palette:commodore ascii:on /tmp/pardes-snap/tagbottomimage/cwd/pic.ppm Tty Del Collapse +| img petscii:off palette:commodore ascii:on /tmp/pardes-snap/tagbottomimage/cwd/pic.ppm Tty Collapse Del | 4*🬹~F~N🬰|G🬏▚Y~KF🬴s>T&zZ/🬻iTY=`S~╳bkZR37v🬦🬵d4QHZ8X▛▟ | ^🬪🬛$}DrydNU&wsz=`*r🬒🬓🬳🬟*Y🬴G6🬧f🬮/>t🬧u🬲1Rg1t🬝🬻█ @@ -34,66 +34,66 @@ |2: ls |3: pic.ppm |4: -|5: /tmp/pardes-snap/tagbottomimage/cwd Save Tty Del Togglettymode Filter Collapse -|6: 4*🬹~F~N🬰|G🬏▚Y~KF🬴s>T&zZ/🬻iTY=`S~╳bkZR37v🬦🬵d4QHZ8X▛▟ -|8: ^🬪🬛$}DrydNU&wsz=`*r🬒🬓🬳🬟*Y🬴G6🬧f🬮/>t🬧u🬲1Rg1t🬝🬻█ -|9: ▖#_{🬗X@🬢&$s'C%*=w@🬆▀wq%🬡d┼a┼m─>🬭🬜A▀A🬲H]p🬝🬹 -|10: %?WX🬕f🬩*TA8n╱┼E▘🬭Y#qo~XVE▐(╳▀H4^[mj🬗=🬒🬕▟█ -|11: ]Z🬷eb~Oyl3=SL▙a🬱🬉~MPMz}FMu<🬝▚>3&▖🬷WS🬝~█ -|12: EF-🬑y🬔!r🬙🬐╳O🬩▐%Qj─4za/?/\a🬜"🬖🬈🬛🬟A🬙🬝▄ -|13: 🬃N@xzOnczIK=t0@🬖j5🬮🬧65▟{🬮🬉🬄🬩zQ9/🬝🬻 -|14: ╲${&%@"#ctt▀Cr5F;🬐ARM╱uej╳75🬹9▛🬻 -|15: h^🬜"🬈🬨▜╲|W🬊🬦k6^🬰🬶rZ─▄\z9🬎🬉4^🬎🬻 -|16: 🬆f│Q_V🬗wGx🬱=5▛5*&V🬟🬄ZrXGz2🬝🬻█ -|17: !🬷W🬐(🬭]7x_>▗er🬯~▚di🬬4jY:🬝▟ -|18: gU~🬧3▙bjr\C#kKMpffAjps🬝🬻 -|19: *🬯G"🬣▟d🬮▀zJ🬪EHV▟╳9}y▛▄ -|20: ``))~RyJ🬴jA~w=hLpX🬝🬻█ -|21: 4x▀J"TG7=y-QZ🬙╲~▛🬻 -|22: 🬯/+╳f9ZG🬕+{QN_🬝🬹 -|23: E<'─🬫pS!"n4&🬝~ -|24: m$dx"!2🬳&{🬝🬻 -|25: *8f🬩▙Jb🬒🬝🬻█ -|26: m🬩7CiN🬎🬹 -|27: pG╲L🬝🬻 -|28: 🬡L🬝▄ -|29: 🬝~ -|30: img petscii:off palette:commodore ascii:on /tmp/pardes-snap/tagbottomimage/cwd/pic.ppm Tty Del Collapse +|5: /tmp/pardes-snap/tagbottomimage/cwd Tty Save Mode Filter Collapse Del +|6: Tagbottom +|7: {DbgY🬲s▜M^#▐FUJ[zNq=🬝g/y╱?V@🬱🬙▌UK╱🬍("🬕KJ8hSo🬝🬻 +|8: tX🬆s>🬌`🬵 Date: Tue, 22 Sep 2026 09:31:11 -0300 Subject: Notices become chips that float over the body, not rows taken from it A notice is an overlay now, which is the one place it is NOT like the tree-sitter context: it takes no row from the body and moves no text. Each one is a chip as wide as its own message plus a blank cell either side, anchored to the pane right edge on the body top rows. The rest of each of those rows is ordinary body text that still reads and still answers a click -- Notices.left records where each chip starts, and the hit test refuses only the cells it covers rather than the whole row. The width is counted in GRID columns rather than scaled into the tagline face the chip is drawn in, because the canonical grid is what a terminal client draws and a chip narrower than its own text there would clip it; the narrower tagline face simply leaves a little more room inside the chip. The tag layer takes the geometry the grid pass already chose, so the two cannot disagree and the GUI skipping the cells a tag layer covers leaves no stub behind. Pane.body_offset is gone with the reservation it existed for, and bodyTop takes only a rect. The body layer keeps every row it had, the scrollbar runs the full body again, and the GUI smooth-scroll extents go back to the pane. Co-Authored-By: Claude Opus 5 (1M context) --- features.txt | 13 +- src/gui/gui.zig | 25 +- src/panes.zig | 46 ++- src/pardes.zig | 302 +++++++------- test/output.zig | 4 +- test/panes.zig | 26 +- test/snapshots/builtins.golden | 8 +- test/snapshots/chordcut.golden | 34 +- test/snapshots/collapse.golden | 17 +- test/snapshots/exec.golden | 24 +- test/snapshots/filewatch.golden | 18 +- test/snapshots/find.golden | 47 +-- test/snapshots/fsearch.golden | 15 +- test/snapshots/grep.golden | 8 +- test/snapshots/hscroll.golden | 21 +- test/snapshots/images.golden | 53 ++- test/snapshots/jumps.golden | 160 ++------ test/snapshots/layout-open.golden | 6 +- test/snapshots/leader.golden | 24 +- test/snapshots/look-center.golden | 31 +- test/snapshots/look-dir.golden | 6 +- test/snapshots/look-file-1col.golden | 4 +- test/snapshots/look-file.golden | 10 +- test/snapshots/lookloaded.golden | 18 +- test/snapshots/lsp-client-edit.golden | 26 +- test/snapshots/lsp-client.golden | 23 +- test/snapshots/lsp-rename.golden | 18 +- test/snapshots/lsp.golden | 40 +- test/snapshots/lspcomplete.golden | 3 +- test/snapshots/lsprelpath.golden | 16 +- test/snapshots/mini.golden | 87 ++-- test/snapshots/msg.golden | 67 +--- test/snapshots/ninep.golden | 150 +++---- test/snapshots/pipe.golden | 5 +- test/snapshots/psearch.golden | 61 +-- test/snapshots/savepane.golden | 10 +- test/snapshots/selregex.golden | 36 +- test/snapshots/shellset.golden | 5 +- test/snapshots/stepgrain.golden | 2 +- test/snapshots/syntax.golden | 33 +- test/snapshots/tag.golden | 4 +- test/snapshots/tagalign2col.golden | 8 +- test/snapshots/tagbottom.golden | 10 +- test/snapshots/tagbottomimage.golden | 102 ++--- test/snapshots/tagbottomshort.golden | 16 +- test/snapshots/tagcmd.golden | 18 +- test/snapshots/tagnav.golden | 34 +- test/snapshots/theme.golden | 14 +- test/snapshots/themesel.golden | 726 ++++++++++++++++------------------ test/snapshots/tty.golden | 12 +- test/snapshots/ttylook.golden | 10 +- test/snapshots/ttytaken.golden | 16 +- test/snapshots/wheeldrift.golden | 14 +- test/snapshots/windownav.golden | 63 +-- test/snapshots/windowops.golden | 6 +- test/snapshots/wrap.golden | 27 +- 56 files changed, 1046 insertions(+), 1536 deletions(-) (limited to 'src/gui') diff --git a/features.txt b/features.txt index d035648a..fa1c0f6b 100644 --- a/features.txt +++ b/features.txt @@ -173,10 +173,15 @@ renderHeaderLayer the pane and column tags use, as a TagLayer of the new `.notic offset and its border for free -- none of which a body-grid row can have just by wearing a tagline font. The text is right aligned. The prompt stays on the canonical grid because it owns a cursor, which has to sit on a real cell. -The body starts BELOW the bands rather than under them: Pane.body_offset is the number of rows they take, and every painter and hit test derives the body's -first row from Pardes.bodyTop(pane, rect). That replaced fifteen copies of `if (tag_bottom) r.y else r.y + BOX_H` scattered across the paint and pointer paths, -which is what let the bands and the text they sit over come adrift in the first place. renderBodyLayer zeroes the offset around its own render, because it -paints into a surface of its own that carries no bands. +A notice is an OVERLAY, which is the one place it is NOT like the tree-sitter context: it takes no row from the body and moves no text. It is a chip as wide +as its own message plus a blank cell either side, anchored to the pane's right edge on the body's top rows, and the rest of each of those rows is ordinary +body text that still reads and still answers a click -- Notices.left records where each chip starts and the hit test refuses only the cells it covers. The +chip is measured in GRID columns rather than scaled into the tagline face it is drawn in, because the canonical grid is what a terminal client draws and a +chip narrower than its own text there would clip it; the narrower tagline face simply leaves a little more room inside the chip. The tag layer takes the +geometry the grid pass already chose, so the two cannot disagree and the GUI's "skip the cells a tag layer covers" leaves no stub behind. + +Pardes.bodyTop(rect) is now the single answer to "where does the body begin", replacing fifteen copies of `if (tag_bottom) r.y else r.y + BOX_H` scattered +across the paint, hit-test, scroll, PDF and image paths -- which is what let the bands and the text under them come adrift in the first place. Every notice is ALSO painted on the canonical grid, because the grid is what a terminal client draws and a band it cannot see is a message it never gets. The GUI skips grid cells a tag layer covers, so nothing is drawn twice there. diff --git a/src/gui/gui.zig b/src/gui/gui.zig index c26629ab..3c2fd693 100644 --- a/src/gui/gui.zig +++ b/src/gui/gui.zig @@ -1788,7 +1788,6 @@ const Gui = struct { scroll_pane: ?usize = null, 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 how many rows it has, notice bands taken off 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 @@ -4293,15 +4292,14 @@ fn stepScroll(g: *Gui, core: *pardes.Pardes, gpa: std.mem.Allocator) void { } g.scroll_lag = st.lag; g.scroll_rect = r; - const body_y = core.bodyTop(pane, r); + const body_y = core.bodyTop(r); g.scroll_body_y = body_y; - g.scroll_body_h = (r.h -| pardes.BOX_H) -| pane.body_offset; if (st.rows != 0) { const s = &core.surface; g.scroll_edge_len = 0; - if (r.w > config.GUTTER and r.h > pardes.BOX_H + pane.body_offset and r.x + r.w <= s.cols) { + if (r.w > config.GUTTER and r.h > pardes.BOX_H and r.x + r.w <= s.cols) { const bw = r.w - config.GUTTER; - const bh = (r.h - pardes.BOX_H) - pane.body_offset; + const bh = r.h - pardes.BOX_H; const k: u16 = @intCast(@min(@abs(st.rows), @as(i32, bh))); const srow = body_y + (if (st.rows > 0) k - 1 else bh - k); if (srow < s.rows) { @@ -4329,11 +4327,7 @@ fn emitScrollRows(g: *Gui, instances: [*]CellInstance, base: u32, surface: *pard const x0 = r.x + config.GUTTER; const y0 = g.scroll_body_y; const bw = r.w - config.GUTTER; - // The body the editor actually painted: measuring it from the rect while - // the origin comes from bodyTop reads past the pane by the band rows, and - // for the bottom-most pane past the surface, which drops the animation. - const bh = g.scroll_body_h; - if (bh == 0) return 0; + const bh = r.h - pardes.BOX_H; 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; @@ -4365,7 +4359,7 @@ fn scrollScissor(g: *const Gui, layout: CellLayout, sw: u32, sh: u32) c.SDL_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 pw = @as(f32, @floatFromInt(r.w - config.GUTTER)) * layout.w; - const ph = @as(f32, @floatFromInt(g.scroll_body_h)) * layout.h; + const ph = @as(f32, @floatFromInt(r.h - pardes.BOX_H)) * layout.h; 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))); @@ -6691,14 +6685,11 @@ fn appendPaneChrome( const chrome = core.chromeTheme(); const page = overlayRgb(core.theme().bg orelse bg_default); for (core.panes, core.rects) |slot, r| { - const pane = slot orelse continue; - if (r.w <= config.GUTTER or r.h <= pardes.BOX_H) continue; + if (slot == null or r.w <= config.GUTTER or r.h <= pardes.BOX_H) continue; if (@as(u32, r.x) + r.w > surface.cols or @as(u32, r.y) + r.h > surface.rows) continue; const tag_y = if (core.settings.tag_bottom) r.y + r.h - pardes.BOX_H else r.y; - // The rail the editor painted, notice bands included -- overlaying the - // rows above it would tint the bands instead of the scrollbar. - const body_y = core.bodyTop(pane, r); - const body_end = body_y + ((r.h -| pardes.BOX_H) -| pane.body_offset); + const body_y = core.bodyTop(r); + const body_end = body_y + (r.h -| pardes.BOX_H); const x0 = @as(f32, @floatFromInt(r.x)) * layout.w; const x1 = x0 + @as(f32, @floatFromInt(r.w)) * layout.w; const tag_cells = surface.cells[@as(usize, tag_y) * surface.cols + r.x + pardes.TAG_TEXT_INSET ..][0 .. r.w - pardes.TAG_TEXT_INSET]; diff --git a/src/panes.zig b/src/panes.zig index 4b5c6721..f995986b 100644 --- a/src/panes.zig +++ b/src/panes.zig @@ -191,11 +191,6 @@ pub const Pane = struct { /// body layer reserves exactly `len` rows for them, the way it already /// reserves rows for sticky context headers. notices: Notices = .{}, - /// Rows the notice bands take off the TOP of the body, the way tree-sitter - /// context rows do: the body starts below them rather than being painted - /// under them. Zero while the body LAYER renders, which paints into a - /// surface of its own that carries no bands. - body_offset: u16 = 0, pub const Notices = struct { /// Painted bottom-up in this order, so a prompt keeps the row nearest @@ -204,14 +199,25 @@ pub const Pane = struct { pub const max = @typeInfo(Kind).@"enum".fields.len; kinds: [max]Kind = undefined, + /// Where each band's chip starts, as an absolute grid column. A chip + /// is only as wide as its own text, so the rest of the row underneath + /// is ordinary body text and a click there has to reach it. + left: [max]u16 = @splat(std.math.maxInt(u16)), len: u8 = 0, pub fn push(n: *Notices, kind: Kind) void { if (n.len >= max) return; n.kinds[n.len] = kind; + n.left[n.len] = std.math.maxInt(u16); n.len += 1; } + /// Is this cell inside the chip drawn for band `i`? Nothing else on + /// that row belongs to the notice. + pub fn covers(n: *const Notices, i: usize, col: u16) bool { + return i < n.len and col >= n.left[i]; + } + pub fn slice(n: *const Notices) []const Kind { return n.kinds[0..n.len]; } @@ -2041,7 +2047,7 @@ pub const File = struct { const gcrow = if (pane.cur_pinned) pane.cur_row else @as(i32, gcur.y) + goff; const cur_line: i32 = if (active and !pane.tag_edit) gcrow else std.math.minInt(i32); // the body's first row, the way renderPane derives it (Tagbottom) - const body_y = p.bodyTop(pane, r); + const body_y = p.bodyTop(r); const context_bg = p.theme().tag_bg; for (0..@min(pane.context_rows, body_h)) |context_row| { for (0..tw) |col| { @@ -2095,7 +2101,7 @@ pub const File = struct { // indexed start, same as bodyText — an empty tail simply paints nothing var flines = std.mem.splitScalar(u8, f.content[lineStart(p.gpa, f, f.scroll)..], '\n'); const total = nlines(p.gpa, f); - const body_y = p.bodyTop(pane, r); + const body_y = p.bodyTop(r); var vr: u16 = 0; while (vr < body_h) : (vr += 1) { var base: usize = undefined; @@ -2171,7 +2177,7 @@ pub const File = struct { pane_bg: pardes.Color, ) void { if (tw <= gutterWidth(pane) + 1) return; - const body_y = p.bodyTop(pane, r); + const body_y = p.bodyTop(r); const marker_fg = p.chromeTheme().lineno; var row: u16 = 0; while (row + 1 < pane.wrap_n and row + 1 < body_h) : (row += 1) { @@ -2195,9 +2201,9 @@ pub const File = struct { const tx = r.x + config.GUTTER; const tw = r.w - config.GUTTER; const prefix_width = gutterWidth(pane); - const body_y = p.bodyTop(pane, r); + const body_y = p.bodyTop(r); var vr: i32 = 0; - while (vr + @as(i32, pardes.BOX_H) < @as(i32, r.h -| pane.body_offset)) : (vr += 1) { + while (vr + @as(i32, pardes.BOX_H) < @as(i32, r.h)) : (vr += 1) { const here = pane.wrapAt(vr); if (here.line != row) continue; var hi = word_hi; @@ -5482,7 +5488,7 @@ pub const Pdf = struct { if (slot == pane) break core.rects[id]; } else return null; const cols = rect.w -| config.GUTTER; - const rows = (rect.h -| pardes.BOX_H) -| pane.body_offset; + const rows = rect.h -| pardes.BOX_H; if (cols == 0 or rows == 0) return null; return .{ .pixel_w = @as(u32, cols) * @as(u32, core.cell_pixels.w), @@ -5520,8 +5526,8 @@ pub const Pdf = struct { const rect = for (core.panes, 0..) |slot, id| { if (slot == pane) break core.rects[id]; } else return null; - const body_y = core.bodyTop(pane, rect); - if (row < body_y or row >= body_y + ((rect.h -| pardes.BOX_H) -| pane.body_offset)) return null; + const body_y = core.bodyTop(rect); + if (row < body_y or row >= body_y + (rect.h -| pardes.BOX_H)) return null; const local_y = @as(f64, @floatFromInt( @as(u32, row - body_y) * core.cell_pixels.h + core.cell_pixels.h / 2, )); @@ -5577,7 +5583,7 @@ pub const Pdf = struct { if (slot == pane) break core.rects[id]; } else return null; const body_x = @as(i64, rect.x + config.GUTTER); - const body_y = @as(i64, core.bodyTop(pane, rect)); + const body_y = @as(i64, core.bodyTop(rect)); const px = (@as(i64, col) - body_x) * core.cell_pixels.w + core.cell_pixels.w / 2; const py = (@as(i64, row) - body_y) * core.cell_pixels.h + core.cell_pixels.h / 2; return pointAtPage(state, view, page, px, py, clamp_to_page); @@ -5860,7 +5866,7 @@ pub const Pdf = struct { text_width: u16, ) bool { if (comptime !enabled) return false; - if (!core.native_images or rect.h <= pardes.BOX_H + pane.body_offset) return false; + if (!core.native_images or rect.h <= pardes.BOX_H) return false; const state = &(pane.pdf orelse return false); const view = paneViewport(core, pane) orelse return false; const key = TintKey{ .mode = state.tint, .colors = tintColors(core) }; @@ -5897,9 +5903,9 @@ pub const Pdf = struct { null, }, .x = text_x, - .y = core.bodyTop(pane, rect), + .y = core.bodyTop(rect), .w = text_width, - .h = (rect.h -| pardes.BOX_H) -| pane.body_offset, + .h = rect.h -| pardes.BOX_H, .rgba = placed.rgba, .iw = placed.width, // The texture contains the retained band, not the full page. @@ -5911,8 +5917,8 @@ pub const Pdf = struct { // This frame has spent the motion used to choose its raster band. state.scroll_travel = 0; - const body_y = core.bodyTop(pane, rect); - const body_h = (rect.h -| pardes.BOX_H) -| pane.body_offset; + const body_y = core.bodyTop(rect); + const body_h = rect.h -| pardes.BOX_H; const chrome = core.chromeTheme(); const theme = core.theme(); const pane_bg: pardes.Color = if (theme.bg) |color| .{ .rgb = color } else .default; @@ -7579,7 +7585,7 @@ pub const Terminal = struct { if (comptime !enabled) return; const s = &p.surface; if (pane.terminal == null) return; - const body_y = p.bodyTop(pane, r); + const body_y = p.bodyTop(r); var filtered_storage: FilteredColors = undefined; const filtered: ?*FilteredColors = if (pane.tty_filter) blk: { const tz_filter = tracy.zone(@src(), "filterInit"); diff --git a/src/pardes.zig b/src/pardes.zig index c271a16f..0ac16162 100644 --- a/src/pardes.zig +++ b/src/pardes.zig @@ -1168,29 +1168,30 @@ test "TreeContext tag style preserves message rows and its opt-out survives rest pane.msg[0] = '!'; pane.msg_len = 1; _ = try p.render(p.scratch.allocator()); - try std.testing.expectEqual(full_height - 1, p.surface.body_layers[0].viewport.h); + // An overlay takes nothing: the message is a chip OVER the body's first + // row, so the viewport keeps every row it had. + try std.testing.expectEqual(full_height, p.surface.body_layers[0].viewport.h); const r = p.rects[0]; - // The message is a tagline band at the top of the body now, not a body row - // at the bottom: same reservation, different carrier. const band = for (p.surface.tagLayers()) |*layer| { if (layer.cols != 0 and layer.kind == .notice) break layer; } else return error.NoNoticeBand; - try std.testing.expectEqual(r.y + BOX_H, band.viewport.y); - // Right aligned: the text sits in the last cell the viewport actually - // shows, which is a column short of the layer's cursor slack. - try std.testing.expectEqualStrings("!", band.cells[p.tagCapacity(band.viewport.w) - 1].grapheme()); - // ...and the body starts below it rather than under it. - try std.testing.expectEqual(band.viewport.y + 1, p.surface.body_layers[0].viewport.y); + try std.testing.expectEqual(p.bodyTop(r), band.viewport.y); + try std.testing.expectEqual(p.surface.body_layers[0].viewport.y, band.viewport.y); + // Sized to its message, flush with the pane's right edge, and the text + // right aligned a cell short of that edge. + try std.testing.expectEqual(r.x + r.w, band.viewport.x + band.viewport.w); + try std.testing.expect(band.viewport.w < r.w - config.GUTTER); + try std.testing.expectEqualStrings("!", band.cells[p.tagCapacity(band.viewport.w) - 2].grapheme()); pane.msg_len = 0; p.leader_on = true; _ = try p.render(p.scratch.allocator()); - try std.testing.expectEqual(full_height - 1, p.surface.body_layers[0].viewport.h); + try std.testing.expectEqual(full_height, p.surface.body_layers[0].viewport.h); p.leader_on = false; try std.testing.expect(p.executeBuiltinLine(0, "TreeContextTagStyle")); _ = try p.render(p.scratch.allocator()); try std.testing.expectEqual(@as(u16, 0), p.surface.body_layers[0].rows); try std.testing.expectEqual(@as(u16, 0), pane.body_rows); - try std.testing.expectEqual(FontRole.body, p.surface.at(r.x + config.GUTTER, p.bodyTop(pane, r)).style.font_role); + try std.testing.expectEqual(FontRole.body, p.surface.at(r.x + config.GUTTER, p.bodyTop(r)).style.font_role); try p.dumpState(); const restored = try Pardes.initFromDump(p.gpa, .{ .tty_only = true }, p.dump_out.?); defer restored.deinit(); @@ -6282,6 +6283,33 @@ pub const Pardes = struct { return p; } + /// `SPC` plus the chord keys typed so far, spaced out the way the help + /// index spells a leader path. + fn leaderText(p: *const Pardes, buf: *[16]u8) []const u8 { + buf.* = @splat(' '); + @memcpy(buf[0..3], "SPC"); + var at: usize = 3; + for (p.leader_keys[0..p.leader_n]) |ch| { + if (at + 2 > buf.len) break; + buf[at + 1] = ch; + at += 2; + } + return buf[0..at]; + } + + /// How wide a notice chip is, in grid columns: its own text plus a blank + /// cell either side. A notice is an OVERLAY over the body's top rows, not + /// a row taken from them, so it is sized to its message and never to the + /// pane. Counted in GRID columns rather than scaled into the tagline face + /// it is drawn in, because the canonical grid is what a terminal client + /// draws and a chip narrower than its own text there would clip it; the + /// tagline face simply leaves a little more room inside the chip. + fn noticeCols(p: *const Pardes, text: []const u8, limit: u16) u16 { + _ = p; + if (limit == 0) return 0; + return @intCast(std.math.clamp(panes.File.displayWidth(text) + 2, 1, @as(usize, limit))); + } + /// Prints `text` flush with the right edge of the band, and answers the /// column it started at so a cursor can follow it. fn printRight(s: *Surface, x: u16, row: u16, w: u16, text: []const u8, style: CellStyle) u16 { @@ -11264,13 +11292,14 @@ pub const Pardes = struct { const r = p.rects[id]; if (col < r.x + config.GUTTER or col >= r.x + r.w or row < r.y or row >= r.y + r.h) return null; const tag_y = if (p.settings.tag_bottom) r.y + r.h -| BOX_H else r.y; - const body_y = p.bodyTop(p.panes[id].?, r); + const body_y = p.bodyTop(r); const on_tag = row >= tag_y and row < tag_y + BOX_H; if (on_tag and col < r.x + TAG_TEXT_INSET) return null; - // A notice band is chrome. Without this it maps to Sel row 0 or less, - // which is the TAG row -- so a click on a leader band would expand a - // word out of the tag text and run it as a builtin. - if (!on_tag and row >= body_y -| p.panes[id].?.body_offset and row < body_y) return null; + // A notice chip is chrome: it sits OVER the body's top rows, so a + // click inside one belongs to nobody. The rest of those rows is + // ordinary body text and still answers normally. + if (!on_tag and row >= body_y and row - body_y < p.panes[id].?.notices.len and + p.panes[id].?.notices.covers(row - body_y, col)) return null; if (!on_tag) if (body_hit) |supplied| { const mapped_hit = p.bodyHitForPane(id, supplied, false) orelse return null; const c = @as(i32, mapped_hit.col) - config.GUTTER; @@ -11657,7 +11686,7 @@ pub const Pardes = struct { if (previous.tag_edit) exitTagEdit(previous); }; const tag_y = if (p.settings.tag_bottom) r.y + r.h -| BOX_H else r.y; - const body_y = p.bodyTop(pane, r); + const body_y = p.bodyTop(r); if (mcol < r.x + config.GUTTER) { // gutter scrollbar: a left click scrolls UP to that row p.active = id; @@ -11721,7 +11750,7 @@ pub const Pardes = struct { // the tag row and the body's first, exactly as the select // arm above derives them const tag_y = if (p.settings.tag_bottom) r.y + r.h -| BOX_H else r.y; - const body_y = p.bodyTop(pane, r); + const body_y = p.bodyTop(r); const on_tag = mrow >= tag_y and mrow < tag_y + BOX_H; if (mcol < r.x + config.GUTTER and !on_tag) { const local = @as(i32, mrow) - @as(i32, body_y); @@ -11818,8 +11847,8 @@ pub const Pardes = struct { // measure from the body's top, notice bands included, or a // selection made while a message is up lands rows away // from the pointer. - const body_y = p.bodyTop(pane, r); - const body_h = (r.h -| BOX_H) -| pane.body_offset; + const body_y = p.bodyTop(r); + const body_h = r.h -| BOX_H; pane.sel[b].r1 = if (pane.sel[b].r0 < BOX_H or body_h == 0) 0 else @@ -13370,12 +13399,11 @@ pub const Pardes = struct { return null; } - /// The pane's first body row: under the tag when it is on top, and under - /// whatever notice bands `collectNotices` stacked above the body. Every - /// painter and hit test derives the body from here so the bands cannot - /// come adrift from the text they sit over. - pub fn bodyTop(p: *const Pardes, pane: *const Pane, r: Rect) u16 { - return (if (p.settings.tag_bottom) r.y else r.y + BOX_H) + pane.body_offset; + /// The pane's first body row: under the tag when it is on top, over it + /// when it is at the bottom. Notice bands do NOT move it -- they are an + /// overlay, drawn over the top rows rather than taking them. + pub fn bodyTop(p: *const Pardes, r: Rect) u16 { + return if (p.settings.tag_bottom) r.y else r.y + BOX_H; } fn tagCapacity(p: *const Pardes, physical_width: u16) u16 { @@ -13461,12 +13489,13 @@ pub const Pardes = struct { .bg = .{ .rgb = chrome.tag_bg }, .font_role = .tagline, }; - // Sticky at the TOP of the body, where the tree-sitter context - // headers sit, one line to a row in the order collectNotices chose. - // Text is right aligned: the left edge is where the body's own text - // begins, and a notice that shared it would read as a line of the - // file rather than as chrome over it. - const first = if (p.settings.tag_bottom) r.y else r.y + BOX_H; + // An OVERLAY over the body's top rows, at the right edge, one + // chip to a row in the order collectNotices chose -- not a row + // taken out of the body the way a tree-sitter context header is. + // The chip is as wide as its own message and no wider, so the text + // beneath the rest of the row keeps reading as the file it is. + const first = p.bodyTop(r); + var leader_buf: [16]u8 = undefined; for (pane.notices.slice(), 0..) |kind, i| { const row = first + @as(u16, @intCast(i)); // Every notice is painted on the canonical grid as well as @@ -13474,39 +13503,34 @@ pub const Pardes = struct { // draws, and a band it cannot see is a message it never gets. // The GUI skips grid cells a tag layer covers, so nothing is // drawn twice there. - s.fill(tx, row, tw, 1, .{ .bg = msg_style.bg, .font_role = .tagline }); - switch (kind) { - .message => _ = printRight(s, tx, row, tw, pane.msg[0..pane.msg_len], msg_style), - .leader => { - var ibuf: [16]u8 = @splat(' '); - @memcpy(ibuf[0..3], "SPC"); - var iw: usize = 3; - for (p.leader_keys[0..p.leader_n]) |ch| { - ibuf[iw + 1] = ch; - iw += 2; - } - _ = printRight(s, tx, row, tw, ibuf[0..iw], msg_style); - }, - .prompt => { + const text = switch (kind) { + .message => pane.msg[0..pane.msg_len], + .leader => p.leaderText(&leader_buf), + .prompt => blk: { const at = pane.promptAt() orelse continue; - const text = pane.tagSlice()[@min(at, pane.tag_tail_len)..]; - // One column short of the edge: the caret sits AFTER - // the last character the moment a prompt opens, and - // flush right would put it at r.x + r.w -- off the - // pane, off the grid, and past what the detached wire - // will encode, which drops every frame while it is up. - const left = printRight(s, tx, row, tw -| 1, text, msg_style); - if (id != p.active) continue; - const prompt0 = (p.tagPrefix(pane) catch continue).len + at; - const col = @as(usize, pane.tag_col); - if (col >= prompt0) { - // The cursor follows the text to wherever it landed. - const prompt_col = panes.File.displayWidth(text[0..@min(col - prompt0, text.len)]); - if (prompt_col < tw) - s.cursor = .{ .x = left + @as(u16, @intCast(prompt_col)), .y = row, .bar = pane.mode == .insert }; - } + break :blk pane.tagSlice()[@min(at, pane.tag_tail_len)..]; }, - } + }; + const chip = p.noticeCols(text, tw); + if (chip == 0) continue; + const cx = tx + tw - chip; + pane.notices.left[i] = cx; + s.fill(cx, row, chip, 1, .{ .bg = msg_style.bg, .font_role = .tagline }); + // One column short of the chip's right edge: a prompt's caret + // sits AFTER its last character the moment it opens, and flush + // right would put it past the pane, off the grid, and past what + // the detached wire will encode -- which drops every frame for + // as long as the prompt is up. + const left = printRight(s, cx, row, chip -| 1, text, msg_style); + if (kind != .prompt or id != p.active) continue; + const at = pane.promptAt() orelse continue; + const prompt0 = (p.tagPrefix(pane) catch continue).len + at; + const col = @as(usize, pane.tag_col); + if (col < prompt0) continue; + // The cursor follows the text to wherever it landed. + const prompt_col = panes.File.displayWidth(text[0..@min(col - prompt0, text.len)]); + if (left + prompt_col < tx + tw) + s.cursor = .{ .x = left + @as(u16, @intCast(prompt_col)), .y = row, .bar = pane.mode == .insert }; } } @@ -13829,11 +13853,11 @@ pub const Pardes = struct { const raw = pane.mode == .tty; const tx = r.x + config.GUTTER; const width = r.w -| config.GUTTER; - const body_y = p.bodyTop(pane, r); + const body_y = p.bodyTop(r); var lines = std.mem.splitScalar(u8, body, '\n'); var visible: i32 = 0; while (lines.next()) |line| : (visible += 1) { - if (visible >= (r.h -| BOX_H) -| pane.body_offset) break; + if (visible >= r.h -| BOX_H) break; const source_row = if (raw) panes.Terminal.gridOffset(pane) + visible else pane.wrapAt(visible).line; for (rows) |row| { const target = if (row.raw_terminal) @@ -13871,10 +13895,10 @@ pub const Pardes = struct { const terminal_lines = if (pane.file == null) panes.Terminal.cursorLines(p, pane) catch return else &.{}; const tx = r.x + config.GUTTER; const width = r.w -| config.GUTTER; - const body_y = p.bodyTop(pane, r); + const body_y = p.bodyTop(r); const prefix: i32 = if (pane.file != null) panes.File.gutterWidth(pane) else 0; var visible: i32 = 0; - while (visible < @as(i32, (r.h -| BOX_H) -| pane.body_offset)) : (visible += 1) { + while (visible < @as(i32, r.h -| BOX_H)) : (visible += 1) { const source = pane.wrapAt(visible); const line = pointerSourceLine(pane, terminal_lines, source.line); const start = @min(line.len, @as(usize, @intCast(@max(0, source.at)))); @@ -13919,11 +13943,6 @@ pub const Pardes = struct { while (row < r.h) : (row += 1) { if (@as(i32, row) < r0 or @as(i32, row) > r1) continue; const sy = if (row < BOX_H) tag_y else body_y + row - BOX_H; - // The body sits `body_offset` rows lower than it used to, so the - // last rows of Sel space now fall past the pane. Bounding the loop - // instead would break the caller that paints a tag into a - // one-row surface of its own, where the offset means nothing. - if (row >= BOX_H and sy >= r.y + r.h) break; // File line numbers occupy a gutter only in the body. The tag is // row zero in Sel space and starts at its real first text cell. const scroll: i32 = if (row < BOX_H) pane.tag_scroll else 0; @@ -13972,48 +13991,45 @@ pub const Pardes = struct { // workspace layer to render; the menu bar carries its commands. if (p.settings.workspace_tag) try p.renderHeaderLayer(arena, MAX_PANES + MAX_COLS, .workspace, 0, .{ .x = 0, .y = 0, .w = p.screen_w, .h = TOPBAR_H }, p.topbar(&text_buf), chrome.tag_bg, chrome.tag_fg); - // Each notice is its own tagline-shaped band at the top of the body. + // Each notice is its own tagline-shaped chip over the top of the body. // Going through the same layer machinery the pane and column tags use // is what gives it the tagline's height, its small-font metrics, the // band offset and the border -- none of which a body-grid row can have - // just by wearing a tagline font. + // just by wearing a tagline font. The geometry is the one the grid + // pass already chose and recorded, so the two cannot disagree and the + // GUI's "skip the cells a tag layer covers" leaves no stub behind. for (p.panes, 0..) |slot, id| { const pane = slot orelse continue; const r = p.rects[id]; if (r.w <= TAG_TEXT_INSET or r.h <= BOX_H) continue; - const first = if (p.settings.tag_bottom) r.y else r.y + BOX_H; - var band: u16 = 0; - for (pane.notices.slice()) |kind| { + const first = p.bodyTop(r); + var leader_buf: [16]u8 = undefined; + for (pane.notices.slice(), 0..) |kind, i| { const text = switch (kind) { .message => pane.msg[0..pane.msg_len], - .leader => blk: { - var ibuf: [16]u8 = @splat(' '); - @memcpy(ibuf[0..3], "SPC"); - var iw: usize = 3; - for (p.leader_keys[0..p.leader_n]) |ch| { - ibuf[iw + 1] = ch; - iw += 2; - } - break :blk try arena.dupe(u8, ibuf[0..iw]); - }, + .leader => p.leaderText(&leader_buf), // A prompt is an editing line with a cursor in it, so it // stays on the grid where the cursor can sit on a cell. .prompt => continue, }; if (text.len == 0) continue; - const room = p.tagCapacity(r.w -| TAG_TEXT_INSET); + const cx = pane.notices.left[i]; + if (cx == std.math.maxInt(u16) or cx >= r.x + r.w) continue; + const chip = r.x + r.w - cx; + // Right aligned inside the chip, a blank cell short of its + // edge: the same one the grid pass leaves for a prompt caret. + const room = p.tagCapacity(chip) -| 1; const shown = panes.File.displayWidth(text); const pad = room -| shown; const line = try arena.alloc(u8, pad + text.len); @memset(line[0..pad], ' '); @memcpy(line[pad..], text); - try p.renderHeaderLayer(arena, NOTICE_LAYER_BASE + id * Pane.Notices.max + band, .notice, @intCast(id), .{ - .x = r.x + TAG_TEXT_INSET, - .y = first + band, - .w = r.w -| TAG_TEXT_INSET, + try p.renderHeaderLayer(arena, NOTICE_LAYER_BASE + id * Pane.Notices.max + i, .notice, @intCast(id), .{ + .x = cx, + .y = first + @as(u16, @intCast(i)), + .w = chip, .h = BOX_H, }, line, chrome.tag_bg, chrome.tag_fg); - band += 1; } } if (p.columnBarHeight() > 0) for (0..p.ncol) |column| { @@ -14087,7 +14103,6 @@ pub const Pardes = struct { /// them instead of letting the last one win the row. fn collectNotices(p: *Pardes, pane: *Pane, r: Rect, id: usize) void { pane.notices.len = 0; - pane.body_offset = 0; if (r.w <= config.GUTTER or r.h <= BOX_H) return; if (pane.msg_len > 0) pane.notices.push(.message); if (id == p.active and p.leader_on) pane.notices.push(.leader); @@ -14105,13 +14120,12 @@ pub const Pardes = struct { for (0..room) |i| pane.notices.kinds[i] = pane.notices.kinds[i + drop]; pane.notices.len = room; } - pane.body_offset = pane.notices.len; } fn renderBodyLayer(p: *Pardes, arena: std.mem.Allocator, pane: *Pane, r: Rect, id: usize) !void { if (!p.settings.tree_context_tag_style or pane.context_rows == 0 or pane.file == null or pane.collapsed) return; if (r.w <= config.GUTTER or r.h <= BOX_H) return; - const viewport_rows = r.h - BOX_H -| @as(u16, pane.notices.len); + const viewport_rows = r.h - BOX_H; if (viewport_rows == 0) return; // The canonical fixed grid remains available to terminal clients. The // separate body layer reserves enough rows for any compact font size. @@ -14132,9 +14146,6 @@ pub const Pardes = struct { @memset(temporary_cells, .{}); var temporary: Surface = .{ .cols = r.w, .rows = @intCast(logical_rows + BOX_H), .cells = temporary_cells }; std.mem.swap(Surface, &p.surface, &temporary); - // This surface carries no notice bands, so the body starts at its top. - pane.body_offset = 0; - defer pane.body_offset = pane.notices.len; const synthetic: Rect = .{ .x = 0, .y = 0, .w = r.w, .h = @intCast(logical_rows + BOX_H) }; p.renderBody(arena, pane, synthetic, id, id == p.active, false) catch |err| { std.mem.swap(Surface, &p.surface, &temporary); @@ -14148,11 +14159,7 @@ pub const Pardes = struct { } layer.pane = @intCast(id); layer.serial = pane.serial; - // Below the notice bands, which are stacked at the TOP of the body - // now: the rows they took came off this viewport, so its origin has to - // move with them or the first context header renders under a band. - const body_top = (if (p.settings.tag_bottom) r.y else r.y + BOX_H) + @as(u16, pane.notices.len); - layer.viewport = .{ .x = r.x + config.GUTTER, .y = body_top, .w = width, .h = viewport_rows }; + layer.viewport = .{ .x = r.x + config.GUTTER, .y = p.bodyTop(r), .w = width, .h = viewport_rows }; layer.cols = width; layer.rows = @intCast(logical_rows); layer.context_rows = pane.context_rows; @@ -14174,7 +14181,7 @@ pub const Pardes = struct { const tx = r.x + config.GUTTER; // text area (tag + body), right of the gutter const tw = r.w - config.GUTTER; const tag_y = if (p.settings.tag_bottom) r.y + r.h -| BOX_H else r.y; - const body_y = p.bodyTop(pane, r); + const body_y = p.bodyTop(r); const pane_bg: Color = if (th.bg) |c| .{ .rgb = c } else .default; // text area resets to terminal-default cells (vaxis clear semantics); @@ -14214,7 +14221,7 @@ pub const Pardes = struct { if (pane.hasPdf() and panes.Pdf.draw(p, pane, r, id, tx, tw)) return; if (pane.image) |*iv| { - const image_h = (r.h -| BOX_H) -| pane.body_offset; + const image_h = r.h -| BOX_H; panes.Image.draw(p, iv, @intCast(id), pane.serial, tx, body_y, tw, image_h); // thumbless, but the same one column as the real scrollbar below — // that is the whole point of drawing it, and like that one it runs @@ -14235,7 +14242,7 @@ pub const Pardes = struct { const tx = r.x + @min(TAG_TEXT_INSET, r.w); const tw = r.w -| TAG_TEXT_INSET; const tag_y = if (p.settings.tag_bottom) r.y + r.h -| BOX_H else r.y; - const body_y = p.bodyTop(pane, r); + const body_y = p.bodyTop(r); const page_rgb = th.bg orelse th.tag_bg; // Focus is visible along the tag without changing its live text grid. const tag_bg = if (active and p.settings.focus_tint) chrome.tag_active_bg else chrome.tag_bg; @@ -14322,12 +14329,12 @@ pub const Pardes = struct { // Below the notice bands: they are stacked at the top of the body the // way tree-sitter context rows are, so the body starts under them // rather than being painted over by them. - const body_y = p.bodyTop(pane, r); + const body_y = p.bodyTop(r); const pane_bg: Color = if (th.bg) |c| .{ .rgb = c } else .default; const page_rgb = th.bg orelse th.tag_bg; // body: emulator rows, prompt rows hidden outside tty mode - const body_h = (r.h -| BOX_H) -| pane.body_offset; - const body_bottom = r.h -| pane.body_offset; + const body_h = r.h -| BOX_H; + const body_bottom = r.h; const body_style: CellStyle = .{ .fg = if (th.fg) |c| .{ .rgb = c } else .default, .bg = pane_bg, @@ -14820,7 +14827,7 @@ test "a builtin announces itself on the message row, and Verbose silences it" { try std.testing.expectEqual(@as(u16, 0), pane.msg_len); } -test "notices stack downward from the top of the body, which starts below them" { +test "notices stack over the body's top rows without moving them" { if (platform == .web) return; const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 80, .rows = 24 }); defer p.deinit(); @@ -14831,44 +14838,45 @@ test "notices stack downward from the top of the body, which starts below them" defer frame.deinit(); const r = p.rects[id]; - const plain = p.bodyTop(pane, r); - try std.testing.expectEqual(@as(u16, 0), pane.body_offset); + const top = p.bodyTop(r); - // A message and a leader prefix at once: two bands, stacked in the order + // A message and a leader prefix at once: two chips, in the order // collectNotices chose, each one row tall and each one row further down. try std.testing.expect(p.executeBuiltinLine(id, "Msg first")); p.leader_on = true; p.leader_n = 0; _ = frame.reset(.retain_capacity); _ = try p.render(frame.allocator()); - try std.testing.expectEqual(@as(u16, 2), pane.body_offset); - try std.testing.expectEqual(plain + 2, p.bodyTop(pane, r)); + try std.testing.expectEqual(@as(u8, 2), pane.notices.len); + // An overlay, not a reservation: the body still starts where it did. + try std.testing.expectEqual(top, p.bodyTop(r)); - var rows: [Pane.Notices.max]u16 = @splat(0); - var found: usize = 0; + var seen: usize = 0; for (p.surface.tagLayers()) |*layer| { if (layer.cols == 0 or layer.kind != .notice) continue; try std.testing.expectEqual(@as(u16, 1), layer.viewport.h); - rows[found] = layer.viewport.y; - found += 1; - } - try std.testing.expectEqual(@as(usize, 2), found); - std.mem.sort(u16, rows[0..2], {}, std.sort.asc(u16)); - try std.testing.expectEqual(plain, rows[0]); - try std.testing.expectEqual(plain + 1, rows[1]); - - // Gone with the notices: no stale band, and the body back at the top. + // Sized to its own message, right up against the pane's right edge -- + // not the width of the pane. + try std.testing.expectEqual(r.x + r.w, layer.viewport.x + layer.viewport.w); + try std.testing.expect(layer.viewport.w < r.w - config.GUTTER); + try std.testing.expect(layer.viewport.y == top or layer.viewport.y == top + 1); + try std.testing.expectEqual(pane.notices.left[layer.viewport.y - top], layer.viewport.x); + seen += 1; + } + try std.testing.expectEqual(@as(usize, 2), seen); + // "first" is longer than "SPC", so its chip is wider. + try std.testing.expect(pane.notices.left[0] < pane.notices.left[1]); + + // Gone with the notices: no stale chip left behind. p.leader_on = false; pane.msg_len = 0; _ = frame.reset(.retain_capacity); _ = try p.render(frame.allocator()); - try std.testing.expectEqual(@as(u16, 0), pane.body_offset); - try std.testing.expectEqual(plain, p.bodyTop(pane, r)); for (p.surface.tagLayers()) |*layer| try std.testing.expect(layer.cols == 0 or layer.kind != .notice); } -test "a prompt band keeps its caret on the grid, and a band is not a click target" { +test "a prompt chip keeps its caret on the grid, and only the chip swallows a click" { if (platform == .web) return; const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 80, .rows = 24 }); defer p.deinit(); @@ -14879,24 +14887,36 @@ test "a prompt band keeps its caret on the grid, and a band is not a click targe defer frame.deinit(); // The caret sits AFTER the prompt text the moment the prompt opens, and - // the band is flush with the pane's right edge -- so this is the frame - // that used to put it one column past the pane, off the grid and past - // what the detached wire will encode. + // the chip ends at the pane's right edge -- so this is the frame that + // used to put it one column past the pane, off the grid and past what the + // detached wire will encode. p.startPrompt(pane, .{ .search = "/" }); _ = try p.render(frame.allocator()); const r = p.rects[id]; const cursor = p.surface.cursor orelse return error.MissingPromptCursor; - try std.testing.expect(pane.body_offset > 0); - try std.testing.expectEqual(p.bodyTop(pane, r) - 1, cursor.y); + const row = p.bodyTop(r); + try std.testing.expectEqual(@as(u8, 1), pane.notices.len); + try std.testing.expectEqual(row, cursor.y); try std.testing.expect(cursor.x < r.x + r.w); try std.testing.expect(cursor.x < p.surface.cols); - // The band is chrome. Mapped as body it would land on Sel row 0, which is - // the TAG row, so a click on it would run a word out of the tag as a - // builtin. - const band_row = p.bodyTop(pane, r) - 1; - p.update(.{ .mouse = .{ .button = .left, .kind = .press, .col = r.x + r.w - 4, .row = band_row } }); - p.update(.{ .mouse = .{ .button = .left, .kind = .release, .col = r.x + r.w - 4, .row = band_row } }); + // The chip covers only its own columns. Left of it is ordinary body, and + // a sweep there still selects. + const left = pane.notices.left[0]; + try std.testing.expect(left > r.x + config.GUTTER + 2); + p.update(.{ .mouse = .{ .button = .left, .kind = .press, .col = left - 3, .row = row } }); + p.update(.{ .mouse = .{ .button = .left, .kind = .drag, .col = left - 1, .row = row } }); + p.update(.{ .mouse = .{ .button = .left, .kind = .release, .col = left - 1, .row = row } }); + try std.testing.expect(pane.sel[0].state != .none); + try std.testing.expect(pane.sel[0].r0 >= BOX_H); // the body, not the tag + + // Inside it is chrome: mapped as body it would land on Sel row 0, which is + // the TAG row, so a sweep there would highlight the tagline instead. + pane.clearPointerSelection(0); + pane.sel[0] = .{}; + p.update(.{ .mouse = .{ .button = .left, .kind = .press, .col = r.x + r.w - 3, .row = row } }); + p.update(.{ .mouse = .{ .button = .left, .kind = .drag, .col = r.x + r.w - 2, .row = row } }); + p.update(.{ .mouse = .{ .button = .left, .kind = .release, .col = r.x + r.w - 2, .row = row } }); for (pane.sel) |selection| try std.testing.expect(selection.state == .none); } diff --git a/test/output.zig b/test/output.zig index 8afbf4d2..ad33954f 100644 --- a/test/output.zig +++ b/test/output.zig @@ -77,7 +77,7 @@ fn outputCell(p: *Pardes, surface: *pardes.Surface, id: usize, byte: usize) *par const line = modal.lineSlice(pane.file.?.content, 0); const rect = p.rects[id]; const x = rect.x + config.GUTTER + panes.File.gutterWidth(pane) + @as(u16, @intCast(panes.File.displayWidth(line[0..byte]))); - const y = p.bodyTop(pane, rect); + const y = p.bodyTop(rect); return surface.at(x, y); } @@ -490,7 +490,7 @@ test "Mini syntax colors survive toggles themes and rendering without source acc const surface = try p.render(frame.allocator()); const rect = p.rects[id]; const x = rect.x + config.GUTTER + panes.File.gutterWidth(mini) + @as(u16, @intCast(column)); - const y = p.bodyTop(mini, rect) + @as(u16, @intCast(position.row)); + const y = p.bodyTop(rect) + @as(u16, @intCast(position.row)); if (enabled) try std.testing.expectEqualDeep(pardes.Color{ .rgb = p.theme().kw }, surface.at(x, y).style.fg); try std.testing.expectEqual(colors, mini.file.?.mini.?.colors.ptr); try std.testing.expectEqual(@as(usize, 0), mini.file.?.highlights.len); diff --git a/test/panes.zig b/test/panes.zig index 69628cd9..8e71e69d 100644 --- a/test/panes.zig +++ b/test/panes.zig @@ -468,7 +468,7 @@ const TreeContextTests = struct { try std.testing.expectEqual(@as(i32, 59), pane.wrapAt(visible.row).line); const cursor = surface.cursor orelse return error.MissingLookCursor; const rect = p.rects[0]; - const y = p.bodyTop(pane, rect); + const y = p.bodyTop(rect); try std.testing.expectEqual(y + @as(u16, @intCast(visible.row)), cursor.y); } } @@ -490,7 +490,7 @@ const TreeContextTests = struct { try std.testing.expectEqual(@as(i32, 7), pane.wrapAt(pane.context_rows).line); const rect = p.rects[0]; const x = rect.x + config.GUTTER + panes.File.gutterWidth(pane); - const y = p.bodyTop(pane, rect); + const y = p.bodyTop(rect); ClickCursorTests.click(p, .left, x + 6, y); try std.testing.expectEqual(@as(i32, 0), pane.cur_row); try std.testing.expectEqual(@as(i32, 6), pane.cur_col); @@ -499,7 +499,7 @@ const TreeContextTests = struct { try std.testing.expectEqual(x + 6, cursor.x); // Read the body top again: the click cleared the announcement band the // builtin above put up, and the body moved back up with it. - try std.testing.expectEqual(p.bodyTop(pane, p.rects[0]), cursor.y); + try std.testing.expectEqual(p.bodyTop(p.rects[0]), cursor.y); p.update(.{ .key = .{ .cp = 'i' } }); p.update(.{ .key = .{ .cp = 'Z', .text = "Z" } }); try std.testing.expect(std.mem.startsWith(u8, pane.file.?.content, "const ZBox = struct {")); @@ -538,7 +538,7 @@ const TreeContextTests = struct { const surface = try p.render(frame.allocator()); try std.testing.expectEqual(@as(u16, 3), pane.context_rows); const rect = p.rects[0]; - const y = p.bodyTop(pane, rect); + const y = p.bodyTop(rect); var glyph_x: ?u16 = null; for (0..surface.cols) |col| { if (std.mem.eql(u8, surface.at(@intCast(col), y).grapheme(), "界")) glyph_x = @intCast(col); @@ -552,7 +552,7 @@ const TreeContextTests = struct { try std.testing.expectEqual(x, cursor.x); // 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); + try std.testing.expectEqual(p.bodyTop(p.rects[0]), cursor.y); panes.File.setContent(p, &pane.file.?, try p.gpa.dupe(u8, "// no enclosing declaration\n" ** 18)); _ = try p.render(frame.allocator()); try std.testing.expectEqual(@as(u16, 0), pane.context_rows); @@ -580,16 +580,12 @@ const TreeContextTests = struct { target = .{ .x = @intCast(col), .y = @intCast(row) }; }; const glyph = target orelse return error.MissingWrappedContextBody; - const offset = pane.body_offset; ClickCursorTests.click(p, .left, glyph.x + 1, glyph.y); try std.testing.expectEqual(@as(i32, 2), pane.cur_row); try std.testing.expectEqual(@as(i32, @intCast(std.mem.indexOf(u8, body, "界").?)), pane.cur_col); const cursor = (try p.render(frame.allocator())).cursor orelse return error.MissingContextBodyCursor; try std.testing.expectEqual(glyph.x, cursor.x); - // The scan above ran with the builtin's announcement band up; the click - // cleared it, so the row the glyph was found on has moved up with the - // body it belongs to. - try std.testing.expectEqual(glyph.y - offset, cursor.y); + try std.testing.expectEqual(glyph.y, cursor.y); } }; @@ -615,7 +611,7 @@ const TtySelectionTests = struct { _ = try p.render(frame.allocator()); const rect = p.rects[0]; const x = rect.x + config.GUTTER; - const y = p.bodyTop(pane, rect); + const y = p.bodyTop(rect); JumpSelectionTests.drag(p, x + 1, y, x + 3, y); try std.testing.expectEqualStrings("lph", p.yank orelse return error.MissingAutomaticTtyYank); p.update(.{ .key = .{ .cp = p.opts.tty_toggle, .ctrl = true } }); @@ -645,7 +641,7 @@ const TtySelectionTests = struct { _ = try p.render(frame.allocator()); const rect = p.rects[0]; const x = rect.x + config.GUTTER; - const y = p.bodyTop(pane, rect); + const y = p.bodyTop(rect); JumpSelectionTests.drag(p, x + @as(u16, if (prompt) 0 else 1), y, x + 3, y + @as(u16, if (prompt) 0 else 1)); const expected = if (prompt) "$ ab" else "lph\nrav"; try std.testing.expectEqual(Pane.Mode.tty, pane.mode); @@ -960,7 +956,7 @@ const JumpSelectionTests = struct { if (wrap) try std.testing.expectEqual(pane.wrap_line[0], pane.wrap_line[1]); const rect = p.rects[0]; const x = rect.x + config.GUTTER + panes.File.gutterWidth(pane); - const y = p.bodyTop(pane, rect); + const y = p.bodyTop(rect); if (reverse) drag(p, x + last_col, y + 1, x + first_col, y) else @@ -991,7 +987,7 @@ const JumpSelectionTests = struct { // A selection created after Back must also disappear on Forward. // Back announces itself, so the body sits under a notice band now. - const y2 = p.bodyTop(pane, p.rects[0]); + const y2 = p.bodyTop(p.rects[0]); drag(p, x + 1, y2, x + 3, y2 + 1); try std.testing.expect(pardes.test_api.heldSelection(p, 0) != null); p.update(.{ .key = .{ .cp = 'i', .ctrl = true } }); @@ -4127,7 +4123,7 @@ test "cancelled normal gestures leave no count or subprefix after mouse and focu .body, .tag => { const rect = p.rects[0]; const tag_y = if (p.settings.tag_bottom) rect.y + rect.h - pardes.BOX_H else rect.y; - const body_y = p.bodyTop(pane, rect); + const body_y = p.bodyTop(rect); const x = rect.x + config.GUTTER + @as(u16, @intCast(panes.File.gutterWidth(pane))) + 3; const y = if (gesture == .tag) tag_y else body_y; p.update(.{ .mouse = .{ .button = config.select_button, .kind = .press, .col = x, .row = y } }); diff --git a/test/snapshots/builtins.golden b/test/snapshots/builtins.golden index 96dabb54..a36092f7 100644 --- a/test/snapshots/builtins.golden +++ b/test/snapshots/builtins.golden @@ -42,10 +42,4 @@ |32: 13 |33: 14 A pane is just text on screen. There is no separate "buffer" type — |34: 15 what you see is what you edit. Some panes happen to be live terminals; -|36: Tutor -|37: 1 pardes builtins under SPC h -|38: 2 -|39: 3 SPC h c Changelog topbar -|40: 4 SPC h m Messages -|41: 5 SPC h t Tutor topbar -|42: 6 +|36: 1 pardes builtins under SPC h Tutor diff --git a/test/snapshots/chordcut.golden b/test/snapshots/chordcut.golden index a9586983..8e83e584 100644 --- a/test/snapshots/chordcut.golden +++ b/test/snapshots/chordcut.golden @@ -2,9 +2,9 @@ |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill | New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol | /tmp/pardes-snap/chordcut/cwd Tty Save Mode Filter Collap /tmp/pardes-snap/chordcut/cwd Tty Save Mode Filter Collap -| Look ls -| ls f.txt g.txt -| f.txt g.txt +| ls Look ls +| f.txt g.txt f.txt g.txt +| | /tmp/pardes-snap/chordcut/cwd/f.txt Save Tty Collapse Del | 1 line 1 | 2 line 2 @@ -21,8 +21,6 @@ | f.txt g.txt == snap cut grid=120x31 cursor=7,8 |3: ls ls -|4: f.txt g.txt f.txt g.txt -|5: |6: /tmp/pardes-snap/chordcut/cwd/f.txt * Save Tty Collapse D |8: 2 2 == snap copied grid=120x31 cursor=10,9 @@ -32,30 +30,14 @@ |11: 5 lline 5 == snap cancelexec grid=120x31 cursor=25,8 |8: 2 2echo B''OO g.txt -== snap execafter grid=120x31 cursor=25,9 +== snap execafter grid=120x31 cursor=25,8 |3: f.txt ls |4: BOO f.txt g.txt -|7: Exec -|8: 1 line 1 -|9: 2 2echo B''OO g.txt -|10: 3 line 3 -|11: 4 line 4line -|12: 5 lline 5 -|13: 6 +|7: 1 line 1 Exec == snap cancellook grid=120x31 cursor=25,8 |7: 1 line 1 -|8: 2 2echo B''OO g.txt -|9: 3 line 3 -|10: 4 line 4line -|11: 5 lline 5 -|12: 6 -|13: == snap lookafter grid=120x31 cursor=7,13 -|7: Look -|8: 1 line 1 -|9: 2 2echo B''OO g.txt -|10: 3 line 3 -|11: 4 line 4line +|7: 1 line 1 Look |12: /tmp/pardes-snap/chordcut/cwd/g.txt Save Tty Collapse Del |13: 1 line 1 |14: 2 line 2 @@ -97,10 +79,6 @@ |14: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-12 #e5eee5,#0d1410, 13-59 d,#0d1410, 60-60 d,#608269, 61-61 d,#0d1410, 62-119 #e5eee5,#0d1410, == snap ttyprobe grid=120x31 cursor=42,22 |7: 1 line 1 -|8: 2 2echo B''OO g.txt -|9: 3 line 3 -|10: 4 line 4line -|11: 5 lline 5 |12: /tmp/pardes-snap/chordcut/cwd/g.txt * Save Tty Collapse D |17: $ /tmp/pardes-snap/chordcut/cwd Tty Save Mode Filter Collap |18: $ ls diff --git a/test/snapshots/collapse.golden b/test/snapshots/collapse.golden index d356fd02..18d24d6b 100644 --- a/test/snapshots/collapse.golden +++ b/test/snapshots/collapse.golden @@ -60,22 +60,19 @@ @23: 0-159 d,#486152,,body |24: @24: 0-159 d,#486152,,body -== snap middle-restored grid=160x25 cursor=7,4 -|3: Collapse -|4: 1 KEEP-FIRST -|5: 2 KEEP-SECOND -|6: 3 KEEP-THIRD +== snap middle-restored grid=160x25 cursor=7,3 +|3: 1 KEEP-FIRST Collapse +|4: 2 KEEP-SECOND +|5: 3 KEEP-THIRD == snap tab-collapsed grid=160x25 cursor=51,2 |3: |4: |5: -|6: == 9p tab-collapsed-cursor grid=160x25 cursor=51,2,bar == snap tab-restored grid=160x25 cursor=51,2 -|3: Collapse -|4: 1 KEEP-FIRST -|5: 2 KEEP-SECOND -|6: 3 KEEP-THIRD +|3: 1 KEEP-FIRST Collapse +|4: 2 KEEP-SECOND +|5: 3 KEEP-THIRD == file unchanged KEEP-FIRST KEEP-SECOND diff --git a/test/snapshots/exec.golden b/test/snapshots/exec.golden index 6ec18f46..2ddd7eec 100644 --- a/test/snapshots/exec.golden +++ b/test/snapshots/exec.golden @@ -1,10 +1,9 @@ -== snap exec grid=140x31 cursor=16,9 +== snap exec grid=140x31 cursor=16,8 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill | New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol | /tmp/pardes-snap/exec/cwd Tty Save Mode Filter Collapse Del /tmp/pardes-snap/exec/cwd Tty Save Mode Filter Collapse Del -| Exec ls -| ls e.txt -| e.txt +| ls Exec ls +| e.txt e.txt | | | @@ -16,29 +15,22 @@ | | | +| | /tmp/pardes-snap/exec/cwd Tty Save Mode Filter Collapse Del | ls | e.txt == snap kept grid=140x31 cursor=6,3 |3: ZZARG ls |4: ./c.sh e.txt -|5: -|8: echo MID''OK |9: -|10: -== snap chord grid=140x31 cursor=6,4 -|3: Exec ls -|4: ZZARG e.txt -|5: ./c.sh -|8: -|9: echo MID''OK -|10: CHORDARG:ZZARG +== snap chord grid=140x31 cursor=6,3 +|3: ZZARG Exec ls +|9: CHORDARG:ZZARG == snap deleted grid=140x31 cursor=4,5 |3: ls ls |4: e.txt e.txt -|5: +|8: |9: -|10: |17: |18: |19: diff --git a/test/snapshots/filewatch.golden b/test/snapshots/filewatch.golden index 6e535d45..74bce6f3 100644 --- a/test/snapshots/filewatch.golden +++ b/test/snapshots/filewatch.golden @@ -26,11 +26,11 @@ | 7 line 7 | 8 line 8 | 9 -== snap reloaded grid=210x31 cursor=15,4 +== snap reloaded grid=210x31 cursor=15,3 |2: /tmp/pardes-snap/filewatch/cwd/w.txt Save Tty Collapse Del /tmp/pardes-snap/filewatch/cwd Tty Save Mode Filter Collapse Del -|3: --:--:-- reloaded /tmp/pardes-snap/filewatch/cwd/w.txt ls -|4: 1 EXTERNAL sub w.txt -|5: 2 +|3: 1 EXTERNAL --:--:-- reloaded /tmp/pardes-snap/filewatch/cwd/w.txt ls +|4: 2 sub w.txt +|5: |6: |7: |8: w.txt @@ -41,10 +41,10 @@ |13: |14: |15: -== snap reloaded_sub grid=210x31 cursor=15,4 -|18: --:--:-- reloaded /tmp/pardes-snap/filewatch/cwd/sub/s.txt -|19: 1 RENAMED -|20: 2 +== snap reloaded_sub grid=210x31 cursor=15,3 +|18: 1 RENAMED --:--:-- reloaded /tmp/pardes-snap/filewatch/cwd/sub/s.txt +|19: 2 +|20: |21: |22: |23: @@ -67,5 +67,3 @@ |14: 12 line 12 |15: 13 |18: 1 RENAMED -|19: 2 -|20: diff --git a/test/snapshots/find.golden b/test/snapshots/find.golden index b076d419..8038c2b5 100644 --- a/test/snapshots/find.golden +++ b/test/snapshots/find.golden @@ -1,20 +1,16 @@ -== snap group grid=120x41 cursor=7,4 +== snap group grid=120x41 cursor=7,3 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill | New Tty Find Grep Joincol Delcol | /tmp/pardes-snap/find/cwd/here.txt Save Tty Collapse Del -| SPC f -| 1 Find +| 1 Find SPC f == snap armed grid=120x41 cursor=119,4 -|3: Find +|3: 1 Find Find |4: Find / -|5: 1 Find == snap typing grid=120x41 cursor=119,3 -|3: Find /zqm -|4: 1 Find -|5: +|3: 1 Find Find /zqm +|4: == snap results grid=120x41 cursor=7,3 |3: 1 Find -|4: |37: /tmp/pardes-snap/find/cwd/+Search Save Tty Collapse Del |38: 1 sub/ZQMARK-beta.txt |39: 2 sub/nest/zqmark-gamma.txt @@ -22,9 +18,7 @@ == snap first grid=120x41 cursor=7,21 |20: /tmp/pardes-snap/find/cwd/sub/ZQMARK-beta.txt Save Tty Collapse Del |21: 1 beta body -|38: Look -|39: 1 sub/ZQMARK-beta.txt -|40: 2 sub/nest/zqmark-gamma.txt +|38: 1 sub/ZQMARK-beta.txt Look == style first grid=120x41 |0: 0-70 #b2c3b8,#1d2824, 71-119 d,#1d2824, |1: 0-1 #ffffff,#887455, 2-2 d,#26362d, 3-34 #becfc4,#26362d, 35-119 d,#26362d, @@ -64,41 +58,36 @@ |35: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-119 d,#0d1410, |36: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-119 d,#0d1410, |37: 0-1 #ffffff,#496656, 2-2 d,#1d2824, 3-28 #b2c3b8,#1d2824, 29-35 #d3b0d9,#1d2824, 36-57 #b2c3b8,#1d2824, 58-119 d,#1d2824, -|38: 0-0 d,#152019, 1-1 d,#0d1410, 2-115 d,#1d2824, 116-119 #b2c3b8,#1d2824, -|39: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-25 #e5eee5,#0d1410, 26-119 d,#0d1410, -|40: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-31 #e5eee5,#0d1410, 32-119 d,#0d1410, +|38: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-25 #e5eee5,#0d1410, 26-113 d,#0d1410, 114-114 d,#1d2824, 115-118 #b2c3b8,#1d2824, 119-119 d,#1d2824, +|39: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-31 #e5eee5,#0d1410, 32-119 d,#0d1410, +|40: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-22 #e5eee5,#0d1410, 23-119 d,#0d1410, == snap second grid=120x41 cursor=7,30 |29: /tmp/pardes-snap/find/cwd/sub/nest/zqmark-gamma.txt Save Tty Collapse Del |30: 1 gamma body == snap third grid=120x41 cursor=7,34 |33: /tmp/pardes-snap/find/cwd/zqmark-alpha.txt Save Tty Collapse Del |34: 1 alpha body +|38: 2 sub/nest/zqmark-gamma.txt Look +|39: 3 zqmark-alpha.txt +|40: 4 +== snap back grid=120x41 cursor=7,30 +|38: 1 sub/ZQMARK-beta.txt Look |39: 2 sub/nest/zqmark-gamma.txt |40: 3 zqmark-alpha.txt -== snap back grid=120x41 cursor=7,30 -|39: 1 sub/ZQMARK-beta.txt -|40: 2 sub/nest/zqmark-gamma.txt == snap word grid=120x41 cursor=7,30 -|3: Find +|3: 1 Find Find |4: Find / -|5: 1 Find |38: 1 sub/ZQMARK-beta.txt -|39: 2 sub/nest/zqmark-gamma.txt -|40: 3 zqmark-alpha.txt == snap cancel grid=120x41 cursor=7,39 -|3: Find / -|4: 1 Find -|5: -|30: Last -|31: 1 gamma body +|3: 1 Find Find / +|4: +|30: 1 gamma body Last == snap nomatch grid=120x41 cursor=7,39 |2: /tmp/pardes-snap/find/cwd/here.txt Save Tty Collapse Del Find / |3: 1 Find -|4: |18: /tmp/pardes-snap/find/cwd/+Search Save Tty Collapse Del |19: 1 |30: 1 gamma body -|31: |38: 2 sub/nest/zqmark-gamma.txt |39: 3 zqmark-alpha.txt |40: 4 diff --git a/test/snapshots/fsearch.golden b/test/snapshots/fsearch.golden index ccc25503..eba3237f 100644 --- a/test/snapshots/fsearch.golden +++ b/test/snapshots/fsearch.golden @@ -20,22 +20,9 @@ | ls | g.txt == snap typing grid=180x31 cursor=89,7 -|7: /MARK -|8: 1 l1 -|9: 2 MARK a -|10: 3 l3 -|11: 4 l4 -|12: 5 l5 -|13: 6 MARK b -|14: 7 l7 -|15: 8 l8 -|16: 9 l9 +|7: 1 l1 /MARK == snap results grid=180x31 cursor=10,8 |7: 1 l1 -|8: 2 MARK a -|9: 3 l3 -|10: 4 l4 -|11: 5 l5 |12: /tmp/pardes-snap/fsearch/cwd/+Search Save Tty Collapse Del LocationsConfig |13: 1 g.txt:2:1-4 |14: 2 MARK a diff --git a/test/snapshots/grep.golden b/test/snapshots/grep.golden index 8f498e05..a371bfb6 100644 --- a/test/snapshots/grep.golden +++ b/test/snapshots/grep.golden @@ -20,15 +20,9 @@ | ls | a.txt noise.txt sub == snap typing grid=180x31 cursor=89,7 -|7: Grep /TARGET -|8: 1 hello TARGET one -|9: 2 nothing here -|10: 3 last TARGET line +|7: 1 hello TARGET one Grep /TARGET == snap results grid=180x31 cursor=7,7 |7: 1 hello TARGET one -|8: 2 nothing here -|9: 3 last TARGET line -|10: |13: /tmp/pardes-snap/grep/cwd/+Search Save Tty Collapse Del LocationsConfig |14: 1 a.txt:1:7-12 hello TARGET one |15: 2 a.txt:3:6-11 last TARGET line diff --git a/test/snapshots/hscroll.golden b/test/snapshots/hscroll.golden index 407d0f82..6a932152 100644 --- a/test/snapshots/hscroll.golden +++ b/test/snapshots/hscroll.golden @@ -1,12 +1,12 @@ -== snap opened grid=90x31 cursor=6,8 +== snap opened grid=90x31 cursor=7,7 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill | New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol | /tmp/pardes-snap/hscroll/cwd Tty Save Mode /tmp/pardes-snap/hscroll/cwd Tty Save Mode -| ls ls +| ls Look ls | wide.txt wide.txt | -| -| wide.txt +| /tmp/pardes-snap/hscroll/cwd/wide.txt Save +| 1 short1 END_A_MARKER_WAY_OUT_RIGHT_padp | | | @@ -19,7 +19,12 @@ | /tmp/pardes-snap/hscroll/cwd Tty Save Mode | ls | wide.txt -== snap wheeled grid=90x31 cursor=6,8 -== snap clamped grid=90x31 cursor=6,8 -== snap dollar grid=90x31 cursor=3,3 -== snap zero grid=90x31 cursor=2,3 +== snap wheeled grid=90x31 cursor=7,7 +|3: ls ls +|7: 1 ND_A_MARKER_WAY_OUT_RIGHT_padpadpadpad +== snap clamped grid=90x31 cursor=7,7 +|7: 1 short1 END_A_MARKER_WAY_OUT_RIGHT_padp +== snap dollar grid=90x31 cursor=41,7 +|7: 1 padpadpadpadpadpadpadpadpadpad_TAIL +== snap zero grid=90x31 cursor=7,7 +|7: 1 short1 END_A_MARKER_WAY_OUT_RIGHT_padp diff --git a/test/snapshots/images.golden b/test/snapshots/images.golden index 95c56d9f..a1b78556 100644 --- a/test/snapshots/images.golden +++ b/test/snapshots/images.golden @@ -2,9 +2,9 @@ |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill | New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol | /tmp/pardes-snap/images/cwd Tty Save Mode Filter Collapse Del /tmp/pardes-snap/images/cwd Tty Save Mode Filter Collapse Del -| Look ls -| ls pic.ppm -| pic.ppm +| ls Look ls +| pic.ppm pic.ppm +| | img petscii:off palette:commodore ascii:on /tmp/pardes-snap/images/cwd/p | 92@7%5Gm$D4▘🬵%🬨3'🬥🬆🬻 | 🬥3▖╱{=CY,▌*)^M<▀🬎🬻 @@ -23,9 +23,9 @@ |0: 0-70 #b2c3b8,#1d2824, 71-149 d,#1d2824, |1: 0-1 #ffffff,#887455, 2-2 d,#26362d, 3-34 #becfc4,#26362d, 35-74 d,#26362d, 75-76 #ffffff,#887455, 77-77 d,#1d2824, 78-109 #b2c3b8,#1d2824, 110-149 d,#1d2824, |2: 0-1 #ffffff,#496656, 2-2 d,#1d2824, 3-30 #b2c3b8,#1d2824, 31-33 #d3b0d9,#1d2824, 34-63 #b2c3b8,#1d2824, 64-74 d,#1d2824, 75-76 #ffffff,#496656, 77-77 d,#1d2824, 78-105 #b2c3b8,#1d2824, 106-108 #d3b0d9,#1d2824, 109-138 #b2c3b8,#1d2824, 139-149 d,#1d2824, -|3: 0-0 d,#152019, 1-1 d,#0d1410, 2-70 d,#1d2824, 71-74 #b2c3b8,#1d2824, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|3: 0-0 d,#608269, 1-1 d,#0d1410, 2-68 #e5eee5,#0d1410, 69-69 d,#1d2824, 70-73 #b2c3b8,#1d2824, 74-74 d,#1d2824, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, |4: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|5: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-149 d,#0d1410, +|5: 0-0 d,#608269, 1-74 d,#0d1410, 75-75 d,#608269, 76-149 d,#0d1410, |6: 0-1 #000000,#add38a, 2-2 d,#26362d, 3-73 #becfc4,#26362d, 74-74 #dfbce5,#26362d, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, |7: 0-0 d,#152019, 1-27 d,#0d1410, 28-29 #959595,#6c6c6c, 30-30 #6c6c6c,#959595, 31-34 #959595,#6c6c6c, 35-35 #6c6c6c,#959595, 36-37 #959595,#6c6c6c, 38-38 #6c6c6c,#959595, 39-39 #959595,#6c6c6c, 40-40 #6c6c6c,#959595, 41-41 #959595,#6c6c6c, 42-42 #6c6c6c,#959595, 43-44 #959595,#6c6c6c, 45-45 #6c6c6c,#959595, 46-46 #959595,#6c5eb5, 47-47 #352879,#6c6c6c, 48-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, |8: 0-0 d,#152019, 1-27 d,#0d1410, 28-28 #6c6c6c,#959595, 29-29 #959595,#6c6c6c, 30-30 #6c6c6c,#959595, 31-34 #959595,#6c6c6c, 35-38 #6c6c6c,#959595, 39-42 #959595,#6c6c6c, 43-43 #6c6c6c,#959595, 44-44 #6c6c6c,#352879, 45-45 #352879,#959595, 46-47 #352879,#352879, 48-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, @@ -53,33 +53,30 @@ |30: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, == style term-palette grid=150x31 |3: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|5: 0-0 d,#608269, 1-74 d,#0d1410, 75-75 d,#608269, 76-149 d,#0d1410, |6: 0-1 #000000,#add38a, 2-2 d,#26362d, 3-72 #becfc4,#26362d, 73-74 #dfbce5,#26362d, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|7: 0-0 d,#152019, 1-1 d,#0d1410, 2-67 d,#1d2824, 68-74 #b2c3b8,#1d2824, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|8: 0-0 d,#152019, 1-28 d,#0d1410, 29-31 p8,p4, 32-33 p4,p8, 34-37 p8,p4, 38-38 p4,p8, 39-44 p8,p4, 45-45 p8,p12, 46-46 p12,p8, 47-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|9: 0-0 d,#152019, 1-28 d,#0d1410, 29-29 p8,p4, 30-30 p4,p8, 31-35 p8,p4, 36-36 p5,p8, 37-37 p8,p4, 38-38 p4,p8, 39-41 p8,p4, 42-42 p4,p8, 43-43 p8,p12, 44-45 p12,p8, 46-46 p12,p12, 47-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|10: 0-0 d,#152019, 1-28 d,#0d1410, 29-30 p8,p4, 31-32 p4,p8, 33-40 p8,p4, 41-41 p8,p12, 42-43 p12,p8, 44-46 p12,p12, 47-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|11: 0-0 d,#152019, 1-28 d,#0d1410, 29-31 p8,p4, 32-32 p4,p8, 33-34 p8,p4, 35-37 p4,p8, 38-38 p8,p4, 39-39 p8,p12, 40-41 p12,p8, 42-46 p12,p12, 47-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|12: 0-0 d,#152019, 1-28 d,#0d1410, 29-36 p8,p4, 37-37 p8,p12, 38-39 p12,p8, 40-46 p12,p12, 47-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|13: 0-0 d,#152019, 1-28 d,#0d1410, 29-30 p4,p8, 31-34 p8,p4, 35-35 p8,p12, 36-36 p12,p8, 37-46 p12,p12, 47-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|14: 0-0 d,#152019, 1-28 d,#0d1410, 29-29 p4,p8, 30-31 p8,p4, 32-32 p4,p8, 33-33 p8,p12, 34-35 p12,p8, 36-46 p12,p12, 47-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|15: 0-0 d,#152019, 1-28 d,#0d1410, 29-29 p4,p8, 30-30 p8,p4, 31-31 p8,p12, 32-32 p12,p8, 33-46 p12,p12, 47-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|16: 0-0 d,#152019, 1-28 d,#0d1410, 29-29 p8,p12, 30-30 p12,p8, 31-46 p12,p12, 47-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|7: 0-0 d,#152019, 1-27 d,#0d1410, 28-28 p8,p5, 29-30 p8,p4, 31-31 p4,p8, 32-35 p8,p4, 36-37 p4,p8, 38-39 p8,p4, 40-40 p4,p8, 41-42 p8,p4, 43-43 p4,p8, 44-46 p8,p4, 47-47 p12,p8, 48-65 d,#0d1410, 66-66 d,#1d2824, 67-73 #b2c3b8,#1d2824, 74-74 d,#1d2824, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|8: 0-0 d,#152019, 1-27 d,#0d1410, 28-30 p8,p4, 31-33 p4,p8, 34-34 p8,p4, 35-36 p4,p8, 37-37 p8,p4, 38-41 p4,p8, 42-42 p8,p4, 43-43 p4,p8, 44-44 p8,p12, 45-46 p12,p8, 47-47 p12,p12, 48-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|9: 0-0 d,#152019, 1-27 d,#0d1410, 28-28 p8,p4, 29-29 p4,p8, 30-30 p8,p4, 31-31 p4,p8, 32-32 p8,p4, 33-33 p4,p8, 34-35 p8,p4, 36-37 p4,p8, 38-38 p8,p5, 39-41 p8,p4, 42-42 p4,p8, 43-44 p12,p8, 45-47 p12,p12, 48-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|10: 0-0 d,#152019, 1-27 d,#0d1410, 28-29 p8,p4, 30-34 p4,p8, 35-36 p8,p4, 37-38 p4,p8, 39-39 p8,p4, 40-40 p4,p8, 41-41 p12,p8, 42-47 p12,p12, 48-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|11: 0-0 d,#152019, 1-27 d,#0d1410, 28-28 p4,p8, 29-29 p8,p4, 30-31 p4,p8, 32-32 p8,p4, 33-33 p4,p8, 34-34 p8,p4, 35-36 p4,p8, 37-37 p8,p4, 38-38 p8,p12, 39-39 p12,p8, 40-47 p12,p12, 48-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|12: 0-0 d,#152019, 1-27 d,#0d1410, 28-28 p8,p4, 29-31 p4,p8, 32-35 p8,p4, 36-36 p4,p8, 37-37 p12,p8, 38-47 p12,p12, 48-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|13: 0-0 d,#152019, 1-27 d,#0d1410, 28-32 p8,p4, 33-33 p4,p8, 34-34 p8,p12, 35-36 p12,p8, 37-47 p12,p12, 48-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|14: 0-0 d,#152019, 1-27 d,#0d1410, 28-28 p8,p4, 29-29 p4,p8, 30-30 p8,p4, 31-32 p4,p8, 33-33 p12,p8, 34-34 p8,p12, 35-47 p12,p12, 48-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|15: 0-0 d,#152019, 1-27 d,#0d1410, 28-29 p4,p8, 30-30 p8,p12, 31-32 p12,p8, 33-47 p12,p12, 48-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|16: 0-0 d,#152019, 1-27 d,#0d1410, 28-28 p8,p12, 29-29 p12,p8, 30-47 p12,p12, 48-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, == snap no-ascii grid=150x31 cursor=11,8 |3: ls ls -|4: pic.ppm pic.ppm -|5: |6: img petscii:off palette:terminal ascii:off /tmp/pardes-snap/images/cwd/p -|7: Ascii -|8: █🬝█╲███▙🬸🬬🬻█████🬝🬵 -|9: ███████🬻██🬸█🬝█🬝▄█ -|10: ████████████🬝▄█ -|11: ███🬸██████🬝▄█ -|12: ████████🬝🬵█ -|13: ╱█████🬝▄ -|14: █🬬█╲🬝🬵█ -|15: 🬺█🬝🬵 -|16: 🬝▄ +|7: ███╱█🬻██🬺██🬻███╱██🬴▄ Ascii +|8: 🬬██╱███╱🬻🬝🬻🬬████🬝🬵█ +|9: █╲█🬴████╲╱█🬝██▟▄█ +|10: ██╲╱╲█🬝█████╱🬵 +|11: ╱█████████🬝▄ +|12: █│█████🬝🬝🬹 +|13: ██████🬝▄█ +|14: 🬜🬬██🬸▄╲ +|15: 🬺█🬝🬵█ +|16: 🬝▄ == snap tag-edit grid=400x31 cursor=87,6 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill | New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol diff --git a/test/snapshots/jumps.golden b/test/snapshots/jumps.golden index 9800ca4c..8d4dc36e 100644 --- a/test/snapshots/jumps.golden +++ b/test/snapshots/jumps.golden @@ -36,9 +36,7 @@ |3: 1 line 1 ls |4: 2 line 2 big.txt == snap to-file grid=150x31 cursor=7,3 -|3: 1 line 1 Left -|4: 2 line 2 ls -|5: 3 line 3 big.txt +|3: 1 line 1 ls Left == snap goto-100 grid=150x31 cursor=7,27 |3: 76 line 76 ls |4: 77 line 77 big.txt @@ -68,40 +66,10 @@ |28: 101 line 101 |29: 102 line 102 |30: 103 line 103 -== snap back-in-file grid=150x31 cursor=7,4 -|3: Back ls -|4: 1 line 1 big.txt -|5: 2 line 2 -|6: 3 line 3 -|7: 4 line 4 -|8: 5 line 5 -|9: 6 line 6 -|10: 7 line 7 -|11: 8 line 8 -|12: 9 line 9 -|13: 10 line 10 -|14: 11 line 11 -|15: 12 line 12 -|16: 13 line 13 -|17: 14 line 14 -|18: 15 line 15 -|19: 16 line 16 -|20: 17 line 17 -|21: 18 line 18 -|22: 19 line 19 -|23: 20 line 20 -|24: 21 line 21 -|25: 22 line 22 -|26: 23 line 23 -|27: 24 line 24 -|28: 25 line 25 -|29: 26 line 26 -|30: 27 line 27 -== snap back-to-shell grid=150x31 cursor=79,5 -== snap forward-file grid=150x31 cursor=7,3 -|3: 1 line 1 Forward -|4: 2 line 2 ls -|5: 3 line 3 big.txt +== snap back-in-file grid=150x31 cursor=7,3 +|3: 1 line 1 Back ls +|4: 2 line 2 big.txt +|5: 3 line 3 |6: 4 line 4 |7: 5 line 5 |8: 6 line 6 @@ -127,41 +95,13 @@ |28: 26 line 26 |29: 27 line 27 |30: 28 line 28 -== snap forward-100 grid=150x31 cursor=7,18 -|3: Forward ls -|4: 86 line 86 big.txt -|5: 87 line 87 -|6: 88 line 88 -|7: 89 line 89 -|8: 90 line 90 -|9: 91 line 91 -|10: 92 line 92 -|11: 93 line 93 -|12: 94 line 94 -|13: 95 line 95 -|14: 96 line 96 -|15: 97 line 97 -|16: 98 line 98 -|17: 99 line 99 -|18: 100 line 100 -|19: 101 line 101 -|20: 102 line 102 -|21: 103 line 103 -|22: 104 line 104 -|23: 105 line 105 -|24: 106 line 106 -|25: 107 line 107 -|26: 108 line 108 -|27: 109 line 109 -|28: 110 line 110 -|29: 111 line 111 -|30: 112 line 112 -== snap last grid=150x31 cursor=79,5 -|3: Last ls -== snap last-back grid=150x31 cursor=7,17 -|3: 86 line 86 Last -|4: 87 line 87 ls -|5: 88 line 88 big.txt +== snap back-to-shell grid=150x31 cursor=79,5 +== snap forward-file grid=150x31 cursor=7,3 +|3: 1 line 1 ls Forward +== snap forward-100 grid=150x31 cursor=7,17 +|3: 86 line 86 Forward ls +|4: 87 line 87 big.txt +|5: 88 line 88 |6: 89 line 89 |7: 90 line 90 |8: 91 line 91 @@ -187,30 +127,12 @@ |28: 111 line 111 |29: 112 line 112 |30: 113 line 113 -== snap jumplist grid=150x31 cursor=7,18 -|3: Jumplist ls -|4: 86 line 86 big.txt -|5: 87 line 87 -|6: 88 line 88 -|7: 89 line 89 -|8: 90 line 90 -|9: 91 line 91 -|10: 92 line 92 -|11: 93 line 93 -|12: 94 line 94 -|13: 95 line 95 -|14: 96 line 96 -|15: 97 line 97 -|16: 98 line 98 -|17: 99 line 99 -|18: 100 line 100 -|19: 101 line 101 -|20: 102 line 102 -|21: 103 line 103 -|22: 104 line 104 -|23: 105 line 105 -|24: 106 line 106 -|25: 107 line 107 +== snap last grid=150x31 cursor=79,5 +|3: 86 line 86 Last ls +== snap last-back grid=150x31 cursor=7,17 +|3: 86 line 86 ls Last +== snap jumplist grid=150x31 cursor=7,17 +|3: 86 line 86 Jumplist ls |26: /tmp/pardes-snap/jumps/cwd/+Jumps Save Tty Collapse Del LocationsConfig |27: 1 @p1:3:3 /tmp/pardes-snap/jumps/cwd |28: 2 /tmp/pardes-snap/jumps/cwd/big.txt:1:1 line 1 @@ -218,32 +140,7 @@ |30: 4 /tmp/pardes-snap/jumps/cwd/big.txt:100:1 line 100 == snap step1-shell grid=150x31 cursor=79,5 |3: 86 line 86 ls -|4: 87 line 87 big.txt -|5: 88 line 88 -|6: 89 line 89 -|7: 90 line 90 -|8: 91 line 91 -|9: 92 line 92 -|10: 93 line 93 -|11: 94 line 94 -|12: 95 line 95 -|13: 96 line 96 -|14: 97 line 97 -|15: 98 line 98 -|16: 99 line 99 -|17: 100 line 100 -|18: 101 line 101 -|19: 102 line 102 -|20: 103 line 103 -|21: 104 line 104 -|22: 105 line 105 -|23: 106 line 106 -|24: 107 line 107 -|25: 108 line 108 -|27: Look -|28: 1 @p1:3:3 /tmp/pardes-snap/jumps/cwd -|29: 2 /tmp/pardes-snap/jumps/cwd/big.txt:1:1 line 1 -|30: 3 @p1:3:3 /tmp/pardes-snap/jumps/cwd +|27: 1 @p1:3:3 /tmp/pardes-snap/jumps/cwd Look == style step1-shell grid=150x31 |0: 0-70 #b2c3b8,#1d2824, 71-149 d,#1d2824, |1: 0-1 #ffffff,#887455, 2-2 d,#1d2824, 3-34 #b2c3b8,#1d2824, 35-74 d,#1d2824, 75-76 #ffffff,#887455, 77-77 d,#26362d, 78-109 #becfc4,#26362d, 110-149 d,#26362d, @@ -272,10 +169,10 @@ |24: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-14 #e5eee5,#0d1410, 15-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, |25: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-14 #e5eee5,#0d1410, 15-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, |26: 0-1 #ffffff,#496656, 2-2 d,#1d2824, 3-29 #b2c3b8,#1d2824, 30-35 #d3b0d9,#1d2824, 36-73 #b2c3b8,#1d2824, 74-74 d,#1d2824, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|27: 0-0 d,#152019, 1-1 d,#0d1410, 2-70 d,#1d2824, 71-74 #b2c3b8,#1d2824, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|28: 0-0 d,#608269, 1-1 d,#0d1410, 2-13 #59675c,#0d1410, 14-40 #e5eee5,#0d1410, 41-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|29: 0-0 d,#608269, 1-1 d,#0d1410, 2-44 #59675c,#0d1410, 45-51 #e5eee5,#0d1410, 52-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|30: 0-0 d,#152019, 1-1 d,#0d1410, 2-13 #59675c,#0d1410, 14-40 #e5eee5,#0d1410, 41-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|27: 0-0 d,#608269, 1-1 d,#0d1410, 2-13 #59675c,#0d1410, 14-40 #e5eee5,#0d1410, 41-68 d,#0d1410, 69-69 d,#1d2824, 70-73 #b2c3b8,#1d2824, 74-74 d,#1d2824, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|28: 0-0 d,#608269, 1-1 d,#0d1410, 2-44 #59675c,#0d1410, 45-51 #e5eee5,#0d1410, 52-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|29: 0-0 d,#608269, 1-1 d,#0d1410, 2-13 #59675c,#0d1410, 14-40 #e5eee5,#0d1410, 41-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|30: 0-0 d,#152019, 1-1 d,#0d1410, 2-46 #59675c,#0d1410, 47-55 #e5eee5,#0d1410, 56-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, == snap step2-file grid=150x31 cursor=7,3 |3: 1 line 1 ls |4: 2 line 2 big.txt @@ -324,10 +221,9 @@ |23: 109 line 109 |24: 110 line 110 |25: 111 line 111 -|28: 2 /tmp/pardes-snap/jumps/cwd/big.txt:1:1 line 1 -|29: 3 @p1:3:3 /tmp/pardes-snap/jumps/cwd -|30: 4 /tmp/pardes-snap/jumps/cwd/big.txt:100:1 line 100 +|27: 2 /tmp/pardes-snap/jumps/cwd/big.txt:1:1 line 1 Look +|28: 3 @p1:3:3 /tmp/pardes-snap/jumps/cwd +|29: 4 /tmp/pardes-snap/jumps/cwd/big.txt:100:1 line 100 +|30: 5 == snap step-back grid=150x31 cursor=79,5 -== snap look-row grid=150x31 cursor=79,5 -|5: 91 line 91 ls -|6: 92 line 92 big.txt +== snap look-row grid=150x31 cursor=7,14 diff --git a/test/snapshots/layout-open.golden b/test/snapshots/layout-open.golden index 47eea036..d5783a9a 100644 --- a/test/snapshots/layout-open.golden +++ b/test/snapshots/layout-open.golden @@ -28,9 +28,7 @@ |7: ls ls |8: sub sub == snap file-open grid=100x31 cursor=7,22 -|18: Look -|19: ls -|20: sub +|18: ls Look |21: /tmp/pardes-snap/layout-open/cwd/sub/f.txt Save |22: 1 echo 'TTY'OK == snap ttydir grid=100x31 cursor=7,22 @@ -38,5 +36,3 @@ |11: echo 'TTY'OK |12: TTYOK |18: ls -|19: sub -|20: diff --git a/test/snapshots/leader.golden b/test/snapshots/leader.golden index 81d9e3cb..3be0846b 100644 --- a/test/snapshots/leader.golden +++ b/test/snapshots/leader.golden @@ -1,14 +1,12 @@ -== snap spc grid=100x41 cursor=7,4 +== snap spc grid=100x41 cursor=7,3 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill | New Tty Find Grep Joincol Delcol | /tmp/pardes-snap/leader/cwd/cmds.txt Save Tty Collapse Del -| SPC -| 1 Help -== snap spc-h grid=100x41 cursor=7,4 -|3: SPC h +| 1 Help SPC +== snap spc-h grid=100x41 cursor=7,3 +|3: 1 Help SPC h == snap abandoned grid=100x41 cursor=7,3 |3: 1 Help -|4: == snap unmapped grid=100x41 cursor=7,3 == snap help-group grid=100x41 cursor=7,23 |22: /tmp/pardes-snap/leader/cwd/+Help Save Tty Collapse Del @@ -29,13 +27,7 @@ |19: 7 Press j until you reach the introduction. |20: 8 |21: 9 -|23: Tutor -|24: 1 pardes builtins under SPC h -|25: 2 -|26: 3 SPC h c Changelog topbar -|27: 4 SPC h m Messages -|28: 5 SPC h t Tutor topbar -|29: 6 +|23: 1 pardes builtins under SPC h Tutor == snap deleted grid=100x41 cursor=7,23 |12: |13: @@ -48,12 +40,6 @@ |20: |21: |23: 1 pardes builtins under SPC h -|24: 2 -|25: 3 SPC h c Changelog topbar -|26: 4 SPC h m Messages -|27: 5 SPC h t Tutor topbar -|28: 6 -|29: == snap help-window grid=100x41 cursor=7,23 |23: 1 pardes builtins under SPC w |25: 3 SPC w h Left C-w h, C-w left diff --git a/test/snapshots/look-center.golden b/test/snapshots/look-center.golden index e13a7886..c876f58c 100644 --- a/test/snapshots/look-center.golden +++ b/test/snapshots/look-center.golden @@ -2,9 +2,9 @@ |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill | New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol | /tmp/pardes-snap/look-center/cwd Tty Save Mode Filter Collapse Del /tmp/pardes-snap/look-center/cwd Tty Save Mode Filter Collapse Del -| Look ls -| ls big.txt -| big.txt +| ls Look ls +| big.txt big.txt +| | /tmp/pardes-snap/look-center/cwd/big.txt Save Tty Collapse Del | 95 line 95 | 96 line 96 @@ -20,12 +20,10 @@ | ls | big.txt == snap center-dedup grid=150x31 cursor=7,12 -|3: ls Look -|4: big.txt ls -|5: big.txt +|3: ls ls Look |7: 145 line 145 -|8: 146 line 146 -|9: 147 line 147 big.txt:150 big.txt:2 +|8: 146 line 146 big.txt:150 big.txt:2 +|9: 147 line 147 |10: 148 line 148 |11: 149 line 149 |12: 150 line 150 @@ -33,9 +31,14 @@ |14: 152 line 152 |15: 153 line 153 |16: 154 line 154 -== snap center-clamp grid=150x31 cursor=93,7 -|3: ls ls -|4: big.txt big.txt -|5: -|8: 146 line 146 big.txt:150 big.txt:2 -|9: 147 line 147 +== snap center-clamp grid=150x31 cursor=7,8 +|7: 1 line 1 +|8: 2 line 2 big.txt:150 big.txt:2 +|9: 3 line 3 +|10: 4 line 4 +|11: 5 line 5 +|12: 6 line 6 +|13: 7 line 7 +|14: 8 line 8 +|15: 9 line 9 +|16: 10 line 10 diff --git a/test/snapshots/look-dir.golden b/test/snapshots/look-dir.golden index 8f90d604..5301223e 100644 --- a/test/snapshots/look-dir.golden +++ b/test/snapshots/look-dir.golden @@ -2,9 +2,9 @@ |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill | New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol | /tmp/pardes-snap/look-dir/cwd Tty Save Mode Fil /tmp/pardes-snap/look-dir/cwd Tty Save Mode Fil -| Look ls -| ls sub top.txt -| sub top.txt +| ls Look ls +| sub top.txt sub top.txt +| | /tmp/pardes-snap/look-dir/cwd/sub Tty Save Mode | ls | inner.txt diff --git a/test/snapshots/look-file-1col.golden b/test/snapshots/look-file-1col.golden index abe1fcbb..1a5ee5ce 100644 --- a/test/snapshots/look-file-1col.golden +++ b/test/snapshots/look-file-1col.golden @@ -2,9 +2,9 @@ |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill | New Tty Find Grep Joincol Delcol | /tmp/pardes-snap/look-file-1col/cwd Tty Save Mode Filter Collapse Del -| Look -| ls +| ls Look | big.txt +| | /tmp/pardes-snap/look-file-1col/cwd/big.txt Save Tty Collapse Del | 28 line 28 | 29 line 29 diff --git a/test/snapshots/look-file.golden b/test/snapshots/look-file.golden index 13919c3d..de8225a3 100644 --- a/test/snapshots/look-file.golden +++ b/test/snapshots/look-file.golden @@ -2,9 +2,9 @@ |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill | New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol | /tmp/pardes-snap/look-file/cwd Tty Save Mode Filter Collapse Del /tmp/pardes-snap/look-file/cwd Tty Save Mode Filter Collapse Del -| Look ls -| ls big.txt -| big.txt +| ls Look ls +| big.txt big.txt +| | /tmp/pardes-snap/look-file/cwd/big.txt Save Tty Collapse Del | 35 line 35 | 36 line 36 @@ -23,9 +23,9 @@ |0: 0-70 #b2c3b8,#1d2824, 71-149 d,#1d2824, |1: 0-1 #ffffff,#887455, 2-2 d,#26362d, 3-34 #becfc4,#26362d, 35-74 d,#26362d, 75-76 #ffffff,#887455, 77-77 d,#1d2824, 78-109 #b2c3b8,#1d2824, 110-149 d,#1d2824, |2: 0-1 #ffffff,#496656, 2-2 d,#1d2824, 3-33 #b2c3b8,#1d2824, 34-36 #d3b0d9,#1d2824, 37-66 #b2c3b8,#1d2824, 67-74 d,#1d2824, 75-76 #ffffff,#496656, 77-77 d,#1d2824, 78-108 #b2c3b8,#1d2824, 109-111 #d3b0d9,#1d2824, 112-141 #b2c3b8,#1d2824, 142-149 d,#1d2824, -|3: 0-0 d,#152019, 1-1 d,#0d1410, 2-70 d,#1d2824, 71-74 #b2c3b8,#1d2824, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|3: 0-0 d,#608269, 1-1 d,#0d1410, 2-68 #e5eee5,#0d1410, 69-69 d,#1d2824, 70-73 #b2c3b8,#1d2824, 74-74 d,#1d2824, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, |4: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|5: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-149 d,#0d1410, +|5: 0-0 d,#608269, 1-74 d,#0d1410, 75-75 d,#608269, 76-149 d,#0d1410, |6: 0-1 #000000,#add38a, 2-2 d,#26362d, 3-33 #becfc4,#26362d, 34-40 #dfbce5,#26362d, 41-62 #becfc4,#26362d, 63-74 d,#26362d, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, |7: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-13 #e5eee5,#0d1410, 14-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, |8: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-13 #e5eee5,#0d1410, 14-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, diff --git a/test/snapshots/lookloaded.golden b/test/snapshots/lookloaded.golden index a55151f4..a9e08392 100644 --- a/test/snapshots/lookloaded.golden +++ b/test/snapshots/lookloaded.golden @@ -2,9 +2,9 @@ |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill | New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol | /tmp/pardes-snap/lookloaded/cwd Tty Save Mode F /tmp/pardes-snap/lookloaded/cwd Tty Save Mode F -| Look ls -| ls big.txt -| big.txt +| ls Look ls +| big.txt big.txt +| | /tmp/pardes-snap/lookloaded/cwd/big.txt Save Tt | 35 line 35 | 36 line 36 @@ -21,17 +21,13 @@ | big.txt == snap removed grid=100x31 cursor=54,7 |3: ls ls -|4: big.txt big.txt |5: rm big.txt; echo GO''NE |6: /tmp/pardes-snap/lookloaded/cwd/big.txt Save Tt GONE == snap look-noFS grid=100x31 cursor=7,12 -|3: ls Look -|4: big.txt ls -|5: big.txt -|6: /tmp/pardes-snap/lookloaded/cwd/big.txt Save Tt rm big.txt; echo GO''NE -|7: 5 line 5 GONE -|8: 6 line 6 -|9: 7 line 7 big.txt:10 +|3: ls ls Look +|7: 5 line 5 +|8: 6 line 6 big.txt:10 +|9: 7 line 7 |10: 8 line 8 |11: 9 line 9 |12: 10 line 10 diff --git a/test/snapshots/lsp-client-edit.golden b/test/snapshots/lsp-client-edit.golden index 54c6e083..18138dd7 100644 --- a/test/snapshots/lsp-client-edit.golden +++ b/test/snapshots/lsp-client-edit.golden @@ -1,9 +1,8 @@ -== snap formatted grid=100x25 cursor=7,5 +== snap formatted grid=100x25 cursor=7,4 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill | New Tty Find Grep Joincol Delcol | /tmp/pardes-snap/lsp-client-edit/cwd/main.rs * Save Tty Collapse Del TreeContext -| formatted 1 range(s) -| 1 // formatted by mock +| 1 // formatted by mock formatted 1 range(s) | 2 mod lib; | 3 | 4 fn main() { @@ -22,24 +21,11 @@ |9: 7 } |10: 8 |11: -|12: -== snap renamed grid=100x25 cursor=12,6 -|3: renamed 2 range(s) -|4: 1 mod lib; -|5: 2 -|6: 3 fn main() { -|7: 4 let x = sum(1, 2); -|8: 5 let y = sum(3, 4); -|9: 6 let _ = x + y; -|10: 7 } -|11: 8 +== snap renamed grid=100x25 cursor=12,5 +|3: 1 mod lib; renamed 2 range(s) +|6: 4 let x = sum(1, 2); +|7: 5 let y = sum(3, 4); == snap unrenamed grid=100x25 cursor=12,5 |3: 1 mod lib; -|4: 2 -|5: 3 fn main() { |6: 4 let x = add(1, 2); |7: 5 let y = add(3, 4); -|8: 6 let _ = x + y; -|9: 7 } -|10: 8 -|11: diff --git a/test/snapshots/lsp-client.golden b/test/snapshots/lsp-client.golden index 6d4a0c0f..52a91d61 100644 --- a/test/snapshots/lsp-client.golden +++ b/test/snapshots/lsp-client.golden @@ -2,8 +2,7 @@ |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill | New Tty Find Grep Joincol Delcol | /tmp/pardes-snap/lsp-client/cwd/main.rs Save Tty Collapse Del TreeContext -| --:--:-- lsp rust-analyzer: ready -| 1 mod lib; +| 1 mod lib; --:--:-- lsp rust-analyzer: ready | 2 | 3 fn main() { | 4 let x = add(1, 2); @@ -13,6 +12,7 @@ | 8 | | +| | /tmp/pardes-snap/lsp-client/cwd/lib.rs Save Tty Collapse Del TreeContext | 1 // mock fixture | 2 pub fn add(a: i32, b: i32) -> i32 { @@ -21,25 +21,18 @@ | 5 == snap gr-list grid=100x25 cursor=21,6 |3: 1 mod lib; -|4: 2 -|5: 3 fn main() { -|6: 4 let x = add(1, 2); -|7: 5 let y = add(3, 4); -|8: 6 let _ = x + y; -|9: 7 } -|10: 8 -|11: |20: /tmp/pardes-snap/lsp-client/cwd/+Search Save Tty Collapse Del LocationsConfig |21: 1 lib.rs:2:8-10 |22: 2 pub fn add(a: i32, b: i32) -> i32 { |23: 3 main.rs:4:13-15 |24: 4 let x = add(1, 2); == snap gr-opened grid=100x25 cursor=21,7 -|21: Look +|21: 3 main.rs:4:13-15 Look +|22: 4 let x = add(1, 2); +|23: 5 main.rs:5:13-15 +|24: 6 let y = add(3, 4); +== snap gr-back grid=100x25 cursor=21,6 +|21: 2 pub fn add(a: i32, b: i32) -> i32 { Look |22: 3 main.rs:4:13-15 |23: 4 let x = add(1, 2); |24: 5 main.rs:5:13-15 -== snap gr-back grid=100x25 cursor=21,6 -|22: 2 pub fn add(a: i32, b: i32) -> i32 { -|23: 3 main.rs:4:13-15 -|24: 4 let x = add(1, 2); diff --git a/test/snapshots/lsp-rename.golden b/test/snapshots/lsp-rename.golden index d18e6566..75d87879 100644 --- a/test/snapshots/lsp-rename.golden +++ b/test/snapshots/lsp-rename.golden @@ -1,9 +1,8 @@ -== snap renamed grid=110x25 cursor=17,11 +== snap renamed grid=110x25 cursor=17,10 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill | New Tty Find Grep Joincol Delcol | /tmp/pardes-snap/lsp-rename/cwd/rename.zig * Save Tty Collapse Del TreeContext -| renamed 2 range(s) -| 1 const std = @import("std"); +| 1 const std = @import("std"); renamed 2 range(s) | 2 | 3 fn renamed_helper(x: u32) u32 { | 4 return x + 1; @@ -20,21 +19,8 @@ | 15 == snap undone grid=110x25 cursor=17,10 |3: 1 const std = @import("std"); -|4: 2 |5: 3 fn helper(x: u32) u32 { -|6: 4 return x + 1; -|7: 5 } -|8: 6 -|9: 7 pub fn main() void { |10: 8 _ = helper(41); -|11: 9 } -|12: 10 -|13: 11 fn shadowed() void { -|14: 12 const helper: u32 = 7; -|15: 13 _ = helper; -|16: 14 } -|17: 15 -|18: == snap redone grid=110x25 cursor=17,10 |5: 3 fn renamed_helper(x: u32) u32 { |10: 8 _ = renamed_helper(41); diff --git a/test/snapshots/lsp.golden b/test/snapshots/lsp.golden index 7baf7716..34078a38 100644 --- a/test/snapshots/lsp.golden +++ b/test/snapshots/lsp.golden @@ -14,23 +14,13 @@ | 10 == snap cursor grid=120x41 cursor=17,10 == snap definition grid=120x41 cursor=15,5 -== snap hover grid=120x41 cursor=15,6 -|3: Hover -|4: 1 const std = @import("std"); -|5: 2 -|6: 3 fn helper(x: u32) u32 { -|7: 4 return x + 1; -|8: 5 } -|9: 6 -|10: 7 pub fn main() void { -|11: 8 _ = helper(41); -|12: 9 } -|13: 10 +== snap hover grid=120x41 cursor=15,5 +|3: 1 const std = @import("std"); Hover |38: /tmp/pardes-snap/lsp/cwd/+Hover Save Tty Collapse Del |39: 1 fn helper(x: u32) u32 |40: 2 (fn (u32) u32) -== snap symbols grid=120x41 cursor=15,6 -|3: Symbols +== snap symbols grid=120x41 cursor=15,5 +|3: 1 const std = @import("std"); Symbols |31: /tmp/pardes-snap/lsp/cwd/+Search Save Tty Collapse Del LocationsConfig |32: 1 a.zig:1:7-9 |33: 2 std @@ -40,26 +30,6 @@ |37: 6 main fn main() void == snap step grid=120x41 cursor=15,3 |3: 1 const std = @import("std"); -|4: 2 -|5: 3 fn helper(x: u32) u32 { -|6: 4 return x + 1; -|7: 5 } -|8: 6 -|9: 7 pub fn main() void { -|10: 8 _ = helper(41); -|11: 9 } -|12: 10 -|13: -|32: Look -|33: 1 a.zig:1:7-9 -|34: 2 std -|35: 3 a.zig:3:4-9 -|36: 4 helper fn helper(x: u32) u32 -|37: 5 a.zig:7:8-11 +|32: 1 a.zig:1:7-9 Look == snap nothing grid=120x41 cursor=7,5 |32: 1 a.zig:1:7-9 -|33: 2 std -|34: 3 a.zig:3:4-9 -|35: 4 helper fn helper(x: u32) u32 -|36: 5 a.zig:7:8-11 -|37: 6 main fn main() void diff --git a/test/snapshots/lspcomplete.golden b/test/snapshots/lspcomplete.golden index 4a9ff8b5..5a08f5ec 100644 --- a/test/snapshots/lspcomplete.golden +++ b/test/snapshots/lspcomplete.golden @@ -29,8 +29,7 @@ == snap refill grid=120x41 cursor=16,10 == snap step grid=120x41 cursor=19,4 |2: /tmp/pardes-snap/lspcomplete/cwd/a.zig * Save Tty Collapse Del TreeContext -|39: Look -|40: 1 a.zig:2:5-13 verdigris verdigris, +|39: 1 a.zig:2:5-13 verdigris verdigris, Look == snap txtindent grid=120x41 cursor=15,3 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill | New Tty Find Grep Joincol Delcol diff --git a/test/snapshots/lsprelpath.golden b/test/snapshots/lsprelpath.golden index 58de860b..110d4440 100644 --- a/test/snapshots/lsprelpath.golden +++ b/test/snapshots/lsprelpath.golden @@ -42,8 +42,7 @@ |20: 3 cinnabar, |21: 4 }; |22: 5 -|33: Look -|34: 1 /tmp/pardes-snap/lsprelpath/cwd/shade.zig:2:5-13 verdigris verdigris, +|33: 1 /tmp/pardes-snap/lsprelpath/cwd/shade.zig:2:5-13 verdigris verdigris, Look == style abslook grid=100x35 |0: 0-70 #b2c3b8,#1d2824, 71-99 d,#1d2824, |1: 0-1 #ffffff,#887455, 2-2 d,#26362d, 3-34 #becfc4,#26362d, 35-99 d,#26362d, @@ -78,8 +77,8 @@ |30: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-99 d,#0d1410, |31: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-99 d,#0d1410, |32: 0-1 #ffffff,#496656, 2-2 d,#1d2824, 3-38 #b2c3b8,#1d2824, 39-45 #d3b0d9,#1d2824, 46-67 #b2c3b8,#1d2824, 68-99 d,#1d2824, -|33: 0-0 d,#152019, 1-1 d,#0d1410, 2-95 d,#1d2824, 96-99 #b2c3b8,#1d2824, -|34: 0-0 d,#608269, 1-1 d,#0d1410, 2-54 #59675c,#0d1410, 55-76 #e5eee5,#0d1410, 77-99 d,#0d1410, +|33: 0-0 d,#608269, 1-1 d,#0d1410, 2-54 #59675c,#0d1410, 55-76 #e5eee5,#0d1410, 77-93 d,#0d1410, 94-94 d,#1d2824, 95-98 #b2c3b8,#1d2824, 99-99 d,#1d2824, +|34: 0-0 d,#152019, 1-1 d,#0d1410, 2-54 #59675c,#0d1410, 55-74 #e5eee5,#0d1410, 75-99 d,#0d1410, == snap subrow grid=100x35 cursor=16,7 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill | New Tty Find Grep Joincol Delcol @@ -124,8 +123,7 @@ |20: 3 indigo, |21: 4 }; |22: 5 -|33: Look -|34: 1 inner/tint.zig:2:5-9 ochre ochre, +|33: 1 inner/tint.zig:2:5-9 ochre ochre, Look == style sublook grid=100x35 |0: 0-70 #b2c3b8,#1d2824, 71-99 d,#1d2824, |1: 0-1 #ffffff,#887455, 2-2 d,#26362d, 3-34 #becfc4,#26362d, 35-99 d,#26362d, @@ -160,6 +158,6 @@ |30: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-99 d,#0d1410, |31: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-99 d,#0d1410, |32: 0-1 #ffffff,#496656, 2-2 d,#1d2824, 3-38 #b2c3b8,#1d2824, 39-45 #d3b0d9,#1d2824, 46-67 #b2c3b8,#1d2824, 68-99 d,#1d2824, -|33: 0-0 d,#152019, 1-1 d,#0d1410, 2-95 d,#1d2824, 96-99 #b2c3b8,#1d2824, -|34: 0-0 d,#608269, 1-1 d,#0d1410, 2-26 #59675c,#0d1410, 27-40 #e5eee5,#0d1410, 41-99 d,#0d1410, -== snap clicked grid=100x35 cursor=15,19 +|33: 0-0 d,#608269, 1-1 d,#0d1410, 2-26 #59675c,#0d1410, 27-40 #e5eee5,#0d1410, 41-93 d,#0d1410, 94-94 d,#1d2824, 95-98 #b2c3b8,#1d2824, 99-99 d,#1d2824, +|34: 0-0 d,#152019, 1-1 d,#0d1410, 2-27 #59675c,#0d1410, 28-43 #e5eee5,#0d1410, 44-99 d,#0d1410, +== snap clicked grid=100x35 cursor=16,20 diff --git a/test/snapshots/mini.golden b/test/snapshots/mini.golden index b915c60b..3f4e2889 100644 --- a/test/snapshots/mini.golden +++ b/test/snapshots/mini.golden @@ -2,8 +2,8 @@ |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill | New Tty Find Grep Joincol Delcol | /tmp/pardes-snap/mini/cwd/commands.txt Save Tty Collapse Del -| Mini -| 1 @`Mini demo.zig` +| 1 @`Mini demo.zig` Mini +| | | | @@ -21,8 +21,8 @@ |0: 0-70 #b2c3b8,#1d2824, 71-89 d,#1d2824, |1: 0-1 #ffffff,#887455, 2-2 d,#26362d, 3-34 #becfc4,#26362d, 35-89 d,#26362d, |2: 0-1 #ffffff,#496656, 2-2 d,#1d2824, 3-28 #b2c3b8,#1d2824, 29-40 #d3b0d9,#1d2824, 41-62 #b2c3b8,#1d2824, 63-89 d,#1d2824, -|3: 0-0 d,#152019, 1-1 d,#0d1410, 2-85 d,#1d2824, 86-89 #b2c3b8,#1d2824, -|4: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-22 #e5eee5,#0d1410, 23-89 d,#0d1410, +|3: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-22 #e5eee5,#0d1410, 23-83 d,#0d1410, 84-84 d,#1d2824, 85-88 #b2c3b8,#1d2824, 89-89 d,#1d2824, +|4: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-89 d,#0d1410, |5: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-89 d,#0d1410, |6: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-89 d,#0d1410, |7: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-89 d,#0d1410, @@ -48,10 +48,10 @@ @1: 0-1 #ffffff,#887455,,tagline 2-2 d,#26362d,,tagline 3-34 #becfc4,#26362d,,tagline 35-89 d,#26362d,,tagline |2: /tmp/pardes-snap/mini/cwd/commands.txt Save Tty Collapse Del @2: 0-1 #ffffff,#496656,,tagline 2-2 d,#1d2824,,tagline 3-28 #b2c3b8,#1d2824,,tagline 29-40 #d3b0d9,#1d2824,,tagline 41-62 #b2c3b8,#1d2824,,tagline 63-89 d,#1d2824,,tagline -|3: Mini -@3: 0-0 d,#152019,,body 1-1 d,#0d1410,,body 2-85 d,#1d2824,,tagline 86-89 #b2c3b8,#1d2824,,tagline -|4: 1 @`Mini demo.zig` -@4: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-22 #e5eee5,#0d1410,,body 23-89 d,#0d1410,,body +|3: 1 @`Mini demo.zig` Mini +@3: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-22 #e5eee5,#0d1410,,body 23-83 d,#0d1410,,body 84-84 d,#1d2824,,tagline 85-88 #b2c3b8,#1d2824,,tagline 89-89 d,#1d2824,,tagline +|4: +@4: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-89 d,#0d1410,,body |5: @5: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-89 d,#0d1410,,body |6: @@ -93,34 +93,26 @@ @22: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-89 d,#0d1410,,body == style colors-off grid=90x23 |3: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-22 #e5eee5,#0d1410, 23-89 d,#0d1410, -|4: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-89 d,#0d1410, -|14: 0-0 d,#152019, 1-1 d,#0d1410, 2-83 d,#1d2824, 84-89 #b2c3b8,#1d2824, -|15: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-22 #e5eee5,#0d1410, 23-89 d,#0d1410, -|16: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-25 #e5eee5,#0d1410, 26-89 d,#0d1410, -|17: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-20 #e5eee5,#0d1410, 21-89 d,#0d1410, -== 9p colors-off grid=90x23 cursor=7,15,block +|14: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-22 #e5eee5,#0d1410, 23-81 d,#0d1410, 82-82 d,#1d2824, 83-88 #b2c3b8,#1d2824, 89-89 d,#1d2824, +|15: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-25 #e5eee5,#0d1410, 26-89 d,#0d1410, +|16: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-20 #e5eee5,#0d1410, 21-89 d,#0d1410, +== 9p colors-off grid=90x23 cursor=7,14,block |3: 1 @`Mini demo.zig` @3: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-22 #e5eee5,#0d1410,,body 23-89 d,#0d1410,,body -|4: -@4: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-89 d,#0d1410,,body -|14: Colors -@14: 0-0 d,#152019,,body 1-1 d,#0d1410,,body 2-83 d,#1d2824,,tagline 84-89 #b2c3b8,#1d2824,,tagline -|15: 1 ⠭⠍⣥⢩⣭⡭⣭⣬⣌⢭⣭⠌⠬⠅⠍⠁ -+15: 7="⠭" 8="⠍" 9="⣥" 10="⢩" 11="⣭" 12="⡭" 13="⣭" 14="⣬" 15="⣌" 16="⢭" 17="⣭" 18="⠌" 19="⠬" 20="⠅" 21="⠍" 22="⠁" -@15: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #616f64,#0d1410,b,body 7-22 #e5eee5,#0d1410,,body 23-89 d,#0d1410,,body -|16: 2 ⣂⢀⣉⣉⢉⣈⢁⣀⣀⢀⣀⣀⣀⢀⣀⣀⣀⣀⣀ -+16: 7="⣂" 8="⢀" 9="⣉" 10="⣉" 11="⢉" 12="⣈" 13="⢁" 14="⣀" 15="⣀" 16="⢀" 17="⣀" 18="⣀" 19="⣀" 20="⢀" 21="⣀" 22="⣀" 23="⣀" 24="⣀" 25="⣀" -@16: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-25 #e5eee5,#0d1410,,body 26-89 d,#0d1410,,body -|17: 3 ⠉⠉⠁⠉⠉⠉⠈⠈⠉⠉⠉⠉⠉⠉ -+17: 7="⠉" 8="⠉" 9="⠁" 10="⠉" 11="⠉" 12="⠉" 13="⠈" 14="⠈" 15="⠉" 16="⠉" 17="⠉" 18="⠉" 19="⠉" 20="⠉" -@17: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-20 #e5eee5,#0d1410,,body 21-89 d,#0d1410,,body -|18: 4 -@18: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-89 d,#0d1410,,body +|14: 1 ⠭⠍⣥⢩⣭⡭⣭⣬⣌⢭⣭⠌⠬⠅⠍⠁ Colors ++14: 7="⠭" 8="⠍" 9="⣥" 10="⢩" 11="⣭" 12="⡭" 13="⣭" 14="⣬" 15="⣌" 16="⢭" 17="⣭" 18="⠌" 19="⠬" 20="⠅" 21="⠍" 22="⠁" +@14: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #616f64,#0d1410,b,body 7-22 #e5eee5,#0d1410,,body 23-81 d,#0d1410,,body 82-82 d,#1d2824,,tagline 83-88 #b2c3b8,#1d2824,,tagline 89-89 d,#1d2824,,tagline +|15: 2 ⣂⢀⣉⣉⢉⣈⢁⣀⣀⢀⣀⣀⣀⢀⣀⣀⣀⣀⣀ ++15: 7="⣂" 8="⢀" 9="⣉" 10="⣉" 11="⢉" 12="⣈" 13="⢁" 14="⣀" 15="⣀" 16="⢀" 17="⣀" 18="⣀" 19="⣀" 20="⢀" 21="⣀" 22="⣀" 23="⣀" 24="⣀" 25="⣀" +@15: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-25 #e5eee5,#0d1410,,body 26-89 d,#0d1410,,body +|16: 3 ⠉⠉⠁⠉⠉⠉⠈⠈⠉⠉⠉⠉⠉⠉ ++16: 7="⠉" 8="⠉" 9="⠁" 10="⠉" 11="⠉" 12="⠉" 13="⠈" 14="⠈" 15="⠉" 16="⠉" 17="⠉" 18="⠉" 19="⠉" 20="⠉" +@16: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-20 #e5eee5,#0d1410,,body 21-89 d,#0d1410,,body == style colors-on grid=90x23 -|15: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-8 #e5eee5,#0d1410, 9-9 #c9a7ed,#0d1410, 10-12 #e5eee5,#0d1410, 13-15 #c9a7ed,#0d1410, 16-21 #b8d88a,#0d1410, 22-22 #e5eee5,#0d1410, 23-89 d,#0d1410, -|16: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-8 #b9f480,#0d1410, 9-11 #c9a7ed,#0d1410, 12-25 #b9f480,#0d1410, 26-89 d,#0d1410, -|17: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-17 #e5eee5,#0d1410, 18-19 #f8c082,#0d1410, 20-20 #e5eee5,#0d1410, 21-89 d,#0d1410, -== snap resized grid=105x27 cursor=7,17 +|14: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-8 #e5eee5,#0d1410, 9-9 #c9a7ed,#0d1410, 10-12 #e5eee5,#0d1410, 13-15 #c9a7ed,#0d1410, 16-21 #b8d88a,#0d1410, 22-22 #e5eee5,#0d1410, 23-81 d,#0d1410, 82-82 d,#1d2824, 83-88 #b2c3b8,#1d2824, 89-89 d,#1d2824, +|15: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-8 #b9f480,#0d1410, 9-11 #c9a7ed,#0d1410, 12-25 #b9f480,#0d1410, 26-89 d,#0d1410, +|16: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-17 #e5eee5,#0d1410, 18-19 #f8c082,#0d1410, 20-20 #e5eee5,#0d1410, 21-89 d,#0d1410, +== snap resized grid=105x27 cursor=7,16 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill | New Tty Find Grep Joincol Delcol | /tmp/pardes-snap/mini/cwd/commands.txt Save Tty Collapse Del @@ -137,12 +129,11 @@ | | | /tmp/pardes-snap/mini/cwd/Mini demo.zig Save Tty Collapse Del -| Colors -| 1 ⠭⠍⣥⢩⣭⡭⣭⣬⣌⢭⣭⠌⠬⠅⠍⠁ +| 1 ⠭⠍⣥⢩⣭⡭⣭⣬⣌⢭⣭⠌⠬⠅⠍⠁ Colors | 2 ⣂⢀⣉⣉⢉⣈⢁⣀⣀⢀⣀⣀⣀⢀⣀⣀⣀⣀⣀ | 3 ⠉⠉⠁⠉⠉⠉⠈⠈⠉⠉⠉⠉⠉⠉ | 4 -== 9p resized grid=105x27 cursor=7,17,block +== 9p resized grid=105x27 cursor=7,16,block |0: Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill @0: 0-70 #b2c3b8,#1d2824,,tagline 71-104 d,#1d2824,,tagline |1: New Tty Find Grep Joincol Delcol @@ -175,18 +166,18 @@ @14: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-104 d,#0d1410,,body |15: /tmp/pardes-snap/mini/cwd/Mini demo.zig Save Tty Collapse Del @15: 0-1 #000000,#add38a,,tagline 2-2 d,#26362d,,tagline 3-28 #becfc4,#26362d,,tagline 29-41 #dfbce5,#26362d,,tagline 42-63 #becfc4,#26362d,,tagline 64-104 d,#26362d,,tagline -|16: Colors -@16: 0-0 d,#152019,,body 1-1 d,#0d1410,,body 2-98 d,#1d2824,,tagline 99-104 #b2c3b8,#1d2824,,tagline -|17: 1 ⠭⠍⣥⢩⣭⡭⣭⣬⣌⢭⣭⠌⠬⠅⠍⠁ -+17: 7="⠭" 8="⠍" 9="⣥" 10="⢩" 11="⣭" 12="⡭" 13="⣭" 14="⣬" 15="⣌" 16="⢭" 17="⣭" 18="⠌" 19="⠬" 20="⠅" 21="⠍" 22="⠁" -@17: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #616f64,#0d1410,b,body 7-8 #e5eee5,#0d1410,,body 9-9 #c9a7ed,#0d1410,,body 10-12 #e5eee5,#0d1410,,body 13-15 #c9a7ed,#0d1410,,body 16-21 #b8d88a,#0d1410,,body 22-22 #e5eee5,#0d1410,,body 23-104 d,#0d1410,,body -|18: 2 ⣂⢀⣉⣉⢉⣈⢁⣀⣀⢀⣀⣀⣀⢀⣀⣀⣀⣀⣀ -+18: 7="⣂" 8="⢀" 9="⣉" 10="⣉" 11="⢉" 12="⣈" 13="⢁" 14="⣀" 15="⣀" 16="⢀" 17="⣀" 18="⣀" 19="⣀" 20="⢀" 21="⣀" 22="⣀" 23="⣀" 24="⣀" 25="⣀" -@18: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-8 #b9f480,#0d1410,,body 9-11 #c9a7ed,#0d1410,,body 12-25 #b9f480,#0d1410,,body 26-104 d,#0d1410,,body -|19: 3 ⠉⠉⠁⠉⠉⠉⠈⠈⠉⠉⠉⠉⠉⠉ -+19: 7="⠉" 8="⠉" 9="⠁" 10="⠉" 11="⠉" 12="⠉" 13="⠈" 14="⠈" 15="⠉" 16="⠉" 17="⠉" 18="⠉" 19="⠉" 20="⠉" -@19: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-17 #e5eee5,#0d1410,,body 18-19 #f8c082,#0d1410,,body 20-20 #e5eee5,#0d1410,,body 21-104 d,#0d1410,,body -|20: 4 +|16: 1 ⠭⠍⣥⢩⣭⡭⣭⣬⣌⢭⣭⠌⠬⠅⠍⠁ Colors ++16: 7="⠭" 8="⠍" 9="⣥" 10="⢩" 11="⣭" 12="⡭" 13="⣭" 14="⣬" 15="⣌" 16="⢭" 17="⣭" 18="⠌" 19="⠬" 20="⠅" 21="⠍" 22="⠁" +@16: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #616f64,#0d1410,b,body 7-8 #e5eee5,#0d1410,,body 9-9 #c9a7ed,#0d1410,,body 10-12 #e5eee5,#0d1410,,body 13-15 #c9a7ed,#0d1410,,body 16-21 #b8d88a,#0d1410,,body 22-22 #e5eee5,#0d1410,,body 23-96 d,#0d1410,,body 97-97 d,#1d2824,,tagline 98-103 #b2c3b8,#1d2824,,tagline 104-104 d,#1d2824,,tagline +|17: 2 ⣂⢀⣉⣉⢉⣈⢁⣀⣀⢀⣀⣀⣀⢀⣀⣀⣀⣀⣀ ++17: 7="⣂" 8="⢀" 9="⣉" 10="⣉" 11="⢉" 12="⣈" 13="⢁" 14="⣀" 15="⣀" 16="⢀" 17="⣀" 18="⣀" 19="⣀" 20="⢀" 21="⣀" 22="⣀" 23="⣀" 24="⣀" 25="⣀" +@17: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-8 #b9f480,#0d1410,,body 9-11 #c9a7ed,#0d1410,,body 12-25 #b9f480,#0d1410,,body 26-104 d,#0d1410,,body +|18: 3 ⠉⠉⠁⠉⠉⠉⠈⠈⠉⠉⠉⠉⠉⠉ ++18: 7="⠉" 8="⠉" 9="⠁" 10="⠉" 11="⠉" 12="⠉" 13="⠈" 14="⠈" 15="⠉" 16="⠉" 17="⠉" 18="⠉" 19="⠉" 20="⠉" +@18: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-17 #e5eee5,#0d1410,,body 18-19 #f8c082,#0d1410,,body 20-20 #e5eee5,#0d1410,,body 21-104 d,#0d1410,,body +|19: 4 +@19: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-104 d,#0d1410,,body +|20: @20: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-104 d,#0d1410,,body |21: @21: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-104 d,#0d1410,,body diff --git a/test/snapshots/msg.golden b/test/snapshots/msg.golden index 197d01d9..653e9772 100644 --- a/test/snapshots/msg.golden +++ b/test/snapshots/msg.golden @@ -9,21 +9,13 @@ | 5 line 5 | 6 line 6 | 7 -== snap saved grid=70x15 cursor=7,4 -|3: --:--:-- saved /tmp/pardes-snap/msg/cwd/a.txt -|4: 1 line 1 -|5: 2 line 2 -|6: 3 line 3 -|7: 4 line 4 -|8: 5 line 5 -|9: 6 line 6 -|10: 7 -== snap repainted grid=70x17 cursor=7,4 +== snap saved grid=70x15 cursor=7,3 +|3: 1 line 1 --:--:-- saved /tmp/pardes-snap/msg/cwd/a.txt +== snap repainted grid=70x17 cursor=7,3 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kil | New Tty Find Grep Joincol Delcol | /tmp/pardes-snap/msg/cwd/a.txt Save Tty Collapse Del -| --:--:-- saved /tmp/pardes-snap/msg/cwd/a.txt -| 1 line 1 +| 1 line 1 --:--:-- saved /tmp/pardes-snap/msg/cwd/a.txt | 2 line 2 | 3 line 3 | 4 line 4 @@ -32,54 +24,27 @@ | 7 == snap keycleared grid=70x17 cursor=7,4 |3: 1 line 1 -|4: 2 line 2 -|5: 3 line 3 -|6: 4 line 4 -|7: 5 line 5 -|8: 6 line 6 -|9: 7 -|10: -== snap saved-again grid=70x17 cursor=7,5 -|3: --:--:-- saved /tmp/pardes-snap/msg/cwd/a.txt -|4: 1 line 1 -|5: 2 line 2 -|6: 3 line 3 -|7: 4 line 4 -|8: 5 line 5 -|9: 6 line 6 -|10: 7 +== snap saved-again grid=70x17 cursor=7,4 +|3: 1 line 1 --:--:-- saved /tmp/pardes-snap/msg/cwd/a.txt == snap mousecleared grid=70x17 cursor=7,4 |3: 1 line 1 -|4: 2 line 2 -|5: 3 line 3 -|6: 4 line 4 -|7: 5 line 5 -|8: 6 line 6 -|9: 7 -|10: -== snap reloaded grid=70x17 cursor=7,5 -|3: --:--:-- reloaded /tmp/pardes-snap/msg/cwd/a.txt -|4: 1 EXTERNAL -|5: 2 +== snap reloaded grid=70x17 cursor=7,4 +|3: 1 EXTERNAL --:--:-- reloaded /tmp/pardes-snap/msg/cwd/a.txt +|4: 2 +|5: |6: |7: |8: |9: == snap prompt grid=70x17 cursor=69,3 -|3: /EXT +|3: 1 EXTERNAL /EXT == snap prompt-wins grid=70x17 cursor=69,4 -|3: --:--:-- reloaded /tmp/pardes-snap/msg/cwd/a.txt -|4: /EXT -|5: 1 AGAIN -|6: 2 +|3: 1 AGAIN --:--:-- reloaded /tmp/pardes-snap/msg/cwd/a.txt +|4: 2 /EXT == snap esc grid=70x17 cursor=7,4 |3: 1 AGAIN |4: 2 -|5: -|6: -== snap msgbuiltin grid=70x17 cursor=29,6 +== snap msgbuiltin grid=70x17 cursor=29,5 |2: /tmp/pardes-snap/msg/cwd/a.txt * Save Tty Collapse Del -|3: hand-written report -|4: 1 AGAIN -|5: 2 -|6: 3 Msg hand-written report +|3: 1 AGAIN hand-written report +|5: 3 Msg hand-written report diff --git a/test/snapshots/ninep.golden b/test/snapshots/ninep.golden index b501004e..d4cb2a27 100644 --- a/test/snapshots/ninep.golden +++ b/test/snapshots/ninep.golden @@ -58,31 +58,20 @@ |14: @14: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-89 d,#0d1410,,body == style colors-off grid=90x15 -|3: 0-0 d,#152019, 1-1 d,#0d1410, 2-83 d,#1d2824, 84-89 #b2c3b8,#1d2824, -|4: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-32 #e5eee5,#0d1410, 33-33 d,d, 34-37 #e5eee5,#0d1410, 38-89 d,#0d1410, -|5: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-89 d,#0d1410, -|6: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-35 #e5eee5,#0d1410, 36-89 d,#0d1410, -|7: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-28 #e5eee5,#0d1410, 29-89 d,#0d1410, -|8: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-19 #e5eee5,#0d1410, 20-89 d,#0d1410, -|9: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-7 #e5eee5,#0d1410, 8-89 d,#0d1410, -== 9p colors-off grid=90x15 cursor=7,4,block -|3: Colors -@3: 0-0 d,#152019,,body 1-1 d,#0d1410,,body 2-83 d,#1d2824,,tagline 84-89 #b2c3b8,#1d2824,,tagline -|4: 1 const greeting = "café λ 界 é"; -+4: 28="é" 30="λ" 32="界" 33="" 35="é" -@4: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #616f64,#0d1410,b,body 7-37 #e5eee5,#0d1410,,body 38-89 d,#0d1410,,body -|5: 2 -@5: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-89 d,#0d1410,,body -|6: 3 pub fn choose(ok: bool) u32 { -@6: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-35 #e5eee5,#0d1410,,body 36-89 d,#0d1410,,body -|7: 4 if (ok) return 42; -@7: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-28 #e5eee5,#0d1410,,body 29-89 d,#0d1410,,body -|8: 5 return 7; -@8: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-19 #e5eee5,#0d1410,,body 20-89 d,#0d1410,,body -|9: 6 } -@9: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-7 #e5eee5,#0d1410,,body 8-89 d,#0d1410,,body -|10: 7 -@10: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-89 d,#0d1410,,body +|3: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-32 #e5eee5,#0d1410, 33-33 d,d, 34-37 #e5eee5,#0d1410, 38-81 d,#0d1410, 82-82 d,#1d2824, 83-88 #b2c3b8,#1d2824, 89-89 d,#1d2824, +|5: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-35 #e5eee5,#0d1410, 36-89 d,#0d1410, +|6: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-28 #e5eee5,#0d1410, 29-89 d,#0d1410, +|7: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-19 #e5eee5,#0d1410, 20-89 d,#0d1410, +== 9p colors-off grid=90x15 cursor=7,3,block +|3: 1 const greeting = "café λ 界 é"; Colors ++3: 28="é" 30="λ" 32="界" 33="" 35="é" +@3: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #616f64,#0d1410,b,body 7-37 #e5eee5,#0d1410,,body 38-81 d,#0d1410,,body 82-82 d,#1d2824,,tagline 83-88 #b2c3b8,#1d2824,,tagline 89-89 d,#1d2824,,tagline +|5: 3 pub fn choose(ok: bool) u32 { +@5: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-35 #e5eee5,#0d1410,,body 36-89 d,#0d1410,,body +|6: 4 if (ok) return 42; +@6: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-28 #e5eee5,#0d1410,,body 29-89 d,#0d1410,,body +|7: 5 return 7; +@7: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-19 #e5eee5,#0d1410,,body 20-89 d,#0d1410,,body == snap edited-with-colors-off grid=90x15 cursor=7,4 |2: /tmp/pardes-snap/ninep/cwd/demo.zig * Save Tty Collapse Del TreeContext |3: 1 // café λ 界 @@ -116,46 +105,38 @@ @10: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-89 d,#0d1410,,body == style colors-on grid=90x15 |2: 0-1 #000000,#add38a, 2-2 d,#26362d, 3-29 #becfc4,#26362d, 30-37 #dfbce5,#26362d, 38-73 #becfc4,#26362d, 74-89 d,#26362d, -|4: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-17 #b9f480,#0d1410, 18-18 d,d, 19-89 d,#0d1410, -|5: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-23 #e5eee5,#0d1410, 24-32 #b8d88a,#0d1410, 33-33 d,d, 34-36 #b8d88a,#0d1410, 37-37 #e5eee5,#0d1410, 38-89 d,#0d1410, -|6: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-89 d,#0d1410, -|7: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-12 #c9a7ed,#0d1410, 13-35 #e5eee5,#0d1410, 36-89 d,#0d1410, -|8: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-12 #c9a7ed,#0d1410, 13-18 #e5eee5,#0d1410, 19-24 #c9a7ed,#0d1410, 25-25 #e5eee5,#0d1410, 26-27 #f8c082,#0d1410, 28-28 #e5eee5,#0d1410, 29-89 d,#0d1410, -|9: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-16 #c9a7ed,#0d1410, 17-17 #e5eee5,#0d1410, 18-18 #f8c082,#0d1410, 19-19 #e5eee5,#0d1410, 20-89 d,#0d1410, -|10: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-7 #e5eee5,#0d1410, 8-89 d,#0d1410, -== 9p colors-on grid=90x15 cursor=7,5,block -|3: Colors -@3: 0-0 d,#152019,,body 1-1 d,#0d1410,,body 2-83 d,#1d2824,,tagline 84-89 #b2c3b8,#1d2824,,tagline -|4: 1 // café λ 界 -+4: 13="é" 15="λ" 17="界" 18="" -@4: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-18 #b9f480,#0d1410,,body 19-89 d,#0d1410,,body -|5: 2 const greeting = "café λ 界 é"; -+5: 28="é" 30="λ" 32="界" 33="" 35="é" -@5: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #616f64,#0d1410,b,body 7-23 #e5eee5,#0d1410,,body 24-36 #b8d88a,#0d1410,,body 37-37 #e5eee5,#0d1410,,body 38-89 d,#0d1410,,body -|6: 3 -@6: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-89 d,#0d1410,,body -|7: 4 pub fn choose(ok: bool) u32 { -@7: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-10 #e5eee5,#0d1410,,body 11-12 #c9a7ed,#0d1410,,body 13-35 #e5eee5,#0d1410,,body 36-89 d,#0d1410,,body -|8: 5 if (ok) return 42; -@8: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-10 #e5eee5,#0d1410,,body 11-12 #c9a7ed,#0d1410,,body 13-18 #e5eee5,#0d1410,,body 19-24 #c9a7ed,#0d1410,,body 25-25 #e5eee5,#0d1410,,body 26-27 #f8c082,#0d1410,,body 28-28 #e5eee5,#0d1410,,body 29-89 d,#0d1410,,body -|9: 6 return 7; -@9: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-10 #e5eee5,#0d1410,,body 11-16 #c9a7ed,#0d1410,,body 17-17 #e5eee5,#0d1410,,body 18-18 #f8c082,#0d1410,,body 19-19 #e5eee5,#0d1410,,body 20-89 d,#0d1410,,body -|10: 7 } -@10: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-7 #e5eee5,#0d1410,,body 8-89 d,#0d1410,,body -|11: 8 -@11: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-89 d,#0d1410,,body +|3: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-17 #b9f480,#0d1410, 18-18 d,d, 19-81 d,#0d1410, 82-82 d,#1d2824, 83-88 #b2c3b8,#1d2824, 89-89 d,#1d2824, +|4: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-23 #e5eee5,#0d1410, 24-32 #b8d88a,#0d1410, 33-33 d,d, 34-36 #b8d88a,#0d1410, 37-37 #e5eee5,#0d1410, 38-89 d,#0d1410, +|5: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-89 d,#0d1410, +|6: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-12 #c9a7ed,#0d1410, 13-35 #e5eee5,#0d1410, 36-89 d,#0d1410, +|7: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-12 #c9a7ed,#0d1410, 13-18 #e5eee5,#0d1410, 19-24 #c9a7ed,#0d1410, 25-25 #e5eee5,#0d1410, 26-27 #f8c082,#0d1410, 28-28 #e5eee5,#0d1410, 29-89 d,#0d1410, +|8: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-16 #c9a7ed,#0d1410, 17-17 #e5eee5,#0d1410, 18-18 #f8c082,#0d1410, 19-19 #e5eee5,#0d1410, 20-89 d,#0d1410, +|9: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-7 #e5eee5,#0d1410, 8-89 d,#0d1410, +== 9p colors-on grid=90x15 cursor=7,4,block +|3: 1 // café λ 界 Colors ++3: 13="é" 15="λ" 17="界" 18="" +@3: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-18 #b9f480,#0d1410,,body 19-81 d,#0d1410,,body 82-82 d,#1d2824,,tagline 83-88 #b2c3b8,#1d2824,,tagline 89-89 d,#1d2824,,tagline +|4: 2 const greeting = "café λ 界 é"; ++4: 28="é" 30="λ" 32="界" 33="" 35="é" +@4: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #616f64,#0d1410,b,body 7-23 #e5eee5,#0d1410,,body 24-36 #b8d88a,#0d1410,,body 37-37 #e5eee5,#0d1410,,body 38-89 d,#0d1410,,body +|6: 4 pub fn choose(ok: bool) u32 { +@6: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-10 #e5eee5,#0d1410,,body 11-12 #c9a7ed,#0d1410,,body 13-35 #e5eee5,#0d1410,,body 36-89 d,#0d1410,,body +|7: 5 if (ok) return 42; +@7: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-10 #e5eee5,#0d1410,,body 11-12 #c9a7ed,#0d1410,,body 13-18 #e5eee5,#0d1410,,body 19-24 #c9a7ed,#0d1410,,body 25-25 #e5eee5,#0d1410,,body 26-27 #f8c082,#0d1410,,body 28-28 #e5eee5,#0d1410,,body 29-89 d,#0d1410,,body +|8: 6 return 7; +@8: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-10 #e5eee5,#0d1410,,body 11-16 #c9a7ed,#0d1410,,body 17-17 #e5eee5,#0d1410,,body 18-18 #f8c082,#0d1410,,body 19-19 #e5eee5,#0d1410,,body 20-89 d,#0d1410,,body == style resized grid=105x20 |0: 0-70 #b2c3b8,#1d2824, 71-104 d,#1d2824, |1: 0-1 #ffffff,#887455, 2-2 d,#26362d, 3-34 #becfc4,#26362d, 35-104 d,#26362d, |2: 0-1 #000000,#add38a, 2-2 d,#26362d, 3-29 #becfc4,#26362d, 30-37 #dfbce5,#26362d, 38-73 #becfc4,#26362d, 74-104 d,#26362d, -|3: 0-0 d,#152019, 1-1 d,#0d1410, 2-98 d,#1d2824, 99-104 #b2c3b8,#1d2824, -|4: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-17 #b9f480,#0d1410, 18-18 d,d, 19-104 d,#0d1410, -|5: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-23 #e5eee5,#0d1410, 24-32 #b8d88a,#0d1410, 33-33 d,d, 34-36 #b8d88a,#0d1410, 37-37 #e5eee5,#0d1410, 38-104 d,#0d1410, -|6: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-104 d,#0d1410, -|7: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-12 #c9a7ed,#0d1410, 13-35 #e5eee5,#0d1410, 36-104 d,#0d1410, -|8: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-12 #c9a7ed,#0d1410, 13-18 #e5eee5,#0d1410, 19-24 #c9a7ed,#0d1410, 25-25 #e5eee5,#0d1410, 26-27 #f8c082,#0d1410, 28-28 #e5eee5,#0d1410, 29-104 d,#0d1410, -|9: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-16 #c9a7ed,#0d1410, 17-17 #e5eee5,#0d1410, 18-18 #f8c082,#0d1410, 19-19 #e5eee5,#0d1410, 20-104 d,#0d1410, -|10: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-7 #e5eee5,#0d1410, 8-104 d,#0d1410, +|3: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-17 #b9f480,#0d1410, 18-18 d,d, 19-96 d,#0d1410, 97-97 d,#1d2824, 98-103 #b2c3b8,#1d2824, 104-104 d,#1d2824, +|4: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-23 #e5eee5,#0d1410, 24-32 #b8d88a,#0d1410, 33-33 d,d, 34-36 #b8d88a,#0d1410, 37-37 #e5eee5,#0d1410, 38-104 d,#0d1410, +|5: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-104 d,#0d1410, +|6: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-12 #c9a7ed,#0d1410, 13-35 #e5eee5,#0d1410, 36-104 d,#0d1410, +|7: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-12 #c9a7ed,#0d1410, 13-18 #e5eee5,#0d1410, 19-24 #c9a7ed,#0d1410, 25-25 #e5eee5,#0d1410, 26-27 #f8c082,#0d1410, 28-28 #e5eee5,#0d1410, 29-104 d,#0d1410, +|8: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-16 #c9a7ed,#0d1410, 17-17 #e5eee5,#0d1410, 18-18 #f8c082,#0d1410, 19-19 #e5eee5,#0d1410, 20-104 d,#0d1410, +|9: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-7 #e5eee5,#0d1410, 8-104 d,#0d1410, +|10: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-104 d,#0d1410, |11: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-104 d,#0d1410, |12: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-104 d,#0d1410, |13: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-104 d,#0d1410, @@ -165,32 +146,32 @@ |17: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-104 d,#0d1410, |18: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-104 d,#0d1410, |19: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-104 d,#0d1410, -== 9p resized grid=105x20 cursor=7,5,block +== 9p resized grid=105x20 cursor=7,4,block |0: Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill @0: 0-70 #b2c3b8,#1d2824,,tagline 71-104 d,#1d2824,,tagline |1: New Tty Find Grep Joincol Delcol @1: 0-1 #ffffff,#887455,,tagline 2-2 d,#26362d,,tagline 3-34 #becfc4,#26362d,,tagline 35-104 d,#26362d,,tagline |2: /tmp/pardes-snap/ninep/cwd/demo.zig * Save Tty Collapse Del TreeContext @2: 0-1 #000000,#add38a,,tagline 2-2 d,#26362d,,tagline 3-29 #becfc4,#26362d,,tagline 30-37 #dfbce5,#26362d,,tagline 38-73 #becfc4,#26362d,,tagline 74-104 d,#26362d,,tagline -|3: Colors -@3: 0-0 d,#152019,,body 1-1 d,#0d1410,,body 2-98 d,#1d2824,,tagline 99-104 #b2c3b8,#1d2824,,tagline -|4: 1 // café λ 界 -+4: 13="é" 15="λ" 17="界" 18="" -@4: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-18 #b9f480,#0d1410,,body 19-104 d,#0d1410,,body -|5: 2 const greeting = "café λ 界 é"; -+5: 28="é" 30="λ" 32="界" 33="" 35="é" -@5: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #616f64,#0d1410,b,body 7-23 #e5eee5,#0d1410,,body 24-36 #b8d88a,#0d1410,,body 37-37 #e5eee5,#0d1410,,body 38-104 d,#0d1410,,body -|6: 3 -@6: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-104 d,#0d1410,,body -|7: 4 pub fn choose(ok: bool) u32 { -@7: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-10 #e5eee5,#0d1410,,body 11-12 #c9a7ed,#0d1410,,body 13-35 #e5eee5,#0d1410,,body 36-104 d,#0d1410,,body -|8: 5 if (ok) return 42; -@8: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-10 #e5eee5,#0d1410,,body 11-12 #c9a7ed,#0d1410,,body 13-18 #e5eee5,#0d1410,,body 19-24 #c9a7ed,#0d1410,,body 25-25 #e5eee5,#0d1410,,body 26-27 #f8c082,#0d1410,,body 28-28 #e5eee5,#0d1410,,body 29-104 d,#0d1410,,body -|9: 6 return 7; -@9: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-10 #e5eee5,#0d1410,,body 11-16 #c9a7ed,#0d1410,,body 17-17 #e5eee5,#0d1410,,body 18-18 #f8c082,#0d1410,,body 19-19 #e5eee5,#0d1410,,body 20-104 d,#0d1410,,body -|10: 7 } -@10: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-7 #e5eee5,#0d1410,,body 8-104 d,#0d1410,,body -|11: 8 +|3: 1 // café λ 界 Colors ++3: 13="é" 15="λ" 17="界" 18="" +@3: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-18 #b9f480,#0d1410,,body 19-96 d,#0d1410,,body 97-97 d,#1d2824,,tagline 98-103 #b2c3b8,#1d2824,,tagline 104-104 d,#1d2824,,tagline +|4: 2 const greeting = "café λ 界 é"; ++4: 28="é" 30="λ" 32="界" 33="" 35="é" +@4: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #616f64,#0d1410,b,body 7-23 #e5eee5,#0d1410,,body 24-36 #b8d88a,#0d1410,,body 37-37 #e5eee5,#0d1410,,body 38-104 d,#0d1410,,body +|5: 3 +@5: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-104 d,#0d1410,,body +|6: 4 pub fn choose(ok: bool) u32 { +@6: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-10 #e5eee5,#0d1410,,body 11-12 #c9a7ed,#0d1410,,body 13-35 #e5eee5,#0d1410,,body 36-104 d,#0d1410,,body +|7: 5 if (ok) return 42; +@7: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-10 #e5eee5,#0d1410,,body 11-12 #c9a7ed,#0d1410,,body 13-18 #e5eee5,#0d1410,,body 19-24 #c9a7ed,#0d1410,,body 25-25 #e5eee5,#0d1410,,body 26-27 #f8c082,#0d1410,,body 28-28 #e5eee5,#0d1410,,body 29-104 d,#0d1410,,body +|8: 6 return 7; +@8: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-10 #e5eee5,#0d1410,,body 11-16 #c9a7ed,#0d1410,,body 17-17 #e5eee5,#0d1410,,body 18-18 #f8c082,#0d1410,,body 19-19 #e5eee5,#0d1410,,body 20-104 d,#0d1410,,body +|9: 7 } +@9: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-7 #e5eee5,#0d1410,,body 8-104 d,#0d1410,,body +|10: 8 +@10: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-104 d,#0d1410,,body +|11: @11: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-104 d,#0d1410,,body |12: @12: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-104 d,#0d1410,,body @@ -208,12 +189,11 @@ @18: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-104 d,#0d1410,,body |19: @19: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-104 d,#0d1410,,body -== snap resized grid=105x20 cursor=7,5 +== snap resized grid=105x20 cursor=7,4 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill | New Tty Find Grep Joincol Delcol | /tmp/pardes-snap/ninep/cwd/demo.zig * Save Tty Collapse Del TreeContext -| Colors -| 1 // café λ 界 +| 1 // café λ 界 Colors | 2 const greeting = "café λ 界 é"; | 3 | 4 pub fn choose(ok: bool) u32 { @@ -221,4 +201,4 @@ | 6 return 7; | 7 } | 8 -== 9p unchanged grid=105x20 cursor=7,5,block +== 9p unchanged grid=105x20 cursor=7,4,block diff --git a/test/snapshots/pipe.golden b/test/snapshots/pipe.golden index d3f6bbc2..2e0b3fa6 100644 --- a/test/snapshots/pipe.golden +++ b/test/snapshots/pipe.golden @@ -2,13 +2,10 @@ |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill | New Tty Find Grep Joincol Delcol | /tmp/pardes-snap/pipe/cwd/pipe.txt Save Tty Collapse Del -| |tr a-z A-Z -| 1 alpha beta +| 1 alpha beta |tr a-z A-Z | 2 gamma delta == snap filtered grid=180x13 cursor=17,3 |2: /tmp/pardes-snap/pipe/cwd/pipe.txt * Save Tty Collapse Del |3: 1 ALPHA BETA -|4: 2 gamma delta -|5: == snap undone grid=180x13 cursor=17,3 |3: 1 alpha beta diff --git a/test/snapshots/psearch.golden b/test/snapshots/psearch.golden index b0827d7c..b3d91b7a 100644 --- a/test/snapshots/psearch.golden +++ b/test/snapshots/psearch.golden @@ -23,28 +23,16 @@ | /+New Save Tty Collapse Del | 1 == snap typing grid=140x31 cursor=139,3 -|3: /MARK -|4: printf 'x MA''RK a\nzz\nx MA''RK b\nzz\nx MA''RK c\n' -|5: x MARK a -|6: zz -|7: x MARK b -|8: zz -|9: x MARK c +|3: printf 'x MA''RK a\nzz\nx MA''RK b\nzz\nx MA''RK c\n' /MARK == snap results grid=140x31 cursor=7,4 |3: printf 'x MA''RK a\nzz\nx MA''RK b\nzz\nx MA''RK c\n' -|4: x MARK a -|5: zz -|6: x MARK b -|7: zz -|8: x MARK c -|9: |14: /tmp/pardes-snap/psearch/cwd/+Search Save Tty Collapse Del LocationsConfig -|15: Look -|16: 1 @p0:2:3-6 -|17: 2 x MARK a -|18: 3 @p0:4:3-6 -|19: 4 x MARK b -|20: 5 @p0:6:3-6 +|15: 1 @p0:2:3-6 Look +|16: 2 x MARK a +|17: 3 @p0:4:3-6 +|18: 4 x MARK b +|19: 5 @p0:6:3-6 +|20: 6 x MARK c == style results grid=140x31 |0: 0-70 #b2c3b8,#1d2824, 71-139 d,#1d2824, |1: 0-1 #ffffff,#887455, 2-2 d,#26362d, 3-34 #becfc4,#26362d, 35-139 d,#26362d, @@ -61,12 +49,12 @@ |12: 0-0 d,#608269, 1-1 d,#0d1410, 2-139 #e5eee5,#0d1410, |13: 0-0 d,#608269, 1-1 d,#0d1410, 2-139 #e5eee5,#0d1410, |14: 0-1 #ffffff,#496656, 2-2 d,#1d2824, 3-31 #b2c3b8,#1d2824, 32-38 #d3b0d9,#1d2824, 39-76 #b2c3b8,#1d2824, 77-139 d,#1d2824, -|15: 0-0 d,#152019, 1-1 d,#0d1410, 2-135 d,#1d2824, 136-139 #b2c3b8,#1d2824, -|16: 0-0 d,#608269, 1-1 d,#0d1410, 2-15 #59675c,#0d1410, 16-139 d,#0d1410, -|17: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-8 #e5eee5,#0d1410, 9-12 #f7e4a5,#5e4923, 13-14 #e5eee5,#0d1410, 15-139 d,#0d1410, -|18: 0-0 d,#608269, 1-1 d,#0d1410, 2-15 #59675c,#0d1410, 16-139 d,#0d1410, -|19: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-8 #e5eee5,#0d1410, 9-12 #f7e4a5,#5e4923, 13-14 #e5eee5,#0d1410, 15-139 d,#0d1410, -|20: 0-0 d,#152019, 1-1 d,#0d1410, 2-15 #59675c,#0d1410, 16-139 d,#0d1410, +|15: 0-0 d,#608269, 1-1 d,#0d1410, 2-15 #59675c,#0d1410, 16-133 d,#0d1410, 134-134 d,#1d2824, 135-138 #b2c3b8,#1d2824, 139-139 d,#1d2824, +|16: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-8 #e5eee5,#0d1410, 9-12 #f7e4a5,#5e4923, 13-14 #e5eee5,#0d1410, 15-139 d,#0d1410, +|17: 0-0 d,#608269, 1-1 d,#0d1410, 2-15 #59675c,#0d1410, 16-139 d,#0d1410, +|18: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-8 #e5eee5,#0d1410, 9-12 #f7e4a5,#5e4923, 13-14 #e5eee5,#0d1410, 15-139 d,#0d1410, +|19: 0-0 d,#608269, 1-1 d,#0d1410, 2-15 #59675c,#0d1410, 16-139 d,#0d1410, +|20: 0-0 d,#152019, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-8 #e5eee5,#0d1410, 9-12 #f7e4a5,#5e4923, 13-14 #e5eee5,#0d1410, 15-139 d,#0d1410, |21: 0-1 #ffffff,#496656, 2-2 d,#1d2824, 3-3 #b2c3b8,#1d2824, 4-7 #d3b0d9,#1d2824, 8-29 #b2c3b8,#1d2824, 30-139 d,#1d2824, |22: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-139 d,#0d1410, |23: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-139 d,#0d1410, @@ -83,22 +71,11 @@ |12: /tmp/pardes-snap/psearch/cwd/+Search Save Tty Collapse Del LocationsConfig |13: 1 |15: 1 @p0:2:3-6 -|16: 2 x MARK a -|17: 3 @p0:4:3-6 -|18: 4 x MARK b -|19: 5 @p0:6:3-6 -|20: 6 x MARK c -== snap ttyinert grid=140x31 cursor=4,10 +== snap ttyinert grid=140x31 cursor=4,9 |2: $ /tmp/pardes-snap/psearch/cwd Tty Save Mode Filter Collapse Del -|3: Look -|4: $ printf 'x MA''RK a\nzz\nx MA''RK b\nzz\nx MA''RK c\n' -|5: x MARK a -|6: zz -|7: x MARK b -|8: zz -|9: x MARK c -|10: $ -== snap rightsearch grid=140x31 cursor=7,7 +|3: $ printf 'x MA''RK a\nzz\nx MA''RK b\nzz\nx MA''RK c\n' Look +|9: $ +== snap rightsearch grid=140x31 cursor=7,6 |2: /tmp/pardes-snap/psearch/cwd Tty Save Mode Filter Collapse Del -|4: printf 'x MA''RK a\nzz\nx MA''RK b\nzz\nx MA''RK c\n' -|10: +|3: printf 'x MA''RK a\nzz\nx MA''RK b\nzz\nx MA''RK c\n' Look +|9: diff --git a/test/snapshots/savepane.golden b/test/snapshots/savepane.golden index ab54ee3e..23af2bd5 100644 --- a/test/snapshots/savepane.golden +++ b/test/snapshots/savepane.golden @@ -7,14 +7,12 @@ | /tmp/pardes-snap/savepane/cwd/+New * Save Tty Collapse Del | 1 scratch bytes == snap prompt grid=100x31 cursor=99,7 -|6: Save +|6: 1 scratch bytes Save |7: Save /tmp/pardes-snap/savepane/cwd/ -|8: 1 scratch bytes -== snap saved grid=100x31 cursor=20,7 +== snap saved grid=100x31 cursor=20,6 |5: /tmp/pardes-snap/savepane/cwd/saved.txt Save Tty Collapse Del -|6: --:--:-- saved /tmp/pardes-snap/savepane/cwd/saved.txt -|7: 1 scratch bytes -|8: +|6: 1 scratch bytes --:--:-- saved /tmp/pardes-snap/savepane/cwd/saved.txt +|7: == file bytes scratch bytes == end file diff --git a/test/snapshots/selregex.golden b/test/snapshots/selregex.golden index f071fb15..e28d47a5 100644 --- a/test/snapshots/selregex.golden +++ b/test/snapshots/selregex.golden @@ -2,21 +2,20 @@ |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill | New Tty Find Grep Joincol Delcol | /tmp/pardes-snap/selregex/cwd/m.zig Save Tty Collapse Del TreeContext -| Select / -| 1 const one = 1; +| 1 const one = 1; Select / | 2 const two = 2; | 3 const three = 3; | 4 == snap preview grid=160x25 cursor=159,3 -|3: Select /const +|3: 1 const one = 1; Select /const == style preview grid=160x25 |0: 0-70 #b2c3b8,#1d2824, 71-159 d,#1d2824, |1: 0-1 #ffffff,#887455, 2-2 d,#26362d, 3-34 #becfc4,#26362d, 35-159 d,#26362d, |2: 0-1 #000000,#add38a, 2-2 d,#26362d, 3-32 #becfc4,#26362d, 33-37 #dfbce5,#26362d, 38-71 #becfc4,#26362d, 72-159 d,#26362d, -|3: 0-0 d,#152019, 1-1 d,#0d1410, 2-144 d,#1d2824, 145-158 #b2c3b8,#1d2824, 159-159 d,#1d2824, -|4: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #f5f7ee,#3c614a, 11-11 #3c614a,#f5f7ee, 12-18 #e5eee5,#0d1410, 19-19 #f8c082,#0d1410, 20-20 #e5eee5,#0d1410, 21-159 d,#0d1410, -|5: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #f5f7ee,#243a2d, 11-11 #3c614a,#f5f7ee, 12-18 #e5eee5,#0d1410, 19-19 #f8c082,#0d1410, 20-20 #e5eee5,#0d1410, 21-159 d,#0d1410, -|6: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #f5f7ee,#243a2d, 11-11 #3c614a,#f5f7ee, 12-20 #e5eee5,#0d1410, 21-21 #f8c082,#0d1410, 22-22 #e5eee5,#0d1410, 23-159 d,#0d1410, +|3: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #f5f7ee,#3c614a, 11-11 #3c614a,#f5f7ee, 12-18 #e5eee5,#0d1410, 19-19 #f8c082,#0d1410, 20-20 #e5eee5,#0d1410, 21-143 d,#0d1410, 144-144 d,#1d2824, 145-158 #b2c3b8,#1d2824, 159-159 d,#1d2824, +|4: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #f5f7ee,#243a2d, 11-11 #3c614a,#f5f7ee, 12-18 #e5eee5,#0d1410, 19-19 #f8c082,#0d1410, 20-20 #e5eee5,#0d1410, 21-159 d,#0d1410, +|5: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #f5f7ee,#243a2d, 11-11 #3c614a,#f5f7ee, 12-20 #e5eee5,#0d1410, 21-21 #f8c082,#0d1410, 22-22 #e5eee5,#0d1410, 23-159 d,#0d1410, +|6: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-159 d,#0d1410, |7: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-159 d,#0d1410, |8: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-159 d,#0d1410, |9: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-159 d,#0d1410, @@ -37,37 +36,20 @@ |24: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-159 d,#0d1410, == snap three-selected grid=160x25 cursor=11,3 |3: 1 const one = 1; -|4: 2 const two = 2; -|5: 3 const three = 3; -|6: 4 -|7: == style three-selected grid=160x25 |3: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-11 #f5f7ee,#3c614a, 12-18 #e5eee5,#0d1410, 19-19 #f8c082,#0d1410, 20-20 #e5eee5,#0d1410, 21-159 d,#0d1410, -|4: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #f5f7ee,#243a2d, 11-11 #3c614a,#f5f7ee, 12-18 #e5eee5,#0d1410, 19-19 #f8c082,#0d1410, 20-20 #e5eee5,#0d1410, 21-159 d,#0d1410, -|5: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #f5f7ee,#243a2d, 11-11 #3c614a,#f5f7ee, 12-20 #e5eee5,#0d1410, 21-21 #f8c082,#0d1410, 22-22 #e5eee5,#0d1410, 23-159 d,#0d1410, -|6: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-159 d,#0d1410, == snap narrowed grid=160x25 cursor=159,3 -|3: Select /t -|4: 1 const one = 1; -|5: 2 const two = 2; -|6: 3 const three = 3; -|7: 4 +|3: 1 const one = 1; Select /t == style narrowed grid=160x25 -|3: 0-0 d,#152019, 1-1 d,#0d1410, 2-148 d,#1d2824, 149-158 #b2c3b8,#1d2824, 159-159 d,#1d2824, +|3: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-11 #3c614a,#f5f7ee, 12-18 #e5eee5,#0d1410, 19-19 #f8c082,#0d1410, 20-20 #e5eee5,#0d1410, 21-147 d,#0d1410, 148-148 d,#1d2824, 149-158 #b2c3b8,#1d2824, 159-159 d,#1d2824, |4: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-11 #3c614a,#f5f7ee, 12-18 #e5eee5,#0d1410, 19-19 #f8c082,#0d1410, 20-20 #e5eee5,#0d1410, 21-159 d,#0d1410, -|5: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-11 #3c614a,#f5f7ee, 12-18 #e5eee5,#0d1410, 19-19 #f8c082,#0d1410, 20-20 #e5eee5,#0d1410, 21-159 d,#0d1410, -|6: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-11 #3c614a,#f5f7ee, 12-20 #e5eee5,#0d1410, 21-21 #f8c082,#0d1410, 22-22 #e5eee5,#0d1410, 23-159 d,#0d1410, +|5: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-11 #3c614a,#f5f7ee, 12-20 #e5eee5,#0d1410, 21-21 #f8c082,#0d1410, 22-22 #e5eee5,#0d1410, 23-159 d,#0d1410, == snap esc-restores grid=160x25 cursor=11,3 |3: 1 const one = 1; -|4: 2 const two = 2; -|5: 3 const three = 3; -|6: 4 -|7: == style esc-restores grid=160x25 |3: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-11 #f5f7ee,#3c614a, 12-18 #e5eee5,#0d1410, 19-19 #f8c082,#0d1410, 20-20 #e5eee5,#0d1410, 21-159 d,#0d1410, |4: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #f5f7ee,#243a2d, 11-11 #3c614a,#f5f7ee, 12-18 #e5eee5,#0d1410, 19-19 #f8c082,#0d1410, 20-20 #e5eee5,#0d1410, 21-159 d,#0d1410, |5: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #f5f7ee,#243a2d, 11-11 #3c614a,#f5f7ee, 12-20 #e5eee5,#0d1410, 21-21 #f8c082,#0d1410, 22-22 #e5eee5,#0d1410, 23-159 d,#0d1410, -|6: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-159 d,#0d1410, == snap commented grid=160x25 cursor=14,3 |2: /tmp/pardes-snap/selregex/cwd/m.zig * Save Tty Collapse Del TreeContext |3: 1 // const one = 1; diff --git a/test/snapshots/shellset.golden b/test/snapshots/shellset.golden index 777bb102..d4ab24d9 100644 --- a/test/snapshots/shellset.golden +++ b/test/snapshots/shellset.golden @@ -3,9 +3,8 @@ | New Tty Find Grep Joincol Delcol | /tmp/pardes-snap/shellset/cwd/cmd.txt Save Tty Collapse Del | 1 Shell zznosuchshell -== snap builtin-ran grid=90x21 cursor=25,4 -|3: Shell -|4: 1 Shell zznosuchshell +== snap builtin-ran grid=90x21 cursor=25,3 +|3: 1 Shell zznosuchshell Shell == snap fallback-shell grid=90x21 cursor=49,5 |1: New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol |2: /tmp/pardes-snap/shellset/cwd/cmd.txt Save /tmp/pardes-snap/shellset/cwd Tty Save Mod diff --git a/test/snapshots/stepgrain.golden b/test/snapshots/stepgrain.golden index b8b4dca2..ff39676d 100644 --- a/test/snapshots/stepgrain.golden +++ b/test/snapshots/stepgrain.golden @@ -93,4 +93,4 @@ == snap blank-opened grid=150x31 cursor=7,13 |12: /tmp/pardes-snap/stepgrain/cwd/two words.txt Save Tty Collapse Del |13: 1 -|23: Look +|23: 1 two words.txt Look diff --git a/test/snapshots/syntax.golden b/test/snapshots/syntax.golden index 5b2811f7..ab14a815 100644 --- a/test/snapshots/syntax.golden +++ b/test/snapshots/syntax.golden @@ -2,9 +2,9 @@ |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill | New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol | /tmp/pardes-snap/syntax/cwd Tty Save Mode Filter Collapse Del /tmp/pardes-snap/syntax/cwd Tty Save Mode Filter Collapse Del -| Look ls -| ls demo.zig -| demo.zig +| ls Look ls +| demo.zig demo.zig +| | /tmp/pardes-snap/syntax/cwd/demo.zig Save Tty Collapse Del TreeContext | 1 const std = @import("std"); // greet | 2 pub fn main() void { @@ -23,9 +23,9 @@ |0: 0-70 #b2c3b8,#1d2824, 71-149 d,#1d2824, |1: 0-1 #ffffff,#887455, 2-2 d,#26362d, 3-34 #becfc4,#26362d, 35-74 d,#26362d, 75-76 #ffffff,#887455, 77-77 d,#1d2824, 78-109 #b2c3b8,#1d2824, 110-149 d,#1d2824, |2: 0-1 #ffffff,#496656, 2-2 d,#1d2824, 3-30 #b2c3b8,#1d2824, 31-33 #d3b0d9,#1d2824, 34-63 #b2c3b8,#1d2824, 64-74 d,#1d2824, 75-76 #ffffff,#496656, 77-77 d,#1d2824, 78-105 #b2c3b8,#1d2824, 106-108 #d3b0d9,#1d2824, 109-138 #b2c3b8,#1d2824, 139-149 d,#1d2824, -|3: 0-0 d,#152019, 1-1 d,#0d1410, 2-70 d,#1d2824, 71-74 #b2c3b8,#1d2824, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|3: 0-0 d,#608269, 1-1 d,#0d1410, 2-68 #e5eee5,#0d1410, 69-69 d,#1d2824, 70-73 #b2c3b8,#1d2824, 74-74 d,#1d2824, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, |4: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|5: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-149 d,#0d1410, +|5: 0-0 d,#608269, 1-74 d,#0d1410, 75-75 d,#608269, 76-149 d,#0d1410, |6: 0-1 #000000,#add38a, 2-2 d,#26362d, 3-30 #becfc4,#26362d, 31-38 #dfbce5,#26362d, 39-72 #becfc4,#26362d, 73-74 d,#26362d, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, |7: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-18 #e5eee5,#0d1410, 19-25 #c9a7ed,#0d1410, 26-26 #e5eee5,#0d1410, 27-31 #b8d88a,#0d1410, 32-34 #e5eee5,#0d1410, 35-42 #b9f480,#0d1410, 43-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, |8: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-12 #c9a7ed,#0d1410, 13-26 #e5eee5,#0d1410, 27-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, @@ -54,14 +54,13 @@ == style colors-off grid=150x31 |3: 0-0 d,#608269, 1-1 d,#0d1410, 2-3 #e5eee5,#0d1410, 4-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-78 #e5eee5,#0d1410, 79-149 d,#0d1410, |4: 0-0 d,#608269, 1-1 d,#0d1410, 2-9 #e5eee5,#0d1410, 10-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-84 #e5eee5,#0d1410, 85-149 d,#0d1410, -|5: 0-0 d,#608269, 1-74 d,#0d1410, 75-75 d,#608269, 76-149 d,#0d1410, |6: 0-1 #000000,#add38a, 2-2 d,#26362d, 3-30 #becfc4,#26362d, 31-38 #dfbce5,#26362d, 39-72 #becfc4,#26362d, 73-74 d,#26362d, 75-75 d,#608269, 76-149 d,#0d1410, -|7: 0-0 d,#152019, 1-1 d,#0d1410, 2-68 d,#1d2824, 69-74 #b2c3b8,#1d2824, 75-75 d,#608269, 76-149 d,#0d1410, -|8: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-42 #e5eee5,#0d1410, 43-74 d,#0d1410, 75-75 d,#608269, 76-149 d,#0d1410, +|7: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-42 #e5eee5,#0d1410, 43-66 d,#0d1410, 67-67 d,#1d2824, 68-73 #b2c3b8,#1d2824, 74-74 d,#1d2824, 75-75 d,#608269, 76-149 d,#0d1410, +|8: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-26 #e5eee5,#0d1410, 27-74 d,#0d1410, 75-75 d,#608269, 76-149 d,#0d1410, |9: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-26 #e5eee5,#0d1410, 27-74 d,#0d1410, 75-75 d,#608269, 76-149 d,#0d1410, -|10: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-26 #e5eee5,#0d1410, 27-74 d,#0d1410, 75-75 d,#608269, 76-149 d,#0d1410, -|11: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-16 #e5eee5,#0d1410, 17-74 d,#0d1410, 75-75 d,#608269, 76-149 d,#0d1410, -|12: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-7 #e5eee5,#0d1410, 8-74 d,#0d1410, 75-75 d,#608269, 76-149 d,#0d1410, +|10: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-16 #e5eee5,#0d1410, 17-74 d,#0d1410, 75-75 d,#608269, 76-149 d,#0d1410, +|11: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-7 #e5eee5,#0d1410, 8-74 d,#0d1410, 75-75 d,#608269, 76-149 d,#0d1410, +|12: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-74 d,#0d1410, 75-75 d,#608269, 76-149 d,#0d1410, |13: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-74 d,#0d1410, 75-75 d,#608269, 76-149 d,#0d1410, |14: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-74 d,#0d1410, 75-75 d,#608269, 76-149 d,#0d1410, |15: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-74 d,#0d1410, 75-75 d,#608269, 76-149 d,#0d1410, @@ -84,12 +83,12 @@ |3: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, |4: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, |6: 0-1 #000000,#add38a, 2-2 d,#26362d, 3-30 #becfc4,#26362d, 31-38 #dfbce5,#26362d, 39-72 #becfc4,#26362d, 73-74 d,#26362d, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|7: 0-0 d,#152019, 1-1 d,#0d1410, 2-68 d,#1d2824, 69-74 #b2c3b8,#1d2824, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|8: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-18 #e5eee5,#0d1410, 19-25 #c9a7ed,#0d1410, 26-26 #e5eee5,#0d1410, 27-31 #b8d88a,#0d1410, 32-34 #e5eee5,#0d1410, 35-42 #b9f480,#0d1410, 43-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|9: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-12 #c9a7ed,#0d1410, 13-26 #e5eee5,#0d1410, 27-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|10: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-23 #e5eee5,#0d1410, 24-25 #f8c082,#0d1410, 26-26 #e5eee5,#0d1410, 27-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|11: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-16 #e5eee5,#0d1410, 17-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|12: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-7 #e5eee5,#0d1410, 8-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|7: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #616f64,#0d1410,b 7-18 #e5eee5,#0d1410, 19-25 #c9a7ed,#0d1410, 26-26 #e5eee5,#0d1410, 27-31 #b8d88a,#0d1410, 32-34 #e5eee5,#0d1410, 35-42 #b9f480,#0d1410, 43-66 d,#0d1410, 67-67 d,#1d2824, 68-73 #b2c3b8,#1d2824, 74-74 d,#1d2824, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|8: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-12 #c9a7ed,#0d1410, 13-26 #e5eee5,#0d1410, 27-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|9: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-23 #e5eee5,#0d1410, 24-25 #f8c082,#0d1410, 26-26 #e5eee5,#0d1410, 27-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|10: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-16 #e5eee5,#0d1410, 17-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|11: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-7 #e5eee5,#0d1410, 8-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|12: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, |13: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, |14: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, |15: 0-0 d,#608269, 1-1 d,#0d1410, 2-6 #59675c,#0d1410, 7-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, diff --git a/test/snapshots/tag.golden b/test/snapshots/tag.golden index 5e4cb4d1..a07f7a0f 100644 --- a/test/snapshots/tag.golden +++ b/test/snapshots/tag.golden @@ -26,8 +26,6 @@ == snap tag-exit grid=150x31 cursor=4,5 |2: /tmp/pardes-snap/tag/cwd Tty t.txt Save Mode Filter Collapse Del /tmp/pardes-snap/tag/cwd Tty Save Mode Filter Collapse Del == snap tag-look grid=150x31 cursor=7,7 -|3: Look ls -|4: ls t.txt -|5: t.txt +|3: ls Look ls |6: /tmp/pardes-snap/tag/cwd/t.txt Save Tty Collapse Del |7: 1 ZZLOOKED diff --git a/test/snapshots/tagalign2col.golden b/test/snapshots/tagalign2col.golden index e703dbef..afa1c1ec 100644 --- a/test/snapshots/tagalign2col.golden +++ b/test/snapshots/tagalign2col.golden @@ -2,13 +2,11 @@ |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill | New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol | /tmp/pardes-snap/tagalign2col/cwd/deep/proj/document.txt Save Tty Collapse De /tmp/pardes-snap/tagalign2col/cwd Tty Save Mode Filter Collapse Del -| 1 alpha Left -| 2 beta ls -| 3 gamma deep +| 1 alpha ls Left +| 2 beta deep +| 3 gamma == snap aligned grid=160x31 cursor=4,20 |3: 1 alpha ls -|4: 2 beta deep -|5: 3 gamma |17: /tmp/pardes-snap/tagalign2col/cwd Tty Save Mode Filter Collapse Del |18: ls |19: deep diff --git a/test/snapshots/tagbottom.golden b/test/snapshots/tagbottom.golden index eb1d67fd..95ef0529 100644 --- a/test/snapshots/tagbottom.golden +++ b/test/snapshots/tagbottom.golden @@ -151,11 +151,9 @@ |9: 9 iii |10: 10 jjj == snap search-prompt grid=100x31 cursor=99,12 -|12: /ZZ -|13: 1 ZZONE -|14: 2 ZZTWO -== snap leader grid=100x31 cursor=9,14 -|12: SPC +|12: 1 ZZONE /ZZ +== snap leader grid=100x31 cursor=9,13 +|12: 1 ZZONE SPC == snap cut-down grid=100x31 cursor=7,5 |2: 1 aaa |3: 2 bbb @@ -168,8 +166,6 @@ |10: 9 ooo |11: /tmp/pardes-snap/tagbottom/cwd/top.txt * Save Tty Collapse Del bottom.txt |12: 1 ZZONE -|13: 2 ZZTWO -|14: == file cut-buffer aaa bbb diff --git a/test/snapshots/tagbottomimage.golden b/test/snapshots/tagbottomimage.golden index 72352672..e7100114 100644 --- a/test/snapshots/tagbottomimage.golden +++ b/test/snapshots/tagbottomimage.golden @@ -2,9 +2,9 @@ |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill | New Tty Find Grep Joincol Delcol | /tmp/pardes-snap/tagbottomimage/cwd Tty Save Mode Filter Collapse Del -| Look -| ls +| ls Look | pic.ppm +| | img petscii:off palette:commodore ascii:on /tmp/pardes-snap/tagbottomimage/cwd/pic.ppm Tty Collapse Del | 4*🬹~F~N🬰|G🬏▚Y~KF🬴s>T&zZ/🬻iTY=`S~╳bkZR37v🬦🬵d4QHZ8X▛▟ @@ -35,30 +35,30 @@ |3: pic.ppm |4: |5: /tmp/pardes-snap/tagbottomimage/cwd Tty Save Mode Filter Collapse Del -|6: Tagbottom -|7: {DbgY🬲s▜M^#▐FUJ[zNq=🬝g/y╱?V@🬱🬙▌UK╱🬍("🬕KJ8hSo🬝🬻 -|8: tX🬆s>🬌`🬵>T&zZ/🬻iTY=`S~╳bkZR37v🬦🬵d4QHZ8X▛▟ +|8: ^🬪🬛$}DrydNU&wsz=`*r🬒🬓🬳🬟*Y🬴G6🬧f🬮/>t🬧u🬲1Rg1t🬝🬻█ +|9: ▖#_{🬗X@🬢&$s'C%*=w@🬆▀wq%🬡d┼a┼m─>🬭🬜A▀A🬲H]p🬝🬹 +|10: %?WX🬕f🬩*TA8n╱┼E▘🬭Y#qo~XVE▐(╳▀H4^[mj🬗=🬒🬕▟█ +|11: ]Z🬷eb~Oyl3=SL▙a🬱🬉~MPMz}FMu<🬝▚>3&▖🬷WS🬝~█ +|12: EF-🬑y🬔!r🬙🬐╳O🬩▐%Qj─4za/?/\a🬜"🬖🬈🬛🬟A🬙🬝▄ +|13: 🬃N@xzOnczIK=t0@🬖j5🬮🬧65▟{🬮🬉🬄🬩zQ9/🬝🬻 +|14: ╲${&%@"#ctt▀Cr5F;🬐ARM╱uej╳75🬹9▛🬻 +|15: h^🬜"🬈🬨▜╲|W🬊🬦k6^🬰🬶rZ─▄\z9🬎🬉4^🬎🬻 +|16: 🬆f│Q_V🬗wGx🬱=5▛5*&V🬟🬄ZrXGz2🬝🬻█ +|17: !🬷W🬐(🬭]7x_>▗er🬯~▚di🬬4jY:🬝▟ +|18: gU~🬧3▙bjr\C#kKMpffAjps🬝🬻 +|19: *🬯G"🬣▟d🬮▀zJ🬪EHV▟╳9}y▛▄ +|20: ``))~RyJ🬴jA~w=hLpX🬝🬻█ +|21: 4x▀J"TG7=y-QZ🬙╲~▛🬻 +|22: 🬯/+╳f9ZG🬕+{QN_🬝🬹 +|23: E<'─🬫pS!"n4&🬝~ +|24: m$dx"!2🬳&{🬝🬻 +|25: *8f🬩▙Jb🬒🬝🬻█ +|26: m🬩7CiN🬎🬹 +|27: pG╲L🬝🬻 +|28: 🬡L🬝▄ +|29: 🬝~ |30: img petscii:off palette:commodore ascii:on /tmp/pardes-snap/tagbottomimage/cwd/pic.ppm Tty Collapse Del == style img-bottom grid=150x31 |0: 0-70 #b2c3b8,#1d2824, 71-149 d,#1d2824, @@ -67,33 +67,33 @@ |3: 0-0 d,#608269, 1-1 d,#0d1410, 2-149 #e5eee5,#0d1410, |4: 0-0 d,#608269, 1-149 d,#0d1410, |5: 0-1 #ffffff,#496656, 2-2 d,#1d2824, 3-38 #b2c3b8,#1d2824, 39-41 #d3b0d9,#1d2824, 42-71 #b2c3b8,#1d2824, 72-149 d,#1d2824, -|6: 0-0 d,#152019, 1-1 d,#0d1410, 2-140 d,#1d2824, 141-149 #b2c3b8,#1d2824, -|7: 0-0 d,#152019, 1-52 d,#0d1410, 53-55 #959595,#6c6c6c, 56-56 #6c6c6c,#959595, 57-57 #959595,#6c6c6c, 58-58 #6c6c6c,#959595, 59-60 #959595,#6c6c6c, 61-63 #6c6c6c,#959595, 64-65 #959595,#6c6c6c, 66-66 #6c6c6c,#959595, 67-71 #959595,#6c6c6c, 72-72 #6c6c6c,#959595, 73-73 #959595,#6c6c6c, 74-76 #6c6c6c,#959595, 77-77 #959595,#6c6c6c, 78-81 #6c6c6c,#959595, 82-84 #959595,#6c6c6c, 85-85 #6c6c6c,#959595, 86-87 #959595,#6c6c6c, 88-88 #6c6c6c,#959595, 89-89 #959595,#6c6c6c, 90-90 #6c6c6c,#959595, 91-92 #959595,#6c6c6c, 93-96 #6c6c6c,#959595, 97-97 #6c6c6c,#352879, 98-98 #352879,#959595, 99-149 d,#0d1410, -|8: 0-0 d,#152019, 1-52 d,#0d1410, 53-58 #959595,#6c6c6c, 59-59 #444444,#959595, 60-64 #959595,#6c6c6c, 65-66 #6c6c6c,#959595, 67-71 #959595,#6c6c6c, 72-72 #444444,#959595, 73-73 #959595,#6c6c6c, 74-74 #6c6c6c,#959595, 75-75 #959595,#6c6c6c, 76-76 #444444,#959595, 77-81 #6c6c6c,#959595, 82-82 #959595,#6c6c6c, 83-85 #6c6c6c,#959595, 86-87 #959595,#6c6c6c, 88-89 #6c6c6c,#959595, 90-90 #959595,#6c6c6c, 91-92 #6c6c6c,#959595, 93-93 #959595,#6c6c6c, 94-94 #6c6c6c,#959595, 95-95 #6c6c6c,#352879, 96-96 #352879,#959595, 97-97 #352879,#6c5eb5, 98-98 #352879,#352879, 99-149 d,#0d1410, -|9: 0-0 d,#152019, 1-52 d,#0d1410, 53-57 #959595,#6c6c6c, 58-58 #6c6c6c,#959595, 59-59 #959595,#6c6c6c, 60-60 #6c6c6c,#959595, 61-62 #959595,#6c6c6c, 63-63 #6c6c6c,#959595, 64-67 #959595,#6c6c6c, 68-68 #6c6c6c,#959595, 69-70 #959595,#6c6c6c, 71-71 #6c6c6c,#959595, 72-73 #959595,#6c6c6c, 74-75 #6c6c6c,#959595, 76-77 #959595,#6c6c6c, 78-79 #6c6c6c,#959595, 80-82 #959595,#6c6c6c, 83-86 #6c6c6c,#959595, 87-90 #959595,#6c6c6c, 91-91 #6c6c6c,#959595, 92-92 #959595,#6c6c6c, 93-93 #6c6c6c,#352879, 94-94 #352879,#6c6c6c, 95-98 #352879,#352879, 99-149 d,#0d1410, -|10: 0-0 d,#152019, 1-52 d,#0d1410, 53-53 #6c6c6c,#959595, 54-54 #959595,#6c6c6c, 55-55 #6c6c6c,#959595, 56-59 #959595,#6c6c6c, 60-60 #6c6c6c,#959595, 61-61 #959595,#6c6c6c, 62-63 #6c6c6c,#959595, 64-64 #959595,#6c6c6c, 65-65 #6c6c6c,#959595, 66-67 #959595,#6c6c6c, 68-71 #6c6c6c,#959595, 72-75 #959595,#6c6c6c, 76-77 #6c6c6c,#959595, 78-78 #959595,#6c6c6c, 79-79 #6c6c6c,#959595, 80-81 #959595,#6c6c6c, 82-83 #6c6c6c,#959595, 84-86 #959595,#6c6c6c, 87-87 #6c6c6c,#959595, 88-90 #959595,#6c6c6c, 91-92 #6c6c6c,#352879, 93-93 #352879,#6c5eb5, 94-98 #352879,#352879, 99-149 d,#0d1410, -|11: 0-0 d,#152019, 1-52 d,#0d1410, 53-54 #6c6c6c,#959595, 55-55 #959595,#6c6c6c, 56-56 #6c6c6c,#959595, 57-57 #959595,#6c6c6c, 58-59 #6c6c6c,#959595, 60-62 #959595,#6c6c6c, 63-63 #6c6c6c,#959595, 64-64 #959595,#6c6c6c, 65-65 #6c6c6c,#959595, 66-66 #959595,#6c6c6c, 67-70 #6c6c6c,#959595, 71-73 #959595,#6c6c6c, 74-74 #6c6c6c,#959595, 75-77 #959595,#6c6c6c, 78-80 #6c6c6c,#959595, 81-82 #959595,#6c6c6c, 83-83 #6c6c6c,#959595, 84-85 #959595,#6c6c6c, 86-86 #6c6c6c,#959595, 87-88 #959595,#6c6c6c, 89-89 #959595,#352879, 90-90 #352879,#6c6c6c, 91-98 #352879,#352879, 99-149 d,#0d1410, -|12: 0-0 d,#152019, 1-52 d,#0d1410, 53-54 #6c6c6c,#959595, 55-55 #959595,#6c6c6c, 56-56 #6c6c6c,#959595, 57-58 #959595,#6c6c6c, 59-59 #6c6c6c,#959595, 60-60 #959595,#6c6c6c, 61-61 #6c6c6c,#959595, 62-64 #959595,#6c6c6c, 65-66 #6c6c6c,#959595, 67-69 #959595,#6c6c6c, 70-70 #6c6c6c,#959595, 71-72 #959595,#6c6c6c, 73-74 #6c6c6c,#959595, 75-75 #959595,#6c6c6c, 76-77 #6c6c6c,#959595, 78-83 #959595,#6c6c6c, 84-86 #6c6c6c,#959595, 87-87 #959595,#352879, 88-88 #352879,#6c6c6c, 89-98 #352879,#352879, 99-149 d,#0d1410, -|13: 0-0 d,#152019, 1-52 d,#0d1410, 53-58 #959595,#6c6c6c, 59-59 #6c6c6c,#959595, 60-62 #959595,#6c6c6c, 63-64 #6c6c6c,#959595, 65-68 #959595,#6c6c6c, 69-69 #6c6c6c,#959595, 70-72 #959595,#6c6c6c, 73-73 #6c6c6c,#959595, 74-77 #959595,#6c6c6c, 78-79 #6c6c6c,#959595, 80-81 #959595,#6c6c6c, 82-83 #6c6c6c,#959595, 84-84 #959595,#6c6c6c, 85-85 #6c6c6c,#352879, 86-86 #959595,#352879, 87-87 #352879,#6c5eb5, 88-98 #352879,#352879, 99-149 d,#0d1410, -|14: 0-0 d,#152019, 1-52 d,#0d1410, 53-53 #959595,#6c6c6c, 54-54 #6c6c6c,#959595, 55-55 #959595,#6c6c6c, 56-56 #6c6c6c,#959595, 57-58 #959595,#6c6c6c, 59-59 #6c6c6c,#959595, 60-60 #959595,#6c6c6c, 61-61 #6c6c6c,#959595, 62-62 #959595,#6c6c6c, 63-64 #6c6c6c,#959595, 65-71 #959595,#6c6c6c, 72-73 #6c6c6c,#959595, 74-76 #959595,#6c6c6c, 77-77 #6c6c6c,#959595, 78-79 #959595,#6c6c6c, 80-80 #6c6c6c,#959595, 81-82 #959595,#6c6c6c, 83-83 #6c6c6c,#352879, 84-84 #959595,#352879, 85-85 #352879,#6c5eb5, 86-98 #352879,#352879, 99-149 d,#0d1410, -|15: 0-0 d,#152019, 1-52 d,#0d1410, 53-53 #6c6c6c,#959595, 54-55 #959595,#6c6c6c, 56-56 #6c6c6c,#959595, 57-60 #959595,#6c6c6c, 61-63 #6c6c6c,#959595, 64-64 #959595,#6c6c6c, 65-65 #6c6c6c,#959595, 66-66 #959595,#6c6c6c, 67-67 #6c6c6c,#959595, 68-70 #959595,#6c6c6c, 71-72 #6c6c6c,#959595, 73-75 #959595,#6c6c6c, 76-77 #6c6c6c,#959595, 78-79 #959595,#6c6c6c, 80-80 #6c6c6c,#959595, 81-81 #959595,#352879, 82-82 #352879,#6c5eb5, 83-98 #352879,#352879, 99-149 d,#0d1410, -|16: 0-0 d,#152019, 1-52 d,#0d1410, 53-57 #959595,#6c6c6c, 58-58 #6c6c6c,#959595, 59-60 #959595,#6c6c6c, 61-61 #6c6c6c,#959595, 62-63 #959595,#6c6c6c, 64-64 #6c6c6c,#959595, 65-66 #959595,#6c6c6c, 67-67 #6c6c6c,#959595, 68-68 #959595,#6c6c6c, 69-69 #6c6c6c,#959595, 70-70 #959595,#6c6c6c, 71-72 #6c6c6c,#959595, 73-78 #959595,#6c6c6c, 79-79 #6c6c6c,#352879, 80-80 #959595,#352879, 81-81 #352879,#6c5eb5, 82-98 #352879,#352879, 99-149 d,#0d1410, -|17: 0-0 d,#152019, 1-52 d,#0d1410, 53-54 #959595,#6c6c6c, 55-56 #6c6c6c,#959595, 57-58 #959595,#6c6c6c, 59-60 #6c6c6c,#959595, 61-62 #959595,#6c6c6c, 63-63 #6c6c6c,#959595, 64-64 #959595,#6c6c6c, 65-67 #6c6c6c,#959595, 68-68 #959595,#6c6c6c, 69-72 #6c6c6c,#959595, 73-74 #959595,#6c6c6c, 75-75 #6c6c6c,#959595, 76-76 #959595,#6c6c6c, 77-77 #6c6c6c,#352879, 78-78 #352879,#959595, 79-98 #352879,#352879, 99-149 d,#0d1410, -|18: 0-0 d,#152019, 1-52 d,#0d1410, 53-54 #959595,#6c6c6c, 55-55 #6c6c6c,#959595, 56-60 #959595,#6c6c6c, 61-61 #6c6c6c,#959595, 62-62 #959595,#6c6c6c, 63-63 #444444,#6c6c6c, 64-66 #959595,#6c6c6c, 67-68 #6c6c6c,#959595, 69-71 #959595,#6c6c6c, 72-73 #6c6c6c,#959595, 74-74 #959595,#6c6c6c, 75-76 #6c6c6c,#352879, 77-98 #352879,#352879, 99-149 d,#0d1410, -|19: 0-0 d,#152019, 1-52 d,#0d1410, 53-53 #6c6c6c,#959595, 54-55 #959595,#6c6c6c, 56-56 #6c6c6c,#959595, 57-59 #959595,#6c6c6c, 60-60 #6c6c6c,#959595, 61-61 #959595,#6c6c6c, 62-64 #6c6c6c,#959595, 65-68 #959595,#6c6c6c, 69-69 #6c6c6c,#959595, 70-72 #959595,#6c6c6c, 73-73 #6c6c6c,#352879, 74-74 #352879,#6c6c6c, 75-98 #352879,#352879, 99-149 d,#0d1410, -|20: 0-0 d,#152019, 1-52 d,#0d1410, 53-53 #6c6c6c,#959595, 54-56 #959595,#6c6c6c, 57-57 #6c6c6c,#959595, 58-58 #959595,#6c6c6c, 59-59 #6c6c6c,#959595, 60-60 #959595,#6c6c6c, 61-61 #6c6c6c,#959595, 62-63 #959595,#6c6c6c, 64-64 #6c6c6c,#959595, 65-70 #959595,#6c6c6c, 71-71 #959595,#352879, 72-72 #352879,#6c6c6c, 73-98 #352879,#352879, 99-149 d,#0d1410, -|21: 0-0 d,#152019, 1-52 d,#0d1410, 53-53 #6c6c6c,#959595, 54-55 #959595,#6c6c6c, 56-56 #6c6c6c,#959595, 57-59 #959595,#6c6c6c, 60-60 #6c6c6c,#959595, 61-63 #959595,#6c6c6c, 64-65 #6c6c6c,#959595, 66-68 #959595,#6c6c6c, 69-69 #959595,#352879, 70-70 #352879,#6c6c6c, 71-71 #352879,#6c5eb5, 72-98 #352879,#352879, 99-149 d,#0d1410, -|22: 0-0 d,#152019, 1-52 d,#0d1410, 53-55 #6c6c6c,#959595, 56-58 #959595,#6c6c6c, 59-59 #6c6c6c,#959595, 60-60 #959595,#6c6c6c, 61-61 #6c6c6c,#959595, 62-65 #959595,#6c6c6c, 66-66 #6c6c6c,#959595, 67-67 #6c6c6c,#352879, 68-68 #352879,#6c6c6c, 69-98 #352879,#352879, 99-149 d,#0d1410, -|23: 0-0 d,#152019, 1-52 d,#0d1410, 53-53 #6c6c6c,#959595, 54-57 #959595,#6c6c6c, 58-59 #6c6c6c,#959595, 60-61 #959595,#6c6c6c, 62-62 #6c6c6c,#959595, 63-64 #959595,#6c6c6c, 65-65 #6c6c6c,#352879, 66-66 #959595,#352879, 67-98 #352879,#352879, 99-149 d,#0d1410, -|24: 0-0 d,#152019, 1-52 d,#0d1410, 53-60 #959595,#6c6c6c, 61-61 #6c6c6c,#959595, 62-62 #959595,#6c6c6c, 63-64 #959595,#352879, 65-98 #352879,#352879, 99-149 d,#0d1410, -|25: 0-0 d,#152019, 1-52 d,#0d1410, 53-56 #959595,#6c6c6c, 57-60 #6c6c6c,#959595, 61-61 #6c6c6c,#352879, 62-63 #352879,#6c5eb5, 64-98 #352879,#352879, 99-149 d,#0d1410, -|26: 0-0 d,#152019, 1-52 d,#0d1410, 53-57 #959595,#6c6c6c, 58-58 #6c6c6c,#959595, 59-59 #6c6c6c,#352879, 60-60 #352879,#6c5eb5, 61-98 #352879,#352879, 99-149 d,#0d1410, -|27: 0-0 d,#152019, 1-52 d,#0d1410, 53-54 #959595,#6c6c6c, 55-56 #6c6c6c,#959595, 57-57 #6c6c6c,#352879, 58-58 #959595,#352879, 59-59 #352879,#6c5eb5, 60-98 #352879,#352879, 99-149 d,#0d1410, -|28: 0-0 d,#152019, 1-52 d,#0d1410, 53-54 #959595,#6c6c6c, 55-55 #6c6c6c,#352879, 56-56 #352879,#6c6c6c, 57-98 #352879,#352879, 99-149 d,#0d1410, -|29: 0-0 d,#152019, 1-52 d,#0d1410, 53-53 #352879,#6c6c6c, 54-54 #352879,#959595, 55-55 #352879,#6c5eb5, 56-98 #352879,#352879, 99-149 d,#0d1410, +|6: 0-0 d,#152019, 1-51 d,#0d1410, 52-59 #959595,#6c6c6c, 60-60 #6c6c6c,#959595, 61-65 #959595,#6c6c6c, 66-66 #6c6c6c,#959595, 67-70 #959595,#6c6c6c, 71-73 #6c6c6c,#959595, 74-75 #959595,#6c6c6c, 76-76 #6c6c6c,#959595, 77-84 #959595,#6c6c6c, 85-85 #6c6c6c,#959595, 86-90 #959595,#6c6c6c, 91-91 #6c6c6c,#959595, 92-95 #959595,#6c6c6c, 96-97 #6c6c6c,#959595, 98-98 #959595,#352879, 99-99 #352879,#959595, 100-138 d,#0d1410, 139-139 d,#1d2824, 140-148 #b2c3b8,#1d2824, 149-149 d,#1d2824, +|7: 0-0 d,#152019, 1-51 d,#0d1410, 52-52 #6c6c6c,#959595, 53-54 #959595,#6c6c6c, 55-55 #6c6c6c,#959595, 56-56 #959595,#6c6c6c, 57-57 #6c6c6c,#959595, 58-58 #959595,#6c6c6c, 59-59 #6c6c6c,#959595, 60-60 #959595,#6c6c6c, 61-61 #6c6c6c,#959595, 62-66 #959595,#6c6c6c, 67-67 #6c6c6c,#959595, 68-70 #959595,#6c6c6c, 71-72 #6c6c6c,#959595, 73-73 #959595,#6c6c6c, 74-74 #6c6c6c,#959595, 75-75 #959595,#6c6c6c, 76-76 #444444,#959595, 77-77 #6c6c6c,#959595, 78-81 #959595,#6c6c6c, 82-84 #6c6c6c,#959595, 85-85 #959595,#6c6c6c, 86-86 #6c6c6c,#959595, 87-89 #959595,#6c6c6c, 90-90 #6c6c6c,#959595, 91-92 #959595,#6c6c6c, 93-94 #6c6c6c,#959595, 95-95 #959595,#6c6c6c, 96-96 #959595,#352879, 97-97 #352879,#959595, 98-99 #352879,#352879, 100-149 d,#0d1410, +|8: 0-0 d,#152019, 1-51 d,#0d1410, 52-55 #959595,#6c6c6c, 56-56 #6c6c6c,#959595, 57-57 #959595,#6c6c6c, 58-58 #6c6c6c,#959595, 59-59 #959595,#6c6c6c, 60-60 #6c6c6c,#959595, 61-61 #959595,#6c6c6c, 62-62 #6c6c6c,#959595, 63-64 #959595,#6c6c6c, 65-65 #6c6c6c,#959595, 66-66 #959595,#6c6c6c, 67-67 #6c6c6c,#959595, 68-68 #959595,#6c6c6c, 69-69 #6c6c6c,#959595, 70-70 #959595,#6c6c6c, 71-71 #6c6c6c,#959595, 72-75 #959595,#6c6c6c, 76-78 #6c6c6c,#959595, 79-80 #959595,#6c6c6c, 81-81 #6c6c6c,#959595, 82-83 #959595,#6c6c6c, 84-86 #6c6c6c,#959595, 87-88 #959595,#6c6c6c, 89-91 #6c6c6c,#959595, 92-92 #959595,#6c6c6c, 93-93 #6c6c6c,#959595, 94-94 #6c6c6c,#352879, 95-95 #352879,#959595, 96-96 #352879,#6c5eb5, 97-99 #352879,#352879, 100-149 d,#0d1410, +|9: 0-0 d,#152019, 1-51 d,#0d1410, 52-56 #959595,#6c6c6c, 57-57 #6c6c6c,#959595, 58-60 #959595,#6c6c6c, 61-61 #6c6c6c,#959595, 62-66 #959595,#6c6c6c, 67-67 #444444,#6c6c6c, 68-68 #959595,#6c6c6c, 69-70 #6c6c6c,#959595, 71-71 #959595,#6c6c6c, 72-72 #6c6c6c,#959595, 73-73 #959595,#6c6c6c, 74-74 #6c6c6c,#959595, 75-75 #959595,#6c6c6c, 76-79 #6c6c6c,#959595, 80-82 #959595,#6c6c6c, 83-83 #6c6c6c,#959595, 84-84 #959595,#6c6c6c, 85-85 #6c6c6c,#959595, 86-86 #959595,#6c6c6c, 87-87 #6c6c6c,#959595, 88-88 #959595,#6c6c6c, 89-89 #6c6c6c,#959595, 90-91 #959595,#6c6c6c, 92-92 #6c6c6c,#352879, 93-93 #352879,#6c5eb5, 94-99 #352879,#352879, 100-149 d,#0d1410, +|10: 0-0 d,#152019, 1-51 d,#0d1410, 52-55 #6c6c6c,#959595, 56-57 #959595,#6c6c6c, 58-59 #6c6c6c,#959595, 60-62 #959595,#6c6c6c, 63-63 #6c6c6c,#959595, 64-64 #959595,#6c6c6c, 65-66 #6c6c6c,#959595, 67-68 #959595,#6c6c6c, 69-72 #6c6c6c,#959595, 73-75 #959595,#6c6c6c, 76-76 #6c6c6c,#959595, 77-77 #959595,#6c6c6c, 78-80 #6c6c6c,#959595, 81-89 #959595,#6c6c6c, 90-90 #959595,#352879, 91-91 #352879,#6c6c6c, 92-92 #352879,#6c5eb5, 93-99 #352879,#352879, 100-149 d,#0d1410, +|11: 0-0 d,#152019, 1-51 d,#0d1410, 52-55 #959595,#6c6c6c, 56-56 #6c6c6c,#959595, 57-57 #959595,#6c6c6c, 58-59 #6c6c6c,#959595, 60-60 #959595,#6c6c6c, 61-61 #6c6c6c,#959595, 62-62 #959595,#6c6c6c, 63-64 #6c6c6c,#959595, 65-66 #959595,#6c6c6c, 67-67 #6c6c6c,#959595, 68-70 #959595,#6c6c6c, 71-72 #6c6c6c,#959595, 73-78 #959595,#6c6c6c, 79-80 #6c6c6c,#959595, 81-85 #959595,#6c6c6c, 86-86 #6c6c6c,#959595, 87-87 #959595,#6c6c6c, 88-89 #959595,#352879, 90-90 #352879,#6c5eb5, 91-99 #352879,#352879, 100-149 d,#0d1410, +|12: 0-0 d,#152019, 1-51 d,#0d1410, 52-52 #959595,#6c6c6c, 53-53 #6c6c6c,#959595, 54-56 #959595,#6c6c6c, 57-57 #6c6c6c,#959595, 58-58 #959595,#6c6c6c, 59-59 #6c6c6c,#959595, 60-66 #959595,#6c6c6c, 67-67 #6c6c6c,#959595, 68-71 #959595,#6c6c6c, 72-72 #6c6c6c,#959595, 73-73 #959595,#6c6c6c, 74-74 #6c6c6c,#959595, 75-76 #959595,#6c6c6c, 77-78 #6c6c6c,#959595, 79-81 #959595,#6c6c6c, 82-82 #6c6c6c,#959595, 83-83 #959595,#6c6c6c, 84-84 #6c6c6c,#959595, 85-85 #959595,#6c6c6c, 86-86 #959595,#352879, 87-87 #352879,#6c5eb5, 88-99 #352879,#352879, 100-149 d,#0d1410, +|13: 0-0 d,#152019, 1-51 d,#0d1410, 52-52 #959595,#6c6c6c, 53-54 #6c6c6c,#959595, 55-55 #959595,#6c6c6c, 56-58 #6c6c6c,#959595, 59-61 #959595,#6c6c6c, 62-62 #6c6c6c,#959595, 63-65 #959595,#6c6c6c, 66-66 #6c6c6c,#959595, 67-67 #959595,#6c6c6c, 68-68 #6c6c6c,#959595, 69-72 #959595,#6c6c6c, 73-74 #6c6c6c,#959595, 75-75 #959595,#6c6c6c, 76-76 #6c6c6c,#959595, 77-77 #959595,#6c6c6c, 78-78 #6c6c6c,#959595, 79-79 #959595,#6c6c6c, 80-80 #6c6c6c,#959595, 81-81 #959595,#6c6c6c, 82-82 #6c6c6c,#959595, 83-83 #959595,#6c6c6c, 84-84 #6c6c6c,#352879, 85-85 #352879,#6c6c6c, 86-99 #352879,#352879, 100-149 d,#0d1410, +|14: 0-0 d,#152019, 1-51 d,#0d1410, 52-52 #444444,#959595, 53-55 #959595,#6c6c6c, 56-56 #6c6c6c,#959595, 57-57 #959595,#6c6c6c, 58-58 #444444,#959595, 59-61 #959595,#6c6c6c, 62-63 #6c6c6c,#959595, 64-64 #959595,#6c6c6c, 65-66 #6c6c6c,#959595, 67-67 #959595,#6c6c6c, 68-68 #6c6c6c,#959595, 69-70 #959595,#6c6c6c, 71-71 #6c6c6c,#959595, 72-73 #959595,#6c6c6c, 74-74 #6c6c6c,#959595, 75-75 #959595,#6c6c6c, 76-76 #6c6c6c,#959595, 77-78 #959595,#6c6c6c, 79-80 #6c6c6c,#959595, 81-81 #959595,#6c6c6c, 82-82 #959595,#352879, 83-83 #352879,#6c6c6c, 84-99 #352879,#352879, 100-149 d,#0d1410, +|15: 0-0 d,#152019, 1-51 d,#0d1410, 52-56 #959595,#6c6c6c, 57-57 #6c6c6c,#959595, 58-59 #959595,#6c6c6c, 60-61 #6c6c6c,#959595, 62-63 #959595,#6c6c6c, 64-64 #6c6c6c,#959595, 65-65 #959595,#6c6c6c, 66-66 #6c6c6c,#959595, 67-68 #959595,#6c6c6c, 69-69 #6c6c6c,#959595, 70-74 #959595,#6c6c6c, 75-76 #6c6c6c,#959595, 77-78 #959595,#6c6c6c, 79-79 #6c6c6c,#959595, 80-80 #959595,#352879, 81-81 #352879,#959595, 82-99 #352879,#352879, 100-149 d,#0d1410, +|16: 0-0 d,#152019, 1-51 d,#0d1410, 52-52 #6c6c6c,#959595, 53-53 #959595,#6c6c6c, 54-54 #6c6c6c,#959595, 55-59 #959595,#6c6c6c, 60-61 #6c6c6c,#959595, 62-64 #959595,#6c6c6c, 65-65 #6c6c6c,#959595, 66-67 #959595,#6c6c6c, 68-69 #6c6c6c,#959595, 70-71 #959595,#6c6c6c, 72-75 #6c6c6c,#959595, 76-77 #959595,#6c6c6c, 78-78 #6c6c6c,#352879, 79-79 #352879,#959595, 80-80 #352879,#6c5eb5, 81-99 #352879,#352879, 100-149 d,#0d1410, +|17: 0-0 d,#152019, 1-51 d,#0d1410, 52-52 #959595,#6c6c6c, 53-53 #6c6c6c,#959595, 54-63 #959595,#6c6c6c, 64-65 #6c6c6c,#959595, 66-68 #959595,#6c6c6c, 69-71 #6c6c6c,#959595, 72-73 #959595,#6c6c6c, 74-75 #6c6c6c,#959595, 76-76 #6c6c6c,#352879, 77-77 #352879,#6c6c6c, 78-99 #352879,#352879, 100-149 d,#0d1410, +|18: 0-0 d,#152019, 1-51 d,#0d1410, 52-52 #959595,#6c6c6c, 53-55 #6c6c6c,#959595, 56-60 #959595,#6c6c6c, 61-61 #444444,#959595, 62-62 #959595,#6c6c6c, 63-63 #6c6c6c,#959595, 64-64 #959595,#6c6c6c, 65-66 #6c6c6c,#959595, 67-69 #959595,#6c6c6c, 70-71 #6c6c6c,#959595, 72-72 #959595,#6c6c6c, 73-73 #6c6c6c,#959595, 74-74 #6c6c6c,#352879, 75-75 #352879,#6c6c6c, 76-99 #352879,#352879, 100-149 d,#0d1410, +|19: 0-0 d,#152019, 1-51 d,#0d1410, 52-52 #959595,#6c6c6c, 53-55 #6c6c6c,#959595, 56-63 #959595,#6c6c6c, 64-64 #6c6c6c,#959595, 65-66 #959595,#6c6c6c, 67-67 #6c6c6c,#959595, 68-69 #959595,#6c6c6c, 70-70 #6c6c6c,#959595, 71-71 #959595,#6c6c6c, 72-72 #959595,#352879, 73-73 #352879,#6c5eb5, 74-99 #352879,#352879, 100-149 d,#0d1410, +|20: 0-0 d,#152019, 1-51 d,#0d1410, 52-56 #959595,#6c6c6c, 57-59 #6c6c6c,#959595, 60-62 #959595,#6c6c6c, 63-63 #6c6c6c,#959595, 64-66 #959595,#6c6c6c, 67-69 #6c6c6c,#959595, 70-70 #6c6c6c,#352879, 71-71 #352879,#6c6c6c, 72-72 #352879,#6c5eb5, 73-99 #352879,#352879, 100-149 d,#0d1410, +|21: 0-0 d,#152019, 1-51 d,#0d1410, 52-52 #6c6c6c,#959595, 53-56 #959595,#6c6c6c, 57-57 #6c6c6c,#959595, 58-67 #959595,#6c6c6c, 68-68 #6c6c6c,#352879, 69-69 #352879,#6c6c6c, 70-99 #352879,#352879, 100-149 d,#0d1410, +|22: 0-0 d,#152019, 1-51 d,#0d1410, 52-52 #959595,#6c6c6c, 53-53 #6c6c6c,#959595, 54-54 #959595,#6c6c6c, 55-55 #6c6c6c,#959595, 56-58 #959595,#6c6c6c, 59-62 #6c6c6c,#959595, 63-65 #959595,#6c6c6c, 66-66 #6c6c6c,#352879, 67-67 #352879,#6c5eb5, 68-99 #352879,#352879, 100-149 d,#0d1410, +|23: 0-0 d,#152019, 1-51 d,#0d1410, 52-52 #959595,#6c6c6c, 53-53 #6c6c6c,#959595, 54-55 #959595,#6c6c6c, 56-56 #6c6c6c,#959595, 57-60 #959595,#6c6c6c, 61-62 #6c6c6c,#959595, 63-63 #959595,#6c6c6c, 64-64 #6c6c6c,#352879, 65-65 #959595,#352879, 66-99 #352879,#352879, 100-149 d,#0d1410, +|24: 0-0 d,#152019, 1-51 d,#0d1410, 52-53 #959595,#6c6c6c, 54-55 #6c6c6c,#959595, 56-56 #959595,#6c6c6c, 57-57 #6c6c6c,#959595, 58-58 #959595,#6c6c6c, 59-61 #6c6c6c,#959595, 62-62 #6c6c6c,#352879, 63-63 #352879,#959595, 64-99 #352879,#352879, 100-149 d,#0d1410, +|25: 0-0 d,#152019, 1-51 d,#0d1410, 52-52 #959595,#6c6c6c, 53-53 #6c6c6c,#959595, 54-55 #959595,#6c6c6c, 56-56 #6c6c6c,#959595, 57-57 #959595,#6c6c6c, 58-58 #6c6c6c,#959595, 59-59 #959595,#6c6c6c, 60-60 #6c6c6c,#352879, 61-61 #352879,#959595, 62-62 #352879,#6c5eb5, 63-99 #352879,#352879, 100-149 d,#0d1410, +|26: 0-0 d,#152019, 1-51 d,#0d1410, 52-53 #959595,#6c6c6c, 54-57 #6c6c6c,#959595, 58-58 #959595,#352879, 59-59 #352879,#6c6c6c, 60-99 #352879,#352879, 100-149 d,#0d1410, +|27: 0-0 d,#152019, 1-51 d,#0d1410, 52-52 #959595,#6c6c6c, 53-53 #6c6c6c,#959595, 54-55 #959595,#6c6c6c, 56-56 #6c6c6c,#352879, 57-57 #352879,#959595, 58-99 #352879,#352879, 100-149 d,#0d1410, +|28: 0-0 d,#152019, 1-51 d,#0d1410, 52-53 #959595,#6c6c6c, 54-54 #6c6c6c,#352879, 55-55 #352879,#6c5eb5, 56-99 #352879,#352879, 100-149 d,#0d1410, +|29: 0-0 d,#152019, 1-51 d,#0d1410, 52-52 #6c6c6c,#352879, 53-53 #959595,#352879, 54-99 #352879,#352879, 100-149 d,#0d1410, |30: 0-1 #000000,#add38a, 2-2 d,#26362d, 3-81 #becfc4,#26362d, 82-88 #dfbce5,#26362d, 89-105 #becfc4,#26362d, 106-149 d,#26362d, == snap search-prompt grid=150x31 cursor=149,6 -|6: /ZZ +|6: 4*🬹~F~N🬰|G🬏▚Y~KF🬴s Date: Tue, 22 Sep 2026 11:15:46 -0300 Subject: Answer 9P on the connection's task, so a session can open its own tree The editor's loop was the only thing that could answer a 9P request, which made the editor's own syscalls through a mount of its own tree -- a Look at /mnt/9p/pardes//anything under a `9ns --mntgen` view, a Save into it -- requests only the blocked loop could serve. The name-based refusal that followed (ownMountSuffix) and the in-process routing of a mount of oneself (Client.sameSession) were patches over that, and both are gone, with the mailbox that shipped every request to the editor's thread. One rule replaces them, `pardes.turn`: the core is single-threaded, the editor's thread has the turn by default and gives it up in two kinds of gap -- while it waits for input and while a step of it is out in a host syscall -- and a cloud9 connection task takes it in those gaps to answer. `out` counts the steps that are out, from any thread: while one is, the core reads consistently but that step still holds pointers into it, so a request that would change a pane (a write, a truncation, an rmdir) is parked in the engine and retried when the turn is next given up with nothing out, and the editor's own wake waits for the count to reach zero. It is never a write of its own that a step waits on out there -- writes come from a shell performing a save between steps -- so a parked request is never the syscall's own, and making a pane or rendering a screen need not park: every yield sits before its step's mutation, so the layout and the surface are whole under it. A changing request that queued effects is answered once the editor has performed them (`echo Save > exec` returns with the file written, as acme's `put` does), and it settles the way a step does, because without that a /log reader waited for the user's next keystroke. Every host syscall on a user path has to give the turn up, not fs.zig's alone: the first end-to-end run hung in `inotify_add_watch` performing the new pane's watch effect. PDFs and images are read whole at open, so no draw goes out into the host. The core's allocator takes its fixed buffer through the lock-free interface, since a connection task allocates while the editor's thread is out in a syscall that allocates too. A Restore puts the replacement in first and releases every task waiting on the old core. cloud9 (pinned at eb1a104) parks an open, a truncating wstat, a clunk and a remove on `again`, not only reads and writes, and answers a parked job whose fid was clunked without asking the backend. Verified: test/selfmount.py runs the editor under `9ns --mntgen` and Looks at, reads and Saves its own tree through the mount; a unit test pins that a change parks while the editor is out mid-step and lands when it rests, while a read is answered in the window. 9P over the Unix socket against a tty session, same machine, Debug builds: a read of /index 278us -> 61us, a truncating body write 1184us -> 609us, exec Save 718us -> 583us; the gesture benchmark is unchanged (geometric mean 0.997 over 53 cells). Also from the reviews: a notice chip over an image or PDF pane was painted out by the picture drawn after the cells, so pictures give up the rows; in the GUI a tree-sitter context band painted over the chip, so body layers are emitted first; a message is one row of printable text, its 256-byte cut never leaves half a glyph, and one wider than its pane keeps its tail (the file name, the reason) rather than its head. Co-Authored-By: Claude Fable 5.1 --- .agents/skills/pardes-9p/SKILL.md | 7 +- build.zig.zon | 4 +- docs/cloud9.md | 13 +- docs/fs.md | 27 +- docs/v9fs.md | 6 +- features.txt | 56 ++++ src/9p.zig | 19 +- src/9p_io.zig | 511 +++++++++++++++-------------------- src/CHANGELOG.md | 13 + src/detached/server.zig | 27 +- src/detached/wire.zig | 8 +- src/file_watch.zig | 6 + src/fs.zig | 444 ++++++++++-------------------- src/gui/gui.zig | 30 +- src/host_io.zig | 3 + src/macos.zig | 125 ++++++++- src/memory.zig | 50 +++- src/ninep/testing.zig | 7 +- src/ninep/tree.zig | 16 ++ src/panes.zig | 45 ++- src/pardes.zig | 282 +++++++++++++++---- src/tty/tty.zig | 11 +- test/fs_namespace.zig | 24 -- test/selfmount.py | 126 +++++++++ test/snapshots/images.golden | 40 +-- test/snapshots/msg.golden | 4 + test/snapshots/msg.snap | 12 + test/snapshots/tagbottomimage.golden | 98 +++---- 28 files changed, 1205 insertions(+), 809 deletions(-) create mode 100644 test/selfmount.py (limited to 'src/gui') diff --git a/.agents/skills/pardes-9p/SKILL.md b/.agents/skills/pardes-9p/SKILL.md index b776e407..2e065819 100644 --- a/.agents/skills/pardes-9p/SKILL.md +++ b/.agents/skills/pardes-9p/SKILL.md @@ -69,9 +69,10 @@ echo "/etc/hosts:3" > "$m/look"; cat "$m/look" # open a file, see where it land rmdir "$m/pane/$n" # close it, dirty or not ``` -Do not open a session's own mount from inside that session -- a Look at -`$m/anything` in the editor that serves `$m` would deadlock it, so such paths -are refused. Use `/n/self/...` from inside; `$m/...` is for everyone else. +A session may open its own mount from inside itself: a Look at `$m/anything` +in the editor that serves `$m` is answered on the connection's task while the +editor's own syscall waits. `/n/self/...` names the same tree without leaving +the process. **Opening** `$m/pane/new` is what makes a pane, and reading the open file answers its serial — `/net/tcp/clone`'s mechanism. Each open makes another one, diff --git a/build.zig.zon b/build.zig.zon index 3a172f3b..8f1b8068 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -9,8 +9,8 @@ // 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#9c4d668c926e2d9eae6ef87cd9b391d8185605f9", - .hash = "cloud9-0.1.0-yt86qjAoGgBEPMJl2t4CZn7iWPMZUw4sMHAL54tq7spP", + .url = "git+https://git.sr.ht/~gbrls/cloud9#eb1a104f385f375a74319695e1a59f6f82e6384e", + .hash = "cloud9-0.1.0-yt86qiixGgCCjOhSDJ6tijGR7zj_zLT8mjvuUqrkeG9_", }, // ZLS as a LIBRARY, not a language server: src/lsp_zls.zig imports the // `zls` module its build.zig publishes and calls the analyser in diff --git a/docs/cloud9.md b/docs/cloud9.md index d030db1d..6eb76238 100644 --- a/docs/cloud9.md +++ b/docs/cloud9.md @@ -16,11 +16,14 @@ Mounting, Unix namespace discovery and permissions, the editor event loop, connection limits, and exported tree policy remain here. The Unix and TCP listeners run on cloud9's `serve.Runner` (`std.Io`: an accept task per listener, a reader and a writer task per connection, four slots); its handler -queues every backend request for the editor's thread, which answers them all -in `Listener.tick` after each editor update, retries parked reads there, and -has the runner ship the replies. `src/9p_quic.zig` selects the existing -`pardes-9p` ALPN for cloud9's optional OpenSSL transport; QUIC still runs on -the poll loop in `src/9p_io.zig`, since cloud9's QUIC adapter is +answers every backend request on the connection's task, taking the editor's +turn with the core (`pardes.turn`) while the editor waits for input or is out +in a syscall. A request that would change a pane while the editor is mid-step +is parked with `Status.again` -- the engine parks reads, writes, opens, +truncations, clunks and removes -- and retried by `Runner.wakeAll` when the +editor next rests. `src/9p_quic.zig` selects the existing `pardes-9p` ALPN for +cloud9's optional OpenSSL transport; QUIC still runs on the poll loop in +`src/9p_io.zig` on the editor's thread, since cloud9's QUIC adapter is nonblocking-descriptor based rather than `std.Io` based. The standalone protocol/GPIO tests import the same module. The separate `05-zig-p4` build also supplies cloud9 for the GPIO firmware entry. diff --git a/docs/fs.md b/docs/fs.md index 6d2891e0..335ee4e6 100644 --- a/docs/fs.md +++ b/docs/fs.md @@ -106,15 +106,24 @@ at the cost of acme's one-step `new/body`. Nothing in the tree is created by list, stat, walk or read; only that one open. Every other name in `/pane` is a serial. -A session cannot open its own tree through a mount. Looking at -`/mnt/9p/pardes//anything` from inside that very editor used to hang it -outright: the realpath, the stat and the read all leave through the mount and -come back as 9P requests only that editor's loop can answer, while the loop is -blocked making them, and the filesystem then stops answering anybody. Such a -path is now refused by name before any syscall runs, because the syscall is the -thing that never returns. Address your own tree as `/n/self/...`, which the -editor serves from memory without leaving the process. Another session's mount -is perfectly fine to open. +A session can open its own tree through a mount: a Look at +`/mnt/9p/pardes//pane/2/body` from inside that very editor opens it, and +a Save of that pane writes back through the mount into pane 2. Requests on +the Unix and TCP listeners are answered on the 9P connection's own task, not +by the editor's loop, so the realpath, the stat and the read the editor makes +out through the mount come back while it waits for them. The one rule is +whose turn it is with the core (`pardes.turn`): the editor has it, and gives +it up while it waits for input and while a step of it is out in a syscall. A +step of a connection task's own -- a Look written to `look` -- goes out the +same way, and the editor waits for it to return before it takes a step of +its own. While any step is out, a request that would change a pane (a write, +a truncation, an rmdir) parks in the engine until none is; everything else, +opening `pane/new` and `screen` included, is answered at once, which is why a +Look at any path in the tree comes back. A write into the tree from the +editor itself only ever happens between steps (a Save), so nothing it waits +on out there is a request that has to park. QUIC is still served on the +editor's loop, so through QUIC the old hang remains. `/n/self/...` names the +same tree without leaving the process. `/look` and `/exec` are the editor's two clicks, one per line of a write: diff --git a/docs/v9fs.md b/docs/v9fs.md index cfbbd35b..a105fe06 100644 --- a/docs/v9fs.md +++ b/docs/v9fs.md @@ -72,9 +72,9 @@ remain available for subsequent explicit authentication. The launcher waits for forwards termination signals, and removes its empty temporary directory on exit. Namespace destruction releases the mount when its last process exits. -The core stays outside the mount namespace because its event loop serves 9P. -A blocking filesystem operation through its own mount could wait for a request -that the blocked event loop must service. Even pathname resolution may do this. +The core stays outside the mount namespace, which is the helper's private +one: a path under `$PARDES_MOUNT` names nothing in the editor's own namespace, +so a Look on one from that shell opens nothing. Each `Tty9p` currently creates its own mount and consumes a server connection; the session has four application connection slots across all transports. This diff --git a/features.txt b/features.txt index fa1c0f6b..0db7c497 100644 --- a/features.txt +++ b/features.txt @@ -202,3 +202,59 @@ means what it says when fed back as configuration -- the symmetry the report was Left failing, deliberately: `nested-optout`. See docs/divergences.md -- two levels of nesting prepend U+E016 (vaxis's F3) to typed lines, which is a real bug in the key-forwarding path and not a stale expectation. + +9P is answered on the connection's task now, not by the editor's loop. The loop used to be the only thing that could answer a +request, which made the editor's own syscalls through a mount of its own tree -- a Look at /mnt/9p/pardes//anything under a +`9ns --mntgen` view, a Save into it -- a request only the blocked loop could serve. The name-based refusal that followed +(ownMountSuffix) and the in-process routing of a mount of oneself (Client.sameSession) were patches over that, and both are gone. +What replaced them is one rule, `pardes.turn`: the core is single-threaded, the editor's thread has the turn by default and gives it +up in two kinds of gap -- while it waits for input (`rest`/`wake`, one site per shell) and while a step is out in a host syscall +(`yield`/`back`, inside the leaf calls in fs.zig and the few host-side ones: the file watcher's marks, a shell's cwd stat) -- and a +cloud9 connection task takes it in those gaps to answer. Which gap it is matters: waiting, anything goes; out in a syscall +mid-step, the core reads consistently but the step still holds pointers into it, so a request that would change a pane +(tree.needsQuiet: writes, truncations, /pane/new, rmdir, and the screen open because it renders) is parked in the engine with +Status.again and retried when the turn is next given up quiet. That needed cloud9's engine to park an open, a truncating wstat, a +clunk and a remove, not only reads and writes -- a parked job goes back into the job slot on retry, and a walk still cannot park +because its names live in the input frame. A changing request that queued effects waits (`awaitSettled`) until the editor's pump has +performed them before it is answered, so `echo Save > exec` still returns with the file written, the way `put` does in acme; and a +request settles the way a step does (`sync`, `fsReport`, `events.announce`), because without that a `/log` reader waited for the +user's next keystroke to hear about the pane the request made. + +Two traps that cost real time. The first end-to-end run hung anyway: the Look completed on the connection task, then the editor woke +to perform the new pane's watch effect, and `inotify_add_watch` on a FUSE path is itself a request -- made while holding the turn. +The rule is therefore every host syscall on a user path, not fs.zig's alone; PDFs are read whole and opened from memory for the same +reason (MuPDF reads a file lazily at every page). The second: a parked write one byte longer than `park_data_max` fails EAGAIN, and +the client's largest write is msize less the 23-byte Twrite header, not less iohdrsz; a large Save to a peer's /os path came back +"save: Remote" until the engine's room was sized from a client. test/selfmount.py runs the editor under `9ns --mntgen` and Looks at, +reads and Saves its own tree through the mount; a unit test in 9p_io.zig pins that a change parks while the editor is out mid-step +and lands when it rests, while a read is answered in the window. + +Performance, same machine, Debug builds, 9P over the Unix socket against a tty session: a read of /index 278us -> 61us and a pane +body 283us -> 64us, because a read no longer waits for the editor to wake; a truncating body write 1184us -> 609us; exec Msg 696us +-> 543us; pane/new + rmdir 1535us -> 1295us; exec Save 718us -> 583us. A change still costs one editor frame, since the editor +draws it before it rests again. + +Left as they are: QUIC still runs on the editor's thread (cloud9's QUIC adapter is not std.Io based), so a QUIC client of a session +that Looks at its own QUIC-mounted tree would still wait on the loop; the Tty9p kernel mount lives in the helper's private +namespace, so a Look on `$PARDES_MOUNT/...` from that shell opens nothing in the editor -- no longer a deadlock, only a namespace +the editor is not in; and a message wider than its pane now keeps its tail rather than its head (msg.snap `msgtail`). + +Two adversarial reviews of that design. The concurrency one found the lost wake for real: a connection task's own yield saved the +editor's mid-step "not quiet" and restored it after the editor had rested, so a resting editor looked busy forever and every change +parked with nobody to wake it -- `quiet` is now `out`, a count of steps out in a syscall from any thread, and nothing saves or +restores it. Behind it, three more: the editor could take its turn back while a connection task's step was still out (that step's +pointers dangling when it returned) -- `wake` now waits for the count to reach zero; the core's allocator was a stack-fallback +over a FixedBufferAllocator, thread-safe only in Debug where the DebugAllocator wrapped it -- the fixed buffer is taken through +its lock-free interface now; and a Restore let a task waiting on the old core wake after that core was freed -- `reset` swaps the +listener's core first and releases every waiter, which then finds the core changed and answers nothing. It also showed that +parking `pane/new` and `screen` would have hung a Look at exactly those two paths in one's own mount (the editor's own open would +park, waiting for a rest that cannot come), so those are answered mid-step: every yield sits before its step's mutation, so the +layout and the surface are whole under it. Images are read at open for the same reason PDFs are. + +The rendering one found the chips drawn out from under: a placed image or PDF page is drawn after the cells (the GUI's image pass, +kitty's z-order), so a chip over a picture was painted over -- pictures give up the rows now, text keeps the overlay -- and in the +GUI a tree-sitter context band was emitted after the tag layers and painted over the chip, so body layers go first. A message is +one row of printable text (a language server's multi-line report read as one line with U+FFFD per newline), the 256-byte cut +never leaves half a glyph, and an over-wide message cut inside a wide glyph now drops that glyph rather than clipping its last. +The simplicity one cut the vestiges: `ninep_identity`, the restore's copy of listener addresses, `setWake`, the mailbox's +`Drained` name, the 64K read buffer, and the two macOS entry points whose multi-line signatures the wrapping had missed. diff --git a/src/9p.zig b/src/9p.zig index c0e7f61e..5ffe9058 100644 --- a/src/9p.zig +++ b/src/9p.zig @@ -52,9 +52,16 @@ pub const msize_min = cloud9.fs.msize_min; /// The smallest msize a native listener offers (src/9p_io.zig). pub const min_msize: u32 = 4096; +/// What a native listener negotiates. +pub const msize: u32 = 8192; -/// The editor's engine: native fid count, native file names. -pub const editor: cloud9.fs.Options = .{ .fid_capacity = max_fids, .name_capacity = 255 }; +/// The editor's engine: native fid count, native file names, and room to +/// park a write of any size a frame can carry -- a request that would change +/// a pane while the editor is out in a syscall waits in the engine +/// (src/9p_io.zig, `serve`), and a write it cannot keep would fail instead. +/// The largest write is msize less the Twrite header, 23 bytes (the test +/// below asks a client), one byte more than `iohdrsz` allows for. +pub const editor: cloud9.fs.Options = .{ .fid_capacity = max_fids, .name_capacity = 255, .park_data_max = msize - 23 }; /// The board's engine: the GPIO firmware's budget (src/esp32p4_9p.zig). pub const board: cloud9.fs.Options = .{ .fid_capacity = board_fids, .name_capacity = board_name_capacity }; @@ -70,6 +77,14 @@ const Stub = struct { pub const Reply = cloud9.fs.Reply; }; +test "9p server: the editor's engine can park the largest write a client sends" { + var in: [4096]u8 = undefined; + var out: [4096]u8 = undefined; + var client: Client = .init(.{ .in = &in, .out = &out }); + client.msize = msize; + try testing.expect(editor.park_data_max >= client.maxWrite()); +} + test "9p server: board and native capacities size the actual fid storage" { const Board = Server(Stub, board); const Native = Server(Stub, editor); diff --git a/src/9p_io.zig b/src/9p_io.zig index 08deae7a..7e09fb27 100644 --- a/src/9p_io.zig +++ b/src/9p_io.zig @@ -62,7 +62,7 @@ pub fn ensureSocketDir(dir: [:0]const u8) bool { const prefix = "pardes-9p-"; -pub const msize: u32 = 8192; +pub const msize = ninep.msize; pub const max_conns = 4; @@ -143,76 +143,17 @@ const Srv = ninep.Server(pardes.ctlfs, ninep.editor); /// The Unix and TCP listeners run on cloud9's `std.Io` runner: it accepts, /// reads frames, steps each connection's engine and writes replies on its -/// own tasks, and hands every backend request to the editor's thread -/// through `Slot` (see `tick`). QUIC keeps the poll loop below. +/// own tasks, and every backend request is answered right there, on the +/// connection's task, by taking the editor's turn (`pardes.turn`): while the +/// editor waits for input, or while a step of it is out in a syscall -- +/// which is what lets the editor read its own tree through a mount. QUIC +/// keeps the poll loop below, on the editor's thread. const Runner = if (supported) cloud9.serve.Runner(pardes.ctlfs, ninep.editor, .{ .msize = msize, .connections = max_conns, .listeners = 2, }) else void; -/// Answers one backend request on the editor's thread. -fn step(core: *pardes.Pardes, srv: *Srv, req: pardes.ctlfs.Req) void { - core.update(.{ .fs_req = req }); - var answered = false; - while (core.nextEffect()) |effect| { - if (effect == .fs_reply) { - const reply = effect.fs_reply; - if (reply.tag == req.tag) answered = true; - srv.reply(&reply, core.fsPayload(reply)); - } else core.perform(effect); - } - if (!answered) { - const reply = pardes.ctlfs.Reply.fail(req.tag, pardes.ctlfs.E.IO); - srv.reply(&reply, ""); - } -} - -/// Pays the backend a request whose connection is gone; replies go nowhere. -fn pay(core: *pardes.Pardes, req: pardes.ctlfs.Req) void { - core.update(.{ .fs_req = req }); - while (core.nextEffect()) |effect| if (effect != .fs_reply) core.perform(effect); -} - -/// One runner slot's mailbox: the requests its connection task handed over, -/// answered by the editor's thread in `tick`. A hangup's releases (at most -/// one per fid) and one outstanding request are the most it ever holds, -/// because a closing connection waits for its entries to be paid before -/// the slot is reused. -const Slot = struct { - const capacity = ninep.editor.fid_capacity + 2; - const Entry = struct { gen: u32, req: pardes.ctlfs.Req }; - - mutex: std.Io.Mutex = .init, - queue: [capacity]Entry = undefined, - head: usize = 0, - len: usize = 0, - /// Bumped when a connection takes the slot; entries carry the value. - gen: u32 = 0, - closing: bool = false, - drained: std.Io.Event = .unset, - /// Requests refused for want of room; never expected. - refused: u32 = 0, - - fn push(s: *Slot, req: pardes.ctlfs.Req) bool { - if (s.len == s.queue.len) { - s.refused += 1; - return false; - } - s.queue[(s.head + s.len) % capacity] = .{ .gen = s.gen, .req = req }; - s.len += 1; - return true; - } - - fn pop(s: *Slot) ?Entry { - if (s.len == 0) return null; - const e = s.queue[s.head]; - s.head = (s.head + 1) % capacity; - s.len -= 1; - return e; - } -}; - const quic_slots = if (quic_enabled) max_conns else 0; /// A QUIC connection on the poll path. @@ -229,12 +170,10 @@ const accept_pause_ms: i64 = 100; pub const Listener = struct { io: std.Io, + /// The core that answers; `reset` puts a replacement in. + core: *pardes.Pardes, runner: Runner = undefined, - slots: [max_conns]Slot = @splat(.{}), stopping: std.atomic.Value(bool) = .init(false), - /// While `reset` runs: the generation each slot is paying off; anything - /// newer waits for the replacement core. - resetting: ?[max_conns]u32 = null, tcp_address: ?std.Io.net.IpAddress = null, quic: if (quic_enabled) ?quic.Listener else void = if (quic_enabled) null else {}, quic_address: ?std.Io.net.IpAddress = null, @@ -264,47 +203,59 @@ pub const Listener = struct { return @ptrCast(@alignCast(ctx.?)); } - /// The runner's handler: on the connection's task. - fn onOpened(ctx: ?*anyopaque, conn: *Runner.Conn) void { - const l = of(ctx); - const s = &l.slots[conn.index]; - s.mutex.lockUncancelable(l.io); - s.gen +%= 1; - s.mutex.unlock(l.io); - } - + /// The runner's handler, on the connection's task: takes the turn and + /// answers. A request that would change a pane while the editor is out + /// in a syscall mid-step is parked in the engine instead, and retried + /// when the turn is next given up between steps (`wakeParked`). fn onServe(ctx: ?*anyopaque, conn: *Runner.Conn, req: pardes.ctlfs.Req) void { const l = of(ctx); - const s = &l.slots[conn.index]; - s.mutex.lockUncancelable(l.io); - const queued = s.push(req); - s.mutex.unlock(l.io); - if (!queued) { - const reply = pardes.ctlfs.Reply.fail(req.tag, pardes.ctlfs.E.IO); - conn.reply(&reply, ""); - return; + // Once `stop` has begun the editor is tearing down and may never + // rest again: answer without waiting on it. + if (l.stopping.load(.acquire)) { + const refused = pardes.ctlfs.Reply.fail(req.tag, pardes.ctlfs.E.IO); + return conn.reply(&refused, ""); + } + const quiet = pardes.turn.take(); + defer pardes.turn.give(); + if (!quiet and pardes.ctlfs.needsQuiet(req)) { + pardes.turn.parked = true; + const later: pardes.ctlfs.Reply = .{ .tag = req.tag, .status = .again }; + return conn.reply(&later, ""); } + const core = l.core; + const epoch = pardes.turn.epoch; + const restores = pardes.turn.restores; + const reply = core.serveFs(req); + if (req.op == .release and quiet) l.collectOs(); + if (!pardes.ctlfs.changesPane(req)) return conn.reply(&reply, core.fsPayload(reply)); + // The editor draws the change and performs what it asked for; when + // it asked for something -- a save, a shell, a watch -- the answer + // waits until that is done, so `echo Save > exec` returns with the + // file written. A change carries no payload, so the reply is still + // whole after the wait. l.kick(); - } - - /// Holds the slot until the editor's thread has paid what the - /// connection still owes, so a successor never inherits its entries. - fn onClosed(ctx: ?*anyopaque, conn: *Runner.Conn) void { + const restoring = core.restore_req != null; + if (core.effects_len != 0) pardes.turn.awaitSettled(epoch); + // Once a wait returns `core` may be gone: a Restore meanwhile put a + // replacement in (`reset`) and is hanging this connection up, which + // is a Restore's answer. Only one that failed leaves this connection + // here to answer. + if (l.core != core) return; + if (restoring) pardes.turn.awaitRestored(restores); + if (l.core != core) return; + conn.reply(&reply, ""); + } + + /// The turn was given up quiet with a request parked: every connection + /// retries what it parked. + fn wakeParked(ctx: ?*anyopaque) void { const l = of(ctx); - const s = &l.slots[conn.index]; if (l.stopping.load(.acquire)) return; - s.mutex.lockUncancelable(l.io); - if (s.len == 0) { - s.mutex.unlock(l.io); - return; - } - s.closing = true; - s.drained.reset(); - s.mutex.unlock(l.io); - l.kick(); - s.drained.wait(l.io) catch {}; + if (comptime supported) l.runner.wakeAll(); } + /// A request changed the core: the editor wakes to draw it and perform + /// what it asked for. fn kick(l: *Listener) void { if (l.stopping.load(.acquire)) return; if (l.wake) |f| f(l.wake_ctx); @@ -411,68 +362,46 @@ pub const Listener = struct { c.draining = true; } - pub const Drained = struct { count: usize = 0, pending: bool = false }; - - /// Answers what every connection has asked since the last call, retries - /// their parked reads against the editor's current state and has the - /// runner send the replies. Call it after each editor update, on the - /// editor's thread; `pending` says QUIC has more to do right away. - pub fn drain(l: *Listener, core: *pardes.Pardes) Drained { - core.fs.socket_path = l.path(); - core.fs.tcp_address = l.tcp_address; - core.fs.quic_address = l.quic_address; - l.expire(); - var result: Drained = .{}; - if (comptime supported) { - for (&l.slots, 0..) |*s, i| { - const conn = &l.runner.conns[i]; - s.mutex.lockUncancelable(l.io); - const only: ?u32 = if (l.resetting) |gens| gens[i] else null; - var count: usize = 0; - if (s.len != 0 or conn.live()) { - conn.lock(); - while (s.len != 0) { - if (only) |gen| if (s.queue[s.head].gen != gen) break; - const e = s.pop().?; - if (e.gen == s.gen) step(core, &conn.engine, e.req) else if (e.req.op == .release) pay(core, e.req); - count += 1; - } - if (conn.live() and (only == null or only.? == s.gen)) { - while (conn.engine.retry()) |req| { - step(core, &conn.engine, req); - count += 1; - } - while (conn.engine.next()) |req| { - step(core, &conn.engine, req); - count += 1; - } - } - const owed = conn.engine.output().len != 0; - conn.unlock(); - if (owed) conn.flush(); - } - if (s.closing and s.len == 0) { - s.closing = false; - s.drained.set(l.io); - } - s.mutex.unlock(l.io); - result.count += count; - if (count != 0) l.collectOs(core); - } - } + /// What one QUIC poll pass did: `pending` says there is more to do at + /// once. + pub const Polled = struct { count: usize = 0, pending: bool = false }; + + /// Answers one QUIC request, on the editor's thread. + fn step(l: *Listener, srv: *Srv, req: pardes.ctlfs.Req) void { + const reply = l.core.serveFs(req); + srv.reply(&reply, l.core.fsPayload(reply)); + if (req.op == .release) l.collectOs(); + } + + /// QUIC's events, accepts, reads, requests and replies, on the editor's + /// thread after each of its steps; `pending` says there is more to do + /// right away. Unix and TCP need none of this. + pub fn tick(l: *Listener) Polled { + var result: Polled = .{}; + // Between the editor's steps, which is when the table may be swept: + // the editor's own directory listings leave nodes in it too. + l.collectOs(); if (comptime quic_enabled) { + if (l.quic) |*listener| listener.events() catch |err| { + log.warn("QUIC listener stopped: {s}", .{@errorName(err)}); + for (&l.conns, 0..) |*conn, i| if (conn.quic != null) l.drop(@intCast(i)); + listener.deinit(); + l.quic = null; + l.quic_address = null; + }; + l.accept(); + for (0..quic_slots) |i| if (l.live(@intCast(i))) l.fill(@intCast(i)); + l.expire(); for (&l.conns, 0..) |*conn, i| { if (!l.live(@intCast(i)) and !conn.draining) continue; var count: usize = 0; while (conn.srv.retry()) |req| { - step(core, &conn.srv, req); - l.collectOs(core); + l.step(&conn.srv, req); count += 1; } while (count < 64) { const req = conn.srv.next() orelse break; - step(core, &conn.srv, req); - l.collectOs(core); + l.step(&conn.srv, req); count += 1; } result.count += count; @@ -482,64 +411,44 @@ pub const Listener = struct { } else l.flush(@intCast(i)); if (conn.quic) |*connection| result.pending = result.pending or connection.pending(); } + l.arm(); } return result; } - /// `drain` plus the QUIC listener's events, accepts and reads. - pub fn tick(l: *Listener, core: *pardes.Pardes) Drained { - if (comptime quic_enabled) { - if (l.quic) |*listener| listener.events() catch |err| { - log.warn("QUIC listener stopped: {s}", .{@errorName(err)}); - for (&l.conns, 0..) |*conn, i| if (conn.quic != null) l.drop(@intCast(i)); - listener.deinit(); - l.quic = null; - l.quic_address = null; - }; - l.accept(); - for (0..quic_slots) |i| if (l.live(@intCast(i))) l.fill(@intCast(i)); - } - const result = l.drain(core); - l.arm(); - return result; - } - - /// Hangs every connection up and pays `core` what they owed, so that a - /// replacement core starts with no client holding anything. A client - /// that connects meanwhile is not answered until the caller has put - /// the replacement in and calls `tick` again. - pub fn reset(l: *Listener, core: *pardes.Pardes) void { + /// Hangs every connection up, so that `replacement` starts with no + /// client holding anything. From here requests are answered from the + /// replacement -- a client that connects meanwhile is a client of the + /// replacement -- and every task waiting on the old core is let go: it + /// finds the core changed and answers nothing, its connection being + /// hung up. The connections pay their releases on their own tasks, so + /// the editor rests while they do. + pub fn reset(l: *Listener, replacement: *pardes.Pardes) void { for (0..quic_slots) |i| l.drop(@intCast(i)); + if (comptime quic_enabled) while (l.tick().pending) {}; + l.core = replacement; + replacement.fs.socket_path = l.path(); + replacement.fs.tcp_address = l.tcp_address; + replacement.fs.quic_address = l.quic_address; if (comptime supported) { - var gens: [max_conns]u32 = undefined; - for (&l.slots, &gens) |*s, *gen| { - s.mutex.lockUncancelable(l.io); - gen.* = s.gen; - s.mutex.unlock(l.io); - } - l.resetting = gens; - defer l.resetting = null; l.runner.closeAll(); + pardes.turn.settle(); + pardes.turn.restoreSettled(); + pardes.turn.rest(); const deadline = nowMs() +| 2000; - while (true) { - const drained = l.drain(core); - var idle = !drained.pending; - for (&l.slots, &gens, 0..) |*s, gen, i| { - s.mutex.lockUncancelable(l.io); - if (s.len != 0 and s.queue[s.head].gen == gen) idle = false; - if (s.gen == gen and l.runner.conns[i].live()) idle = false; - s.mutex.unlock(l.io); - } - if (idle or nowMs() >= deadline) break; - Client.nap(1); - } - } else while (l.drain(core).pending) {} - l.collectOs(core); + while (l.runner.count() != 0 and nowMs() < deadline) Client.nap(1); + pardes.turn.wake(); + } + l.collectOs(); for (&l.conns) |*conn| conn.accepted_ms = 0; l.arm(); } - fn collectOs(l: *Listener, core: *pardes.Pardes) void { + /// Forgets the host paths no connection names any more. With the turn, + /// and only between the editor's steps: a step out in a syscall may be + /// reading one of these entries. + fn collectOs(l: *Listener) void { + const core = l.core; var i: usize = 0; while (i < core.fs.os_paths.items.len) { const entry = core.fs.os_paths.items[i]; @@ -552,17 +461,10 @@ pub const Listener = struct { } } - /// Whether any connection, or a release still to be paid, names `node`. + /// Whether any connection names `node`. fn references(l: *Listener, node: u64) bool { if (comptime supported) { - for (&l.slots, 0..) |*s, i| { - const conn = &l.runner.conns[i]; - s.mutex.lockUncancelable(l.io); - defer s.mutex.unlock(l.io); - var k: usize = 0; - while (k < s.len) : (k += 1) { - if (s.queue[(s.head + k) % Slot.capacity].req.node == node) return true; - } + for (&l.runner.conns) |*conn| { if (!conn.live()) continue; conn.lock(); defer conn.unlock(); @@ -576,16 +478,12 @@ pub const Listener = struct { return false; } - /// Where the runner's tasks report that a request waits for `tick`. - pub fn setWake(l: *Listener, ctx: ?*anyopaque, wake: *const fn (?*anyopaque) void) void { + /// Where the runner's tasks report that a request changed the core, + /// and for QUIC a thread that watches its socket and calls `wake` when + /// `tick` has something to read. + pub fn watch(l: *Listener, ctx: ?*anyopaque, wake: *const fn (?*anyopaque) void) !void { l.wake_ctx = ctx; l.wake = wake; - } - - /// `setWake`, and for QUIC a thread that watches its socket and calls - /// `wake` when `tick` has something to read. - pub fn watch(l: *Listener, ctx: ?*anyopaque, wake: *const fn (?*anyopaque) void) !void { - l.setWake(ctx, wake); if (comptime !quic_enabled) return; if (l.quic == null or l.watcher != null) return; if (libc.pipe(&l.control) != 0) return error.PipeFailed; @@ -735,7 +633,15 @@ pub const Listener = struct { if (comptime quic_enabled) { if (l.quic) |*listener| listener.deinit(); } - if (comptime supported) l.runner.stop(); + if (comptime supported) { + // A connection task may be waiting for the turn; it answers + // nothing more once stopping, but the wait itself must end. + pardes.turn.rest(); + l.runner.stop(); + pardes.turn.wake(); + } + pardes.turn.wake_parked = null; + pardes.turn.stop(); if (l.path_len != 0) { var z: [sun_path_len:0]u8 = undefined; @memcpy(z[0..l.path_len], l.path_buf[0..l.path_len]); @@ -752,7 +658,9 @@ pub fn socketPath(buf: *[sun_path_len]u8, dir: []const u8, name: []const u8) ?[: return std.fmt.bufPrintSentinel(buf, "{s}/" ++ prefix ++ "{s}.sock", .{ dir, name }, 0) catch null; } -pub fn listen(io: std.Io, gpa: std.mem.Allocator, named: []const u8, fallback: []const u8, tcp_dial: ?[]const u8, quic_dial: ?[]const u8) ?*Listener { +/// Serves `core`. From here on the calling thread has the editor's turn +/// (`pardes.turn`) and must give it up while it waits. +pub fn listen(io: std.Io, gpa: std.mem.Allocator, core: *pardes.Pardes, named: []const u8, fallback: []const u8, tcp_dial: ?[]const u8, quic_dial: ?[]const u8) ?*Listener { if (comptime !supported) return null; var dir_buf: [sun_path_len:0]u8 = undefined; const dir = socketDir(&dir_buf) orelse { @@ -761,11 +669,14 @@ pub fn listen(io: std.Io, gpa: std.mem.Allocator, named: []const u8, fallback: [ }; if (!ensureSocketDir(dir)) return null; const l = gpa.create(Listener) catch return null; - l.* = .{ .io = io }; + l.* = .{ .io = io, .core = core }; + pardes.turn.start(io); + pardes.turn.wake_parked = Listener.wakeParked; + pardes.turn.wake_ctx = l; l.runner.init(.{ .io = io, .root = pardes.ctlfs.root, - .handler = .{ .ctx = l, .serve = Listener.onServe, .opened = Listener.onOpened, .closed = Listener.onClosed }, + .handler = .{ .ctx = l, .serve = Listener.onServe }, .greet_timeout_ms = Listener.greet_deadline_ms, }); const entry_name = if (named.len != 0) named else fallback; @@ -838,6 +749,9 @@ pub fn listen(io: std.Io, gpa: std.mem.Allocator, named: []const u8, fallback: [ } } log.info("serving 9P2000 on {s}", .{p}); + core.fs.socket_path = l.path(); + core.fs.tcp_address = l.tcp_address; + core.fs.quic_address = l.quic_address; return l; } @@ -1160,33 +1074,6 @@ test "TCP addresses are numeric and normalize mapped IPv4" { } else try testing.expectError(error.QuicUnavailable, Client.validateDial("quic!127.0.0.1!5640")); } -test "same-session TCP mounts compare canonical endpoints and local wildcard destinations" { - if (comptime !supported) return error.SkipZigTest; - const Case = struct { bound: []const u8, dial: []const u8, same: bool }; - for ([_]Case{ - .{ .bound = "tcp!127.0.0.1!5640", .dial = "tcp!::ffff:127.0.0.1!5640", .same = true }, - .{ .bound = "tcp!::ffff:127.0.0.1!5640", .dial = "tcp!127.0.0.1!5640", .same = true }, - .{ .bound = "tcp!::1!5640", .dial = "tcp!0:0:0:0:0:0:0:1!5640", .same = true }, - .{ .bound = "tcp!127.0.0.1!5640", .dial = "tcp!0.0.0.0!5640", .same = true }, - .{ .bound = "tcp!::1!5640", .dial = "tcp!::!5640", .same = true }, - .{ .bound = "tcp!0.0.0.0!5640", .dial = "tcp!127.0.0.2!5640", .same = true }, - .{ .bound = "tcp!::!5640", .dial = "tcp!::1!5640", .same = true }, - .{ .bound = "tcp!127.0.0.1!5640", .dial = "tcp!127.0.0.1!5641", .same = false }, - .{ .bound = "tcp!0.0.0.0!5640", .dial = "tcp!192.0.2.1!5640", .same = false }, - .{ .bound = "tcp!::!5640", .dial = "tcp!2001:db8::1!5640", .same = false }, - .{ .bound = "tcp!::!5640", .dial = "tcp!127.0.0.1!5640", .same = false }, - }) |c| try testing.expectEqual(c.same, Client.sameSession(c.dial, "", try networkAddress(c.bound, true), null)); - try testing.expect(Client.sameSession("/tmp/pardes-owned.sock", "/tmp/pardes-owned.sock", null, null)); - try testing.expect(Client.sameSession("unix!/tmp/pardes-owned.sock", "/tmp/pardes-owned.sock", null, null)); - try testing.expect(!Client.sameSession("tcp!127.0.0.1!5640", "/tmp/pardes-owned.sock", null, null)); - if (quic_enabled) { - const endpoint = try networkAddress("quic!127.0.0.1!5640", false); - try testing.expect(Client.sameSession("quic!::ffff:127.0.0.1!5640", "", null, endpoint)); - try testing.expect(!Client.sameSession("tcp!127.0.0.1!5640", "", null, endpoint)); - try testing.expect(!Client.sameSession("quic!127.0.0.1!5640", "", endpoint, null)); - } -} - extern "c" fn mkdtemp(template: [*:0]u8) ?[*:0]u8; extern "c" fn rmdir(path: [*:0]const u8) c_int; @@ -1225,7 +1112,9 @@ test "a listening editor posts itself into the 9P registry and unposts on stop" var link: [sun_path_len]u8 = undefined; { - const l = listen(testing.io, gpa, "unit", "", null, null) orelse return error.ListenFailed; + const p = try pardes.Pardes.init(gpa, .{ .tty_only = true, .cols = 40, .rows = 12 }); + defer p.deinit(); + const l = listen(testing.io, gpa, p, "unit", "", null, null) orelse return error.ListenFailed; defer l.deinit(gpa); // The socket stays exactly where pardes has always bound it: // adopting the registry moves nothing, it only advertises. @@ -1312,7 +1201,7 @@ test "Unix TCP and QUIC share one listener through reads writes reconnects and r var bind_buf: [64]u8 = undefined; const bind = try std.fmt.bufPrint(&bind_buf, "{s}!{s}!0", .{ protocol, host }); const tcp = std.mem.eql(u8, protocol, "tcp"); - const l = listen(testing.io, gpa, "roundtrip", "", if (tcp) bind else null, if (tcp) null else bind) orelse return error.ListenFailed; + const l = listen(testing.io, gpa, p, "roundtrip", "", if (tcp) bind else null, if (tcp) null else bind) orelse return error.ListenFailed; defer { l.reset(p); l.deinit(gpa); @@ -1331,39 +1220,108 @@ test "Unix TCP and QUIC share one listener through reads writes reconnects and r var worker: Worker = .{ .dial = dial, .body_path = body, .expected = if (attempt == 0) "initial\n" else replacement, .replacement = replacement }; const thread = try std.Thread.spawn(.{}, Worker.run, .{&worker}); defer thread.join(); + // The editor rests while the client works: its requests are + // answered on the runner's tasks, not by this thread. const deadline = Client.nowMs() + 3 * Client.budget_ms; + pardes.turn.rest(); while (!worker.done.load(.acquire) and Client.nowMs() < deadline) { - _ = l.tick(p); + if (quic_enabled) { + pardes.turn.wake(); + _ = l.tick(); + pardes.turn.rest(); + } Client.nap(1); } + pardes.turn.wake(); try testing.expect(worker.done.load(.acquire)); if (worker.failure) |err| return err; l.reset(p); try testing.expectEqual(@as(usize, 0), l.runner.count()); - for (&l.slots) |*slot| try testing.expectEqual(@as(usize, 0), slot.len); for (&l.conns, 0..) |conn, i| try testing.expect(!l.live(@intCast(i)) and !conn.draining); for (p.fs.snapshots) |snapshot| try testing.expect(snapshot.node == 0); } }; } +test "a change waits while the editor is out mid-step, a read does not, and the change lands when the editor rests" { + if (comptime !supported) return error.SkipZigTest; + const gpa = testing.allocator; + var directory: [64:0]u8 = undefined; + _ = try std.fmt.bufPrintSentinel(&directory, "/tmp/pardes-park-XXXXXX", .{}, 0); + if (mkdtemp(&directory) == null) return error.TempDirectoryFailed; + defer _ = rmdir(&directory); + const old_runtime = if (libc.getenv("XDG_RUNTIME_DIR")) |v| try gpa.dupeZ(u8, std.mem.span(v)) else null; + defer { + if (old_runtime) |v| { + _ = setenv("XDG_RUNTIME_DIR", v, 1); + gpa.free(v); + } else _ = unsetenv("XDG_RUNTIME_DIR"); + } + try testing.expectEqual(@as(c_int, 0), setenv("XDG_RUNTIME_DIR", &directory, 1)); + + const p = try pardes.Pardes.init(gpa, .{ .tty_only = true, .cols = 40, .rows = 12 }); + defer p.deinit(); + const pane = try p.setTestFile("before\n"); + while (p.nextEffect()) |_| {} + // This thread is the editor's: it has the turn from here on. + const l = listen(testing.io, gpa, p, "park", "", null, null) orelse return error.ListenFailed; + defer { + l.reset(p); + l.deinit(gpa); + } + var body_buf: [64]u8 = undefined; + const body = try std.fmt.bufPrint(&body_buf, "/pane/{d}/body", .{pane.serial}); + + const Writer = struct { + dial: []const u8, + path: []const u8, + done: std.atomic.Value(bool) = .init(false), + failure: ?anyerror = null, + fn run(w: *@This()) void { + defer w.done.store(true, .release); + Client.write(testing.allocator, w.dial, w.path, "after\n") catch |err| { + w.failure = err; + }; + } + }; + var writer: Writer = .{ .dial = l.path(), .path = body }; + + // The editor goes out mid-step -- a Look resolving a path, say -- and a + // write arrives meanwhile. It must not land: the step still holds + // pointers into the pane. A read is answered all the same. + pardes.turn.yield(); + const thread = try std.Thread.spawn(.{}, Writer.run, .{&writer}); + defer thread.join(); + Client.nap(150); + try testing.expect(!writer.done.load(.acquire)); + const seen = try Client.readLimit(gpa, l.path(), body, body, 64); + defer gpa.free(seen); + try testing.expectEqualStrings("before\n", seen); + try testing.expect(!writer.done.load(.acquire)); + pardes.turn.back(); + try testing.expectEqualStrings("before\n", pane.file.?.content); + + // Resting is what lets it in: the parked write is retried, served, and + // the client hears back. + pardes.turn.rest(); + const deadline = Client.nowMs() + Client.budget_ms; + while (!writer.done.load(.acquire) and Client.nowMs() < deadline) Client.nap(1); + pardes.turn.wake(); + try testing.expect(writer.done.load(.acquire)); + if (writer.failure) |err| return err; + try testing.expectEqualStrings("after\n", pane.file.?.content); +} + extern "c" fn setenv(name: [*:0]const u8, value: [*:0]const u8, overwrite: c_int) c_int; extern "c" fn unsetenv(name: [*:0]const u8) c_int; pub fn start(io: std.Io, gpa: std.mem.Allocator, core: *pardes.Pardes) ?*Listener { var name: [16]u8 = undefined; const fallback = std.fmt.bufPrint(&name, "{d}", .{@as(u32, @intCast(libc.getpid()))}) catch unreachable; - const listener = listen(io, gpa, core.opts.ninep_name, fallback, core.opts.ninep_tcp, core.opts.ninep_quic) orelse { + return listen(io, gpa, core, core.opts.ninep_name, fallback, core.opts.ninep_tcp, core.opts.ninep_quic) orelse { core.reportError(0, "9p listener", error.ListenFailed); return null; }; - core.fs.socket_path = listener.path(); - // So the editor can recognise its own tree by name and refuse to walk into - // it through the mount, which would deadlock the loop that serves it. - pardes.filesystem.noteOwnSocket(listener.path()); - core.fs.tcp_address = listener.tcp_address; - core.fs.quic_address = listener.quic_address; - return listener; } /// What a pane shell is told about the editor above it, set into this @@ -1423,7 +1381,7 @@ test "9P shell environment states being inside pardes apart from how to reach it const listener = try testing.allocator.create(Listener); defer testing.allocator.destroy(listener); - listener.* = .{ .io = testing.io }; + listener.* = .{ .io = testing.io, .core = undefined }; // only its path is read const path = "/tmp/pardes-example.sock"; @memcpy(listener.path_buf[0..path.len], path); listener.path_len = path.len; @@ -1549,35 +1507,6 @@ pub const Client = struct { _ = try resolve(&buf, dial); } - pub fn sameSession(dial: []const u8, socket_path: []const u8, tcp_address: ?std.Io.net.IpAddress, quic_address: ?std.Io.net.IpAddress) bool { - if (comptime !supported) return false; - var buf: [sun_path_len]u8 = undefined; - const address = resolve(&buf, dial) catch return false; - switch (address) { - .unix => |path| return socket_path.len != 0 and std.mem.eql(u8, path, socket_path), - .tcp, .quic => |destination| { - var ip = destination; - switch (ip) { - .ip4 => |v4| if (std.mem.allEqual(u8, &v4.bytes, 0)) { - ip = .{ .ip4 = .loopback(v4.port) }; - }, - .ip6 => |v6| if (std.mem.allEqual(u8, &v6.bytes, 0)) { - ip = .{ .ip6 = .loopback(v6.port) }; - }, - } - const bound = canonicalIp((if (address == .tcp) tcp_address else quic_address) orelse return false); - if (ip.getPort() != bound.getPort() or @as(std.Io.net.IpAddress.Family, ip) != @as(std.Io.net.IpAddress.Family, bound)) return false; - if (ip.eql(&bound)) return true; - const wildcard = switch (bound) { - .ip4 => |v4| std.mem.allEqual(u8, &v4.bytes, 0), - .ip6 => |v6| std.mem.allEqual(u8, &v6.bytes, 0), - }; - if (wildcard) return localIp(ip); - return false; - }, - } - } - const Session = struct { fd: c_int, quic: if (quic_enabled) ?quic.Connection else void = if (quic_enabled) null else {}, diff --git a/src/CHANGELOG.md b/src/CHANGELOG.md index e518f97a..0083f97f 100644 --- a/src/CHANGELOG.md +++ b/src/CHANGELOG.md @@ -2,6 +2,19 @@ ## 0.0.3 +- Answer 9P on the connection's task instead of the editor's loop. The core + is single-threaded and `pardes.turn` says whose turn it is with it: the + editor's by default, given up while it waits for input and while a step of + it is out in a syscall, and taken by a connection task to answer a request. + A request that would change a pane while a step is out parks in the engine + and is retried when the editor rests. So a session can open, read and save + its own tree through a mount -- which used to hang it outright, and was + then refused by name -- and the name-based refusal, the in-process routing + of a mount of oneself and the mailbox that shipped every request to the + editor's thread are gone. +- A notice wider than its pane keeps its tail rather than its head: the end + of a message is the file name or the reason. + - Give pty children their own terminal identity. `TERM`, `COLORTERM` and `TERM_PROGRAM` are now written by pardes rather than inherited from whatever launched it, and the child is exec'd with that environment. A macOS `.app` diff --git a/src/detached/server.zig b/src/detached/server.zig index ac9af2ee..3e98fc9d 100644 --- a/src/detached/server.zig +++ b/src/detached/server.zig @@ -156,7 +156,8 @@ pub const Session = struct { inotify_fd: c_int = -1, ninep: ?*ninep_io.Listener = null, ninep_pending: bool = false, - /// Set by the 9P runner's tasks: a request waits for `tick`. + /// A 9P request changed the core since the wake byte was last drained: + /// the next poll returns at once, to draw it. ninep_wake: std.atomic.Value(bool) = .init(false), watches: file_watch.Table = @splat(null), check_files: bool = false, @@ -240,7 +241,7 @@ pub const Session = struct { file_watch.watchPane(s.inotify_fd, &s.watches, @intCast(pane), null, 0, .{ .text = 0 }); _ = file_watch.applyThemeEffect(s.core, s.gpa, s.inotify_fd, &s.watches, 0, false, false); s.check_files = false; - if (s.ninep) |listener| listener.reset(s.core); + if (s.ninep) |listener| listener.reset(replacement); s.ninep_pending = false; replacement.host = s.host(); s.core.deinit(); @@ -587,7 +588,7 @@ pub const Session = struct { if (s.origins()) |c| s.send(c, .detach); } - /// The 9P runner has a request for `tick`: wake the poll loop. + /// A 9P request changed the core: wake the poll loop to draw it. fn wakeNinep(ctx: ?*anyopaque) void { const s = of(ctx); s.ninep_wake.store(true, .release); @@ -596,7 +597,7 @@ pub const Session = struct { fn pollFrame(ctx: ?*anyopaque) void { const s = of(ctx); - if (s.ninep) |l| s.ninep_pending = l.tick(s.core).pending; + if (s.ninep) |l| s.ninep_pending = l.tick().pending; for (&s.ptys, 0..) |*pt, pane| { if (pt.fd < 0) continue; var lbuf: [pardes.memory.limits.host_path_cap + 1]u8 = undefined; @@ -805,11 +806,18 @@ pub const Session = struct { } } } - if (n == 0) return nap(if (timeout_ms == 0) 16 else timeout_ms); + // The wait is the 9P connections' turn with the core. + if (n == 0) { + pardes.turn.rest(); + defer pardes.turn.wake(); + return nap(if (timeout_ms == 0) 16 else timeout_ms); + } var timeout: c_int = if (timeout_ms == 0) -1 else @intCast(@min(timeout_ms, std.math.maxInt(c_int))); if (s.nextWake(now)) |due| timeout = if (timeout < 0) due else @min(timeout, due); if (completed or s.check_files or regridded or s.ninep_pending) timeout = 0; + pardes.turn.rest(); const ready = libc.poll(&fds, @intCast(n), timeout); + pardes.turn.wake(); if (ready > 0) s.dispatch(fds[0..n], src[0..n]); _ = s.drainCompletions(true); s.expire(monotonicMs()); @@ -1134,18 +1142,17 @@ pub fn run(init: std.process.Init, opts: pardes.Options, name: []const u8) !void return error.NoSocket; } - session.ninep = ninep_io.listen(init.io, gpa, opts.ninep_name, name, opts.ninep_tcp, opts.ninep_quic); + session.ninep = ninep_io.listen(init.io, gpa, core, opts.ninep_name, name, opts.ninep_tcp, opts.ninep_quic); if (session.ninep == null) return error.ListenFailed; - session.ninep.?.setWake(&session, Session.wakeNinep); - core.fs.socket_path = session.ninep.?.path(); - core.fs.tcp_address = session.ninep.?.tcp_address; - core.fs.quic_address = session.ninep.?.quic_address; + session.ninep.?.wake_ctx = &session; + session.ninep.?.wake = Session.wakeNinep; const h = session.host(); core.host = h; while (core.nextEffect()) |effect| core.perform(effect); session.in_loop = true; while (!session.core.quit) { + pardes.turn.restoreSettled(); try session.core.pump(h); if (session.core.quit) break; if (session.core.takeRestore()) |path| restore: { diff --git a/src/detached/wire.zig b/src/detached/wire.zig index 6805d980..20b5c093 100644 --- a/src/detached/wire.zig +++ b/src/detached/wire.zig @@ -509,7 +509,7 @@ const Ul = @FieldType(pardes.CellStyle, "ul"); /// which is the whole property the six hand-written switches this replaced /// existed for, in a form that cannot fall out of step. A variant that has to /// travel under a DIFFERENT name than the core's gets an arm of its own before -/// the `inline else`, exactly as `clientTag` keeps `.fs_req`. +/// 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))), @@ -819,7 +819,7 @@ fn clientTag(msg: ClientMsg) ClientTag { return switch (msg) { .event => |ev| switch (ev) { // Machine-local reports and 9P requests belong to the session owner. - .output, .eof, .lsp_resp, .pipe_resp, .file_changed, .tick, .fs_req => unreachable, + .output, .eof, .lsp_resp, .pipe_resp, .file_changed, .tick => unreachable, inline else => |_, t| @field(ClientTag, @tagName(t)), }, inline else => |_, t| @field(ClientTag, @tagName(t)), @@ -946,7 +946,7 @@ pub fn encodeClient(out: []u8, msg: ClientMsg) Error![]const u8 { .touch_scroll => |v| try w.putF32(v), .pointer_leave => {}, // See `clientTag`: no tag, so nothing to encode. - .output, .eof, .lsp_resp, .pipe_resp, .file_changed, .tick, .fs_req => unreachable, + .output, .eof, .lsp_resp, .pipe_resp, .file_changed, .tick => unreachable, }, } try finishMessage(&w, at); @@ -1076,7 +1076,7 @@ pub fn clientBound(msg: ClientMsg) usize { .paste => |b| b.len, .command => |line| line.len, // See `clientTag`: not on this wire in this direction. - .output, .eof, .lsp_resp, .pipe_resp, .file_changed, .tick, .fs_req => unreachable, + .output, .eof, .lsp_resp, .pipe_resp, .file_changed, .tick => unreachable, }, }; } diff --git a/src/file_watch.zig b/src/file_watch.zig index b2908eb7..dfcce65f 100644 --- a/src/file_watch.zig +++ b/src/file_watch.zig @@ -382,6 +382,10 @@ fn watchPath( } const declared_path = path orelse return; const watched_path = filesystem.localPath(declared_path) orelse return; + // The path may lie in a mount this editor serves, and marking it is a + // stat and a lookup out there: the turn goes out with them. + pardes.turn.yield(); + defer pardes.turn.back(); const stat = std.Io.Dir.cwd().statFile(std.Io.Threaded.global_single_threaded.io(), watched_path, .{}) catch null; const dir = if (stat != null and stat.?.kind == .directory) watched_path else std.fs.path.dirname(watched_path) orelse "."; var dir_buf: [4096:0]u8 = undefined; @@ -601,6 +605,8 @@ pub fn reloadTheme( pub fn identify(io: std.Io, path: []const u8) !Identity { const native = filesystem.localPath(path) orelse return error.NonLocalPath; + pardes.turn.yield(); + defer pardes.turn.back(); const stat = try std.Io.Dir.cwd().statFile(io, native, .{}); if (stat.kind != .file) return error.NotFile; return .{ diff --git a/src/fs.zig b/src/fs.zig index 9200236d..85eae825 100644 --- a/src/fs.zig +++ b/src/fs.zig @@ -64,10 +64,9 @@ pub const WriteError = error{ WriteFailed, }; +/// The host takes the bytes. The caller has given the turn up (`write`), +/// because the path may be a mount this editor serves. pub fn writeFile(path: []const u8, bytes: []const u8) WriteError!void { - // No core here to answer from, so the only safe answer is no answer: an - // open(2) into our own mount is the call that never returns. - if (isOwnMount(path)) return error.OpenFailed; var pathbuf: [4096:0]u8 = undefined; if (path.len >= pathbuf.len) return error.PathTooLong; if (std.mem.indexOfScalar(u8, path, 0) != null) return error.OpenFailed; @@ -124,12 +123,21 @@ fn osNode(p: *pardes.Pardes, path: []const u8) !u64 { return node; } +/// The host filesystem under /os. Every syscall here may go out through a +/// mount this editor serves, so the turn is given up around each and taken +/// back before the core is touched; `path` is the table entry's own copy and +/// outlives the yield, and nothing is staged into the shared reply buffer +/// until the turn is back. pub fn osHandle(p: *pardes.Pardes, req: Req) Reply { if (comptime !platform_has_fs) return Reply.fail(req.tag, E.NOENT); const path = osPath(p, req.node) orelse return Reply.fail(req.tag, E.NOENT); if (req.op == .release) return .{ .tag = req.tag }; const io = std.Io.Threaded.global_single_threaded.io(); - const stat = std.Io.Dir.cwd().statFile(io, path, .{}) catch return Reply.fail(req.tag, E.NOENT); + const stat = stat: { + pardes.turn.yield(); + defer pardes.turn.back(); + break :stat std.Io.Dir.cwd().statFile(io, path, .{}) catch return Reply.fail(req.tag, E.NOENT); + }; const attr: Reply.Attr = .{ .name = if (req.node == os_root) "os" else std.fs.path.basename(path), .node = req.node, .dir = stat.kind == .directory, .size = stat.size, .mode = if (stat.kind == .directory) 0o755 else 0o644, .mtime = std.math.cast(u32, stat.mtime.toSeconds()) orelse 0 }; switch (req.op) { .getattr => return .{ .tag = req.tag, .attr = attr }, @@ -150,52 +158,67 @@ pub fn osHandle(p: *pardes.Pardes, req: Req) Reply { return osHandle(p, .{ .tag = req.tag, .op = .getattr, .node = node }); }, .readdir => { - var dir = std.Io.Dir.cwd().openDir(io, path, .{ .iterate = true }) catch return Reply.fail(req.tag, E.NOTDIR); - defer dir.close(io); - var it = dir.iterate(); - const out = p.fs.stage(p.gpa); - var skip = req.off; - while (it.next(io) catch return Reply.fail(req.tag, E.IO)) |entry| { - var buf: [4096]u8 = undefined; - const joined = std.fmt.bufPrint(&buf, "{s}/{s}", .{ std.mem.trimEnd(u8, path, "/"), entry.name }) catch continue; - var normalized_buf: [4096]u8 = undefined; - const normalized = resolveOs(joined, &normalized_buf) orelse continue; - const child = dir.statFile(io, entry.name, .{}) catch continue; - if (skip > 0) { - skip -= 1; - continue; + // Listed into a buffer of this request's own first; the shared + // reply buffer is another request's to use while the turn is out. + var listing: [16 * 1024]u8 = undefined; + var fixed: std.heap.FixedBufferAllocator = .init(&listing); + var listed: std.ArrayList(u8) = .empty; + { + pardes.turn.yield(); + defer pardes.turn.back(); + var dir = std.Io.Dir.cwd().openDir(io, path, .{ .iterate = true }) catch return Reply.fail(req.tag, E.NOTDIR); + defer dir.close(io); + var it = dir.iterate(); + var skip = req.off; + while (it.next(io) catch return Reply.fail(req.tag, E.IO)) |entry| { + var buf: [4096]u8 = undefined; + const joined = std.fmt.bufPrint(&buf, "{s}/{s}", .{ std.mem.trimEnd(u8, path, "/"), entry.name }) catch continue; + var normalized_buf: [4096]u8 = undefined; + const normalized = resolveOs(joined, &normalized_buf) orelse continue; + const child = dir.statFile(io, entry.name, .{}) catch continue; + if (skip > 0) { + skip -= 1; + continue; + } + const node = if (std.mem.eql(u8, normalized.path, "/")) os_root else os_node | (std.hash.Wyhash.hash(0, normalized.path) & (os_node - 1)); + tree.stageDirent(&listed, fixed.allocator(), node, child.kind == .directory, entry.name); + if (listed.items.len >= @max(req.size, 512)) break; } - const node = if (std.mem.eql(u8, normalized.path, "/")) os_root else os_node | (std.hash.Wyhash.hash(0, normalized.path) & (os_node - 1)); - tree.stageDirent(out, p.gpa, node, child.kind == .directory, entry.name); - if (out.items.len >= @max(req.size, 512)) break; } + const out = p.fs.stage(p.gpa); + out.appendSlice(p.gpa, listed.items) catch return Reply.fail(req.tag, E.NOMEM); return .{ .tag = req.tag, .payload = .{ .staged = @intCast(out.items.len) } }; }, .read, .write, .setattr => { if (stat.kind != .file) return Reply.fail(req.tag, E.PERM); var z: [4096]u8 = undefined; const path_z = std.fmt.bufPrintSentinel(&z, "{s}", .{path}, 0) catch return Reply.fail(req.tag, E.NOENT); - const fd = libc.open(path_z, .{ .ACCMODE = if (req.op == .read) .RDONLY else .WRONLY, .NONBLOCK = true, .CLOEXEC = true }); - if (fd < 0) return Reply.fail(req.tag, E.PERM); - defer _ = libc.close(fd); - if (req.op == .setattr) { - if (!req.truncate or req.off != 0 or libc.ftruncate(fd, 0) != 0) return Reply.fail(req.tag, E.INVAL); - var truncated = attr; - truncated.size = 0; - return .{ .tag = req.tag, .attr = truncated }; - } - if (req.off > std.math.maxInt(i64)) return Reply.fail(req.tag, E.INVAL); - if (libc.lseek(fd, @intCast(req.off), libc.SEEK.SET) < 0) return Reply.fail(req.tag, E.IO); - if (req.op == .write) { - const written = libc.write(fd, req.data.ptr, req.data.len); - if (written < 0) return Reply.fail(req.tag, E.IO); - return .{ .tag = req.tag, .written = @intCast(written) }; - } + var buf: [ninep_io.msize]u8 = undefined; // a read never asks for more than a frame + const got = io: { + pardes.turn.yield(); + defer pardes.turn.back(); + const fd = libc.open(path_z, .{ .ACCMODE = if (req.op == .read) .RDONLY else .WRONLY, .NONBLOCK = true, .CLOEXEC = true }); + if (fd < 0) return Reply.fail(req.tag, E.PERM); + defer _ = libc.close(fd); + if (req.op == .setattr) { + if (!req.truncate or req.off != 0 or libc.ftruncate(fd, 0) != 0) return Reply.fail(req.tag, E.INVAL); + var truncated = attr; + truncated.size = 0; + return .{ .tag = req.tag, .attr = truncated }; + } + if (req.off > std.math.maxInt(i64)) return Reply.fail(req.tag, E.INVAL); + if (libc.lseek(fd, @intCast(req.off), libc.SEEK.SET) < 0) return Reply.fail(req.tag, E.IO); + if (req.op == .write) { + const written = libc.write(fd, req.data.ptr, req.data.len); + if (written < 0) return Reply.fail(req.tag, E.IO); + return .{ .tag = req.tag, .written = @intCast(written) }; + } + const got = libc.read(fd, &buf, @min(req.size, buf.len)); + if (got < 0) return Reply.fail(req.tag, E.IO); + break :io @as(usize, @intCast(got)); + }; const out = p.fs.stage(p.gpa); - out.resize(p.gpa, @min(req.size, 65536)) catch return Reply.fail(req.tag, E.NOMEM); - const got = libc.read(fd, out.items.ptr, out.items.len); - if (got < 0) return Reply.fail(req.tag, E.IO); - out.shrinkRetainingCapacity(@intCast(got)); + out.appendSlice(p.gpa, buf[0..got]) catch return Reply.fail(req.tag, E.NOMEM); return .{ .tag = req.tag, .payload = .{ .staged = @intCast(got) } }; }, else => return Reply.fail(req.tag, E.PERM), @@ -378,21 +401,22 @@ test "bounded reads accept exact OS file lengths and empty files" { const empty = try readLimit(p, explicit, 0); defer gpa.free(empty); try std.testing.expectEqual(@as(usize, 0), empty.len); - try std.testing.expectEqual(@as(usize, 0), p.fs.os_paths.items.len); + // The directory's node stays in the table for the listener to collect + // once no connection names it (src/9p_io.zig, collectOs): a client may + // have walked to the same directory meanwhile and hold it by that node. + try std.testing.expectEqual(@as(usize, 1), p.fs.os_paths.items.len); + try std.testing.expectEqualStrings(native, p.fs.os_paths.items[0].path); } test "bounded reads apply the same limits to self bodies and embedded sources" { const gpa = std.testing.allocator; const p = try Pardes.init(gpa, .{ .tty_only = true }); defer p.deinit(); - p.fs.socket_path = "/tmp/pardes-limited-in-process.sock"; - try p.fs.mount(gpa, "own", p.fs.socket_path); var contents: [8209]u8 = @splat('x'); contents[contents.len - 1] = '\n'; for ([_][]const u8{ &contents, "" }) |expected| { const pane = try p.setTestFile(expected); - for ([_][]const u8{ "/virtual", "/n/self", "/n/own" }) |prefix| { - if (!platform_has_fs and std.mem.eql(u8, prefix, "/n/own")) continue; + for ([_][]const u8{ "/virtual", "/n/self" }) |prefix| { var path_buf: [128]u8 = undefined; const path = try std.fmt.bufPrint(&path_buf, "{s}/pane/{d}/body", .{ prefix, pane.serial }); const bytes = try readLimit(p, path, expected.len); @@ -407,8 +431,7 @@ test "bounded reads apply the same limits to self bodies and embedded sources" { } if (limits.embedded_sources) { const source = findEmbeddedSource("src/look.zig", false).?; - for ([_][]const u8{ "/virtual/src/look.zig", "/n/self/src/look.zig", "/n/own/src/look.zig" }) |path| { - if (!platform_has_fs and std.mem.startsWith(u8, path, "/n/own/")) continue; + for ([_][]const u8{ "/virtual/src/look.zig", "/n/self/src/look.zig" }) |path| { const bytes = try readLimit(p, path, source.contents.len); defer gpa.free(bytes); try std.testing.expectEqualStrings(source.contents, bytes); @@ -425,10 +448,8 @@ test "bounded reads count rendered directory paths and unknown self lengths" { const gpa = std.testing.allocator; const p = try Pardes.init(gpa, .{ .tty_only = true }); defer p.deinit(); - p.fs.socket_path = "/tmp/pardes-limited-in-process.sock"; - try p.fs.mount(gpa, "own", p.fs.socket_path); - for ([_][]const u8{ "/n", "/virtual", "/n/self", "/n/own", "/n/own/pane", "/virtual/listeners", "/virtual/README" }) |path| { - if (!platform_has_fs and std.mem.startsWith(u8, path, "/n/own")) continue; + p.fs.socket_path = "/tmp/pardes-limited-in-process.sock"; // so listeners has a line + for ([_][]const u8{ "/n", "/virtual", "/n/self", "/virtual/pane", "/virtual/listeners", "/virtual/README" }) |path| { const expected = try read(p, path); defer gpa.free(expected); try std.testing.expect(expected.len > 0); @@ -573,49 +594,6 @@ test "virtual body writes can read their input from the same pane" { try std.testing.expectEqualStrings("pane contents\n", pane.file.?.content); } -test "same-core mount directories preserve their mount prefix across reads" { - if (!platform_has_fs) return error.SkipZigTest; - const gpa = std.testing.allocator; - const p = try pardes.Pardes.init(gpa, .{ .tty_only = true }); - defer p.deinit(); - const socket_path = "/tmp/pardes-in-process-mount.sock"; - p.fs.socket_path = socket_path; - try p.fs.mount(gpa, "own", socket_path); - const roots = try read(p, "/n/own"); - defer gpa.free(roots); - try std.testing.expect(std.mem.startsWith(u8, roots, "/n/own/README\n/n/own/index\n")); - try std.testing.expect(std.mem.indexOf(u8, roots, "/n/own/pane/\n/n/own/os/\n") != null); - try std.testing.expectError(error.NotADirectory, read(p, "/n/own/index/..")); - try std.testing.expectError(error.FileNotFound, read(p, "/n/own/self/index")); - - var tmp = std.testing.tmpDir(.{}); - defer tmp.cleanup(); - for (0..520) |i| { - var name: [32]u8 = undefined; - try tmp.dir.writeFile(std.testing.io, .{ .sub_path = try std.fmt.bufPrint(&name, "entry-{d:0>4}.txt", .{i}), .data = "child\n" }); - } - var directory_buffer: [4096]u8 = undefined; - const directory = directory_buffer[0..try tmp.dir.realPath(std.testing.io, &directory_buffer)]; - const held_node = try osNode(p, directory); - const path = try std.fmt.allocPrint(gpa, "/n/own/os{s}", .{directory}); - defer gpa.free(path); - const listing = try read(p, path); - defer gpa.free(listing); - var entries = std.mem.tokenizeScalar(u8, listing, '\n'); - var count: usize = 0; - while (entries.next()) |entry| { - try std.testing.expect(std.mem.startsWith(u8, entry, path)); - const child = try read(p, entry); - defer gpa.free(child); - try std.testing.expectEqualStrings("child\n", child); - try std.testing.expectEqual(@as(usize, 1), p.fs.os_paths.items.len); - count += 1; - } - try std.testing.expectEqual(@as(usize, 520), count); - try std.testing.expectEqual(held_node, p.fs.os_paths.items[0].node); - try std.testing.expectEqualStrings(directory, p.fs.os_paths.items[0].path); -} - pub fn isVirtual(path: []const u8) bool { return std.mem.eql(u8, path, "/virtual") or std.mem.startsWith(u8, path, "/virtual/") or std.mem.eql(u8, path, "/n") or std.mem.startsWith(u8, path, "/n/"); @@ -674,9 +652,6 @@ pub fn resolve(p: ?*pardes.Pardes, word: []const u8, cwd: []const u8, out: *[409 } if (std.mem.eql(u8, joined, "/virtual")) return resolveVirtual(p, "/", out); if (std.mem.startsWith(u8, joined, "/virtual/")) return resolveVirtual(p, joined[8..], out); - // This editor's own tree, seen through a mount: answer from the tree - // instead of walking out into the view and back in. - if (ownMountSuffix(joined)) |inner| return resolveVirtual(p, inner, out); if (resolveOs(joined, out)) |found| return found; if (resolveVirtual(p, joined, out)) |found| return found; if (resolveVirtual(p, word, out)) |found| return found; @@ -687,116 +662,15 @@ pub fn resolve(p: ?*pardes.Pardes, word: []const u8, cwd: []const u8, out: *[409 return null; } -/// The name this session is posted under, taken from its socket path. -/// As wide as a name a listener will accept, so there is no session whose -/// name is too long to recognise and therefore too long to protect. -var own_name_buf: [108]u8 = undefined; -var own_name_len: usize = 0; - -pub fn noteOwnSocket(socket_path: []const u8) void { - own_name_len = 0; - const base = std.fs.path.basename(socket_path); - const head = "pardes-9p-"; - const tail = ".sock"; - if (!std.mem.startsWith(u8, base, head) or !std.mem.endsWith(u8, base, tail)) return; - const name = base[head.len .. base.len - tail.len]; - if (name.len == 0 or name.len > own_name_buf.len) return; - @memcpy(own_name_buf[0..name.len], name); - own_name_len = name.len; -} - -/// What this path names inside this editor's OWN 9P tree, if it does: -/// `/mnt/9p/pardes//pane/3/body` -> `pane/3/body`, and the mount root -/// itself -> `/`. -/// -/// A mount is a VIEW of a tree this editor already holds. Going out through -/// the view to reach it deadlocks the session outright -- the realpath, the -/// stat and the read all leave through the mount and come back as 9P requests -/// only this editor's loop can answer, while that loop is blocked making them, -/// and the filesystem then stops answering anybody. So the view is recognised -/// by NAME, before any syscall (the syscall is the thing that never returns), -/// and the request is served from the tree directly. Same answer, no round -/// trip, and a session can drive itself through its own 9P namespace. -pub fn ownMountSuffix(path: []const u8) ?[]const u8 { - if (own_name_len == 0 or path.len == 0 or path[0] != '/') return null; - // Whole components, and the registry's own layout: a session is posted at - // `/9p/pardes/` and mounts group under `/mnt/9p/pardes/`. - // Matching a bare `/pardes/` anywhere in the string would claim - // `~/src/pardes//README` -- an ordinary directory that happens to - // read like a mount -- and serve the tree's README over the real file. - var buf: [own_name_buf.len + 16]u8 = undefined; - const stem = std.fmt.bufPrint(&buf, "/9p/pardes/{s}", .{own_name_buf[0..own_name_len]}) catch return null; - var at: usize = 0; - while (std.mem.indexOfPos(u8, path, at, stem)) |found| : (at = found + 1) { - const rest = path[found + stem.len ..]; - if (rest.len != 0 and rest[0] != '/') continue; // a longer name that merely starts the same - if (rest.len <= 1) return "/"; - return rest[1..]; - } - return null; -} - -pub fn isOwnMount(path: []const u8) bool { - return ownMountSuffix(path) != null; -} - -test "a path inside this session's own mount is answered from the tree, not through the mount" { - noteOwnSocket("/run/user/1000/pardes-9p-demo.sock"); - defer own_name_len = 0; - // What the path names inside the tree, with the mount prefix taken off. - try std.testing.expectEqualStrings("index", ownMountSuffix("/mnt/9p/pardes/demo/index").?); - try std.testing.expectEqualStrings("pane/new", ownMountSuffix("/mnt/9p/pardes/demo/pane/new").?); - try std.testing.expectEqualStrings("/", ownMountSuffix("/mnt/9p/pardes/demo").?); - try std.testing.expectEqualStrings("/", ownMountSuffix("/mnt/9p/pardes/demo/").?); - // The registry posts the session there too, so that spelling counts. - try std.testing.expectEqualStrings("index", ownMountSuffix("/run/user/1000/9p/pardes/demo/index").?); - // Another session's mount is somebody else's to answer, and a name that - // merely STARTS with ours is a different name. - try std.testing.expect(ownMountSuffix("/mnt/9p/pardes/other/index") == null); - try std.testing.expect(ownMountSuffix("/mnt/9p/pardes/demo2/index") == null); - // An ordinary directory that reads like a mount is an ordinary directory. - // Serving the tree here would hand back the tree's README for the file on - // disk, and -- before `write` learned the same trick -- write the tree's - // bytes over it. - try std.testing.expect(ownMountSuffix("/home/goblin/src/pardes/demo/README") == null); - try std.testing.expect(ownMountSuffix("/home/goblin/src/pardes/demo.zig") == null); - // Relative paths never name a mount: they are resolved against a cwd first. - try std.testing.expect(ownMountSuffix("mnt/9p/pardes/demo/index") == null); - - // The syscall is the thing that never returns, so it is never made. - var out: [4096]u8 = undefined; - try std.testing.expect(resolveOs("/mnt/9p/pardes/demo/index", &out) == null); - - // A session with no listener has no name, so nothing is redirected. - noteOwnSocket("/tmp/not-a-pardes-socket"); - try std.testing.expect(ownMountSuffix("/mnt/9p/pardes/demo/index") == null); -} - -test "reading this session's own mount returns what the tree holds" { - const p = try pardes.Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 80, .rows = 24 }); - defer p.deinit(); - noteOwnSocket("/run/user/1000/pardes-9p-selfread.sock"); - defer own_name_len = 0; - - const direct = try read(p, "/n/self/index"); - defer p.gpa.free(direct); - const mounted = try read(p, "/mnt/9p/pardes/selfread/index"); - defer p.gpa.free(mounted); - try std.testing.expectEqualStrings(direct, mounted); - try std.testing.expect(direct.len > 0); - - // A write goes to the same tree the read came from, not out through the - // mount: `/index` is 0400 there, and an OS write would instead try to - // create a file under a directory that does not exist. - try std.testing.expectError(error.ReadOnlyFilesystem, write(p, "/mnt/9p/pardes/selfread/index", "nope\n")); - try std.testing.expectError(error.ReadOnlyFilesystem, write(p, "/n/self/index", "nope\n")); -} - +/// Where a path really is on the host, and whether it is a directory. The +/// path may lie in a mount this editor serves, so the turn is given up for +/// the syscalls: another thread answers them. pub fn resolveOs(path: []const u8, out: *[4096]u8) ?Resolved { if (comptime !platform_has_fs) return null; - if (isOwnMount(path)) return null; var z: [4096]u8 = undefined; const path_z = std.fmt.bufPrintSentinel(&z, "{s}", .{path}, 0) catch return null; + pardes.turn.yield(); + defer pardes.turn.back(); const resolved = realpath(path_z, out) orelse return null; return .{ .path = std.mem.span(resolved), .dir = isDir(resolved) }; } @@ -818,13 +692,6 @@ pub fn read(p: *pardes.Pardes, path: []const u8) ![]u8 { } pub fn readLimit(p: *pardes.Pardes, path: []const u8, max_bytes: usize) ![]u8 { - // The same view, reached by a reader that never went through `resolve`. - // The rewritten path cannot contain the mount stem, so this recurses once. - if (ownMountSuffix(path)) |inner| { - var self_buf: [4096]u8 = undefined; - const internal = std.fmt.bufPrint(&self_buf, "/n/self/{s}", .{inner}) catch return error.FileTooLarge; - return readLimit(p, internal, max_bytes); - } const limit = @min(max_bytes, limits.max_file_bytes); if (std.mem.eql(u8, std.mem.trimEnd(u8, path, "/"), "/n")) { var out: std.Io.Writer.Allocating = .init(p.gpa); @@ -847,11 +714,8 @@ pub fn readLimit(p: *pardes.Pardes, path: []const u8, max_bytes: usize) ![]u8 { var native_buf: [4096]u8 = undefined; const native = resolveOs(remote_path, &native_buf) orelse return readFileLimit(p.gpa, path, limit); if (!native.dir) return readFileLimit(p.gpa, path, limit); - const saved_paths = p.fs.os_paths.items.len; - defer { - for (p.fs.os_paths.items[saved_paths..]) |temporary| p.gpa.free(temporary.path); - p.fs.os_paths.shrinkRetainingCapacity(saved_paths); - } + // The node stays in the table until no connection names it either + // (src/9p_io.zig, collectOs): a client may have walked to it too. const node = try osNode(p, native.path); return readNode(p, node, path, limit); } @@ -861,25 +725,10 @@ pub fn readLimit(p: *pardes.Pardes, path: []const u8, max_bytes: usize) ![]u8 { } for (p.fs.mounts.items) |mount| { if (!std.mem.eql(u8, name, mount.name)) continue; - if (ninep_io.Client.sameSession(mount.dial, p.fs.socket_path, p.fs.tcp_address, p.fs.quic_address)) { - const saved_paths = p.fs.os_paths.items.len; - defer { - for (p.fs.os_paths.items[saved_paths..]) |temporary| p.gpa.free(temporary.path); - p.fs.os_paths.shrinkRetainingCapacity(saved_paths); - } - var node = tree.root; - var directory = true; - var parts = std.mem.tokenizeScalar(u8, remote_path, '/'); - while (parts.next()) |part| { - if (!directory) return error.NotADirectory; - if (std.mem.eql(u8, part, ".")) continue; - const reply = tree.handle(p, .{ .tag = 0, .op = .lookup, .node = node, .data = part }); - if (reply.status != .ok) return error.FileNotFound; - node = reply.attr.node; - directory = reply.attr.dir; - } - return readNode(p, node, path, limit); - } + // A peer answers on its own time, and the peer may be this very + // editor: the turn goes out with the request. + pardes.turn.yield(); + defer pardes.turn.back(); return ninep_io.Client.readLimit(p.gpa, mount.dial, remote_path, path, limit); } return error.FileNotFound; @@ -940,68 +789,64 @@ fn readNode(p: *pardes.Pardes, initial_node: u64, path: []const u8, limit: usize } } +/// The editor's, between steps: a save or a dump the shell is performing, +/// never a step of the core. pub fn write(p: *pardes.Pardes, path: []const u8, bytes: []const u8) !void { - // The same view `readLimit` answers from the tree, so a write lands where - // the matching read came from -- and, just as importantly, never becomes - // an open(2) through a mount this loop is the one that answers. - if (ownMountSuffix(path)) |inner| { - var self_buf: [4096]u8 = undefined; - const internal = std.fmt.bufPrint(&self_buf, "/n/self/{s}", .{inner}) catch return error.PathTooLong; - return write(p, internal, bytes); - } if (std.mem.eql(u8, std.mem.trimEnd(u8, path, "/"), "/n")) return error.IsDirectory; - var self_path: ?[]const u8 = null; - if (std.mem.eql(u8, path, "/virtual")) self_path = ""; - if (std.mem.startsWith(u8, path, "/virtual/")) self_path = path[9..]; - if (std.mem.startsWith(u8, path, "/n/")) { - const explicit = path[3..]; - const cut = std.mem.indexOfScalar(u8, explicit, '/') orelse explicit.len; - const name = explicit[0..cut]; - const remote_path = if (cut < explicit.len) explicit[cut..] else "/"; - if (std.mem.eql(u8, name, "os")) return writeFile(remote_path, bytes); - if (std.mem.eql(u8, name, "self")) { - self_path = remote_path; - } else { - for (p.fs.mounts.items) |mount| { - if (!std.mem.eql(u8, name, mount.name)) continue; - if (ninep_io.Client.sameSession(mount.dial, p.fs.socket_path, p.fs.tcp_address, p.fs.quic_address)) { - var buf: [4096]u8 = undefined; - const local = try std.fmt.bufPrint(&buf, "/n{s}", .{remote_path}); - return write(p, local, bytes); - } - return ninep_io.Client.write(p.gpa, mount.dial, remote_path, bytes); - } - return error.FileNotFound; - } + if (std.mem.eql(u8, path, "/virtual")) return writeSelf(p, "", bytes); + if (std.mem.startsWith(u8, path, "/virtual/")) return writeSelf(p, path[9..], bytes); + if (!std.mem.startsWith(u8, path, "/n/")) return writeOut(p, null, path, bytes); + const explicit = path[3..]; + const cut = std.mem.indexOfScalar(u8, explicit, '/') orelse explicit.len; + const name = explicit[0..cut]; + const remote_path = if (cut < explicit.len) explicit[cut..] else "/"; + if (std.mem.eql(u8, name, "os")) return writeOut(p, null, remote_path, bytes); + if (std.mem.eql(u8, name, "self")) return writeSelf(p, remote_path, bytes); + for (p.fs.mounts.items) |mount| { + if (std.mem.eql(u8, name, mount.name)) return writeOut(p, mount.dial, remote_path, bytes); } - if (self_path) |name| { - var node = tree.resolveSelf(p, name) orelse return error.FileNotFound; - const attributes = tree.handle(p, .{ .tag = 0, .op = .getattr, .node = node }); - if (attributes.status != .ok) return error.FileNotFound; - if (attributes.attr.dir) return error.IsDirectory; - if (attributes.attr.mode & 0o200 == 0) return error.ReadOnlyFilesystem; - const opened = tree.handle(p, .{ .tag = 0, .op = .open, .node = node }); - if (opened.status != .ok) return error.OpenFailed; - if (opened.attr.node != 0) node = opened.attr.node; - defer _ = tree.handle(p, .{ .tag = 0, .op = .release, .node = node, .handle = opened.handle }); - var preserved: ?[]u8 = null; - defer if (preserved) |copy| p.gpa.free(copy); - const target = tree.Node.target(node); - if (target != null and target.? == .pane and target.?.pane.file == .body) { - preserved = try p.gpa.dupe(u8, bytes); - const trunc = tree.handle(p, .{ .tag = 0, .op = .setattr, .node = node, .truncate = true }); - if (trunc.status != .ok) return error.WriteFailed; - } - const contents = preserved orelse bytes; - var off: usize = 0; - while (off < contents.len) { - const reply = tree.handle(p, .{ .tag = 0, .op = .write, .node = node, .off = off, .data = contents[off..] }); - if (reply.status != .ok or reply.written == 0) return error.WriteFailed; - off += reply.written; - } - return; + return error.FileNotFound; +} + +/// The host, or the peer at `dial`, takes the bytes with the turn given up +/// entirely -- the peer may be this very editor, and a write it serves may +/// change any pane -- so they are copied first: `bytes` is usually a pane's +/// own text. +fn writeOut(p: *pardes.Pardes, dial: ?[]const u8, path: []const u8, bytes: []const u8) !void { + const copy = try p.gpa.dupe(u8, bytes); + defer p.gpa.free(copy); + pardes.turn.rest(); + defer pardes.turn.wake(); + if (dial) |d| return ninep_io.Client.write(p.gpa, d, path, copy); + return writeFile(path, copy); +} + +/// This editor's own tree, written in place. +fn writeSelf(p: *pardes.Pardes, name: []const u8, bytes: []const u8) !void { + var node = tree.resolveSelf(p, name) orelse return error.FileNotFound; + const attributes = tree.handle(p, .{ .tag = 0, .op = .getattr, .node = node }); + if (attributes.status != .ok) return error.FileNotFound; + if (attributes.attr.dir) return error.IsDirectory; + if (attributes.attr.mode & 0o200 == 0) return error.ReadOnlyFilesystem; + const opened = tree.handle(p, .{ .tag = 0, .op = .open, .node = node }); + if (opened.status != .ok) return error.OpenFailed; + if (opened.attr.node != 0) node = opened.attr.node; + defer _ = tree.handle(p, .{ .tag = 0, .op = .release, .node = node, .handle = opened.handle }); + var preserved: ?[]u8 = null; + defer if (preserved) |copy| p.gpa.free(copy); + const target = tree.Node.target(node); + if (target != null and target.? == .pane and target.?.pane.file == .body) { + preserved = try p.gpa.dupe(u8, bytes); + const trunc = tree.handle(p, .{ .tag = 0, .op = .setattr, .node = node, .truncate = true }); + if (trunc.status != .ok) return error.WriteFailed; + } + const contents = preserved orelse bytes; + var off: usize = 0; + while (off < contents.len) { + const reply = tree.handle(p, .{ .tag = 0, .op = .write, .node = node, .off = off, .data = contents[off..] }); + if (reply.status != .ok or reply.written == 0) return error.WriteFailed; + off += reply.written; } - return writeFile(path, bytes); } fn resolveEmbedded(word: []const u8, cwd: []const u8, scratch: *[4096]u8) ?Source { @@ -1069,6 +914,8 @@ pub fn find(arena: std.mem.Allocator, dir: []const u8, pat: []const u8, out: []u var hits: [find_max_hits][]const u8 = undefined; var hits_len: usize = 0; if (platform_has_fs) { + pardes.turn.yield(); + defer pardes.turn.back(); const io = std.Io.Threaded.global_single_threaded.io(); var root = try std.Io.Dir.cwd().openDir(io, dir, .{ .iterate = true }); defer root.close(io); @@ -1152,6 +999,9 @@ pub fn grep(arena: std.mem.Allocator, gpa: std.mem.Allocator, dir: []const u8, b const home = std.mem.trimEnd(u8, base, "/"); const files = try arena.alloc([]const u8, grep_max_files); var files_len: usize = 0; + // A walk and thousands of reads: the turn goes out for all of it. + pardes.turn.yield(); + defer pardes.turn.back(); { const io = std.Io.Threaded.global_single_threaded.io(); var root = try std.Io.Dir.cwd().openDir(io, dir, .{ .iterate = true }); @@ -1311,10 +1161,6 @@ test "Restore prefers default directory then falls back to original path" { fn readFileLimit(gpa: std.mem.Allocator, path: []const u8, limit: usize) ![]u8 { if (std.mem.indexOfScalar(u8, path, 0) != null) return error.OpenFailed; - // Same reason as `writeFile`: no core to answer from here, and the open is - // the call that never returns. Callers holding one use `readLimit`, which - // serves the tree instead. - if (isOwnMount(path)) return error.FileNotFound; if (!platform_has_fs or std.mem.startsWith(u8, path, "/virtual/")) { const archive_path = if (std.mem.startsWith(u8, path, "/virtual/")) path[9..] else path; var normalized_buf: [4096]u8 = undefined; @@ -1326,6 +1172,10 @@ fn readFileLimit(gpa: std.mem.Allocator, path: []const u8, limit: usize) ![]u8 { var pathbuf: [4096]u8 = undefined; const native = localPath(path) orelse return error.OpenFailed; const path_z = std.fmt.bufPrintSentinel(&pathbuf, "{s}", .{native}, 0) catch return error.PathTooLong; + // The path may be a mount this editor serves: the turn goes out with the + // syscalls, and the bytes come back into memory of the caller's own. + pardes.turn.yield(); + defer pardes.turn.back(); const fd = libc.open(path_z, .{ .ACCMODE = .RDONLY, .NONBLOCK = true }); if (fd < 0) return switch (libc.errno(fd)) { .ACCES, .PERM => error.PermissionDenied, diff --git a/src/gui/gui.zig b/src/gui/gui.zig index 3c2fd693..8da6f933 100644 --- a/src/gui/gui.zig +++ b/src/gui/gui.zig @@ -2422,6 +2422,7 @@ fn localSession( defer pardes.lsp.setStatusSink(null, null); while (!core.quit) { + pardes.turn.restoreSettled(); try core.pump(host); if (core.quit) break; // a session that ended does not restore into one if (core.takeAttach()) |req| { @@ -2465,7 +2466,7 @@ fn localSession( g.prepared_images.clearRetainingCapacity(); nc.native_images = true; nc.host = host; - if (fs) |f| f.reset(core); + if (fs) |f| f.reset(nc); core.deinit(); core = nc; shell.core = nc; @@ -2758,7 +2759,10 @@ const StdinFeed = struct { } var fds = [_]posix.pollfd{.{ .fd = 0, .events = posix.POLL.IN, .revents = 0 }}; - _ = posix.poll(&fds, 16) catch return out; + pardes.turn.rest(); + const polled = posix.poll(&fds, 16); + pardes.turn.wake(); + _ = polled catch return out; if ((fds[0].revents & posix.POLL.IN) == 0) { if ((fds[0].revents & (posix.POLL.HUP | posix.POLL.ERR)) != 0) out.eof = true; return out; @@ -3762,7 +3766,11 @@ fn waitInput(ctx: ?*anyopaque, timeout_ms: u32) void { if (s.gui) |g| { var sev = std.mem.zeroes(c.SDL_Event); const ms: c_int = if (timeout_ms != 0) @intCast(timeout_ms) else 16; - if (c.SDL_WaitEventTimeout(&sev, ms)) { + // The wait is the 9P connections' turn with the core. + pardes.turn.rest(); + const got = c.SDL_WaitEventTimeout(&sev, ms); + pardes.turn.wake(); + if (got) { dispatch(g, &in, &sev); while (c.SDL_PollEvent(&sev)) dispatch(g, &in, &sev); } @@ -3785,7 +3793,7 @@ fn pollFrame(ctx: ?*anyopaque) void { const s = shellOf(ctx); s.reconcilePtys(); const core = s.core; - if (s.fs) |f| if (f.tick(core).pending) s.queue.push(.fs_ready); + if (s.fs) |f| if (f.tick().pending) s.queue.push(.fs_ready); const g = s.gui orelse { if (core.settings.window_opacity_pending) { var unchanged_opacity: u8 = 100; @@ -3923,7 +3931,7 @@ fn gridPollFrame(ctx: ?*anyopaque) void { const s = shellOf(ctx); s.reconcilePtys(); if (s.fs) |f| { - if (f.tick(s.core).count != 0) s.saw_event = true; + if (f.tick().count != 0) s.saw_event = true; } pollCwds(s.core, s.ptys); if (s.core.animationActive()) { @@ -5077,6 +5085,13 @@ fn renderFrame( ); } } + // Body layers first: a notice chip over a tree-sitter context band + // is a tag layer, and instances paint in emission order. + for (surface.bodyLayers()) |*layer| { + if (layer.rows == 0) continue; + const batch_index = paintBatchAt(&paint_plan, layer.viewport.x, layer.viewport.y); + emitBodyLayer(g, instances, &cell_next[batch_index], layer, win_w, win_h, paint_plan.batches[batch_index].track, page, paint_plan.len == 1, false, topbar_pane_border_rgb); + } for (surface.tagLayers()) |*layer| { if (layer.cols == 0) continue; const batch_index = paintBatchAt(&paint_plan, layer.viewport.x, layer.viewport.y); @@ -5092,11 +5107,6 @@ fn renderFrame( emitTagLayer(g, instances, &cell_next[destination], layer, win_w, win_h, if (under) null else track, page, false, track.effect == .dissolve); } } - for (surface.bodyLayers()) |*layer| { - if (layer.rows == 0) continue; - const batch_index = paintBatchAt(&paint_plan, layer.viewport.x, layer.viewport.y); - emitBodyLayer(g, instances, &cell_next[batch_index], layer, win_w, win_h, paint_plan.batches[batch_index].track, page, paint_plan.len == 1, false, topbar_pane_border_rgb); - } for (paint_plan.batches[1..paint_plan.len], 1..) |batch, batch_index| { const track = batch.track.?; const under = track.effect == .vertical and track.phase == .opening; diff --git a/src/host_io.zig b/src/host_io.zig index a7babc74..72e149c9 100644 --- a/src/host_io.zig +++ b/src/host_io.zig @@ -955,6 +955,9 @@ pub fn forkShell( var cwd_buf: [4096]u8 = undefined; const cwd_z: ?[:0]const u8 = if (native_cwd.len == 0) null else dir: { const path = std.fmt.bufPrintSentinel(&cwd_buf, "{s}", .{native_cwd}, 0) catch return error.NameTooLong; + // A shell's directory may be inside a mount this editor serves. + pardes.turn.yield(); + defer pardes.turn.back(); const stat = try std.Io.Dir.cwd().statFile(std.Io.Threaded.global_single_threaded.io(), path, .{}); if (stat.kind != .directory) return error.NotDir; break :dir path; diff --git a/src/macos.zig b/src/macos.zig index d3b33c55..a7ee3164 100644 --- a/src/macos.zig +++ b/src/macos.zig @@ -773,6 +773,10 @@ fn initCore(runtime: ?*const Runtime, cols_arg: u16, rows_arg: u16) !void { for (&st.ptys, 0..) |*slot, id| if (slot.*) |*pt| startReader(st, pt, @intCast(id)); pardes.lsp.setStatusSink(st, lspStatusSink); + // From here the core is touched only inside the entry points above, + // each of which takes the turn for its own duration; between them the + // 9P connections have it. + pardes.turn.rest(); } fn wakeNinep(ctx: ?*anyopaque) void { @@ -781,6 +785,7 @@ fn wakeNinep(ctx: ?*anyopaque) void { } export fn pardes_deinit() void { + pardes.turn.wake(); const st = &(state orelse return); if (st.ninep) |listener| { listener.deinit(st.gpa); @@ -823,6 +828,8 @@ export fn pardes_deinit() void { } export fn pardes_should_quit() bool { + pardes.turn.wake(); + defer pardes.turn.rest(); const st = &(state orelse return true); return st.core.quit; } @@ -890,11 +897,15 @@ test "the animation clock spends real time, not callbacks" { } export fn pardes_animating() bool { + pardes.turn.wake(); + defer pardes.turn.rest(); const st = &(state orelse return false); return st.core.animationActive() or st.rotate_coasting or st.scroll_coasting; } export fn pardes_theme_bg() u32 { + pardes.turn.wake(); + defer pardes.turn.rest(); const th = if (state) |*st| st.core.theme() else &pardes.themes[0]; const bg = th.bg orelse return color_default; return @as(u32, bg[0]) << 16 | @as(u32, bg[1]) << 8 | bg[2]; @@ -913,6 +924,8 @@ export fn pardes_theme_bg() u32 { /// own (pardes_theme_bg == PARDES_COLOR_DEFAULT) drops the ground entirely, /// whatever percentage is set here. export fn pardes_window_opacity() u8 { + pardes.turn.wake(); + defer pardes.turn.rest(); const st = &(state orelse return 100); st.core.settings.window_opacity_pending = false; return st.core.settings.window_opacity; @@ -920,6 +933,8 @@ export fn pardes_window_opacity() u8 { /// Public AppKit backdrop strength, independent of background paint opacity. export fn pardes_window_blur() u8 { + pardes.turn.wake(); + defer pardes.turn.rest(); return if (state) |st| st.core.settings.window_blur else 0; } @@ -928,10 +943,14 @@ fn taglineFontPercent(core: ?*const pardes.Pardes) u8 { } export fn pardes_gui_tagline_font_percent() u8 { + pardes.turn.wake(); + defer pardes.turn.rest(); return taglineFontPercent(if (state) |*st| st.core else null); } export fn pardes_tagline_band_offset(row: u16, canvas_h: f32, cell_h: u32, tagline_h: u32) u32 { + pardes.turn.wake(); + defer pardes.turn.rest(); return pardes.taglineBandOffset(row, canvas_h, cell_h, tagline_h, if (state) |*st| st.core.settings.workspace_tag else true); } @@ -940,16 +959,22 @@ export fn pardes_topbar_pane_border_px(cell_h: u32, tagline_h: u32) u32 { } export fn pardes_tagline_origin_col(col: u16, row: u16) f32 { + pardes.turn.wake(); + defer pardes.turn.rest(); const st = &(state orelse return @floatFromInt(col)); return pardes.taglineOriginColForFrame(st.core, col, row); } export fn pardes_grid_col_at(x: f32, row: u16, body_w: f32, tagline_w: f32) u16 { + pardes.turn.wake(); + defer pardes.turn.rest(); const st = &(state orelse return pardes.gridColAt(null, x, row, body_w, tagline_w)); return pardes.gridColAt(st.core, x, row, body_w, tagline_w); } export fn pardes_topbar_pane_border_rgb() u32 { + pardes.turn.wake(); + defer pardes.turn.rest(); const rgb = pardes.config.gui_topbar_pane_border_rgb orelse fromTheme: { const st = state orelse return color_default; break :fromTheme st.core.chromeTheme().border; @@ -958,11 +983,15 @@ export fn pardes_topbar_pane_border_rgb() u32 { } export fn pardes_tag_active_bg() u32 { + pardes.turn.wake(); + defer pardes.turn.rest(); const st = state orelse return color_default; const rgb = st.core.chromeTheme().tag_active_bg; return @as(u32, rgb[0]) << 16 | @as(u32, rgb[1]) << 8 | rgb[2]; } export fn pardes_tagline_bg() u32 { + pardes.turn.wake(); + defer pardes.turn.rest(); const st = state orelse return color_default; const rgb = st.core.chromeTheme().tag_bg; return @as(u32, rgb[0]) << 16 | @as(u32, rgb[1]) << 8 | rgb[2]; @@ -1008,6 +1037,8 @@ test "the fallback preference order crosses the ABI intact and ends at the bound } export fn pardes_scene() Scene { + pardes.turn.wake(); + defer pardes.turn.rest(); const st = &(state orelse return .{}); const seconds = @as(f64, @floatFromInt(st.scene_ns)) / @as(f64, std.time.ns_per_s); return .{ @@ -1018,6 +1049,8 @@ export fn pardes_scene() Scene { } export fn pardes_postprocessor_unavailable() void { + pardes.turn.wake(); + defer pardes.turn.rest(); const st = &(state orelse return); st.core.disableSceneEffects(); st.core.settings.panel_transition = .off; @@ -1026,6 +1059,8 @@ export fn pardes_postprocessor_unavailable() void { } export fn pardes_panel_animation_failed() void { + pardes.turn.wake(); + defer pardes.turn.rest(); const st = &(state orelse return); st.core.abandonPanelAnimations(); } @@ -1210,6 +1245,8 @@ fn reloadWatchedFile(st: *State, pane: u8, announce: bool) bool { } export fn pardes_watch_changed(pane: u8, generation: u32) void { + pardes.turn.wake(); + defer pardes.turn.rest(); const st = &(state orelse return); if (pane >= watch_slot_count) return; if (st.file_watches.notify(pane, generation)) wake(st); @@ -1265,11 +1302,13 @@ fn drainInbox(st: *State) bool { } export fn pardes_tick() bool { + pardes.turn.wake(); + defer pardes.turn.rest(); const st = &(state orelse return false); st.inbox.wake_pending.store(false, .release); var did = drainInbox(st); if (st.ninep) |listener| { - const drained = listener.tick(st.core); + const drained = listener.tick(); did = did or drained.count != 0; if (drained.pending) wake(st); } @@ -1277,7 +1316,9 @@ export fn pardes_tick() bool { did = true; st.core.perform(effect); } + pardes.turn.settle(); if (restoreCore(st)) did = true; + pardes.turn.restoreSettled(); return did; } @@ -1309,7 +1350,7 @@ fn restoreCore(st: *State) bool { const generation = st.file_watches.stop(st.gpa, id); hostWatchFile(id, generation, null, 0); }; - if (st.ninep) |listener| listener.reset(st.core); + if (st.ninep) |listener| listener.reset(replacement); replacement.host = hostFor(st); st.core.deinit(); st.core = replacement; @@ -1485,6 +1526,8 @@ test "mac Restore cancels a PTY reader waiting for output capacity" { } export fn pardes_animation_tick() bool { + pardes.turn.wake(); + defer pardes.turn.rest(); const st = &(state orelse return false); const now: u64 = @intCast(@max(0, monotonicNs())); @@ -1546,6 +1589,8 @@ export fn pardes_animation_tick() bool { } export fn pardes_key(cp_arg: u32, text_ptr: ?[*]const u8, len: usize, mods: u32) void { + pardes.turn.wake(); + defer pardes.turn.rest(); const st = &(state orelse return); if (cp_arg > std.math.maxInt(u21)) return; const text: []const u8 = if (text_ptr) |p| p[0..len] else ""; @@ -1559,16 +1604,22 @@ export fn pardes_key(cp_arg: u32, text_ptr: ?[*]const u8, len: usize, mods: u32) } export fn pardes_paste(text_ptr: ?[*]const u8, len: usize) void { + pardes.turn.wake(); + defer pardes.turn.rest(); const st = &(state orelse return); const text: []const u8 = if (text_ptr) |p| p[0..len] else ""; st.core.update(.{ .paste = text }); } export fn pardes_mouse(button_arg: c_int, kind_arg: c_int, col: u16, row: u16, mods: u32) void { + pardes.turn.wake(); + defer pardes.turn.rest(); mouseWithHit(button_arg, kind_arg, col, row, mods, null, null); } export fn pardes_mouse_pixel(button_arg: c_int, kind_arg: c_int, col: u16, row: u16, mods: u32, x: f32, y: f32, bw: f32, bh: f32, tw: f32, th: f32) void { + pardes.turn.wake(); + defer pardes.turn.rest(); const st = &(state orelse return); const source = st.core.presentation.pointerFractional(st.core.screen_w, st.core.screen_h, x / @max(1, bw), y / @max(1, bh)); var hit: ?pardes.Mouse.BodyHit = null; @@ -1620,11 +1671,15 @@ fn mouseWithHit(button_arg: c_int, kind_arg: c_int, col: u16, row: u16, mods: u3 } export fn pardes_pointer_leave() void { + pardes.turn.wake(); + defer pardes.turn.rest(); const st = &(state orelse return); st.core.update(.pointer_leave); } export fn pardes_scroll(delta_rows: f32, delta_cols: f32, col: u16, row: u16) void { + pardes.turn.wake(); + defer pardes.turn.rest(); const st = &(state orelse return); st.scroll_col = col; st.scroll_row = row; @@ -1636,6 +1691,8 @@ export fn pardes_scroll(delta_rows: f32, delta_cols: f32, col: u16, row: u16) vo /// spinning dial. Also drops whatever the last gesture left banked, so the /// first millimetre of a new swipe cannot inherit a nearly-complete row. export fn pardes_scroll_begin() void { + pardes.turn.wake(); + defer pardes.turn.rest(); const st = &(state orelse return); st.scroll_lag = 0; st.scroll_lag_x = 0; @@ -1655,6 +1712,8 @@ export fn pardes_scroll_begin() void { /// momentum simply takes the gesture over, and the tail of that momentum is /// below the fling floor, so its end arms nothing. export fn pardes_scroll_end() void { + pardes.turn.wake(); + defer pardes.turn.rest(); const st = &(state orelse return); const last = st.scroll_last_ns; st.scroll_last_ns = 0; @@ -1671,6 +1730,8 @@ export fn pardes_scroll_end() void { } export fn pardes_rotate(degrees: f32) void { + pardes.turn.wake(); + defer pardes.turn.rest(); const st = &(state orelse return); if (degrees == 0) { st.rotate_lag = 0; @@ -1684,6 +1745,8 @@ export fn pardes_rotate(degrees: f32) void { } export fn pardes_rotate_end() void { + pardes.turn.wake(); + defer pardes.turn.rest(); const st = &(state orelse return); const last = st.rotate_last_ns; st.rotate_last_ns = 0; @@ -1726,6 +1789,8 @@ fn spendRotation(st: *State, degrees: f32) void { } export fn pardes_command(text_ptr: ?[*]const u8, len: usize) void { + pardes.turn.wake(); + defer pardes.turn.rest(); const st = &(state orelse return); const text: []const u8 = if (text_ptr) |p| p[0..len] else ""; if (text.len == 0) return; @@ -1733,6 +1798,8 @@ export fn pardes_command(text_ptr: ?[*]const u8, len: usize) void { } export fn pardes_resize(cols_arg: u16, rows_arg: u16, cell_w: u16, cell_h: u16) void { + pardes.turn.wake(); + defer pardes.turn.rest(); const st = &(state orelse return); const cols = @max(1, cols_arg); const rows = @max(1, rows_arg); @@ -1747,6 +1814,8 @@ export fn pardes_resize(cols_arg: u16, rows_arg: u16, cell_w: u16, cell_h: u16) } export fn pardes_frame() u32 { + pardes.turn.wake(); + defer pardes.turn.rest(); const st = &(state orelse return 0); const tz = tracy.zone(@src(), "pardes_frame"); defer tz.end(); @@ -1921,26 +1990,36 @@ fn collectImages(st: *State, surface: *const pardes.Surface) void { } export fn pardes_frame_images() u32 { + pardes.turn.wake(); + defer pardes.turn.rest(); const st = &(state orelse return 0); return @intCast(st.images_len); } export fn pardes_frame_image_list() ?[*]const Image { + pardes.turn.wake(); + defer pardes.turn.rest(); const st = &(state orelse return null); return if (st.images_len == 0) null else st.images.ptr; } export fn pardes_frame_panel_tracks() u32 { + pardes.turn.wake(); + defer pardes.turn.rest(); const st = &(state orelse return 0); return @intCast(st.panel_tracks_len); } export fn pardes_frame_panel_track_list() ?[*]const PanelTrack { + pardes.turn.wake(); + defer pardes.turn.rest(); const st = &(state orelse return null); return if (st.panel_tracks_len == 0) null else st.panel_tracks[0..].ptr; } export fn pardes_frame_presented(animated_panels: bool) bool { + pardes.turn.wake(); + defer pardes.turn.rest(); const st = &(state orelse return false); const was_animating = st.core.animationActive(); if (animated_panels) @@ -1951,11 +2030,15 @@ export fn pardes_frame_presented(animated_panels: bool) bool { } export fn pardes_frame_cells() ?[*]const Cell { + pardes.turn.wake(); + defer pardes.turn.rest(); const st = &(state orelse return null); return if (st.frame_len == 0) null else st.cells.ptr; } export fn pardes_frame_previous_cells() ?[*]const Cell { + pardes.turn.wake(); + defer pardes.turn.rest(); const st = &(state orelse return null); return if (st.panel_diff_len != st.frame_len or st.panel_diff_len == 0) null @@ -1964,6 +2047,8 @@ export fn pardes_frame_previous_cells() ?[*]const Cell { } export fn pardes_frame_changed_cells() ?[*]const u8 { + pardes.turn.wake(); + defer pardes.turn.rest(); const st = &(state orelse return null); return if (st.panel_diff_len != st.frame_len or st.panel_diff_len == 0) null @@ -1972,16 +2057,22 @@ export fn pardes_frame_changed_cells() ?[*]const u8 { } export fn pardes_frame_cols() u16 { + pardes.turn.wake(); + defer pardes.turn.rest(); const st = &(state orelse return 0); return st.frame_cols; } export fn pardes_frame_rows() u16 { + pardes.turn.wake(); + defer pardes.turn.rest(); const st = &(state orelse return 0); return st.frame_rows; } export fn pardes_cursor_x() i32 { + pardes.turn.wake(); + defer pardes.turn.rest(); const st = &(state orelse return -1); if (tagCursorCovered(st.core)) return -1; return if (st.core.surface.cursor) |c| c.x else -1; @@ -2000,6 +2091,8 @@ export fn pardes_tag_layer_limit() u32 { } export fn pardes_tag_layer_value(index: u32, field: u32) u32 { + pardes.turn.wake(); + defer pardes.turn.rest(); const st = &(state orelse return 0); if (index >= pardes.MAX_TAG_LAYERS) return 0; const layer = &st.core.surface.tag_layers[index]; @@ -2025,6 +2118,8 @@ export fn pardes_tag_layer_value(index: u32, field: u32) u32 { } export fn pardes_tag_layer_cells(index: u32) ?[*]const Cell { + pardes.turn.wake(); + defer pardes.turn.rest(); const st = &(state orelse return null); if (index >= pardes.MAX_TAG_LAYERS) return null; const layer = &st.core.surface.tag_layers[index]; @@ -2036,6 +2131,8 @@ export fn pardes_tag_layer_cells(index: u32) ?[*]const Cell { } export fn pardes_body_layer_value(index: u32, field: u32) u32 { + pardes.turn.wake(); + defer pardes.turn.rest(); const st = &(state orelse return 0); if (index >= pardes.MAX_PANES) return 0; const layer = &st.core.surface.body_layers[index]; @@ -2056,6 +2153,8 @@ export fn pardes_body_layer_value(index: u32, field: u32) u32 { } export fn pardes_body_layer_cells(index: u32) ?[*]const Cell { + pardes.turn.wake(); + defer pardes.turn.rest(); const st = &(state orelse return null); if (index >= pardes.MAX_PANES) return null; const layer = &st.core.surface.body_layers[index]; @@ -2071,27 +2170,37 @@ export fn pardes_body_layer_limit() u32 { } export fn pardes_row_metrics(body_w: u16, body_h: u16, tagline_w: u16, tagline_h: u16) void { + pardes.turn.wake(); + defer pardes.turn.rest(); const st = &(state orelse return); st.core.update(.{ .resize = .{ .cols = st.core.screen_w, .rows = st.core.screen_h, .cell_pixels = st.core.cell_pixels, .row_metrics = .{ .body_w = @max(1, body_w), .body_h = @max(1, body_h), .tagline_w = @max(1, tagline_w), .tagline_h = @max(1, tagline_h) } } }); } 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); } export fn pardes_cursor_y() i32 { + pardes.turn.wake(); + defer pardes.turn.rest(); const st = &(state orelse return -1); if (tagCursorCovered(st.core)) return -1; return if (st.core.surface.cursor) |c| c.y else -1; } export fn pardes_cursor_bar() bool { + pardes.turn.wake(); + defer pardes.turn.rest(); const st = &(state orelse return false); return if (st.core.surface.cursor) |c| c.bar else false; } export fn pardes_take_haptic() c_int { + pardes.turn.wake(); + defer pardes.turn.rest(); const st = &(state orelse return 0); return switch (st.core.takeHaptic()) { .none => 0, @@ -2103,6 +2212,8 @@ export fn pardes_take_haptic() c_int { var font_path_z: [4096:0]u8 = undefined; export fn pardes_font_take(size_hundredths: *u16) ?[*:0]const u8 { + pardes.turn.wake(); + defer pardes.turn.rest(); const st = &(state orelse return null); if (comptime !pardes.font_picker) return null; const want = st.core.takeFontRequest() orelse return null; @@ -2118,6 +2229,8 @@ export fn pardes_font_observe( len: usize, point_hundredths: u16, ) bool { + pardes.turn.wake(); + defer pardes.turn.rest(); const st = &(state orelse return false); const ptr = effective_name orelse return false; if (len == 0 or len > 255 or point_hundredths == 0) return false; @@ -2129,6 +2242,8 @@ export fn pardes_font_ack( len: usize, point_hundredths: u16, ) bool { + pardes.turn.wake(); + defer pardes.turn.rest(); const st = &(state orelse return false); const ptr = effective_name orelse return false; if (len == 0 or len > 255 or point_hundredths == 0) return false; @@ -2136,6 +2251,8 @@ export fn pardes_font_ack( } export fn pardes_font_reject() void { + pardes.turn.wake(); + defer pardes.turn.rest(); const st = &(state orelse return); st.core.rejectFont(); } @@ -2143,6 +2260,8 @@ export fn pardes_font_reject() void { var active_path_z: [4096:0]u8 = undefined; export fn pardes_active_path() ?[*:0]const u8 { + pardes.turn.wake(); + defer pardes.turn.rest(); const st = &(state orelse return null); const path = activeFilePath(st) orelse return null; if (path.len == 0 or path.len >= active_path_z.len) return null; @@ -2152,6 +2271,8 @@ export fn pardes_active_path() ?[*:0]const u8 { } export fn pardes_active_dirty() bool { + pardes.turn.wake(); + defer pardes.turn.rest(); const st = &(state orelse return false); const pane = st.core.panes[st.core.active] orelse return false; const f = if (pane.file) |*x| x else return false; diff --git a/src/memory.zig b/src/memory.zig index f30e4392..e5394b4f 100644 --- a/src/memory.zig +++ b/src/memory.zig @@ -44,7 +44,48 @@ pub const Allocators = struct { pdf: Allocator, }; -var pardes_fallback: std.heap.StackFallbackAllocator(limits.arena.pardes) = undefined; +/// `std.heap.StackFallbackAllocator` with the buffer taken through its +/// lock-free interface. The core's allocator is used from two threads: a 9P +/// connection task answers a request while the editor's own thread is out +/// in a syscall that allocates (`readFileLimit`, `grep`; see `pardes.turn`). +fn SharedStackFallback(comptime size: usize) type { + return struct { + buffer: [size]u8 = undefined, + fallback_allocator: Allocator = undefined, + fixed: std.heap.FixedBufferAllocator = undefined, + + fn get(self: *@This()) Allocator { + self.fixed = .init(self.buffer[0..]); + return .{ .ptr = self, .vtable = &.{ .alloc = alloc, .resize = resize, .remap = remap, .free = free } }; + } + + fn alloc(ctx: *anyopaque, len: usize, alignment: std.mem.Alignment, ra: usize) ?[*]u8 { + const self: *@This() = @ptrCast(@alignCast(ctx)); + return self.fixed.threadSafeAllocator().rawAlloc(len, alignment, ra) orelse + self.fallback_allocator.rawAlloc(len, alignment, ra); + } + + fn resize(ctx: *anyopaque, buf: []u8, alignment: std.mem.Alignment, new_len: usize, ra: usize) bool { + const self: *@This() = @ptrCast(@alignCast(ctx)); + if (self.fixed.ownsPtr(buf.ptr)) return self.fixed.threadSafeAllocator().rawResize(buf, alignment, new_len, ra); + return self.fallback_allocator.rawResize(buf, alignment, new_len, ra); + } + + fn remap(ctx: *anyopaque, buf: []u8, alignment: std.mem.Alignment, new_len: usize, ra: usize) ?[*]u8 { + const self: *@This() = @ptrCast(@alignCast(ctx)); + if (self.fixed.ownsPtr(buf.ptr)) return self.fixed.threadSafeAllocator().rawRemap(buf, alignment, new_len, ra); + return self.fallback_allocator.rawRemap(buf, alignment, new_len, ra); + } + + fn free(ctx: *anyopaque, buf: []u8, alignment: std.mem.Alignment, ra: usize) void { + const self: *@This() = @ptrCast(@alignCast(ctx)); + if (self.fixed.ownsPtr(buf.ptr)) return self.fixed.threadSafeAllocator().rawFree(buf, alignment, ra); + return self.fallback_allocator.rawFree(buf, alignment, ra); + } + }; +} + +var pardes_fallback: SharedStackFallback(limits.arena.pardes) = .{}; var frame_fallback: std.heap.StackFallbackAllocator(limits.arena.frame) = undefined; var tree_sitter_fallback: std.heap.StackFallbackAllocator(limits.arena.tree_sitter) = undefined; var image_fallback: std.heap.StackFallbackAllocator(limits.arena.image) = undefined; @@ -61,7 +102,6 @@ var pdf_debug: Debug = .init; // One session at a time; free its allocations before deinit. Concurrent LSP workers use the caller's allocator. pub fn init(fallback: Allocator) Allocators { pardes_fallback.fallback_allocator = fallback; - pardes_fallback.get_called = if (std.debug.runtime_safety) false else {}; frame_fallback.fallback_allocator = fallback; frame_fallback.get_called = if (std.debug.runtime_safety) false else {}; tree_sitter_fallback.fallback_allocator = fallback; @@ -112,12 +152,12 @@ test "fixed allocators are separate, spill, and restart" { var allocs = init(std.testing.allocator); const core = try allocs.pardes.alloc(u8, 32); const frame = try allocs.frame.alloc(u8, 32); - try std.testing.expect(pardes_fallback.fixed_buffer_allocator.ownsPtr(core.ptr)); + try std.testing.expect(pardes_fallback.fixed.ownsPtr(core.ptr)); try std.testing.expect(frame_fallback.fixed_buffer_allocator.ownsPtr(frame.ptr)); try std.testing.expect(core.ptr != frame.ptr); const spill = try allocs.pardes.alloc(u8, limits.arena.pardes + 1); - try std.testing.expect(!pardes_fallback.fixed_buffer_allocator.ownsPtr(spill.ptr)); + try std.testing.expect(!pardes_fallback.fixed.ownsPtr(spill.ptr)); allocs.pardes.free(spill); allocs.frame.free(frame); allocs.pardes.free(core); @@ -127,7 +167,7 @@ test "fixed allocators are separate, spill, and restart" { defer deinit(); const restarted = try allocs.pardes.alloc(u8, 32); defer allocs.pardes.free(restarted); - try std.testing.expect(pardes_fallback.fixed_buffer_allocator.ownsPtr(restarted.ptr)); + try std.testing.expect(pardes_fallback.fixed.ownsPtr(restarted.ptr)); } test "memory limits preserve desktop capacities" { diff --git a/src/ninep/testing.zig b/src/ninep/testing.zig index 44329eee..6ea40956 100644 --- a/src/ninep/testing.zig +++ b/src/ninep/testing.zig @@ -30,13 +30,10 @@ pub const Answer = struct { }; pub fn call(p: *Pardes, req: Req) Answer { - p.update(.{ .fs_req = req }); var ans: Answer = .{}; + ans.reply = p.serveFs(req); + ans.bytes = p.fsPayload(ans.reply); while (p.nextEffect()) |e| switch (e) { - .fs_reply => |r| { - ans.reply = r; - ans.bytes = p.fsPayload(r); - }, .save_file, .save_text => ans.saved = true, .watch => |w| ans.watch = w.on, .write => |w| { diff --git a/src/ninep/tree.zig b/src/ninep/tree.zig index 5a0c1e11..b13b1472 100644 --- a/src/ninep/tree.zig +++ b/src/ninep/tree.zig @@ -68,6 +68,22 @@ pub const e_bad_event = "bad event syntax"; /// everywhere, as it is in acme (editors/acme/fsys.c, fsyscreate). pub const features: cloud9.fs.Features = .{ .remove = true }; +/// Whether a request must wait until no step is out in a syscall +/// (`pardes.turn`): what would change a pane such a step still points into. +/// Making a pane and rendering a screen do not -- every yield sits before +/// the mutation of its own step, so the layout and the surface are whole +/// under it -- and a step out there is never waiting on a write of its own, +/// so what parks here is never the syscall's own request. +pub fn needsQuiet(req: Req) bool { + return switch (req.op) { + .write, .setattr => true, + .release => req.remove, + else => false, + }; +} + +/// `needsQuiet`, plus the open that makes a pane: what costs a frame and a +/// wake of the editor. pub fn changesPane(req: Req) bool { return switch (req.op) { .write, .setattr => true, diff --git a/src/panes.zig b/src/panes.zig index f995986b..b3424385 100644 --- a/src/panes.zig +++ b/src/panes.zig @@ -3324,11 +3324,28 @@ pub const Image = struct { /// Construct an image pane from a path and optionally transferred dump bytes. /// `raw` must be image_gpa-owned and ownership transfers only on success. + /// Without them the file is read here, not at the first draw: a draw + /// must not go out into the host (`pardes.turn`), and the path may be a + /// mount this editor serves. A file that cannot be read draws blank. pub fn create(p: *pardes.Pardes, id: usize, path: []const u8, raw: []u8) !*pardes.Pane { + var bytes = raw; + var read_here = false; + if (bytes.len == 0) { + // The slot stays ours across the read: another request may + // make a pane meanwhile. + p.reserved_slots[id] = true; + defer p.reserved_slots[id] = false; + if (filesystem.read(p, path)) |from_disk| { + defer p.gpa.free(from_disk); + bytes = try p.image_gpa.dupe(u8, from_disk); + read_here = true; + } else |_| {} + } + errdefer if (read_here) p.image_gpa.free(bytes); const path_copy = try p.image_gpa.dupe(u8, path); errdefer p.image_gpa.free(path_copy); const pane = try p.newDocPane(id); - pane.image = .{ .path = path_copy, .raw = raw }; + pane.image = .{ .path = path_copy, .raw = bytes }; return pane; } @@ -3427,12 +3444,8 @@ pub const Image = struct { fn ensureDecoded(p: *pardes.Pardes, state: *State) void { if (state.tried) return; state.tried = true; - const bytes: []const u8 = if (state.raw.len > 0) - state.raw - else - filesystem.read(p, state.path) catch &.{}; - defer if (state.raw.len == 0) p.gpa.free(bytes); - if (image.decode(p.image_gpa, bytes)) |decoded| { + if (state.raw.len == 0) return; // nothing was readable at open + if (image.decode(p.image_gpa, state.raw)) |decoded| { state.rgba = decoded.rgba; state.iw = decoded.w; state.ih = decoded.h; @@ -3771,9 +3784,15 @@ pub const Pdf = struct { sections_output: ?SectionsOutput = null, outline_reveal_pending: ?pdf.OutlineInternalDestination = null, + /// Read whole and opened from memory (the bridge copies), never from + /// the file itself: MuPDF reads a file lazily at every page, and the + /// path may be a mount this editor serves, which only a read that + /// gives the turn up can come back from (`filesystem.readFile`). pub fn open(gpa: std.mem.Allocator, path: []const u8, page_one_based: usize) !@This() { const local = filesystem.localPath(path) orelse return error.NonLocalPath; - return initDocument(gpa, path, try Document.open(local), page_one_based); + const bytes = try filesystem.readFile(gpa, local); + defer gpa.free(bytes); + return initDocument(gpa, path, try Document.openBytes(bytes), page_one_based); } pub fn openBytes(gpa: std.mem.Allocator, path: []const u8, bytes: []const u8, page_one_based: usize) !@This() { @@ -5219,6 +5238,10 @@ pub const Pdf = struct { page_one_based: usize, ) !*pardes.Pane { if (comptime !enabled) return error.PdfDisabled; + // The slot stays ours across the read: another request may make a + // pane meanwhile. + core.reserved_slots[id] = true; + defer core.reserved_slots[id] = false; var state = if (filesystem.localPath(path) != null) try State.open(core.pdf_gpa, path, page_one_based) else virtual: { @@ -5903,9 +5926,11 @@ pub const Pdf = struct { null, }, .x = text_x, - .y = core.bodyTop(rect), + // Below the notice chips, like an image: a placed page is + // drawn after the cells and would paint a chip out. + .y = core.bodyTop(rect) + pane.notices.len, .w = text_width, - .h = rect.h -| pardes.BOX_H, + .h = (rect.h -| pardes.BOX_H) -| pane.notices.len, .rgba = placed.rgba, .iw = placed.width, // The texture contains the retained band, not the full page. diff --git a/src/pardes.zig b/src/pardes.zig index 0ac16162..cc57127f 100644 --- a/src/pardes.zig +++ b/src/pardes.zig @@ -39,6 +39,148 @@ pub const font_picker = platform == .gui or platform == .macos; pub const hosted = platform == .tty or platform == .gui or platform == .macos; +/// Whose turn it is with the core. The core is single-threaded: the editor's +/// thread has it, and lets go of it in two kinds of gap -- while it waits for +/// input (`rest`, `wake`), and while it is out in the host filesystem in the +/// middle of a step (`yield`, `back`). A 9P connection task takes the turn +/// in those gaps to answer a request (`take`, `give`), which is what lets the +/// editor read its own tree through a mount: the syscall goes out, another +/// thread answers it, the syscall comes back. A step of a connection task's +/// own -- a Look written to `look` -- goes out the same way. +/// +/// `out` counts the steps that are out. While one is, the core reads +/// consistently but that step still holds pointers into it, so nothing may +/// change it: a request that would is parked in the engine (src/9p_io.zig) +/// and retried when the turn is next given up with nothing out, which +/// `parked` remembers to arrange; and the editor's own wake waits for the +/// count to reach zero, since a step of the editor's may change anything. +/// It is never a write of its own that a step waits on out there -- writes +/// come from a shell performing a save between steps -- so a parked request +/// is never the syscall's own. +/// +/// One per process, like the editor it belongs to. A process that never +/// starts it -- a test, the board, the browser -- has no second thread, and +/// every yield is a no-op. +pub var turn: Turn = .{}; + +pub const Turn = struct { + mutex: std.Io.Mutex = .init, + /// Set by `start`; a process that never starts the turn has none. + io: ?std.Io = null, + /// Steps out in a host syscall, from any thread. + out: u32 = 0, + /// A request that changes a pane was parked for want of quiet. + parked: bool = false, + wake_parked: ?*const fn (?*anyopaque) void = null, + wake_ctx: ?*anyopaque = null, + /// Bumped each time the editor has performed what the core asked of it, + /// so a request that asked for something -- a save, a shell -- can be + /// answered once it is done rather than merely queued, the way writing + /// `put` to acme's ctl returns after the file is written. + epoch: u64 = 0, + /// Bumped each time a shell has attempted the Restore the core asked for + /// (`takeRestore`), which lives after `pump` because it swaps the core + /// out from under it; a request that asked for one waits for this. + restores: u64 = 0, + /// Both of the above, and `out` reaching zero. + settled: std.Io.Condition = .init, + + /// The editor's thread takes the turn for good; it has it until `stop`. + pub fn start(t: *Turn, io: std.Io) void { + t.io = io; + t.mutex.lockUncancelable(io); + } + + pub fn stop(t: *Turn) void { + const io = t.io orelse return; + t.io = null; + t.parked = false; + t.mutex.unlock(io); + } + + /// The editor is about to wait for input: anyone may have the core. + pub fn rest(t: *Turn) void { + if (t.io == null) return; + t.release(); + } + + /// The editor takes the turn back -- once every step that is out in a + /// syscall has returned, since a step of the editor's may change what + /// those still point into. + pub fn wake(t: *Turn) void { + const io = t.io orelse return; + t.mutex.lockUncancelable(io); + while (t.out != 0) t.settled.waitUncancelable(io, &t.mutex); + } + + /// Whoever has the turn is about to block in the host in the middle of + /// a step. Nests: a directory listing that resolves each entry yields + /// inside a yield, and only the outermost one lets go. + pub fn yield(t: *Turn) void { + const io = t.io orelse return; + yield_depth += 1; + if (yield_depth != 1) return; + t.out += 1; + t.mutex.unlock(io); + } + + pub fn back(t: *Turn) void { + const io = t.io orelse return; + yield_depth -= 1; + if (yield_depth != 0) return; + t.mutex.lockUncancelable(io); + t.out -= 1; + if (t.out == 0) t.settled.broadcast(io); + } + + /// How many yields this thread is inside of. + threadlocal var yield_depth: u32 = 0; + + /// A connection task takes the turn; answers whether nothing is out + /// mid-step, which is what a request that changes a pane needs. + pub fn take(t: *Turn) bool { + t.mutex.lockUncancelable(t.io.?); + return t.out == 0; + } + + pub fn give(t: *Turn) void { + t.release(); + } + + /// The editor performed the core's effects. + pub fn settle(t: *Turn) void { + const io = t.io orelse return; + t.epoch +%= 1; + t.settled.broadcast(io); + } + + /// With the turn: waits, turn given up meanwhile, until the editor has + /// performed past `epoch`; stopping ends the wait early. + pub fn awaitSettled(t: *Turn, epoch: u64) void { + while (t.epoch == epoch) t.settled.wait(t.io.?, &t.mutex) catch return; + } + + /// The shell attempted the Restore the core asked for, whichever way it + /// went; called at the top of each loop step, when the previous step's + /// attempt is over. + pub fn restoreSettled(t: *Turn) void { + const io = t.io orelse return; + t.restores +%= 1; + t.settled.broadcast(io); + } + + pub fn awaitRestored(t: *Turn, restores: u64) void { + while (t.restores == restores) t.settled.wait(t.io.?, &t.mutex) catch return; + } + + fn release(t: *Turn) void { + const woken = t.out == 0 and t.parked; + if (woken) t.parked = false; + t.mutex.unlock(t.io.?); + if (woken) if (t.wake_parked) |f| f(t.wake_ctx); + } +}; + pub const can_attach = platform == .tty or platform == .gui; pub const terminal_panes = platform != .esp32p4; @@ -4754,7 +4896,6 @@ pub const Event = union(enum) { /// this must not clamp onto and preview the final grid cell. pointer_leave, tick, - fs_req: ctlfs.Req, }; pub const attach_name_max = 256; @@ -4792,7 +4933,6 @@ pub const Effect = union(enum) { /// Write the build-time theme ring below the per-user config directory. /// The pane receives the completion/error message from the native host. dump_themes: struct { pane: u8 }, - fs_reply: ctlfs.Reply, attach: struct { pane: u8, name: Buf(attach_name_max) }, detach: struct { pane: u8 }, quit, @@ -5910,11 +6050,6 @@ pub const Options = struct { ninep_name: []const u8 = "", ninep_tcp: ?[]const u8 = null, ninep_quic: ?[]const u8 = null, - ninep_identity: struct { - socket_path: []const u8 = "", - tcp_address: ?std.Io.net.IpAddress = null, - quic_address: ?std.Io.net.IpAddress = null, - } = .{}, mounts: []const filesystem.Mount = &.{}, config_dir: ?[]const u8 = null, startup_config_path: ?[]const u8 = null, @@ -6182,11 +6317,7 @@ pub const Pardes = struct { .pdf_gpa = pdf_gpa, .tree_sitter_gpa = tree_sitter_gpa, .opts = opts, - .fs = .{ - .socket_path = opts.ninep_identity.socket_path, - .tcp_address = opts.ninep_identity.tcp_address, - .quic_address = opts.ninep_identity.quic_address, - }, + .fs = .{}, .screen_w = opts.cols, .screen_h = opts.rows, .scratch = .init(gpa), @@ -6197,7 +6328,6 @@ pub const Pardes = struct { p.fs.started = ctlfs.events.now(); for (opts.mounts) |mount| try p.fs.mount(gpa, mount.name, mount.dial); p.opts.mounts = &.{}; - p.opts.ninep_identity = .{}; p.boot = Boot.of(opts); switch (p.boot) { .document => { @@ -6310,13 +6440,31 @@ pub const Pardes = struct { return @intCast(std.math.clamp(panes.File.displayWidth(text) + 2, 1, @as(usize, limit))); } + const Printed = struct { left: u16, dropped: usize }; + /// Prints `text` flush with the right edge of the band, and answers the - /// column it started at so a cursor can follow it. - fn printRight(s: *Surface, x: u16, row: u16, w: u16, text: []const u8, style: CellStyle) u16 { - const shown: u16 = @intCast(@min(@as(usize, w), panes.File.displayWidth(text))); - const left = x + w - shown; - _ = s.print(left, row, shown, text, style); - return left; + /// column it started at so a cursor can follow it. Text wider than the + /// band loses its HEAD: the end is the part that says something -- a + /// path's file name, an error's reason -- and `dropped` is how many + /// columns of it went. + fn printRight(s: *Surface, x: u16, row: u16, w: u16, text: []const u8, style: CellStyle) Printed { + const width = panes.File.displayWidth(text); + if (width <= w) { + const left: u16 = @intCast(x + w - width); + _ = s.print(left, row, @intCast(width), text, style); + return .{ .left = left, .dropped = 0 }; + } + // Whole glyphs only: a cut inside a wide one would leave the rest a + // column too wide and clip its LAST glyph instead of the first. + var dropped = width - w; + var start = panes.File.rawAtDisplay(text, dropped); + if (panes.File.rawDisplayCol(text, start) < dropped) { + dropped += 1; + start = panes.File.rawAtDisplay(text, dropped); + } + const left: u16 = @intCast(x + w - (width - dropped)); + _ = s.print(left, row, @intCast(width - dropped), text[start..], style); + return .{ .left = left, .dropped = dropped }; } /// The layout every single-pane boot starts from. @@ -6904,8 +7052,14 @@ pub const Pardes = struct { fn showMessage(p: *Pardes, id: usize, text: []const u8) void { if (id >= MAX_PANES) return; const pane = p.panes[id] orelse return; - pane.msg_len = @intCast(@min(text.len, pane.msg.len)); - @memcpy(pane.msg[0..pane.msg_len], text[0..pane.msg_len]); + // One row of printable text: a language server's multi-line report + // reads as one line, and the cut never leaves half a glyph behind. + var n: usize = @min(text.len, pane.msg.len); + if (n < text.len) { + while (n > 0 and text[n] & 0xC0 == 0x80) n -= 1; + } + for (text[0..n], pane.msg[0..n]) |c, *cell| cell.* = if (c < 0x20 or c == 0x7f) ' ' else c; + pane.msg_len = @intCast(n); } fn logMessage(p: *Pardes, id: usize, text: []const u8) void { @@ -7040,7 +7194,7 @@ pub const Pardes = struct { pub fn postEvent(p: *Pardes, ev: Event) void { switch (ev) { .key => |k| std.debug.assert(k.text.len == 0), - .output, .paste, .lsp_resp, .pipe_resp, .file_changed, .command, .fs_req => unreachable, + .output, .paste, .lsp_resp, .pipe_resp, .file_changed, .command => unreachable, else => {}, } if (p.in_len == p.in_q.len) return; @@ -7173,7 +7327,6 @@ pub const Pardes = struct { }, .theme_file => |t| if (v.watch_theme) |f| f(p.host.ctx, t.generation, t.on), .dump_themes => |d| if (v.dump_themes) |f| f(p.host.ctx, d.pane), - .fs_reply => {}, .attach => |a| { const name = a.name.slice(); @memcpy(p.attach_buf[0..name.len], name); @@ -7194,6 +7347,7 @@ pub const Pardes = struct { if (v.wait_input) |f| f(h.ctx, if (p.animationActive()) layout.Animation.frame_ms else 0); while (p.nextQueued()) |ev| p.update(ev); while (p.nextEffect()) |e| p.perform(e); + turn.settle(); // A quitting frame has already freed what it would draw. if (p.quit) return; if (v.poll_frame) |f| f(h.ctx); @@ -7208,24 +7362,35 @@ pub const Pardes = struct { p.needs_frame = false; } + /// One request of the control filesystem, from whichever thread has the + /// turn (`pardes.turn`). Not an event: it neither sweeps nor resets + /// anything the editor's own step may be in the middle of using, so it + /// can be answered while that step is out in a syscall. Only a request + /// that changes a pane costs a frame, which is why a round trip on a + /// local socket costs microseconds and not a vsync. + pub fn serveFs(p: *Pardes, req: ctlfs.Req) ctlfs.Reply { + if (!ctlfs.changesPane(req)) return ctlfs.handle(p, req); + p.needs_frame = true; + p.raw_hover_intent = false; + p.cancelLookHover(); + const reply = ctlfs.handle(p, req); + // 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 + // told, and the panes it made announced to /log now rather than at + // the end of whatever the editor does next. + p.sync(); + p.fsReport(); + ctlfs.events.announce(p); + return reply; + } + pub fn update(p: *Pardes, ev: Event) void { - // Only two events cannot change the screen: a tick with nothing - // animating, and a filesystem request that only reads. The second is - // what 9P traffic overwhelmingly is, and answering it used to drag a - // whole vsync-blocked frame behind it -- which is why a round trip on - // a local socket cost a frame instead of a few microseconds. - p.needs_frame = p.needs_frame or switch (ev) { - .tick => false, - .fs_req => |req| ctlfs.changesPane(req), - else => true, - }; + // A tick with nothing animating is the one event that cannot change + // the screen. + p.needs_frame = p.needs_frame or ev != .tick; p.shell_rows.sweep(p.gpa); switch (ev) { .tick => {}, - .fs_req => |req| if (ctlfs.changesPane(req)) { - p.raw_hover_intent = false; - p.cancelLookHover(); - }, .mouse => |m| if (!(m.button == .none and m.kind == .motion)) { p.raw_hover_intent = false; p.cancelLookHover(); @@ -7324,7 +7489,6 @@ pub const Pardes = struct { }, .paste => |bytes| p.applyPaste(bytes), .command => |line| _ = p.executeBuiltinLine(p.active, line), - .fs_req => |r| p.emit(.{ .fs_reply = ctlfs.handle(p, r) }), .pinch => |scale| p.ov_pinch_scale = scale, .touch_scroll => |delta| p.ov_touch_scroll_delta = delta, .pointer_leave => { @@ -12915,11 +13079,7 @@ pub const Pardes = struct { .pdf_gpa = pdf_gpa, .tree_sitter_gpa = tree_sitter_gpa, .opts = opts, - .fs = .{ - .socket_path = opts.ninep_identity.socket_path, - .tcp_address = opts.ninep_identity.tcp_address, - .quic_address = opts.ninep_identity.quic_address, - }, + .fs = .{}, .screen_w = opts.cols, .screen_h = opts.rows, .scratch = .init(gpa), @@ -12934,13 +13094,9 @@ pub const Pardes = struct { p.cell_pixels = old.cell_pixels; p.row_metrics = old.row_metrics; p.native_images = old.native_images; - p.fs.socket_path = old.fs.socket_path; - p.fs.tcp_address = old.fs.tcp_address; - p.fs.quic_address = old.fs.quic_address; } for (opts.mounts) |mount| try p.fs.mount(gpa, mount.name, mount.dial); p.opts.mounts = &.{}; - p.opts.ninep_identity = .{}; var parsed = try dump.readZon(gpa, zon_bytes, "load"); defer parsed.deinit(); const st = parsed.value; @@ -13521,16 +13677,19 @@ pub const Pardes = struct { // right would put it past the pane, off the grid, and past what // the detached wire will encode -- which drops every frame for // as long as the prompt is up. - const left = printRight(s, cx, row, chip -| 1, text, msg_style); + const printed = printRight(s, cx, row, chip -| 1, text, msg_style); if (kind != .prompt or id != p.active) continue; const at = pane.promptAt() orelse continue; const prompt0 = (p.tagPrefix(pane) catch continue).len + at; const col = @as(usize, pane.tag_col); if (col < prompt0) continue; - // The cursor follows the text to wherever it landed. + // The cursor follows the text to wherever it landed; a caret + // in the part a narrow band dropped has nowhere to be. const prompt_col = panes.File.displayWidth(text[0..@min(col - prompt0, text.len)]); - if (left + prompt_col < tx + tw) - s.cursor = .{ .x = left + @as(u16, @intCast(prompt_col)), .y = row, .bar = pane.mode == .insert }; + if (prompt_col < printed.dropped) continue; + const caret = printed.left + (prompt_col - printed.dropped); + if (caret < tx + tw) + s.cursor = .{ .x = @intCast(caret), .y = row, .bar = pane.mode == .insert }; } } @@ -14018,12 +14177,19 @@ pub const Pardes = struct { const chip = r.x + r.w - cx; // Right aligned inside the chip, a blank cell short of its // edge: the same one the grid pass leaves for a prompt caret. + // Wider than the chip, the text loses its head, as on the grid. const room = p.tagCapacity(chip) -| 1; const shown = panes.File.displayWidth(text); - const pad = room -| shown; - const line = try arena.alloc(u8, pad + text.len); + var kept = text; + if (shown > room) { + var start = panes.File.rawAtDisplay(text, shown - room); + if (panes.File.rawDisplayCol(text, start) < shown - room) start = panes.File.rawAtDisplay(text, shown - room + 1); + kept = text[start..]; + } + const pad = room -| panes.File.displayWidth(kept); + const line = try arena.alloc(u8, pad + kept.len); @memset(line[0..pad], ' '); - @memcpy(line[pad..], text); + @memcpy(line[pad..], kept); try p.renderHeaderLayer(arena, NOTICE_LAYER_BASE + id * Pane.Notices.max + i, .notice, @intCast(id), .{ .x = cx, .y = first + @as(u16, @intCast(i)), @@ -14221,8 +14387,12 @@ pub const Pardes = struct { if (pane.hasPdf() and panes.Pdf.draw(p, pane, r, id, tx, tw)) return; if (pane.image) |*iv| { - const image_h = r.h -| BOX_H; - panes.Image.draw(p, iv, @intCast(id), pane.serial, tx, body_y, tw, image_h); + // Below the notice chips: a picture is drawn after the cells (the + // GUI's image pass, kitty's z-order), so a chip over it would be + // painted out. Text gets the overlay; a picture gives up the rows. + const shown = pane.notices.len; + const image_h = (r.h -| BOX_H) -| shown; + panes.Image.draw(p, iv, @intCast(id), pane.serial, tx, body_y + shown, tw, image_h); // thumbless, but the same one column as the real scrollbar below — // that is the whole point of drawing it, and like that one it runs // past the notice bands so the gutter has no notch in it diff --git a/src/tty/tty.zig b/src/tty/tty.zig index 23b7c09b..03ccd3e2 100644 --- a/src/tty/tty.zig +++ b/src/tty/tty.zig @@ -727,6 +727,7 @@ fn localSession( if (sh.inotify_fd >= 0) sh.watch_task = io.concurrent(watchFiles, .{ io, sh.inotify_fd, loop }) catch null; frames: while (!core.quit) { + pardes.turn.restoreSettled(); try core.pump(host); if (core.takeRestore()) |rp| blk: { const bytes = filesystem.readRestore(gpa, rp) catch |err| { @@ -760,7 +761,7 @@ fn localSession( _ = file_watch.applyThemeEffect(core, gpa, sh.inotify_fd, &sh.watches, 0, false, false); clearNativeImages(kitty_handles, vx, tty); nc.native_images = vx.caps.kitty_graphics; - if (fs) |f| f.reset(core); + if (fs) |f| f.reset(nc); core.deinit(); core = nc; sh.core = nc; @@ -871,15 +872,21 @@ const Shell = struct { fn waitInput(ctx: ?*anyopaque, timeout_ms: u32) void { const s = of(ctx); var batch: usize = 0; + // The wait is the 9P connections' turn with the core. if (timeout_ms == 0) { + pardes.turn.rest(); const first = s.loop.nextEvent() catch { + pardes.turn.wake(); s.core.quit = true; return s.reloadWatched(); }; + pardes.turn.wake(); batch = 1; if (s.apply(first)) return s.reloadWatched(); } else { + pardes.turn.rest(); std.Io.sleep(s.io, .fromMilliseconds(timeout_ms), .awake) catch {}; + pardes.turn.wake(); _ = s.apply(.tick); batch = 1; } @@ -994,7 +1001,7 @@ const Shell = struct { fn pollFrame(ctx: ?*anyopaque) void { const s = of(ctx); - if (s.fs) |f| if (f.tick(s.core).pending) { + if (s.fs) |f| if (f.tick().pending) { _ = s.loop.tryPostEvent(.fs_ready) catch {}; }; for (&s.ptys, 0..) |*slot, id| if (slot.*) |pt| { diff --git a/test/fs_namespace.zig b/test/fs_namespace.zig index 3eba6639..ec94b509 100644 --- a/test/fs_namespace.zig +++ b/test/fs_namespace.zig @@ -98,9 +98,6 @@ test "transactional restore preserves host capabilities and advances pane identi try std.testing.expect(restored.paneBySerial(pane.serial) == null); try std.testing.expectEqual(p.screen_w, restored.screen_w); try std.testing.expectEqual(p.screen_h, restored.screen_h); - try std.testing.expectEqualStrings(p.fs.socket_path, restored.fs.socket_path); - try std.testing.expectEqualDeep(p.fs.tcp_address, restored.fs.tcp_address); - try std.testing.expectEqualDeep(p.fs.quic_address, restored.fs.quic_address); try std.testing.expect(p.panes[0] == pane); try std.testing.expectEqualStrings("before\n", pane.file.?.content); try std.testing.expectError(error.BadDumpMagic, p.restore( @@ -112,27 +109,6 @@ test "transactional restore preserves host capabilities and advances pane identi try std.testing.expectEqualStrings("/tmp/session.sock", p.fs.socket_path); } -test "same-session identity is available before an initial mounted file is opened" { - if (!filesystem.platform_has_fs) return error.SkipZigTest; - const gpa = std.testing.allocator; - var tmp = std.testing.tmpDir(.{}); - defer tmp.cleanup(); - try tmp.dir.writeFile(std.testing.io, .{ .sub_path = "file.txt", .data = "no socket required\n" }); - var buf: [4096]u8 = undefined; - const len = try tmp.dir.realPathFile(std.testing.io, "file.txt", &buf); - const path = try std.fmt.allocPrint(gpa, "/n/own/os{s}", .{buf[0..len]}); - defer gpa.free(path); - const p = try pardes.Pardes.init(gpa, .{ - .file = path, - .mounts = &.{.{ .name = "own", .dial = "/tmp/not-listening.sock" }}, - .ninep_identity = .{ .socket_path = "/tmp/not-listening.sock" }, - }); - defer p.deinit(); - try std.testing.expectEqualStrings(path, p.panes[0].?.file.?.path); - try std.testing.expectEqualStrings("no socket required\n", p.panes[0].?.file.?.content); - try std.testing.expectEqualStrings("", p.opts.ninep_identity.socket_path); -} - test "filesystem resolves OS first then virtual with explicit mounts and parent paths" { if (!filesystem.platform_has_fs) return error.SkipZigTest; const gpa = std.testing.allocator; diff --git a/test/selfmount.py b/test/selfmount.py new file mode 100644 index 00000000..cc889a93 --- /dev/null +++ b/test/selfmount.py @@ -0,0 +1,126 @@ +#!/usr/bin/env python3 +"""A session that opens, reads and saves its own 9P tree through a mount. + +The editor runs under `9ns --mntgen`, so /mnt/9p/pardes/ inside its +namespace is its own tree, and is driven over its socket from outside. This +used to hang the editor outright: the realpath, the stat and the read went +out through the mount and came back as 9P requests only the editor's loop +could answer, while that loop was blocked making them. Now the connection's +task answers them while the editor waits (pardes.turn). + +Needs 9ns (cloud9) on PATH or in ~/.local/bin, and a runtime directory; it +skips, loudly, without them. +""" +import fcntl +import os +from pathlib import Path +import pty +import shutil +import signal +import struct +import sys +import termios +import time + +sys.path.insert(0, str(Path(__file__).resolve().parent)) +from ninep import Client + + +def run(binary): + ns = shutil.which('9ns') or str(Path.home() / '.local/bin/9ns') + runtime = os.environ.get('XDG_RUNTIME_DIR') + if not os.path.exists(ns) or not runtime: + print('selfmount: skipped (needs 9ns and XDG_RUNTIME_DIR)') + return 0 + name = 'selfmount%d' % os.getpid() + sock = f'{runtime}/pardes-9p-{name}.sock' + fixture = Path(f'/tmp/{name}.txt') + fixture.write_bytes(b'initial\n') + env = {k: v for k, v in os.environ.items() if not k.startswith('PARDES_')} + env.update(PARDES_NOTIME='1', TERM='xterm-256color', PARDES_DUMP=f'/tmp/{name}.dump.zon') + for language in ['RS', 'C', 'GO', 'TS', 'PY']: + env['PARDES_LSP_' + language] = '' + pid, master = pty.fork() + if pid == 0: + os.execve(ns, ['9ns', '--mntgen', '--', binary, '--tty', '--9p=' + name, str(fixture)], env) + fcntl.ioctl(master, termios.TIOCSWINSZ, struct.pack('HHHH', 30, 100, 0, 0)) + os.set_blocking(master, False) + tail = bytearray() + + def drain(): + try: + while True: + chunk = os.read(master, 65536) + if not chunk: + return + tail.extend(chunk[-2000:]) + except OSError: + pass + + failures = [] + + def check(condition, what): + print(('ok ' if condition else 'FAIL ') + what) + if not condition: + failures.append(what) + + try: + deadline = time.monotonic() + 15 + while not os.path.exists(sock): + drain() + if time.monotonic() > deadline: + raise TimeoutError('socket never appeared: ' + tail.decode(errors='replace')[-400:]) + time.sleep(.02) + time.sleep(.3) + mount = f'/mnt/9p/pardes/{name}' + with Client(sock) as client: + index = client.read('/index').decode() + rows = [row.split(maxsplit=3) for row in index.splitlines()] + first = rows[0][0] + # A Look at the tree's own index: realpath, stat and read all go + # out through 9ns and back in, and the write returns when the + # pane is open. + started = time.monotonic() + client.write('/look', (mount + '/index\n').encode()) + took = time.monotonic() - started + check(took < 5, f'look at the mounted index returned ({took:.2f}s)') + rows = [row.split(maxsplit=3) for row in client.read('/index').decode().splitlines()] + opened = [row for row in rows if len(row) == 4 and row[3] == mount + '/index'] + check(len(opened) == 1, 'a pane opened on the mounted index') + if opened: + body = client.read(f'/pane/{opened[0][0]}/body').decode() + check(body.startswith(index.splitlines()[0]), 'its body is the index as served') + # A Look at pane 1's body through the mount, an edit of the copy, + # and a Save: the save writes back through the mount into pane 1, + # and the exec returns once it has. + client.write('/look', f'{mount}/pane/{first}/body\n'.encode()) + rows = [row.split(maxsplit=3) for row in client.read('/index').decode().splitlines()] + mirror = [row for row in rows if len(row) == 4 and row[3] == f'{mount}/pane/{first}/body'] + check(len(mirror) == 1, 'a pane opened on the mounted body') + if mirror: + pane = mirror[0][0] + client.write(f'/pane/{pane}/addr', b'#0,#0') + client.write(f'/pane/{pane}/data', b'HELLO ') + client.write(f'/pane/{pane}/exec', b'Save\n') + check(client.read(f'/pane/{first}/body') == b'HELLO initial\n', f'Save wrote back through the mount into pane {first}') + text = ''.join(cell[0] for cell in client.screen()['cells']) + check('saved ' + mount in text, 'the editor reported the save') + client.write('/exec', b'Msg still here\n') + text = ''.join(cell[0] for cell in client.screen()['cells']) + check('still here' in text, 'the editor answers after all of that') + finally: + os.kill(pid, signal.SIGTERM) + time.sleep(.2) + try: + os.kill(pid, signal.SIGKILL) + except ProcessLookupError: + pass + os.waitpid(pid, 0) + for path in (fixture, Path(f'/tmp/{name}.dump.zon')): + path.unlink(missing_ok=True) + print('selfmount: ' + ('ok' if not failures else f'{len(failures)} failed')) + return 0 if not failures else 1 + + +if __name__ == '__main__': + sys.exit(run(str(Path(sys.argv[1]).resolve()))) diff --git a/test/snapshots/images.golden b/test/snapshots/images.golden index a1b78556..74b5f873 100644 --- a/test/snapshots/images.golden +++ b/test/snapshots/images.golden @@ -54,29 +54,29 @@ == style term-palette grid=150x31 |3: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, |6: 0-1 #000000,#add38a, 2-2 d,#26362d, 3-72 #becfc4,#26362d, 73-74 #dfbce5,#26362d, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|7: 0-0 d,#152019, 1-27 d,#0d1410, 28-28 p8,p5, 29-30 p8,p4, 31-31 p4,p8, 32-35 p8,p4, 36-37 p4,p8, 38-39 p8,p4, 40-40 p4,p8, 41-42 p8,p4, 43-43 p4,p8, 44-46 p8,p4, 47-47 p12,p8, 48-65 d,#0d1410, 66-66 d,#1d2824, 67-73 #b2c3b8,#1d2824, 74-74 d,#1d2824, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|8: 0-0 d,#152019, 1-27 d,#0d1410, 28-30 p8,p4, 31-33 p4,p8, 34-34 p8,p4, 35-36 p4,p8, 37-37 p8,p4, 38-41 p4,p8, 42-42 p8,p4, 43-43 p4,p8, 44-44 p8,p12, 45-46 p12,p8, 47-47 p12,p12, 48-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|9: 0-0 d,#152019, 1-27 d,#0d1410, 28-28 p8,p4, 29-29 p4,p8, 30-30 p8,p4, 31-31 p4,p8, 32-32 p8,p4, 33-33 p4,p8, 34-35 p8,p4, 36-37 p4,p8, 38-38 p8,p5, 39-41 p8,p4, 42-42 p4,p8, 43-44 p12,p8, 45-47 p12,p12, 48-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|10: 0-0 d,#152019, 1-27 d,#0d1410, 28-29 p8,p4, 30-34 p4,p8, 35-36 p8,p4, 37-38 p4,p8, 39-39 p8,p4, 40-40 p4,p8, 41-41 p12,p8, 42-47 p12,p12, 48-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|11: 0-0 d,#152019, 1-27 d,#0d1410, 28-28 p4,p8, 29-29 p8,p4, 30-31 p4,p8, 32-32 p8,p4, 33-33 p4,p8, 34-34 p8,p4, 35-36 p4,p8, 37-37 p8,p4, 38-38 p8,p12, 39-39 p12,p8, 40-47 p12,p12, 48-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|12: 0-0 d,#152019, 1-27 d,#0d1410, 28-28 p8,p4, 29-31 p4,p8, 32-35 p8,p4, 36-36 p4,p8, 37-37 p12,p8, 38-47 p12,p12, 48-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|13: 0-0 d,#152019, 1-27 d,#0d1410, 28-32 p8,p4, 33-33 p4,p8, 34-34 p8,p12, 35-36 p12,p8, 37-47 p12,p12, 48-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|14: 0-0 d,#152019, 1-27 d,#0d1410, 28-28 p8,p4, 29-29 p4,p8, 30-30 p8,p4, 31-32 p4,p8, 33-33 p12,p8, 34-34 p8,p12, 35-47 p12,p12, 48-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|15: 0-0 d,#152019, 1-27 d,#0d1410, 28-29 p4,p8, 30-30 p8,p12, 31-32 p12,p8, 33-47 p12,p12, 48-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, -|16: 0-0 d,#152019, 1-27 d,#0d1410, 28-28 p8,p12, 29-29 p12,p8, 30-47 p12,p12, 48-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|7: 0-0 d,#152019, 1-65 d,#0d1410, 66-66 d,#1d2824, 67-73 #b2c3b8,#1d2824, 74-74 d,#1d2824, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|8: 0-0 d,#152019, 1-28 d,#0d1410, 29-31 p8,p4, 32-33 p4,p8, 34-37 p8,p4, 38-38 p4,p8, 39-44 p8,p4, 45-45 p8,p12, 46-46 p12,p8, 47-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|9: 0-0 d,#152019, 1-28 d,#0d1410, 29-29 p8,p4, 30-30 p4,p8, 31-35 p8,p4, 36-36 p5,p8, 37-37 p8,p4, 38-38 p4,p8, 39-41 p8,p4, 42-42 p4,p8, 43-43 p8,p12, 44-45 p12,p8, 46-46 p12,p12, 47-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|10: 0-0 d,#152019, 1-28 d,#0d1410, 29-30 p8,p4, 31-32 p4,p8, 33-40 p8,p4, 41-41 p8,p12, 42-43 p12,p8, 44-46 p12,p12, 47-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|11: 0-0 d,#152019, 1-28 d,#0d1410, 29-31 p8,p4, 32-32 p4,p8, 33-34 p8,p4, 35-37 p4,p8, 38-38 p8,p4, 39-39 p8,p12, 40-41 p12,p8, 42-46 p12,p12, 47-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|12: 0-0 d,#152019, 1-28 d,#0d1410, 29-36 p8,p4, 37-37 p8,p12, 38-39 p12,p8, 40-46 p12,p12, 47-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|13: 0-0 d,#152019, 1-28 d,#0d1410, 29-30 p4,p8, 31-34 p8,p4, 35-35 p8,p12, 36-36 p12,p8, 37-46 p12,p12, 47-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|14: 0-0 d,#152019, 1-28 d,#0d1410, 29-29 p4,p8, 30-31 p8,p4, 32-32 p4,p8, 33-33 p8,p12, 34-35 p12,p8, 36-46 p12,p12, 47-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|15: 0-0 d,#152019, 1-28 d,#0d1410, 29-29 p4,p8, 30-30 p8,p4, 31-31 p8,p12, 32-32 p12,p8, 33-46 p12,p12, 47-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, +|16: 0-0 d,#152019, 1-28 d,#0d1410, 29-29 p8,p12, 30-30 p12,p8, 31-46 p12,p12, 47-74 d,#0d1410, 75-75 d,#608269, 76-76 d,#0d1410, 77-149 #e5eee5,#0d1410, == snap no-ascii grid=150x31 cursor=11,8 |3: ls ls |6: img petscii:off palette:terminal ascii:off /tmp/pardes-snap/images/cwd/p -|7: ███╱█🬻██🬺██🬻███╱██🬴▄ Ascii -|8: 🬬██╱███╱🬻🬝🬻🬬████🬝🬵█ -|9: █╲█🬴████╲╱█🬝██▟▄█ -|10: ██╲╱╲█🬝█████╱🬵 -|11: ╱█████████🬝▄ -|12: █│█████🬝🬝🬹 -|13: ██████🬝▄█ -|14: 🬜🬬██🬸▄╲ -|15: 🬺█🬝🬵█ -|16: 🬝▄ +|7: Ascii +|8: █🬝█╲███▙🬸🬬🬻█████🬝🬵 +|9: ███████🬻██🬸█🬝█🬝▄█ +|10: ████████████🬝▄█ +|11: ███🬸██████🬝▄█ +|12: ████████🬝🬵█ +|13: ╱█████🬝▄ +|14: █🬬█╲🬝🬵█ +|15: 🬺█🬝🬵 +|16: 🬝▄ == snap tag-edit grid=400x31 cursor=87,6 |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill | New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol diff --git a/test/snapshots/msg.golden b/test/snapshots/msg.golden index 653e9772..1d5b4cc2 100644 --- a/test/snapshots/msg.golden +++ b/test/snapshots/msg.golden @@ -48,3 +48,7 @@ |2: /tmp/pardes-snap/msg/cwd/a.txt * Save Tty Collapse Del |3: 1 AGAIN hand-written report |5: 3 Msg hand-written report +== snap msgtail grid=70x17 cursor=32,7 +|3: 6789 0123456789 0123456789 0123456789 0123456789 0123456789 THE-END +|6: 4 Msg 0123456789 0123456789 0123456789 0123456789 0123456789 012↩ +|7: 3456789 0123456789 THE-END diff --git a/test/snapshots/msg.snap b/test/snapshots/msg.snap index c8a0a265..5252508a 100644 --- a/test/snapshots/msg.snap +++ b/test/snapshots/msg.snap @@ -89,3 +89,15 @@ key x key tab stable 700 15000 snap msgbuiltin +# A message wider than the pane keeps its TAIL, not its head: the end of a +# message is the part that says something -- a path's file name, an error's +# reason -- so the head is what a narrow pane goes without. +key j +key o +text Msg 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 THE-END +key esc +settle 100 +key x +key tab +stable 700 15000 +snap msgtail diff --git a/test/snapshots/tagbottomimage.golden b/test/snapshots/tagbottomimage.golden index e7100114..0136e1a0 100644 --- a/test/snapshots/tagbottomimage.golden +++ b/test/snapshots/tagbottomimage.golden @@ -35,30 +35,30 @@ |3: pic.ppm |4: |5: /tmp/pardes-snap/tagbottomimage/cwd Tty Save Mode Filter Collapse Del -|6: 4*🬹~F~N🬰|G🬏▚Y~KF🬴s>T&zZ/🬻iTY=`S~╳bkZR37v🬦🬵d4QHZ8X▛▟ -|8: ^🬪🬛$}DrydNU&wsz=`*r🬒🬓🬳🬟*Y🬴G6🬧f🬮/>t🬧u🬲1Rg1t🬝🬻█ -|9: ▖#_{🬗X@🬢&$s'C%*=w@🬆▀wq%🬡d┼a┼m─>🬭🬜A▀A🬲H]p🬝🬹 -|10: %?WX🬕f🬩*TA8n╱┼E▘🬭Y#qo~XVE▐(╳▀H4^[mj🬗=🬒🬕▟█ -|11: ]Z🬷eb~Oyl3=SL▙a🬱🬉~MPMz}FMu<🬝▚>3&▖🬷WS🬝~█ -|12: EF-🬑y🬔!r🬙🬐╳O🬩▐%Qj─4za/?/\a🬜"🬖🬈🬛🬟A🬙🬝▄ -|13: 🬃N@xzOnczIK=t0@🬖j5🬮🬧65▟{🬮🬉🬄🬩zQ9/🬝🬻 -|14: ╲${&%@"#ctt▀Cr5F;🬐ARM╱uej╳75🬹9▛🬻 -|15: h^🬜"🬈🬨▜╲|W🬊🬦k6^🬰🬶rZ─▄\z9🬎🬉4^🬎🬻 -|16: 🬆f│Q_V🬗wGx🬱=5▛5*&V🬟🬄ZrXGz2🬝🬻█ -|17: !🬷W🬐(🬭]7x_>▗er🬯~▚di🬬4jY:🬝▟ -|18: gU~🬧3▙bjr\C#kKMpffAjps🬝🬻 -|19: *🬯G"🬣▟d🬮▀zJ🬪EHV▟╳9}y▛▄ -|20: ``))~RyJ🬴jA~w=hLpX🬝🬻█ -|21: 4x▀J"TG7=y-QZ🬙╲~▛🬻 -|22: 🬯/+╳f9ZG🬕+{QN_🬝🬹 -|23: E<'─🬫pS!"n4&🬝~ -|24: m$dx"!2🬳&{🬝🬻 -|25: *8f🬩▙Jb🬒🬝🬻█ -|26: m🬩7CiN🬎🬹 -|27: pG╲L🬝🬻 -|28: 🬡L🬝▄ -|29: 🬝~ +|6: Tagbottom +|7: {DbgY🬲s▜M^#▐FUJ[zNq=🬝g/y╱?V@🬱🬙▌UK╱🬍("🬕KJ8hSo🬝🬻 +|8: tX🬆s>🬌`🬵 Date: Tue, 22 Sep 2026 16:44:05 -0300 Subject: gui: PARDES_TEST_LATENCY trace of input reads and frame fences --- src/gui/gui.zig | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'src/gui') diff --git a/src/gui/gui.zig b/src/gui/gui.zig index 8da6f933..17bdb46f 100644 --- a/src/gui/gui.zig +++ b/src/gui/gui.zig @@ -2096,6 +2096,12 @@ fn runNative(init: std.process.Init, opts_in: pardes.Options, attach: ?[]const u log.err("PARDES_TEST requires PARDES_TEST_CAPTURE_DIR", .{}); return error.SdlInit; } + if (test_mode) if (env.get("PARDES_TEST_LATENCY")) |path| { + var path_buf: [4096]u8 = undefined; + if (std.fmt.bufPrintSentinel(&path_buf, "{s}", .{path}, 0)) |z| + latency_fd = libc.open(z, .{ .ACCMODE = .WRONLY, .CREAT = true, .TRUNC = true, .CLOEXEC = true }, @as(libc.mode_t, 0o644)) + else |_| {} + }; _ = c.SDL_SetHint("SDL_JOYSTICK_HIDAPI", "1"); // SDL_HINT_JOYSTICK_HIDAPI _ = c.SDL_SetHint("SDL_JOYSTICK_HIDAPI_STEAMDECK", "1"); // ..._STEAMDECK @@ -2105,6 +2111,8 @@ fn runNative(init: std.process.Init, opts_in: pardes.Options, attach: ?[]const u } var win_flags: c.SDL_WindowFlags = c.SDL_WINDOW_RESIZABLE; if (!test_mode) win_flags |= c.SDL_WINDOW_HIGH_PIXEL_DENSITY; + // A latency run renders to the capture texture; keep it off the desktop. + if (latency_fd >= 0) win_flags |= c.SDL_WINDOW_HIDDEN; const native_wayland = !test_mode and std.mem.eql(u8, std.mem.span(c.SDL_GetCurrentVideoDriver()), "wayland"); // Background-only opacity needs per-pixel alpha; whole-window compositor // opacity would dim the text as well. SDL requires this flag at creation. @@ -2769,6 +2777,7 @@ const StdinFeed = struct { } const rn = libc.read(0, f.buf[f.fill..].ptr, f.buf.len - f.fill); if (rn < 0) return out; + if (rn > 0) latencyNote("R {d}\n", .{monoNs()}); if (rn == 0) { out.eof = true; return out; @@ -3884,6 +3893,7 @@ fn present(ctx: ?*anyopaque, surface: *const pardes.Surface) void { const s = shellOf(ctx); const core = s.core; const g = s.gui orelse return; + frame_started_ns = monoNs(); const frame = @constCast(surface); s.surface = frame; const scene_requested = core.settings.scene_effects.crt or @@ -6371,6 +6381,25 @@ test "background opacity retains exact endpoints and percentage precision" { } } +/// PARDES_TEST_LATENCY trace for an external driver, CLOCK_MONOTONIC ns: +/// `R t` when stdin input is read, `F start fence` per captured frame (present +/// entry, and the GPU fence of that frame). Nothing is written without it. +var latency_fd: c_int = -1; +var frame_started_ns: u64 = 0; + +fn monoNs() u64 { + var ts: libc.timespec = undefined; + if (libc.clock_gettime(.MONOTONIC, &ts) != 0) return 0; + return @as(u64, @intCast(ts.sec)) * std.time.ns_per_s + @as(u64, @intCast(ts.nsec)); +} + +fn latencyNote(comptime fmt: []const u8, args: anytype) void { + if (latency_fd < 0) return; + var buf: [64]u8 = undefined; + const line = std.fmt.bufPrint(&buf, fmt, args) catch return; + _ = libc.write(latency_fd, line.ptr, line.len); +} + fn captureFrame(g: *Gui, gpa: std.mem.Allocator, cmd: *c.SDL_GPUCommandBuffer, target: *c.SDL_GPUTexture, sw: u32, sh: u32) !void { const size = c.SDL_CalculateGPUTextureFormatSize(g.swapchain_format, sw, sh, 1); if (size == 0) { @@ -6398,6 +6427,7 @@ fn captureFrame(g: *Gui, gpa: std.mem.Allocator, cmd: *c.SDL_GPUCommandBuffer, t defer c.SDL_ReleaseGPUFence(g.device, fence); var fences = [_]*c.SDL_GPUFence{fence}; if (!c.SDL_WaitForGPUFences(g.device, true, &fences, 1)) return error.GpuSubmit; + latencyNote("F {d} {d}\n", .{ frame_started_ns, monoNs() }); const mapped = c.SDL_MapGPUTransferBuffer(g.device, xfer, false) orelse return error.GpuMap; defer c.SDL_UnmapGPUTransferBuffer(g.device, xfer); -- cgit v1.3 From 9695cb098c784792af79c22d46a17f7bc7247d33 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 22 Sep 2026 17:43:57 -0300 Subject: Repaint PDF highlights by row, send rasters by shared memory, and animate messages PDF highlights (hover preview, search, selection) are baked into page rasters, and any change re-rendered the whole page with MuPDF; the TTY then re-sent it as base64 (4.7 MB a page), the GUI as a new texture. Worse, a pointer motion over a PDF invalidated the page even when no preview was shown, so every motion paid that. Now: - A raster whose baked highlight set equals the wanted one is left alone. - A highlighted page keeps its clean rows (before highlights and tint); a change repaints only the rows of quads that differ, running MuPDF's highlight pass (pardes_pdf_paint_highlights) over those clean rows and tinting them: the operations a full render performs, so the pixels are identical. MuPDF band renders are NOT bit-identical to a whole page (edge rows, resampled images), so they are never used to patch; the comment claiming otherwise is corrected. - ImagePlace.patch hands shells the changed rows; the GUI uploads just those rows into the texture it holds. - The TTY probes kitty shared memory (t=s) with an id vaxis never reaches and sends rasters as a /dev/shm name when the terminal reads it; direct base64 otherwise (ssh). - Shells that take row patches (GUI, TTY with shm) repaint a selection while it is dragged instead of only on release. Latency elsewhere: - TTY: an animating frame no longer sleeps 16 ms blind; a tick thread posts into the input queue, so input inside the frame is handled at once. - TTY and GUI: queued pointer motions coalesce to the last. - GUI: a skipped swapchain image re-arms the frame (3 retries); animations still tick while nothing presents. - Editing: the line index is carried across an edit instead of rebuilt from a scan of the whole file per keystroke. Messages fall into their row (ease-in; the GUI slides the band out from under the tagline, a terminal fades it), stay until the next input as before, linger MessageLinger ms (default 800), and dissolve (ease-out). MessageAnimation toggles it; both are settings, in Config and startup files. The snapshot harness pins the old behaviour. The detached server now ticks animations. A restored terminal comes back live: the old screen and scrollback (dumped as clean VT by ghostty's formatter, replayed at the new size; older dumps fall back to their rendered text), a dim "restored history" marker, then a new shell in the directory it was in. Right-click on a line number in a file pane looks at that line (a sticky context header's number included). Measured with an external pty driver (TTY), an in-process fence trace (GUI, PARDES_TEST_LATENCY), and test/pdf_pointer_bench.zig (pixel identity against the baseline and a whole-page oracle); balanced A/A/B rounds, paired per-round statistics. Messages stack: each event gets its own row and its own fall, linger and dissolve; a line keeps its row until it leaves and a new one fills the first free row. Announcements and statuses are replaced in place, not stacked. MessageFall, MessageDissolve and DumpDir are settings Config reports. Co-Authored-By: Claude Opus 5.5 (1M context) --- build.zig | 19 ++ docs/config.md | 24 ++- src/config.zig | 66 +++++- src/detached/server.zig | 14 +- src/dump.zig | 19 +- src/fs.zig | 4 +- src/gui/gui.zig | 110 ++++++++-- src/macos.zig | 4 +- src/panes.zig | 484 ++++++++++++++++++++++++++++++++++++++++-- src/pardes.zig | 433 +++++++++++++++++++++++++++++++++++-- src/pdf.zig | 67 ++++++ src/pdf_bridge.c | 228 ++++++++++++++++---- src/pdf_bridge.h | 46 +++- src/tag_layer.zig | 4 + src/tty/tty.zig | 148 +++++++++++-- test/output.zig | 3 +- test/panes.zig | 37 ++++ test/pdf_pointer_bench.zig | 224 +++++++++++++++++++ test/snapshot.zig | 4 +- test/snapshots/builtins.snap | 4 + test/snapshots/dump.golden | 3 + test/snapshots/load.golden | 18 +- test/snapshots/restore.golden | 6 +- 23 files changed, 1815 insertions(+), 154 deletions(-) create mode 100644 test/pdf_pointer_bench.zig (limited to 'src/gui') diff --git a/build.zig b/build.zig index 562ed89f..7010c863 100644 --- a/build.zig +++ b/build.zig @@ -142,6 +142,7 @@ pub fn build(b: *std.Build) void { const mupdf_check = b.step("mupdf-check", "compile, link, render, and search docs/design.pdf with MuPDF"); const pdf_bench_step = b.step("pdf-bench", "benchmark real MuPDF page rendering (-- [--json] [--reps N] [--warmup N] [--path FILE] [--page N] [--pages N])"); const pdf_sections_bench_step = b.step("pdf-sections-bench", "benchmark PDF outline/sections paths in ReleaseFast (-Doptimize=ReleaseFast -- [--json] [--reps N] [--warmup N])"); + const pdf_pointer_bench_step = b.step("pdf-pointer-bench", "time PDF hover and selection gestures and prove their pixels (-Doptimize=ReleaseFast -- [--label L] [--reps N] [--path FILE] [--cell WxH])"); const pdf_scroll_bench_step = b.step("pdf-scroll-bench", "benchmark fast continuous-strip PDF scrolling in ReleaseFast (-Doptimize=ReleaseFast -- [--json] [--reps N] [--warmup N] [--path FILE])"); if (!enable_mupdf) mupdf_check.dependOn(&b.addFail("mupdf-check is unavailable with -Dmupdf=false").step); @@ -151,6 +152,8 @@ pub fn build(b: *std.Build) void { pdf_sections_bench_step.dependOn(&b.addFail("pdf-sections-bench is unavailable with -Dmupdf=false").step); if (!enable_mupdf) pdf_scroll_bench_step.dependOn(&b.addFail("pdf-scroll-bench is unavailable with -Dmupdf=false").step); + if (!enable_mupdf) + pdf_pointer_bench_step.dependOn(&b.addFail("pdf-pointer-bench is unavailable with -Dmupdf=false").step); const shaders_step = b.step("shaders", "refresh paired shaders/prebuilt/*.spv + *.glsl snapshots (glslc)"); const update_shaders = b.addUpdateSourceFiles(); @@ -482,6 +485,22 @@ pub fn build(b: *std.Build) void { run_pdf_sections_bench.setCwd(b.path(".")); pdf_sections_bench_step.dependOn(&run_pdf_sections_bench.step); + const pdf_pointer_bench = b.addExecutable(.{ + .name = "pardes-pdf-pointer-bench", + .root_module = b.createModule(.{ + .target = target, + .optimize = .ReleaseFast, + .root_source_file = b.path("test/pdf_pointer_bench.zig"), + .link_libc = true, + }), + }); + 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.setCwd(b.path(".")); + pdf_pointer_bench_step.dependOn(&run_pdf_pointer_bench.step); + const pdf_scroll_bench = b.addExecutable(.{ .name = "pardes-pdf-scroll-bench", .root_module = b.createModule(.{ diff --git a/docs/config.md b/docs/config.md index 8eff79a8..27818b5b 100644 --- a/docs/config.md +++ b/docs/config.md @@ -115,6 +115,16 @@ compact screen. Hiding it preserves your custom column commands. name before it runs; it is on by default, and the builtins that own the message row themselves (`Msg`) never announce. Turning it off leaves the row to the messages a builtin chooses to write. +`MessageAnimation` toggles how a message comes and goes; it is on by default. +A message eases down into its row (graphical frontends slide it out from under +the tagline; a terminal fades it in), stays until the next key or click as it +always has, then lingers for `MessageLinger` milliseconds (default 800) before +it dissolves into the page. `MessageFall` (default 180) and `MessageDissolve` +(default 300) set how long the fall and the dissolve take, also in +milliseconds; each timing is at most 60000, and `Config` reports all three. `MessageLinger 0` with +`MessageAnimation off` restores the old behaviour, a message cleared by the +very input that follows it. An updated line on a row already showing one swaps +its text in place rather than falling again. `SyntaxBold` toggles bold syntax keywords; it is off by default. These settings are shared by GUI and TTY, and `Config` reports their current states. Like `Colors` and `Wrap`, these commands take no argument and invert @@ -573,8 +583,18 @@ control all yield null, and the flag has to work anyway. Neither is a question asked at runtime — a binary that shelled out to `git` would describe whatever tree it was standing in rather than the one it came from. -`Restore a.dump` first looks for the relative path in the default dump directory -(`$XDG_DATA_HOME/pardes`, or `~/.local/share/pardes`). If it is absent, Restore +`Restore a.dump` first looks for the relative path in the dump directory: +`DumpDir ` when set (a leading `~/` is your home; bare `DumpDir` returns +to the default), else `$XDG_DATA_HOME/pardes` or `~/.local/share/pardes`. +`Config` reports the directory in effect as `DumpDir `, so the line can +be fed back as configuration. If it is absent, Restore uses the argument as a path as before. Absolute paths and argument-free Restore retain their existing behavior. `Dump` still honors `$PARDES_DUMP` and otherwise writes a timestamped file in the default directory. + +A restored terminal comes back live: its recorded output (the last MiB of it) +is replayed as history, a dim `── restored history ──` line marks where it +ends, and a new shell starts below it in the directory the old one was in. A +view left scrolled back stays where it was. Only the shell is new; nothing the +old one was running is restarted. The web shell, which has no ptys, still +shows the history alone. diff --git a/src/config.zig b/src/config.zig index 98bbf3f4..527c3752 100644 --- a/src/config.zig +++ b/src/config.zig @@ -102,6 +102,11 @@ pub const leader_path = paths: { table.set(.TaglineSize, null); } if (pardes.platform == .gui) table.set(.Pet, null); + table.set(.MessageAnimation, null); + table.set(.MessageLinger, null); + table.set(.MessageFall, null); + table.set(.MessageDissolve, null); + table.set(.DumpDir, null); if (builtins.capabilities.window_opacity) table.set(.WindowOpacity, null); if (builtins.capabilities.window_blur) table.set(.WindowBlur, null); if (builtins.capabilities.panel_transitions) { @@ -269,6 +274,10 @@ pub const wheel_cols: i32 = 4; pub const look_preview_delay_frames: ?u16 = 2; +/// The longest any message timing (MessageLinger, MessageFall, +/// MessageDissolve) may be set to, in milliseconds. +pub const message_ms_max: u16 = 60_000; + // Tag fonts keep body-cell geometry; valid sizes are 1...100 percent. pub const gui_tagline_font_percent: u8 = 82; comptime { @@ -558,6 +567,17 @@ pub const Runtime = struct { syntax_bold: bool = false, /// Builtins announce themselves on the message row. verbose: bool = true, + /// A message falls into its row and dissolves out of it. + message_animation: bool = true, + /// How long a message stays after the key or click that dismisses it. + message_linger_ms: u16 = 800, + /// How long its ease-in fall into the row takes. + message_fall_ms: u16 = 180, + /// How long its ease-out dissolve takes. + message_dissolve_ms: u16 = 300, + /// Where Dump writes and a relative Restore looks; empty is the default + /// ($XDG_DATA_HOME/pardes, else ~/.local/share/pardes). + dump_dir: Text(limits.host_path_cap) = .{}, window_opacity: u8 = 100, window_blur: u8 = 0, window_opacity_pending: bool = true, @@ -655,7 +675,10 @@ pub const Runtime = struct { pub const Capability = std.meta.FieldEnum(Capabilities); - pub const Toggle = enum { colors, wrap, tree_context_tag_style, tag_bottom, debug, focus_tint, column_tags, syntax_bold, verbose }; + /// The message timings a setting word sets, each in milliseconds. + pub const MessageTime = enum { linger, fall, dissolve }; + + pub const Toggle = enum { colors, wrap, tree_context_tag_style, tag_bottom, debug, focus_tint, column_tags, syntax_bold, verbose, message_animation }; pub const Scene = std.meta.FieldEnum(layout.SceneEffect); pub const Action = union(enum) { @@ -666,6 +689,8 @@ pub const Runtime = struct { tagline_size, window_opacity, window_blur, + message_ms: MessageTime, + dump_dir, transition: layout.Transition, scene: Scene, }; @@ -679,7 +704,7 @@ pub const Runtime = struct { return switch (setting.action) { // A toggle flips when it is a bare tagline word and SETS when // it is given `on` or `off`, so the report is configuration. - .shell, .theme, .font, .tagline_size, .window_opacity, .window_blur, .toggle => true, + .shell, .theme, .font, .tagline_size, .window_opacity, .window_blur, .message_ms, .dump_dir, .toggle => true, else => false, }; } @@ -703,6 +728,11 @@ pub const Runtime = struct { .{ .word = "ColumnTags", .action = .{ .toggle = .column_tags } }, .{ .word = "SyntaxBold", .action = .{ .toggle = .syntax_bold } }, .{ .word = "Verbose", .action = .{ .toggle = .verbose } }, + .{ .word = "MessageAnimation", .action = .{ .toggle = .message_animation } }, + .{ .word = "MessageLinger", .action = .{ .message_ms = .linger } }, + .{ .word = "MessageFall", .action = .{ .message_ms = .fall } }, + .{ .word = "MessageDissolve", .action = .{ .message_ms = .dissolve } }, + .{ .word = "DumpDir", .action = .dump_dir }, .{ .word = "Theme", .action = .theme }, .{ .word = "Shell", .action = .shell }, .{ .word = "Font", .action = .font, .availability = .font_picker }, @@ -827,6 +857,17 @@ pub const Runtime = struct { if (percent > 100) return false; state.window_blur = percent; }, + // Bare, it returns to the default directory. + .dump_dir => if (!state.dump_dir.set(std.mem.trim(u8, argument orelse "", " \t\r\n"))) return false, + .message_ms => |which| { + const text = std.mem.trim(u8, argument orelse return false, " \t\r\n"); + for (text) |byte| if (!std.ascii.isDigit(byte)) return false; + const ms = std.fmt.parseInt(u16, text, 10) catch return false; + if (ms > message_ms_max) return false; + switch (which) { + inline else => |w| @field(state, "message_" ++ @tagName(w) ++ "_ms") = ms, + } + }, .transition => |effect| state.toggleTransition(effect), .scene => |effect| switch (effect) { inline else => |field| { @@ -847,6 +888,9 @@ pub const Runtime = struct { compiled_default_shell: []const u8, gui_shader_source_mode: ?[]const u8 = null, hover_delay_frames: ?u16, + /// Where dumps go when `DumpDir` is unset; empty without a host + /// filesystem. + default_dump_dir: []const u8 = "", native_images: bool, capabilities: Capabilities, state: *const Runtime, @@ -895,6 +939,13 @@ pub const Runtime = struct { else try out.print("{s} unsupported\n", .{setting.word}); }, + .dump_dir => { + const dir = if (state.dump_dir.len > 0) state.dump_dir.get() else context.default_dump_dir; + try out.print("{s} {s}\n", .{ setting.word, if (dir.len > 0) dir else "(none)" }); + }, + .message_ms => |which| try out.print("{s} {d}\n", .{ setting.word, switch (which) { + inline else => |w| @field(state, "message_" ++ @tagName(w) ++ "_ms"), + } }), .shell => { const chosen = state.shell.requested.get(); try out.print( @@ -993,7 +1044,7 @@ pub const Runtime = struct { for (settings[i + 1 ..]) |later| try std.testing.expect(!std.mem.eql(u8, setting.word, later.word)); try std.testing.expectEqual(switch (setting.action) { - .shell, .theme, .font, .tagline_size, .window_opacity, .window_blur, .toggle => true, + .shell, .theme, .font, .tagline_size, .window_opacity, .window_blur, .message_ms, .dump_dir, .toggle => true, else => false, }, setting.takesArg()); } @@ -1152,6 +1203,8 @@ pub const Runtime = struct { .tagline_size => "73", .window_opacity => "85", .window_blur => "40", + .message_ms => "1500", + .dump_dir => "~/dumps", else => null, }; try std.testing.expect(apply(&state, setting, argument)); @@ -1170,11 +1223,18 @@ pub const Runtime = struct { .column_tags => "ColumnTags off\n", .syntax_bold => "SyntaxBold on\n", .verbose => "Verbose off\n", + .message_animation => "MessageAnimation off\n", }, .shell => "Shell requested (new panes) fish\n", .tagline_size => "TaglineSize 73\n", .window_opacity => "WindowOpacity 85 (pending)\n", .window_blur => "WindowBlur 40\n", + .dump_dir => "DumpDir ~/dumps\n", + .message_ms => |which| switch (which) { + .linger => "MessageLinger 1500\n", + .fall => "MessageFall 1500\n", + .dissolve => "MessageDissolve 1500\n", + }, .transition => |transition| switch (transition) { .off => unreachable, .slide => "Panel transition PanelSlide\n", diff --git a/src/detached/server.zig b/src/detached/server.zig index 3e98fc9d..6959e577 100644 --- a/src/detached/server.zig +++ b/src/detached/server.zig @@ -536,7 +536,7 @@ pub const Session = struct { fn writeDump(ctx: ?*anyopaque, bytes: []const u8) void { const s = of(ctx); var pbuf: [1024:0]u8 = undefined; - const path = pardes.dump.outPath(&pbuf) orelse return; + const path = pardes.dump.outPath(&pbuf, s.core.settings.dump_dir.get()) orelse return; filesystem.write(s.core, path, bytes) catch |err| return s.core.reportError(0, "dump", err); s.core.setLastDump(path); } @@ -809,8 +809,11 @@ pub const Session = struct { // The wait is the 9P connections' turn with the core. if (n == 0) { pardes.turn.rest(); - defer pardes.turn.wake(); - return nap(if (timeout_ms == 0) 16 else timeout_ms); + nap(if (timeout_ms == 0) 16 else timeout_ms); + pardes.turn.wake(); + // An animating frame's wait is the frame: tick it. + if (timeout_ms != 0) s.core.update(.tick); + return; } var timeout: c_int = if (timeout_ms == 0) -1 else @intCast(@min(timeout_ms, std.math.maxInt(c_int))); if (s.nextWake(now)) |due| timeout = if (timeout < 0) due else @min(timeout, due); @@ -819,6 +822,9 @@ pub const Session = struct { const ready = libc.poll(&fds, @intCast(n), timeout); pardes.turn.wake(); if (ready > 0) s.dispatch(fds[0..n], src[0..n]); + // Animating, the frame's time is up: advance it. There is no other + // tick in a detached session, and without it an animation never ends. + if (timeout_ms != 0 and monotonicMs() -| now >= timeout_ms) s.core.update(.tick); _ = s.drainCompletions(true); s.expire(monotonicMs()); s.harvest(); @@ -1156,7 +1162,7 @@ pub fn run(init: std.process.Init, opts: pardes.Options, name: []const u8) !void try session.core.pump(h); if (session.core.quit) break; if (session.core.takeRestore()) |path| restore: { - const bytes = filesystem.readRestore(gpa, path) catch |err| { + const bytes = filesystem.readRestore(gpa, path, session.core.settings.dump_dir.get()) catch |err| { session.core.reportError(session.core.active, "Restore", err); break :restore; }; diff --git a/src/dump.zig b/src/dump.zig index 89abd995..ff5d2166 100644 --- a/src/dump.zig +++ b/src/dump.zig @@ -11,11 +11,11 @@ const log = std.log.scoped(.dump); /// pins it for deterministic goldens); else $XDG_DATA_HOME|~/.local/share /// /pardes/pardes-.zon — timestamped so dumps never overwrite each other. /// Creates the pardes dir (parents assumed; a failure surfaces at open). -pub fn outPath(buf: *[1024:0]u8) ?[:0]const u8 { +pub fn outPath(buf: *[1024:0]u8, dir_setting: []const u8) ?[:0]const u8 { if (std.c.getenv("PARDES_DUMP")) |p| return std.fmt.bufPrintSentinel(buf, "{s}", .{std.mem.span(p)}, 0) catch null; var dir_buf: [900]u8 = undefined; - const dir = defaultDirectory(&dir_buf) orelse return null; + const dir = directory(&dir_buf, dir_setting) orelse return null; var dz: [901:0]u8 = undefined; @memcpy(dz[0..dir.len], dir); dz[dir.len] = 0; @@ -32,6 +32,15 @@ pub fn outPath(buf: *[1024:0]u8) ?[:0]const u8 { ds.getSecondsIntoMinute(), }, 0) catch null; } +/// Where dumps go and relative Restore names are looked up: the `DumpDir` +/// setting when set (a leading `~/` is the home directory), else the default. +pub fn directory(buf: []u8, dir_setting: []const u8) ?[]const u8 { + if (dir_setting.len == 0) return defaultDirectory(buf); + if (std.mem.startsWith(u8, dir_setting, "~/")) if (std.c.getenv("HOME")) |h| + return std.fmt.bufPrint(buf, "{s}/{s}", .{ std.mem.span(h), dir_setting[2..] }) catch null; + return std.fmt.bufPrint(buf, "{s}", .{dir_setting}) catch null; +} + /// The standard dump directory, without creating it or generating a filename. pub fn defaultDirectory(buf: []u8) ?[]const u8 { if (std.c.getenv("XDG_DATA_HOME")) |x| @@ -69,8 +78,14 @@ pub const PaneKind = enum { pub const Terminal = struct { cwd: []const u8 = "", + /// The rendered scrollback and screen as plain text, one row per line. stream: []const u8 = "", stream_b64: []const u8 = "", + /// `stream_b64` is the emulator's primary screen and scrollback as clean + /// VT (ghostty's formatter), which replays to what the screen showed. + /// Absent (older dumps), it is the raw tail of the pty's output, which + /// replays faithfully only if it holds the whole session at one size. + stream_is_screen: bool = false, cursor: Cursor = .{}, }; diff --git a/src/fs.zig b/src/fs.zig index 85eae825..84ab3b95 100644 --- a/src/fs.zig +++ b/src/fs.zig @@ -1104,9 +1104,9 @@ pub fn readFile(gpa: std.mem.Allocator, path: []const u8) ![]u8 { /// Restore first tries a relative argument under the default dump directory, /// then preserves the ordinary file lookup. Absolute paths remain verbatim. -pub fn readRestore(gpa: std.mem.Allocator, path: []const u8) ![]u8 { +pub fn readRestore(gpa: std.mem.Allocator, path: []const u8, dir_setting: []const u8) ![]u8 { var dir_buf: [4096]u8 = undefined; - const dir = @import("dump.zig").defaultDirectory(&dir_buf); + const dir = @import("dump.zig").directory(&dir_buf, dir_setting); return readRestoreIn(gpa, path, dir); } diff --git a/src/gui/gui.zig b/src/gui/gui.zig index 17bdb46f..7f28124c 100644 --- a/src/gui/gui.zig +++ b/src/gui/gui.zig @@ -2111,8 +2111,8 @@ fn runNative(init: std.process.Init, opts_in: pardes.Options, attach: ?[]const u } var win_flags: c.SDL_WindowFlags = c.SDL_WINDOW_RESIZABLE; if (!test_mode) win_flags |= c.SDL_WINDOW_HIGH_PIXEL_DENSITY; - // A latency run renders to the capture texture; keep it off the desktop. - if (latency_fd >= 0) win_flags |= c.SDL_WINDOW_HIDDEN; + // A test run renders to the capture texture; keep it off the desktop. + if (test_mode) win_flags |= c.SDL_WINDOW_HIDDEN; const native_wayland = !test_mode and std.mem.eql(u8, std.mem.span(c.SDL_GetCurrentVideoDriver()), "wayland"); // Background-only opacity needs per-pixel alpha; whole-window compositor // opacity would dim the text as well. SDL requires this flag at creation. @@ -2353,6 +2353,7 @@ fn localSession( } else try pardes.Pardes.init(allocs.pardes, opts); defer core.deinit(); core.native_images = true; + core.native_image_patches = true; observeGuiFont(g, core); syncTaglineFont(g, core); @@ -2448,7 +2449,7 @@ fn localSession( } } if (core.takeRestore()) |rp| blk: { - const bytes = filesystem.readRestore(gpa, rp) catch |err| { + const bytes = filesystem.readRestore(gpa, rp, core.settings.dump_dir.get()) catch |err| { core.reportError(core.active, "Restore", err); break :blk; }; @@ -2473,6 +2474,7 @@ fn localSession( g.presented_images.clearRetainingCapacity(); g.prepared_images.clearRetainingCapacity(); nc.native_images = true; + nc.native_image_patches = true; nc.host = host; if (fs) |f| f.reset(nc); core.deinit(); @@ -3591,6 +3593,7 @@ const Shell = struct { test_mode: bool = false, feed: StdinFeed = .{}, presented: bool = false, + skipped_presents: u8 = 0, surface: ?*pardes.Surface = null, animation_clock: AnimationClock = .{}, saw_event: bool = false, @@ -3774,14 +3777,29 @@ fn waitInput(ctx: ?*anyopaque, timeout_ms: u32) void { var in: Input = .{ .core = core }; if (s.gui) |g| { var sev = std.mem.zeroes(c.SDL_Event); - const ms: c_int = if (timeout_ms != 0) @intCast(timeout_ms) else 16; + // A latency trace is fed on stdin, whose poll below paces the loop: + // waiting here too would make every tick cost two frames. + const ms: c_int = if (latency_fd >= 0) 0 else if (timeout_ms != 0) @intCast(timeout_ms) else 16; // The wait is the 9P connections' turn with the core. pardes.turn.rest(); const got = c.SDL_WaitEventTimeout(&sev, ms); pardes.turn.wake(); if (got) { - dispatch(g, &in, &sev); - while (c.SDL_PollEvent(&sev)) dispatch(g, &in, &sev); + // A run of queued motions is one move to its last position (the + // handler reads only absolute x/y and held buttons): acting on + // each would repeat hover and selection work the next undoes. + var motion: ?c.SDL_Event = null; + while (true) { + if (sev.type == c.SDL_EVENT_MOUSE_MOTION) { + motion = sev; + } else { + if (motion) |*m| dispatch(g, &in, m); + motion = null; + dispatch(g, &in, &sev); + } + if (!c.SDL_PollEvent(&sev)) break; + } + if (motion) |*m| dispatch(g, &in, m); } } if (s.test_mode) { @@ -3913,6 +3931,10 @@ fn present(ctx: ?*anyopaque, surface: *const pardes.Surface) void { log.err("render: {t}", .{err}); break :blk false; }; + // A skipped swapchain image would otherwise hide this input's frame until + // the next event. A few retries only: a minimized window never gets one. + s.skipped_presents = if (s.presented) 0 else s.skipped_presents +| 1; + if (!s.presented and s.skipped_presents <= 3) core.present_skipped = true; if (g.scene_target_failed) { g.scene_failures +|= 1; log.err("scene target unavailable (attempt {d}/3)", .{g.scene_failures}); @@ -3926,7 +3948,12 @@ fn present(ctx: ?*anyopaque, surface: *const pardes.Surface) void { fn postPresent(ctx: ?*anyopaque) void { const s = shellOf(ctx); const g = s.gui orelse return; - if (!s.presented) return; + if (!s.presented) { + // No image (a minimized window): time still passes, so a lingering + // message or a hover wait runs out instead of redrawing forever. + if (s.animation_clock.due(s.core.animationActive(), c.SDL_GetTicksNS())) s.core.update(.tick); + return; + } const frame = s.surface orelse return; refreshPresentedPointer(g, s.core); finishPresentedAnimationFrame( @@ -4030,7 +4057,7 @@ fn writeFile(ctx: ?*anyopaque, pane: u8, path: []const u8, bytes: []const u8) vo fn writeDump(ctx: ?*anyopaque, bytes: []const u8) void { const s = shellOf(ctx); var pbuf: [1024:0]u8 = undefined; - const path = pardes.dump.outPath(&pbuf) orelse return; + const path = pardes.dump.outPath(&pbuf, s.core.settings.dump_dir.get()) orelse return; filesystem.write(s.core, path, bytes) catch |err| return s.core.reportError(0, "dump", err); s.core.setLastDump(path); } @@ -4533,6 +4560,23 @@ fn uploadNativeTexture( const byte_len = validImageBytes(place) orelse return error.BadImage; const key = place.cacheKey(); if (g.native_images.contains(key)) return; + if (comptime pardes.pdf_enabled) if (place.patch) |patch| patch: { + // The core changed only these rows since a revision we still hold: + // write them into that texture rather than sending the whole page. + var base = key; + base.revision = patch.from; + if (patch.y + patch.h > place.ih) break :patch; + const texture = g.native_images.get(base) orelse break :patch; + const row = place.iw * 4; + try uploadTextureRows(g, cmd, texture, place.rgba[patch.y * row ..][0 .. patch.h * row], place.iw, patch.y, patch.h); + try g.native_images.put(gpa, key, texture); + _ = g.native_images.remove(base); + // A transition snapshot of the last frame follows its texture. + for (g.presented_images.items) |*saved| if (saved.key.eql(base)) { + saved.key = key; + }; + return; + }; var tex_info = std.mem.zeroes(c.SDL_GPUTextureCreateInfo); tex_info.type = c.SDL_GPU_TEXTURETYPE_2D; @@ -4545,39 +4589,51 @@ fn uploadNativeTexture( tex_info.sample_count = c.SDL_GPU_SAMPLECOUNT_1; const texture = c.SDL_CreateGPUTexture(g.device, &tex_info) orelse return error.GpuCreate; errdefer c.SDL_ReleaseGPUTexture(g.device, texture); + try uploadTextureRows(g, cmd, texture, place.rgba[0..byte_len], place.iw, 0, place.ih); + try g.native_images.put(gpa, key, texture); +} +/// Copy `rows` rows of RGBA, `width` pixels each, into `texture` at row `y`. +fn uploadTextureRows( + g: *Gui, + cmd: *c.SDL_GPUCommandBuffer, + texture: *c.SDL_GPUTexture, + rgba: []const u8, + width: usize, + y: usize, + rows: usize, +) !void { var xf_info = c.SDL_GPUTransferBufferCreateInfo{ .usage = c.SDL_GPU_TRANSFERBUFFERUSAGE_UPLOAD, - .size = byte_len, + .size = @intCast(rgba.len), .props = 0, }; const transfer = c.SDL_CreateGPUTransferBuffer(g.device, &xf_info) orelse return error.GpuCreate; defer c.SDL_ReleaseGPUTransferBuffer(g.device, transfer); const mapped: [*]u8 = @ptrCast(c.SDL_MapGPUTransferBuffer(g.device, transfer, false) orelse return error.GpuMap); - @memcpy(mapped[0..byte_len], place.rgba); + @memcpy(mapped[0..rgba.len], rgba); c.SDL_UnmapGPUTransferBuffer(g.device, transfer); const copy = c.SDL_BeginGPUCopyPass(cmd); const src = c.SDL_GPUTextureTransferInfo{ .transfer_buffer = transfer, .offset = 0, - .pixels_per_row = @intCast(place.iw), - .rows_per_layer = @intCast(place.ih), + .pixels_per_row = @intCast(width), + .rows_per_layer = @intCast(rows), }; const dst = c.SDL_GPUTextureRegion{ .texture = texture, .mip_level = 0, .layer = 0, .x = 0, - .y = 0, + .y = @intCast(y), .z = 0, - .w = @intCast(place.iw), - .h = @intCast(place.ih), + .w = @intCast(width), + .h = @intCast(rows), .d = 1, }; c.SDL_UploadToGPUTexture(copy, &src, &dst, false); c.SDL_EndGPUCopyPass(copy); - try g.native_images.put(gpa, key, texture); } fn appendPreparedImage( @@ -5442,16 +5498,30 @@ fn emitTagLayer(g: *Gui, instances: [*]CellInstance, next: *u32, layer: *const p const left = @as(f32, @floatFromInt(layer.viewport.x)) * bw; const right = left + @as(f32, @floatFromInt(layer.viewport.w)) * bw; const background: pardes.Cell = .{ .default = false, .style = .{ .bg = .{ .rgb = layer.bg } } }; - emitInstance(g, instances, next.*, 0, layer.viewport.y, .{ .w = right - left, .h = bh, .x_off = left, .y_off = 0 }, win_w, win_h, track, .body, &background, old_layer, false, page); + // A band sliding into place is drawn offset and cut at its row's top, so + // it comes out from under whatever is above it. + const slide = layer.slide * bh; + const top = @as(f32, @floatFromInt(layer.viewport.y)) * bh; + emitInstance(g, instances, next.*, 0, layer.viewport.y, .{ .w = right - left, .h = bh, .x_off = left, .y_off = slide }, win_w, win_h, track, .body, &background, old_layer, false, page); + if (slide != 0) clipInstanceTop(&instances[next.*], top, win_h); next.* += 1; for (0..tagLayerCellCount(g, layer)) |col| { const cursor = if (layer.cursor) |cu| show_cursor and !cu.bar and cu.col == col else false; - emitInstance(g, instances, next.*, @intCast(col), layer.viewport.y, .{ .w = tw, .h = bh, .x_off = left, .y_off = 0 }, win_w, win_h, track, .tagline, &layer.cells[col], old_layer, cursor, page); + emitInstance(g, instances, next.*, @intCast(col), layer.viewport.y, .{ .w = tw, .h = bh, .x_off = left, .y_off = slide }, win_w, win_h, track, .tagline, &layer.cells[col], old_layer, cursor, page); clipInstanceRight(&instances[next.*], right, win_w); + if (slide != 0) clipInstanceTop(&instances[next.*], top, win_h); next.* += 1; } } +fn clipInstanceTop(instance: *CellInstance, top: f32, win_h: f32) void { + const limit = 1 - top / win_h * 2; + if (instance.y0 <= limit) return; + const fraction = std.math.clamp((limit - instance.y1) / (instance.y0 - instance.y1), 0, 1); + instance.v0 = instance.v1 + (instance.v0 - instance.v1) * fraction; + instance.y0 = @max(instance.y1, limit); +} + fn bodyLayerAt(surface: *const pardes.Surface, col: u16, row: u16) ?*const pardes.BodyLayer { return bodyLayerIn(surface.bodyLayers(), col, row); } @@ -6436,7 +6506,9 @@ fn captureFrame(g: *Gui, gpa: std.mem.Allocator, cmd: *c.SDL_GPUCommandBuffer, t } fn writeCapturePpm(g: *Gui, gpa: std.mem.Allocator, pixels: []const u8, width: u32, height: u32) !void { - if (g.capture_dir.len == 0) return; + // A latency trace times frames, and an 8 MB file write per frame would + // stall the loop it is timing. + if (g.capture_dir.len == 0 or latency_fd >= 0) return; const bpp = c.SDL_GPUTextureFormatTexelBlockSize(g.swapchain_format); if (bpp != 4) return error.UnsupportedCaptureFormat; const bgr = switch (g.swapchain_format) { diff --git a/src/macos.zig b/src/macos.zig index a7ee3164..c359eb3f 100644 --- a/src/macos.zig +++ b/src/macos.zig @@ -1325,7 +1325,7 @@ export fn pardes_tick() bool { fn restoreCore(st: *State) bool { if (st.core.quit) return false; const path = st.core.takeRestore() orelse return false; - const bytes = filesystem.readRestore(st.gpa, path) catch |err| { + const bytes = filesystem.readRestore(st.gpa, path, st.core.settings.dump_dir.get()) catch |err| { st.core.reportError(st.core.active, "Restore", err); return false; }; @@ -2431,7 +2431,7 @@ fn writeFile(ctx: ?*anyopaque, pane: u8, path: []const u8, bytes: []const u8) vo fn writeDump(ctx: ?*anyopaque, bytes: []const u8) void { const st = hostState(ctx); var pbuf: [1024:0]u8 = undefined; - const path = pardes.dump.outPath(&pbuf) orelse return; + const path = pardes.dump.outPath(&pbuf, st.core.settings.dump_dir.get()) orelse return; filesystem.write(st.core, path, bytes) catch |err| return st.core.reportError(0, "dump", err); st.core.setLastDump(path); } diff --git a/src/panes.zig b/src/panes.zig index b3424385..8d4330e9 100644 --- a/src/panes.zig +++ b/src/panes.zig @@ -183,6 +183,20 @@ pub const Pane = struct { tty_filter: bool = false, msg: [256]u8 = undefined, msg_len: u16 = 0, + /// Where the newest message line is in its life. + msg_life: MessageLife = .{}, + /// The row (among the notice rows) the newest line holds for its life. + msg_slot: u8 = 0, + /// Earlier message lines still on screen, oldest first, each running its + /// own life: a new message stacks under them instead of replacing them. + msg_older: [message_stack]OlderMessage = undefined, + msg_older_len: u8 = 0, + /// The newest line is a builtin announcing itself in this step: what + /// the step says next replaces it rather than stacking under it. + msg_announcement: bool = false, + /// The newest line is a status (progress, a server's state): the next + /// line replaces it rather than stacking under it. + msg_status: bool = false, /// The transient lines this pane shows between its body and its tagline: /// a builtin's message, the pending leader chord, a prompt waiting for /// input. Rebuilt every frame from the state that owns each one, so a @@ -192,30 +206,102 @@ pub const Pane = struct { /// reserves rows for sticky context headers. notices: Notices = .{}, + pub const MessagePhase = enum { entering, shown, lingering, leaving }; + /// One message line's animation: falling in, shown, lingering after the + /// key or click that dismissed it, dissolving. `frame` counts animation + /// frames within the phase. + pub const MessageLife = struct { + phase: MessagePhase = .shown, + frame: u16 = 0, + /// Dismissed while still falling: it lingers once it has landed. + dismissed: bool = false, + }; + /// Older message lines kept on screen under a new one. + pub const message_stack = 3; + pub const OlderMessage = struct { + text: [256]u8 = undefined, + len: u16 = 0, + life: MessageLife = .{}, + slot: u8 = 0, + + pub fn slice(line: *const OlderMessage) []const u8 { + return line.text[0..line.len]; + } + }; + + /// Move the newest line onto the stack of older ones, dropping the oldest + /// when it is full; the newest slot is left empty for what arrives. + pub fn pushOlderMessage(pane: *Pane) void { + if (pane.msg_older_len == message_stack) { + std.mem.copyForwards(OlderMessage, pane.msg_older[0 .. message_stack - 1], pane.msg_older[1..]); + pane.msg_older_len -= 1; + } + pane.msg_older[pane.msg_older_len] = .{ .text = pane.msg, .len = pane.msg_len, .life = pane.msg_life, .slot = pane.msg_slot }; + pane.msg_older_len += 1; + pane.msg_len = 0; + pane.msg_life = .{}; + } + + /// The first row no older line holds. A line keeps its row until it + /// leaves, and a new one fills the first gap: nothing on screen moves. + pub fn freeMessageSlot(pane: *const Pane) u8 { + var used: u8 = 0; + for (pane.msg_older[0..pane.msg_older_len]) |line| used |= @as(u8, 1) << @intCast(line.slot); + var slot: u8 = 0; + while (used & (@as(u8, 1) << @intCast(slot)) != 0) slot += 1; + return slot; + } + + pub fn removeOlderMessage(pane: *Pane, i: usize) void { + std.mem.copyForwards(OlderMessage, pane.msg_older[i .. pane.msg_older_len - 1], pane.msg_older[i + 1 .. pane.msg_older_len]); + pane.msg_older_len -= 1; + } + pub const Notices = struct { /// Painted bottom-up in this order, so a prompt keeps the row nearest /// the tagline that it has always had, and its cursor with it. - pub const Kind = enum { message, leader, prompt }; - pub const max = @typeInfo(Kind).@"enum".fields.len; + /// `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; kinds: [max]Kind = undefined, + index: [max]u8 = @splat(0), + /// Each band's row below the body's top: message lines keep theirs, + /// so a band that leaves leaves a gap rather than moving the rest. + row: [max]u8 = @splat(0), /// Where each band's chip starts, as an absolute grid column. A chip /// is only as wide as its own text, so the rest of the row underneath /// is ordinary body text and a click there has to reach it. left: [max]u16 = @splat(std.math.maxInt(u16)), len: u8 = 0, + /// A band on the next row after every band so far. pub fn push(n: *Notices, kind: Kind) void { + n.pushAt(kind, 0, n.span()); + } + + pub fn pushAt(n: *Notices, kind: Kind, index: u8, row: u8) void { if (n.len >= max) return; n.kinds[n.len] = kind; + n.index[n.len] = index; + n.row[n.len] = row; n.left[n.len] = std.math.maxInt(u16); n.len += 1; } /// Is this cell inside the chip drawn for band `i`? Nothing else on /// that row belongs to the notice. - pub fn covers(n: *const Notices, i: usize, col: u16) bool { - return i < n.len and col >= n.left[i]; + pub fn covers(n: *const Notices, row: usize, col: u16) bool { + for (0..n.len) |i| if (n.row[i] == row) return col >= n.left[i]; + return false; + } + + /// Rows from the body's top down to the last band's. + pub fn span(n: *const Notices) u8 { + var rows: u8 = 0; + for (n.row[0..n.len]) |row| rows = @max(rows, row + 1); + return rows; } pub fn slice(n: *const Notices) []const Kind { @@ -1327,7 +1413,15 @@ pub const File = struct { const file = &pane.file.?; for ([_][]const u8{ "", "one", "one\n", "a\r\nλ界\nlast", "\n\n", "\tλ e\u{301}\n\r\n" }) |content| { setContent(p, file, try p.gpa.dupe(u8, content)); - try std.testing.expectEqual(@as(usize, 0), file.line_starts.len); + // An edit carries a built index forward; it must equal a fresh one. + if (file.line_starts.len > 0) { + const carried = file.line_starts; + defer p.gpa.free(carried); + file.line_starts = &.{}; + try std.testing.expectEqualSlices(usize, try lineIndex(p.gpa, file), carried); + p.gpa.free(file.line_starts); + file.line_starts = &.{}; + } const rows = lineCount(content) + 2; for ([_]bool{ false, true }) |indexed| { if (indexed) _ = try lineIndex(p.gpa, file); @@ -1546,6 +1640,80 @@ pub const File = struct { return starts; } + /// The line index of `new` from `old`'s: an edit replaces one span, so + /// line starts before it stand, starts after it shift, and only the span + /// is scanned. Rebuilding scanned the whole file on every keystroke. + fn editedLineStarts(gpa: std.mem.Allocator, starts: []const usize, old: []const u8, new: []const u8) ![]usize { + const n = @min(old.len, new.len); + var head: usize = 0; + while (head + 64 <= n and std.mem.eql(u8, old[head..][0..64], new[head..][0..64])) head += 64; + while (head < n and old[head] == new[head]) head += 1; + var tail: usize = 0; + while (tail + 64 <= n - head and std.mem.eql(u8, old[old.len - tail - 64 ..][0..64], new[new.len - tail - 64 ..][0..64])) tail += 64; + while (tail < n - head and old[old.len - tail - 1] == new[new.len - tail - 1]) tail += 1; + // A start s follows the newline at s-1: kept while that newline is in + // the common head, shifted while it is in the common tail. + const kept = std.sort.upperBound(usize, starts, head, struct { + fn order(key: usize, item: usize) std.math.Order { + return std.math.order(key, item); + } + }.order); + const old_tail_at = old.len - tail; + const moved = starts.len - std.sort.upperBound(usize, starts, old_tail_at, struct { + fn order(key: usize, item: usize) std.math.Order { + return std.math.order(key, item); + } + }.order); + const middle = new[head .. new.len - tail]; + const out = try gpa.alloc(usize, kept + std.mem.count(u8, middle, "\n") + moved); + @memcpy(out[0..kept], starts[0..kept]); + var i = kept; + var off: usize = 0; + while (std.mem.indexOfScalarPos(u8, middle, off, '\n')) |nl| { + off = nl + 1; + out[i] = head + off; + i += 1; + } + for (starts[starts.len - moved ..]) |start| { + out[i] = start + new.len - old.len; + i += 1; + } + return out; + } + + test "edited line index equals a rebuilt one" { + const gpa = std.testing.allocator; + var prng = std.Random.DefaultPrng.init(7); + const r = prng.random(); + var text: std.ArrayList(u8) = .empty; + defer text.deinit(gpa); + for (0..300) |_| try text.append(gpa, "ab\n"[r.uintLessThan(usize, 3)]); + for (0..2000) |_| { + var old_state: State = undefined; + old_state.content = text.items; + old_state.line_starts = &.{}; + const starts = try lineIndex(gpa, &old_state); + defer gpa.free(starts); + // one random replace, like any edit through setContent + const at = r.uintAtMost(usize, text.items.len); + const del = r.uintAtMost(usize, @min(8, text.items.len - at)); + var ins: [8]u8 = undefined; + const ins_len = r.uintAtMost(usize, 8); + for (ins[0..ins_len]) |*c| c.* = "ab\n"[r.uintLessThan(usize, 3)]; + const old = try gpa.dupe(u8, text.items); + defer gpa.free(old); + try text.replaceRange(gpa, at, del, ins[0..ins_len]); + const edited = try editedLineStarts(gpa, starts, old, text.items); + defer gpa.free(edited); + var fresh_state: State = undefined; + fresh_state.content = text.items; + fresh_state.line_starts = &.{}; + const fresh = try lineIndex(gpa, &fresh_state); + defer gpa.free(fresh); + try std.testing.expectEqualSlices(usize, fresh, edited); + } + } + /// line count, O(1) once the index is warm pub fn nlines(gpa: std.mem.Allocator, f: *State) usize { const idx = lineIndex(gpa, f) catch return lineCount(f.content); @@ -1760,12 +1928,13 @@ pub const File = struct { reportEdit(p, f, new); if (f.mini) |*mini| mini.deinit(p.gpa); f.mini = null; + const starts: []usize = if (f.line_starts.len > 0) editedLineStarts(p.gpa, f.line_starts, f.content, new) catch &.{} else &.{}; p.gpa.free(f.content); f.content = new; f.revision +%= 1; f.mtime = pardes.ctlfs.events.now(); if (f.line_starts.len > 0) p.gpa.free(f.line_starts); - f.line_starts = &.{}; + f.line_starts = starts; if (f.highlights.len > 0) p.tree_sitter_gpa.free(f.highlights); f.highlights = &.{}; f.highlight_start = 0; @@ -2864,7 +3033,10 @@ pub const Output = struct { pub fn openConfig(p: *Pardes, id: usize) !void { var out: std.Io.Writer.Allocating = .init(p.gpa); errdefer out.deinit(); + var dir_buf: [1024]u8 = undefined; + const host_fs = comptime (pardes.platform != .web and pardes.platform != .esp32p4); try config.Runtime.writeReport(&out.writer, .{ + .default_dump_dir = if (host_fs) (pardes.dump.defaultDirectory(&dir_buf) orelse "") else "", .startup_config_path = p.opts.startup_config_path, .platform = @tagName(pardes.platform), .theme_name = p.theme().name, @@ -3599,6 +3771,9 @@ pub const Pdf = struct { const Page = struct { page: usize, items: []const Highlight }; pages: [3]Page = undefined, len: usize = 0, + /// Repaint whenever the set changes, not only when a page's raster was + /// invalidated (`HighlightInput.live`). + live: bool = false, pub fn forPage(highlights: @This(), page: usize) []const Highlight { for (highlights.pages[0..highlights.len]) |group| @@ -3612,6 +3787,7 @@ pub const Pdf = struct { hover_page: ?usize = null, hover_color: [3]u8, selection_color: [3]u8, + live: bool = false, } else void; pub fn buildHighlights( @@ -3623,7 +3799,7 @@ pub const Pdf = struct { const search_len = if (state.search_results) |results| results.quads.len else 0; const selection_len = if (state.selection) |selection| selection.quads.len else 0; const items = try arena.alloc(Highlight, input.hover_quads.len + search_len + selection_len); - var result: Highlights = .{}; + var result: Highlights = .{ .live = input.live }; var n: usize = 0; // Hover, search and selection can belong to three different pages. // Group them once so raster rendering can borrow a contiguous slice. @@ -3721,6 +3897,19 @@ pub const Pdf = struct { decorated: bool = false, tint_key: ?TintKey = null, revision: u32 = 0, + /// `rgba` before its highlights and tint, kept once the page has been + /// highlighted: a highlight change repaints rows from it instead of + /// rendering the page again. + clean: []u8 = &.{}, + /// The highlights baked into `rgba` (gpa-owned), so a change repaints + /// only the rows of the quads that differ. + baked: []Highlight = &.{}, + /// `baked` is a true record (false after a render could not copy it). + baked_valid: bool = false, + /// Page rows changed since revision `patch_from`, the one last handed + /// to a shell; 0 when the pixels were replaced wholesale since. + patch_from: u32 = 0, + patch_rows: pdf.Document.Rows = .{ .start = 0, .end = 0 }, } else void; pub const SectionsOutput = if (enabled) struct { @@ -3894,6 +4083,8 @@ pub const Pdf = struct { } fn retireRaster(state: *@This(), gpa: std.mem.Allocator, raster: *Raster) void { + if (raster.clean.len > 0) gpa.free(raster.clean); + gpa.free(raster.baked); state.retireRgba(gpa, raster.rgba); raster.* = .{}; } @@ -4138,8 +4329,11 @@ pub const Pdf = struct { pub fn deinit(state: *@This(), gpa: std.mem.Allocator) void { gpa.free(state.path); - for (state.rasters[0..state.rasters_len]) |raster| + for (state.rasters[0..state.rasters_len]) |raster| { if (raster.rgba.len > 0) gpa.free(raster.rgba); + if (raster.clean.len > 0) gpa.free(raster.clean); + gpa.free(raster.baked); + } for (state.spare[0..state.spare_len]) |rgba| gpa.free(rgba); gpa.free(state.page_sizes); gpa.free(state.page_starts); @@ -4614,16 +4808,27 @@ pub const Pdf = struct { const slot = raster.?; const page_highlights = highlights.forPage(page); const decorated = page_highlights.len > 0; - const stale = !slot.tried or !slot.request_valid or - !slot.request.eql(request) or slot.decorated != decorated or + const base_stale = !slot.request_valid or !slot.request.eql(request) or slot.tint_key == null or !slot.tint_key.?.eql(tint_key) or slot.rgba.len == 0 or slot.band_h == 0; - const uncovered = !stale and uncovered: { + const uncovered = !base_stale and uncovered: { const want = wantedBand(state, viewport, page, slotShape(slot), is_flinging); break :uncovered slot.band_y > want.y or slot.band_y + slot.band_h < want.y + want.height; }; - if (!stale and !uncovered) continue; + if (!base_stale and !uncovered) { + if (slot.tried and slot.decorated == decorated and + !(highlights.live and !sameHighlights(slot.baked, page_highlights))) continue; + // Invalidated, but it already shows exactly these highlights + // (a preview withdrawn that was never drawn, on every pointer + // move over a page): nothing to render. + if (slot.baked_valid and sameHighlights(slot.baked, page_highlights)) { + slot.tried = true; + continue; + } + // Only the highlights moved: repaint their rows in place. + if (repaintHighlights(state, gpa, slot, request, tint_key, page_highlights)) continue; + } slot.tried = true; slot.request = request; @@ -4640,15 +4845,27 @@ pub const Pdf = struct { { const tz_render = tracy.zone(@src(), "pdf.render_into"); defer tz_render.end(); + // A highlighted page keeps its clean rows for repaints. + const keep_clean = pardes.platform != .macos and (decorated or slot.clean.len > 0); state.document.renderIntoAtWithPaper( page, request, shape, want, - page_highlights, + if (keep_clean) &.{} else page_highlights, fresh, pardes.platform == .macos, ) catch break :filled false; + if (slot.clean.len != 0 and (!keep_clean or slot.clean.len != fresh.len)) { + gpa.free(slot.clean); + slot.clean = &.{}; + } + if (keep_clean) { + if (slot.clean.len == 0) slot.clean = gpa.alloc(u8, fresh.len) catch &.{}; + if (slot.clean.len == fresh.len) @memcpy(slot.clean, fresh); + state.document.paintHighlightsAt(page, request, shape, want, page_highlights, fresh) catch + break :filled false; + } } const tz_tint = tracy.zone(@src(), "pdf.tint"); defer tz_tint.end(); @@ -4658,6 +4875,9 @@ pub const Pdf = struct { }; if (!filled) { state.retireRgba(gpa, fresh); + // `clean` may already hold the band that failed. + if (slot.clean.len > 0) gpa.free(slot.clean); + slot.clean = &.{}; continue; } @@ -4669,6 +4889,18 @@ pub const Pdf = struct { slot.band_h = want.height; slot.decorated = decorated; slot.tint_key = tint_key; + if (gpa.dupe(Highlight, page_highlights)) |copy| { + gpa.free(slot.baked); + slot.baked = copy; + slot.baked_valid = true; + } else |_| { + // Unrecorded highlights cannot be compared or diffed. + slot.baked_valid = false; + if (slot.clean.len > 0) gpa.free(slot.clean); + slot.clean = &.{}; + } + slot.patch_from = 0; + slot.patch_rows = .{ .start = 0, .end = 0 }; state.next_raster_revision +%= 1; if (state.next_raster_revision == 0) state.next_raster_revision = 1; slot.revision = state.next_raster_revision; @@ -4676,6 +4908,114 @@ pub const Pdf = struct { state.trimSpares(gpa); } + /// Repaint only the rows where the old and new highlights differ: the + /// clean rows kept from the page's last render, MuPDF's highlight pass + /// (the whole new set) over them, the per-pixel tint — the operations a + /// full render performs, in its order, on fewer rows and without running + /// the page again. False leaves the slot for the full path. + fn repaintHighlights( + state: *State, + gpa: std.mem.Allocator, + slot: *Raster, + request: RenderRequest, + tint_key: TintKey, + page_highlights: []const Highlight, + ) bool { + const tz = tracy.zone(@src(), "pdf.repaint_highlights"); + defer tz.end(); + if (slot.clean.len != slot.rgba.len or !slot.baked_valid) return false; + if (sameHighlights(slot.baked, page_highlights)) { + slot.tried = true; + return true; + } + const baked = gpa.dupe(Highlight, page_highlights) catch return false; + const changed = changedHighlights(gpa, slot.baked, page_highlights) catch { + gpa.free(baked); + return false; + }; + defer gpa.free(changed); + var dirty = state.document.highlightRows(slot.page, request, changed) catch { + gpa.free(baked); + return false; + }; + slot.tried = true; + dirty.start = @max(dirty.start, slot.band_y); + dirty.end = @min(dirty.end, slot.band_y + slot.band_h); + if (dirty.start < dirty.end) { + const shape = slotShape(slot); + const band = shape.band(dirty.start, dirty.end - dirty.start); + const offset = (dirty.start - slot.band_y) * shape.stride; + const out = slot.rgba[offset..][0..band.len]; + @memcpy(out, slot.clean[offset..][0..band.len]); + // On failure the rows are half-made: let the full path redo them. + state.document.paintHighlightsAt(slot.page, request, shape, band, page_highlights, out) catch { + gpa.free(baked); + slot.tried = false; + return false; + }; + pdf.tintRgba(out, tint_key.mode, tint_key.colors) catch { + gpa.free(baked); + slot.tried = false; + return false; + }; + slot.patch_rows = unionRows(slot.patch_rows, dirty); + state.next_raster_revision +%= 1; + if (state.next_raster_revision == 0) state.next_raster_revision = 1; + slot.revision = state.next_raster_revision; + } + gpa.free(slot.baked); + slot.baked = baked; + slot.decorated = page_highlights.len > 0; + return true; + } + + fn sameHighlights(a: []const Highlight, b: []const Highlight) bool { + return std.mem.eql(u8, std.mem.sliceAsBytes(a), std.mem.sliceAsBytes(b)); + } + + /// The highlights in one set and not the other, as multisets (a quad + /// painted twice blends twice). When only the order changed, blending + /// order did, so everything counts. + // ponytail: quadratic match; past 64k comparisons every quad counts. + fn changedHighlights(gpa: std.mem.Allocator, old: []const Highlight, new: []const Highlight) ![]Highlight { + const out = try gpa.alloc(Highlight, old.len + new.len); + errdefer gpa.free(out); + var n: usize = 0; + if (old.len * new.len <= 1 << 16) { + const matched = try gpa.alloc(bool, new.len); + defer gpa.free(matched); + @memset(matched, false); + for (old) |h| { + for (new, matched) |candidate, *used| { + if (!used.* and std.mem.eql(u8, std.mem.asBytes(&h), std.mem.asBytes(&candidate))) { + used.* = true; + break; + } + } else { + out[n] = h; + n += 1; + } + } + for (new, matched) |h, used| if (!used) { + out[n] = h; + n += 1; + }; + } + if (n == 0) { + @memcpy(out[0..old.len], old); + @memcpy(out[old.len..], new); + return out; + } + // Freed by length: hand back exactly what the caller will free. + return gpa.realloc(out, n); + } + + fn unionRows(a: pdf.Document.Rows, b: pdf.Document.Rows) pdf.Document.Rows { + if (a.start >= a.end) return b; + if (b.start >= b.end) return a; + return .{ .start = @min(a.start, b.start), .end = @max(a.end, b.end) }; + } + pub fn renderFrame( state: *State, gpa: std.mem.Allocator, @@ -5837,6 +6177,7 @@ pub const Pdf = struct { .hover_page = hover_page, .hover_color = if (link_hover) core.theme().box else selection_color, .selection_color = selection_color, + .live = core.native_image_patches, }; } @@ -5907,6 +6248,16 @@ pub const Pdf = struct { const visible_end = visible.first + visible.len; while (page < visible_end) : (page += 1) { const placed = placedRaster(state, view, page) orelse continue; + const slot = rasterForPage(state, page).?; + const patch: ?pardes.ImagePatch = if (slot.patch_from != 0 and + slot.patch_rows.start < slot.patch_rows.end) + .{ + .from = slot.patch_from, + .y = @intCast(slot.patch_rows.start - slot.band_y), + .h = @intCast(slot.patch_rows.end - slot.patch_rows.start), + } + else + null; if (!core.appendImagePlace(.{ .pane = @intCast(pane_id), .serial = pane.serial, @@ -5928,14 +6279,18 @@ pub const Pdf = struct { .x = text_x, // Below the notice chips, like an image: a placed page is // drawn after the cells and would paint a chip out. - .y = core.bodyTop(rect) + pane.notices.len, + .y = core.bodyTop(rect) + pane.notices.span(), .w = text_width, - .h = (rect.h -| pardes.BOX_H) -| pane.notices.len, + .h = (rect.h -| pardes.BOX_H) -| pane.notices.span(), .rgba = placed.rgba, .iw = placed.width, // The texture contains the retained band, not the full page. .ih = placed.band_height, + .patch = patch, })) break; + // A shell now holds (or will fetch whole) this revision. + slot.patch_from = slot.revision; + slot.patch_rows = .{ .start = 0, .end = 0 }; placed_any = true; } if (!placed_any) return false; @@ -6439,9 +6794,15 @@ pub const Terminal = struct { return pane; } - /// Rebuild a dump's dead terminal emulator. Registration and tag/cwd policy - /// stay with the core; raw VT replay and viewport restoration belong here. - pub fn restore(p: *Pardes, src: dump.Pane) !*Pane { + /// Where a restored terminal's history ends and its new shell begins. + pub const restored_banner = "\x1b[0m\r\n\x1b[2m\u{2500}\u{2500} restored history \u{2500}\u{2500}\x1b[0m\r\n"; + + /// Rebuild a dump's terminal emulator from its recorded output. `live`: a + /// shell will be spawned into it, so the history is marked off from what + /// that shell prints and the pane waits for it like any new terminal. + /// Registration and tag/cwd policy stay with the core; raw VT replay and + /// viewport restoration belong here. + pub fn restore(p: *Pardes, src: dump.Pane, live: bool) !*Pane { const terminal = src.terminal.?; if (comptime !enabled) { const pane = try create(p.gpa, @max(1, src.cols), @max(1, src.rows)); @@ -6450,12 +6811,28 @@ pub const Terminal = struct { pane.ovl = .{ .row = 0, .rows = 1, .text = try p.gpa.dupe(u8, terminal.stream) }; return pane; } - const bytes = if (terminal.stream_b64.len > 0) + // An older dump's raw output tail cannot come back live: cut off mid + // redraw, or written at sizes the pane no longer has, it replays as + // garbage. Its rendered text can. + const legacy_text = live and !terminal.stream_is_screen and terminal.stream.len > 0; + const bytes = if (legacy_text) + try std.mem.replaceOwned(u8, p.scratch.allocator(), terminal.stream, "\n", "\r\n") + else if (terminal.stream_b64.len > 0) try dump.decodeBytes(p.scratch.allocator(), terminal.stream_b64) else &.{}; const pane = try create(p.gpa, @max(1, src.cols), @max(1, src.rows)); - if (bytes.len > 0) { + if (live) { + if (bytes.len > 0) { + ingest(pane, bytes); + ingest(pane, restored_banner); + } + followOutput(pane); + // A view left scrolled back stays on what it was showing: the + // banner's line breaks scrolled a full screen by that many more. + if (src.scroll > 0) scrollGrid(pane, -@as(i32, @intCast(src.scroll + comptime std.mem.count(u8, restored_banner, "\n")))); + armShellSpawn(pane); + } else if (bytes.len > 0) { ingest(pane, bytes); followOutput(pane); if (src.scroll > 0) @@ -6613,7 +6990,7 @@ pub const Terminal = struct { .cols = pane.cols, .rows = pane.rows, .terminal = .{ .stream_b64 = encoded }, - }); + }, false); defer gpa.destroy(restored); defer deinitEmulator(restored, gpa); const before = try screenTextAlloc(pane, gpa); @@ -6624,6 +7001,58 @@ pub const Terminal = struct { try std.testing.expectEqualSlices(u8, try replayBytes(pane, gpa), try replayBytes(restored, gpa)); } + test "a restored terminal keeps its history above a marker and gets a shell where it was" { + if (comptime !enabled or pardes.isolated) return error.SkipZigTest; + const gpa = std.testing.allocator; + const p = try Pardes.init(gpa, .{ .tty_only = true, .cols = 40, .rows = 12 }); + defer p.deinit(); + while (p.nextEffect()) |_| {} + const pane = p.panes[0].?; + feedOutput(p, pane, "old output\r\n$ ls\r\n"); + try pane.setOwnedCwd("/tmp"); + try p.dumpState(); + const restored = try Pardes.initFromDump(gpa, .{ .tty_only = true, .cols = 40, .rows = 12 }, p.dump_out.?); + defer restored.deinit(); + var spawned = false; + while (restored.nextEffect()) |effect| switch (effect) { + .spawn => |sp| spawned = sp.pane == 0 and std.mem.eql(u8, sp.cwd.slice(), "/tmp"), + else => {}, + }; + try std.testing.expect(spawned); + const again = restored.panes[0].?; + try std.testing.expectEqual(.spawn, again.pending_command.wait); + const text = try screenTextAlloc(again, gpa); + defer gpa.free(text); + const old_at = std.mem.indexOf(u8, text, "old output") orelse return error.HistoryLost; + const mark_at = std.mem.indexOf(u8, text, "restored history") orelse return error.NoMarker; + try std.testing.expect(old_at < mark_at); + } + + test "an older dump comes back live from its rendered text, not its raw output tail" { + if (comptime !enabled) return error.SkipZigTest; + const gpa = std.testing.allocator; + const p = try Pardes.init(gpa, .{ .tty_only = true, .cols = 40, .rows = 12 }); + defer p.deinit(); + // A tail cut mid-redraw: relative moves from a cursor it never set. + const tail = try dump.encodeBytes(gpa, "\x1b[7A\x1b[2Kgarbage\x1b[3B\x1b[9Gmore"); + defer gpa.free(tail); + const restored = try restore(p, .{ + .kind = .terminal, + .tag = "", + .body = "", + .cols = 40, + .rows = 12, + .terminal = .{ .stream = "$ ls\na.txt b.txt\n$ ", .stream_b64 = tail }, + }, true); + defer gpa.destroy(restored); + defer deinitEmulator(restored, gpa); + defer deinitPendingCommand(restored); + const text = try screenTextAlloc(restored, gpa); + defer gpa.free(text); + try std.testing.expect(std.mem.indexOf(u8, text, "$ ls\na.txt b.txt") != null); + try std.testing.expect(std.mem.indexOf(u8, text, "garbage") == null); + } + /// Record and parse one live pty read, invalidate its motion surface, and /// follow it only when the body (possibly parked under a tag edit) is raw. pub fn feedOutput(p: *Pardes, pane: *Pane, bytes: []const u8) void { @@ -7247,6 +7676,16 @@ pub const Terminal = struct { overlay.text = new; } + /// The shell's screen and scrollback (the primary screen, even under a + /// full-screen program) as VT that replays to what was shown: styled + /// text, soft-wrapped lines rejoined so they reflow at another width. + fn screenVt(pane: *const Pane, arena: std.mem.Allocator) ![]const u8 { + const screen = pane.terminal.?.vt.screens.get(.primary) orelse return &.{}; + var out: std.Io.Writer.Allocating = .init(arena); + try ghostty_vt.formatter.ScreenFormatter.init(screen, .{ .emit = .vt, .unwrap = true }).format(&out.writer); + return out.written(); + } + /// Serialize terminal-only state; the core supplies shared pane metadata. pub fn dumpPane( pane: *Pane, @@ -7318,7 +7757,8 @@ pub const Terminal = struct { .terminal = .{ .cwd = try arena.dupe(u8, pane.cwdSlice()), .stream = stream[0..len], - .stream_b64 = try dump.encodeBytes(arena, try replayBytes(pane, arena)), + .stream_b64 = try dump.encodeBytes(arena, try screenVt(pane, arena)), + .stream_is_screen = true, .cursor = .{ .col = pane.terminal.?.vt.screens.active.cursor.x, .row = pane.terminal.?.vt.screens.active.cursor.y, diff --git a/src/pardes.zig b/src/pardes.zig index cc57127f..fae14f47 100644 --- a/src/pardes.zig +++ b/src/pardes.zig @@ -2722,8 +2722,16 @@ test "Msg writes the transient row by hand, bare or with text, and input ends it try std.testing.expect(p.executeBuiltinLine(2, "Msg")); try std.testing.expectEqualStrings("Msg: NoMessage", row(p, 2)); - // A message is exactly as old as your last input. + // Input starts its exit: it lingers, dissolves, and is gone. p.update(.{ .key = .{ .cp = Key.escape } }); + try std.testing.expectEqualStrings("Msg: NoMessage", row(p, 2)); + for (0..200) |_| p.update(.tick); + try std.testing.expectEqualStrings("", row(p, 2)); + // ...and with neither linger nor animation it is as old as your last input. + try std.testing.expect(p.executeBuiltinLine(2, "MessageAnimation off")); + try std.testing.expect(p.executeBuiltinLine(2, "MessageLinger 0")); + try std.testing.expect(p.executeBuiltinLine(2, "Msg gone")); + p.update(.{ .key = .{ .cp = 'h' } }); try std.testing.expectEqualStrings("", row(p, 2)); // Longer than the row's buffer is CUT, never refused and never overrun: @@ -2735,6 +2743,151 @@ test "Msg writes the transient row by hand, bare or with text, and input ends it try std.testing.expectEqual(p.panes[2].?.msg.len, row(p, 2).len); } +test "a message falls in, lingers past the input that dismisses it, and dissolves" { + const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 80, .rows = 24 }); + defer p.deinit(); + while (p.nextEffect()) |_| {} + const pane = p.panes[p.active].?; + try std.testing.expect(p.settings.message_animation); + try std.testing.expect(p.executeBuiltinLine(p.active, "MessageLinger 160")); + try std.testing.expect(p.executeBuiltinLine(p.active, "Msg hello")); + try std.testing.expectEqual(Pane.MessagePhase.entering, pane.msg_life.phase); + try std.testing.expect(p.animationActive()); + // An ease-in fall: starts a whole row up, lands exactly on it. + const start = p.messageMotion(pane.msg_life); + try std.testing.expectEqual(@as(f32, -1), start.slide); + var last = start.slide; + for (0..Pardes.messageFrames(p.settings.message_fall_ms)) |_| { + p.needs_frame = false; + p.update(.tick); + // Every tick that moves it owes a frame, the landing one included. + try std.testing.expect(p.needs_frame); + const now = p.messageMotion(pane.msg_life); + try std.testing.expect(now.slide >= last); + last = now.slide; + } + try std.testing.expectEqual(Pane.MessagePhase.shown, pane.msg_life.phase); + try std.testing.expectEqual(@as(f32, 0), p.messageMotion(pane.msg_life).slide); + try std.testing.expect(!p.animationActive()); + // Shown until input, like always; the same line again does not re-enter. + for (0..100) |_| p.update(.tick); + try std.testing.expectEqual(Pane.MessagePhase.shown, pane.msg_life.phase); + try std.testing.expect(p.executeBuiltinLine(p.active, "Msg hello")); + try std.testing.expectEqual(Pane.MessagePhase.shown, pane.msg_life.phase); + // Input (a key that announces nothing): 160 ms of lingering (ten frames), unaffected by more input... + p.update(.{ .key = .{ .cp = 'h' } }); + try std.testing.expectEqual(Pane.MessagePhase.lingering, pane.msg_life.phase); + for (0..9) |_| { + p.update(.tick); + p.update(.{ .key = .{ .cp = 'h' } }); + } + try std.testing.expectEqual(Pane.MessagePhase.lingering, pane.msg_life.phase); + p.update(.tick); + // ...then an ease-out dissolve toward nothing, and gone. + try std.testing.expectEqual(Pane.MessagePhase.leaving, pane.msg_life.phase); + var alpha: f32 = 1; + for (0..Pardes.messageFrames(p.settings.message_dissolve_ms)) |_| { + const now = p.messageMotion(pane.msg_life).alpha; + try std.testing.expect(now <= alpha); + alpha = now; + p.needs_frame = false; + p.update(.tick); + } + try std.testing.expectEqual(@as(u16, 0), pane.msg_len); + try std.testing.expect(!p.animationActive()); + // The tick that clears it still owes the frame that shows it gone. + try std.testing.expect(p.needs_frame); + + // Dismissed mid-fall: it lands, then lingers. + try std.testing.expect(p.executeBuiltinLine(p.active, "Msg again")); + try std.testing.expectEqual(Pane.MessagePhase.entering, pane.msg_life.phase); + p.update(.tick); + p.update(.{ .key = .{ .cp = 'h' } }); + try std.testing.expectEqual(Pane.MessagePhase.entering, pane.msg_life.phase); + for (0..Pardes.messageFrames(p.settings.message_fall_ms)) |_| p.update(.tick); + try std.testing.expectEqual(Pane.MessagePhase.lingering, pane.msg_life.phase); + // Shown again while lingering: fresh, so it stays; a status update to a + // line on screen swaps its text in place instead of falling again. + try std.testing.expect(p.executeBuiltinLine(p.active, "Msg again")); + try std.testing.expectEqual(Pane.MessagePhase.shown, pane.msg_life.phase); + p.setStatus(p.active, "progress 50%"); + try std.testing.expectEqual(Pane.MessagePhase.shown, pane.msg_life.phase); + try std.testing.expectEqualStrings("progress 50%", pane.msg[0..pane.msg_len]); + try std.testing.expectEqual(@as(u8, 0), pane.msg_older_len); + // The fall and the dissolve are timings of their own, in milliseconds. + try std.testing.expect(p.executeBuiltinLine(p.active, "MessageFall 48")); + try std.testing.expect(p.executeBuiltinLine(p.active, "MessageDissolve 0")); + try std.testing.expectEqual(@as(u16, 3), Pardes.messageFrames(p.settings.message_fall_ms)); + try std.testing.expectEqual(@as(u16, 1), Pardes.messageFrames(p.settings.message_dissolve_ms)); + // The Config report reads back as configuration. + try std.testing.expect(p.executeBuiltinLine(p.active, "MessageAnimation")); + try std.testing.expect(!p.settings.message_animation); + try std.testing.expect(p.executeBuiltinLine(p.active, "Msg plain")); + try std.testing.expectEqual(Pane.MessagePhase.shown, pane.msg_life.phase); +} + +test "messages stack, oldest on top, each on its own timing" { + const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 80, .rows = 24 }); + defer p.deinit(); + while (p.nextEffect()) |_| {} + const pane = p.panes[p.active].?; + try std.testing.expect(p.executeBuiltinLine(p.active, "Verbose off")); + try std.testing.expect(p.executeBuiltinLine(p.active, "MessageLinger 160")); + // `Verbose off` announced itself before it took effect. + pane.msg_len = 0; + pane.msg_life = .{}; + const fall = Pardes.messageFrames(p.settings.message_fall_ms); + p.setMessage(p.active, "first"); + for (0..fall) |_| p.update(.tick); + try std.testing.expectEqual(Pane.MessagePhase.shown, pane.msg_life.phase); + // A second message stacks under the first instead of replacing it. + p.setMessage(p.active, "second"); + try std.testing.expectEqual(@as(u8, 1), pane.msg_older_len); + try std.testing.expectEqualStrings("first", pane.msg_older[0].slice()); + try std.testing.expectEqualStrings("second", pane.msg[0..pane.msg_len]); + try std.testing.expectEqual(Pane.MessagePhase.entering, pane.msg_life.phase); + p.collectNotices(pane, p.rects[p.active], p.active); + try std.testing.expectEqual(Pane.Notices.Kind.older, pane.notices.kinds[0]); + try std.testing.expectEqual(Pane.Notices.Kind.message, pane.notices.kinds[1]); + // One key dismisses both, but each runs its own clock: the first starts + // lingering now, the second only once it has landed. + p.update(.{ .key = .{ .cp = 'h' } }); + try std.testing.expectEqual(Pane.MessagePhase.lingering, pane.msg_older[0].life.phase); + try std.testing.expectEqual(Pane.MessagePhase.entering, pane.msg_life.phase); + const linger = Pardes.messageFrames(p.settings.message_linger_ms); + const dissolve = Pardes.messageFrames(p.settings.message_dissolve_ms); + for (0..linger + dissolve) |_| p.update(.tick); + // The first is gone; the second, a fall later, is still dissolving. + try std.testing.expectEqual(@as(u8, 0), pane.msg_older_len); + try std.testing.expectEqualStrings("second", pane.msg[0..pane.msg_len]); + try std.testing.expectEqual(Pane.MessagePhase.leaving, pane.msg_life.phase); + for (0..fall) |_| p.update(.tick); + try std.testing.expectEqual(@as(u16, 0), pane.msg_len); + try std.testing.expect(!p.animationActive()); + // A status ticking in place does not pile up. + p.setStatus(p.active, "lsp 10%"); + p.setStatus(p.active, "lsp 20%"); + try std.testing.expectEqual(@as(u8, 0), pane.msg_older_len); + // Lines keep their rows: when the top one leaves, the one under it does + // not move up, and the next message fills the gap instead. + p.setMessage(p.active, "top"); + p.setMessage(p.active, "under"); + try std.testing.expectEqual(@as(u8, 0), pane.msg_older[0].slot); + try std.testing.expectEqual(@as(u8, 1), pane.msg_slot); + pane.removeOlderMessage(0); + p.collectNotices(pane, p.rects[p.active], p.active); + try std.testing.expectEqual(@as(u8, 1), pane.notices.row[0]); + try std.testing.expectEqual(@as(u8, 2), pane.notices.span()); + p.setMessage(p.active, "fills"); + try std.testing.expectEqual(@as(u8, 0), pane.msg_slot); + try std.testing.expectEqual(@as(u8, 1), pane.msg_older[0].slot); + // The stack keeps the newest few. + for ([_][]const u8{ "a", "b", "c", "d", "e" }) |text| p.setMessage(p.active, text); + try std.testing.expectEqual(@as(u8, Pane.message_stack), pane.msg_older_len); + try std.testing.expectEqualStrings("b", pane.msg_older[0].slice()); + try std.testing.expectEqualStrings("e", pane.msg[0..pane.msg_len]); +} + test "Font keeps requested and acknowledged faces as separate plain state" { if (comptime !font_picker) return; // there is no Font builtin on tty or web const p = try Pardes.init(std.testing.allocator, .{ .cols = 80, .rows = 24 }); @@ -3774,6 +3927,8 @@ pub const NativePlacement = if (pdf_enabled) struct { paper_bg: ?[3]u8 = null, } else struct {}; +pub const ImagePatch = struct { from: u32, y: u32, h: u32 }; + pub const ImagePlace = struct { pane: u8, /// Pane slots are reused. This identity makes a cached GPU texture or @@ -3787,6 +3942,10 @@ pub const ImagePlace = struct { rgba: []const u8, iw: usize, ih: usize, + /// Rows [y, y+h) of `rgba` are the only ones that differ from the + /// same pane page at revision `from`: a shell still holding that one may + /// update just these rows instead of taking the whole image again. + patch: ?ImagePatch = null, pub fn cacheKey(place: ImagePlace) ImageCacheKey { if (comptime pdf_enabled) @@ -6194,6 +6353,10 @@ pub const Pardes = struct { chrome_animation: ChromeAnimation = ChromeAnimation.init(initial_chrome), animate_theme_changes: bool = false, native_images: bool = false, + /// The shell can take a changed image a few rows at a time (a texture row + /// upload, a shared-memory hand-off), so a PDF selection is repainted as + /// it is dragged instead of once on release. + native_image_patches: bool = false, quit: bool = false, haptic: HapticSlot = if (platform == .macos) .none else {}, drag: Drag = .none, @@ -6250,6 +6413,9 @@ pub const Pardes = struct { /// Is there a frame worth drawing? Cleared once one is presented, set by /// anything that can change what is on screen. The first frame always is. needs_frame: bool = true, + /// Set by a shell whose present was skipped (no swapchain image): the + /// frame is still owed, and the next pump draws it again. + present_skipped: bool = false, /// Builtins announce themselves on the message row. Off while startup /// configuration is applied: those lines are nobody clicking, and should /// not leave the row holding the name of the last one. @@ -7040,16 +7206,18 @@ pub const Pardes = struct { } }; + /// A status updates the message line in place (a progress count does not + /// pile up); a message is an event, and stacks. pub fn setStatus(p: *Pardes, id: usize, text: []const u8) void { - p.showMessage(id, text); + p.showMessage(id, text, false); } pub fn setMessage(p: *Pardes, id: usize, text: []const u8) void { p.logMessage(id, text); - p.showMessage(id, text); + p.showMessage(id, text, true); } - fn showMessage(p: *Pardes, id: usize, text: []const u8) void { + fn showMessage(p: *Pardes, id: usize, text: []const u8, stack: bool) void { if (id >= MAX_PANES) return; const pane = p.panes[id] orelse return; // One row of printable text: a language server's multi-line report @@ -7058,8 +7226,158 @@ pub const Pardes = struct { if (n < text.len) { while (n > 0 and text[n] & 0xC0 == 0x80) n -= 1; } + const same = pane.msg_len == n and for (text[0..n], pane.msg[0..n]) |c, have| { + if ((if (c < 0x20 or c == 0x7f) ' ' else c) != have) break false; + } else true; + // A new event moves the line on screen up the stack, where it keeps + // its own timing, and falls in below it. + // Only an event stacks on an event: an announcement or a status + // stands in for whatever comes next. + if (stack and pane.msg_len > 0 and !same and !pane.msg_announcement and !pane.msg_status) + pane.pushOlderMessage(); + if (pane.msg_len == 0) pane.msg_slot = pane.freeMessageSlot(); + pane.msg_announcement = false; + pane.msg_status = !stack; + const arrives = pane.msg_len == 0 or pane.msg_life.phase == .leaving; for (text[0..n], pane.msg[0..n]) |c, *cell| cell.* = if (c < 0x20 or c == 0x7f) ' ' else c; pane.msg_len = @intCast(n); + p.needs_frame = true; + if (arrives) { + pane.msg_life = .{ .phase = if (p.settings.message_animation and n > 0) .entering else .shown }; + } else if (pane.msg_life.phase == .lingering or + (pane.msg_life.phase == .entering and !p.settings.message_animation)) + { + // The same line again, or a status update: fresh, so it stays. + pane.msg_life = .{}; + } else { + pane.msg_life.dismissed = false; + } + } + + /// The key or click that used to clear the message row now starts each + /// line's exit: it stays `message_linger_ms`, then dissolves. A line + /// already on its way out keeps its own timing. + fn dismissMessage(p: *Pardes, pane: *Pane) void { + if (pane.msg_len > 0 and p.dismissLine(&pane.msg_life)) { + pane.msg_len = 0; + pane.msg_life = .{}; + } + var i: usize = 0; + while (i < pane.msg_older_len) { + if (p.dismissLine(&pane.msg_older[i].life)) pane.removeOlderMessage(i) else i += 1; + } + } + + /// Start one line's exit; true when it is gone at once (no linger, no + /// animation). + fn dismissLine(p: *const Pardes, life: *Pane.MessageLife) bool { + switch (life.phase) { + .lingering, .leaving => return false, + // A falling line lands first, then lingers -- unless falling was + // just turned off, and nothing will land it. + .entering => if (p.settings.message_animation) { + life.dismissed = true; + return false; + }, + .shown => {}, + } + life.frame = 0; + if (p.settings.message_linger_ms > 0) { + life.phase = .lingering; + } else if (p.settings.message_animation) { + life.phase = .leaving; + } else return true; + return false; + } + + /// One animation frame of every message line. Each one that moves owes + /// a frame, the one that finishes included: a tick asks for none itself. + fn advanceMessages(p: *Pardes) void { + for (p.panes) |slot| { + const pane = slot orelse continue; + if (pane.msg_len > 0 and pane.msg_life.phase != .shown) { + p.needs_frame = true; + if (p.advanceLine(&pane.msg_life)) { + pane.msg_len = 0; + pane.msg_life = .{}; + } + } + var i: usize = 0; + while (i < pane.msg_older_len) { + if (pane.msg_older[i].life.phase != .shown) p.needs_frame = true; + if (p.advanceLine(&pane.msg_older[i].life)) pane.removeOlderMessage(i) else i += 1; + } + } + } + + /// One frame of one line's life; true once it has left. + fn advanceLine(p: *const Pardes, life: *Pane.MessageLife) bool { + if (life.phase == .shown) return false; + life.frame +|= 1; + switch (life.phase) { + .shown => {}, + .entering => if (life.frame >= messageFrames(p.settings.message_fall_ms)) { + life.* = .{ .phase = if (life.dismissed) .lingering else .shown }; + }, + .lingering => if (life.frame >= messageFrames(p.settings.message_linger_ms)) { + if (!p.settings.message_animation) return true; + life.* = .{ .phase = .leaving }; + }, + .leaving => if (life.frame >= messageFrames(p.settings.message_dissolve_ms)) return true, + } + return false; + } + + /// Is any message line moving (and so owed ticks)? + fn messagesAnimating(pane: *const Pane) bool { + if (pane.msg_len > 0 and pane.msg_life.phase != .shown) return true; + for (pane.msg_older[0..pane.msg_older_len]) |line| if (line.life.phase != .shown) return true; + return false; + } + + /// How present a message is (1 = fully) and how far above its row it + /// still is (rows), eased: an ease-in fall, an ease-out dissolve. + const MessageMotion = struct { alpha: f32 = 1, slide: f32 = 0 }; + + /// Animation frames a message timing lasts; at least one. + pub fn messageFrames(ms: u16) u16 { + return @intCast(@max(1, (@as(u32, ms) + layout.Animation.frame_ms - 1) / layout.Animation.frame_ms)); + } + + fn messageMotion(p: *const Pardes, life: Pane.MessageLife) MessageMotion { + const fall_frames = messageFrames(p.settings.message_fall_ms); + const dissolve_frames = messageFrames(p.settings.message_dissolve_ms); + return switch (life.phase) { + .shown, .lingering => .{ .alpha = 1, .slide = 0 }, + .entering => blk: { + const t = @as(f32, @floatFromInt(@min(life.frame, fall_frames))) / @as(f32, @floatFromInt(fall_frames)); + const eased = t * t; + break :blk .{ .alpha = eased, .slide = eased - 1 }; + }, + .leaving => blk: { + const t = @as(f32, @floatFromInt(@min(life.frame, dissolve_frames))) / @as(f32, @floatFromInt(dissolve_frames)); + break :blk .{ .alpha = (1 - t) * (1 - t), .slide = 0 }; + }, + }; + } + + /// The life of the message line notice `i` shows, if it shows one. + fn noticeLife(pane: *const Pane, i: usize) ?Pane.MessageLife { + return switch (pane.notices.kinds[i]) { + .message => pane.msg_life, + .older => pane.msg_older[pane.notices.index[i]].life, + .leader, .prompt => null, + }; + } + + fn blendRgb(from: [3]u8, to: [3]u8, amount: f32) [3]u8 { + var out: [3]u8 = undefined; + for (&out, from, to) |*o, a, b| { + const af: f32 = @floatFromInt(a); + const bf: f32 = @floatFromInt(b); + o.* = @intFromFloat(@round(bf + (af - bf) * std.math.clamp(amount, 0, 1))); + } + return out; } fn logMessage(p: *Pardes, id: usize, text: []const u8) void { @@ -7358,8 +7676,11 @@ pub const Pardes = struct { _ = p.frame_arena.reset(.retain_capacity); const surface = try p.render(p.frame_arena.allocator()); if (v.present) |f| f(h.ctx, surface); + // Settled before post_present: a shell ticks there, and what that + // tick moves owes the next frame. + p.needs_frame = p.present_skipped; + p.present_skipped = false; if (v.post_present) |f| f(h.ctx); - p.needs_frame = false; } /// One request of the control filesystem, from whichever thread has the @@ -7389,6 +7710,10 @@ pub const Pardes = struct { // the screen. p.needs_frame = p.needs_frame or ev != .tick; p.shell_rows.sweep(p.gpa); + // An announcement stands in only until its own step says more. + for (p.panes) |slot| if (slot) |pane| { + pane.msg_announcement = false; + }; switch (ev) { .tick => {}, .mouse => |m| if (!(m.button == .none and m.kind == .motion)) { @@ -7415,10 +7740,11 @@ pub const Pardes = struct { switch (ev) { .key, .mouse => { for (p.panes) |slot| { - if (slot) |pane| pane.msg_len = 0; + if (slot) |pane| p.dismissMessage(pane); } p.clip_pending = null; }, + .tick => p.advanceMessages(), else => {}, } if (p.fs.listeners != 0) p.fs.origin = switch (ev) { @@ -11462,7 +11788,7 @@ pub const Pardes = struct { // A notice chip is chrome: it sits OVER the body's top rows, so a // click inside one belongs to nobody. The rest of those rows is // ordinary body text and still answers normally. - if (!on_tag and row >= body_y and row - body_y < p.panes[id].?.notices.len and + if (!on_tag and row >= body_y and row - body_y < p.panes[id].?.notices.span() and p.panes[id].?.notices.covers(row - body_y, col)) return null; if (!on_tag) if (body_hit) |supplied| { const mapped_hit = p.bodyHitForPane(id, supplied, false) orelse return null; @@ -12252,6 +12578,21 @@ pub const Pardes = struct { } } else { const clk = pane.sel[b]; + // A right-click on a line NUMBER looks at that line of + // this file -- a sticky context header's number included, + // since the row map holds each header's own source line. + if (s.button == config.look_button and clk.r0 >= BOX_H and clk.r0 == clk.r1 and + clk.c0 == clk.c1 and clk.c0 >= 0 and pane.mode != .tty) + if (pane.file) |f| if (f.output == null and clk.c0 < panes.File.gutterWidth(pane)) { + const line = pane.wrapAt(clk.r0 - BOX_H).line; + if (line >= 0) { + pane.sel[b].state = .none; + var buf: [48]u8 = undefined; + const target = std.fmt.bufPrint(&buf, "@p{d}:{d}", .{ s.id, @as(usize, @intCast(line)) + 1 }) catch return; + p.runBuiltin(config.look_cmd, s.id, "", target); + return; + } + }; var operand = p.pointerOperand(pane, clk); if (operand.expanded) |expanded| pane.sel[b] = expanded @@ -12876,8 +13217,10 @@ pub const Pardes = struct { // A builtin says its own name before it runs, so a tagline click is // legible even when what it did is invisible. Whatever the builtin // then says for itself replaces the announcement. - if (p.announce and p.settings.verbose and builtins.registry.announces(b)) + if (p.announce and p.settings.verbose and builtins.registry.announces(b)) { p.setMessage(id, @tagName(b)); + pane.msg_announcement = true; + } const c: builtins.Ctx = .{ .p = p, .pane = pane, .id = id, .txt = txt, .arg = arg }; builtins.registry.dispatch(b, c); } @@ -13121,10 +13464,16 @@ pub const Pardes = struct { const pane: *Pane = switch (src.kind) { .terminal => terminal: { const t = src.terminal.?; - const restored = try panes.Terminal.restore(p, src); + // A host that runs shells gets them back: the old history + // above a new shell in the directory it was in. The web + // shell and an isolated build only ever replay it. + const live = comptime (terminal_panes and platform != .web and !isolated); + const revive = live and t.cwd.len <= effect_path_cap; + const restored = try panes.Terminal.restore(p, src, revive); p.installPane(i, restored); try restored.setOwnedCwd(t.cwd); if (std.mem.startsWith(u8, src.tag, "TTY ")) restored.mode = .tty; + if (revive) p.emit(.{ .spawn = .{ .pane = @intCast(i), .cwd = .from(t.cwd) } }); break :terminal restored; }, .file => try panes.File.restore(p, i, src), @@ -13487,6 +13836,9 @@ pub const Pardes = struct { /// core work belongs in this one predicate so TTY and GUI mature it alike. pub fn animationActive(p: *const Pardes) bool { if (p.chrome_animation.isActive() or p.look_hover_wait != null) return true; + for (p.panes) |slot| if (slot) |pane| { + if (messagesAnimating(pane)) return true; + }; const scene = p.settings.scene_effects; if (scene.crt or scene.ripple or scene.glitch) return true; return p.presentation.animating(); @@ -13653,7 +14005,7 @@ pub const Pardes = struct { const first = p.bodyTop(r); var leader_buf: [16]u8 = undefined; for (pane.notices.slice(), 0..) |kind, i| { - const row = first + @as(u16, @intCast(i)); + const row = first + @as(u16, pane.notices.row[i]); // Every notice is painted on the canonical grid as well as // emitted as a tag layer: the grid is what a terminal client // draws, and a band it cannot see is a message it never gets. @@ -13661,6 +14013,7 @@ pub const Pardes = struct { // drawn twice there. const text = switch (kind) { .message => pane.msg[0..pane.msg_len], + .older => pane.msg_older[pane.notices.index[i]].slice(), .leader => p.leaderText(&leader_buf), .prompt => blk: { const at = pane.promptAt() orelse continue; @@ -13671,13 +14024,24 @@ pub const Pardes = struct { if (chip == 0) continue; const cx = tx + tw - chip; pane.notices.left[i] = cx; - s.fill(cx, row, chip, 1, .{ .bg = msg_style.bg, .font_role = .tagline }); + // A message coming or going blends toward the page it sits + // on; a grid cannot move it by less than a row. + var style = msg_style; + if (noticeLife(pane, i)) |life| { + // No page colour to fade to (a terminal's own default): + // the text dissolves into its chip instead. + const alpha = p.messageMotion(life).alpha; + const page = th.bg orelse chrome.tag_bg; + style.fg = .{ .rgb = blendRgb(chrome.tag_fg, page, alpha) }; + style.bg = .{ .rgb = blendRgb(chrome.tag_bg, page, alpha) }; + } + s.fill(cx, row, chip, 1, .{ .bg = style.bg, .font_role = .tagline }); // One column short of the chip's right edge: a prompt's caret // sits AFTER its last character the moment it opens, and flush // right would put it past the pane, off the grid, and past what // the detached wire will encode -- which drops every frame for // as long as the prompt is up. - const printed = printRight(s, cx, row, chip -| 1, text, msg_style); + const printed = printRight(s, cx, row, chip -| 1, text, style); if (kind != .prompt or id != p.active) continue; const at = pane.promptAt() orelse continue; const prompt0 = (p.tagPrefix(pane) catch continue).len + at; @@ -14166,6 +14530,7 @@ pub const Pardes = struct { for (pane.notices.slice(), 0..) |kind, i| { const text = switch (kind) { .message => pane.msg[0..pane.msg_len], + .older => pane.msg_older[pane.notices.index[i]].slice(), .leader => p.leaderText(&leader_buf), // A prompt is an editing line with a cursor in it, so it // stays on the grid where the cursor can sit on a cell. @@ -14190,12 +14555,19 @@ pub const Pardes = struct { const line = try arena.alloc(u8, pad + kept.len); @memset(line[0..pad], ' '); @memcpy(line[pad..], kept); - try p.renderHeaderLayer(arena, NOTICE_LAYER_BASE + id * Pane.Notices.max + i, .notice, @intCast(id), .{ + // A pixel shell slides the message in whole and only fades + // it on the way out. + const motion: MessageMotion = if (noticeLife(pane, i)) |life| p.messageMotion(life) else .{}; + const fade = if (motion.slide == 0) motion.alpha else 1; + const page = p.theme().bg orelse chrome.tag_bg; + const layer_index = NOTICE_LAYER_BASE + id * Pane.Notices.max + i; + try p.renderHeaderLayer(arena, layer_index, .notice, @intCast(id), .{ .x = cx, - .y = first + @as(u16, @intCast(i)), + .y = first + @as(u16, pane.notices.row[i]), .w = chip, .h = BOX_H, - }, line, chrome.tag_bg, chrome.tag_fg); + }, line, blendRgb(chrome.tag_bg, page, fade), blendRgb(chrome.tag_fg, page, fade)); + p.surface.tag_layers[layer_index].slide = motion.slide; } } if (p.columnBarHeight() > 0) for (0..p.ncol) |column| { @@ -14221,6 +14593,7 @@ pub const Pardes = struct { layer.cols = columns; layer.bg = bg; layer.cursor = null; + layer.slide = 0; var surface: Surface = .{ .cols = columns, .rows = 1, .cells = layer.cells }; // A notice band carries a PANE id, not a column index, so it must not // answer to the column being edited -- that would scroll and select @@ -14270,7 +14643,10 @@ pub const Pardes = struct { fn collectNotices(p: *Pardes, pane: *Pane, r: Rect, id: usize) void { pane.notices.len = 0; if (r.w <= config.GUTTER or r.h <= BOX_H) return; - if (pane.msg_len > 0) pane.notices.push(.message); + // Oldest message line on top, so lines already up do not move when a + // new one lands under them; when rows run out the oldest go first. + for (pane.msg_older[0..pane.msg_older_len], 0..) |line, i| pane.notices.pushAt(.older, @intCast(i), line.slot); + if (pane.msg_len > 0) pane.notices.pushAt(.message, 0, pane.msg_slot); if (id == p.active and p.leader_on) pane.notices.push(.leader); if (pane.promptAt()) |at| { if (pane.tagSlice()[@min(at, pane.tag_tail_len)..].len > 0) pane.notices.push(.prompt); @@ -14281,11 +14657,26 @@ pub const Pardes = struct { // into blind. A two-row pane spends its only body row on one notice, // which is what the single shared row used to do anyway. const room: u8 = @intCast(@min(@as(u16, Pane.Notices.max), r.h - BOX_H)); - if (pane.notices.len > room) { - const drop = pane.notices.len - room; - for (0..room) |i| pane.notices.kinds[i] = pane.notices.kinds[i + drop]; - pane.notices.len = room; + const n = &pane.notices; + if (n.span() <= room) return; + // Too short for the gaps: close them up in screen order, and if even + // that does not fit, the top bands go. + var i: usize = 1; + while (i < n.len) : (i += 1) { + var j = i; + while (j > 0 and n.row[j - 1] > n.row[j]) : (j -= 1) { + std.mem.swap(Pane.Notices.Kind, &n.kinds[j - 1], &n.kinds[j]); + std.mem.swap(u8, &n.index[j - 1], &n.index[j]); + std.mem.swap(u8, &n.row[j - 1], &n.row[j]); + } + } + const drop = n.len -| room; + for (0..n.len - drop) |k| { + n.kinds[k] = n.kinds[k + drop]; + n.index[k] = n.index[k + drop]; + n.row[k] = @intCast(k); } + n.len -= @intCast(drop); } fn renderBodyLayer(p: *Pardes, arena: std.mem.Allocator, pane: *Pane, r: Rect, id: usize) !void { @@ -14390,7 +14781,7 @@ pub const Pardes = struct { // Below the notice chips: a picture is drawn after the cells (the // GUI's image pass, kitty's z-order), so a chip over it would be // painted out. Text gets the overlay; a picture gives up the rows. - const shown = pane.notices.len; + const shown = pane.notices.span(); const image_h = (r.h -| BOX_H) -| shown; panes.Image.draw(p, iv, @intCast(id), pane.serial, tx, body_y + shown, tw, image_h); // thumbless, but the same one column as the real scrollbar below — diff --git a/src/pdf.zig b/src/pdf.zig index 712750dc..de5e6d86 100644 --- a/src/pdf.zig +++ b/src/pdf.zig @@ -1017,6 +1017,73 @@ pub const Document = struct { ) != c.PARDES_PDF_OK) return error.RenderFailed; } + /// Only the highlight pass of `renderIntoAtWithPaper`, over `rgba`, which + /// holds `band` of this page as that render left it before highlighting + /// (opaque paper). Rendering with highlights equals rendering without and + /// then this, row for row: the render draws highlights over the finished + /// page, and so does this. + pub fn paintHighlightsAt( + document: *Document, + page: usize, + request: RenderRequest, + raster: Raster, + band: Raster.Band, + highlights: []const Highlight, + rgba: []u8, + ) !void { + if (rgba.len != band.len) return error.BadPixmap; + if (band.height == 0 or band.y + band.height > raster.height) + return error.BadPixmap; + const bounded = try boundedRequest(document, page, request); + if (highlights.len > c.PARDES_PDF_MAX_RESULT_QUADS) return error.RenderFailed; + if (c.pardes_pdf_paint_highlights( + document.handle, + @intCast(page), + bounded.dpi, + bounded.minimum_width, + bounded.minimum_height, + bounded.max_dimension, + if (highlights.len == 0) null else @ptrCast(highlights.ptr), + highlights.len, + rgba.ptr, + rgba.len, + @intCast(raster.width), + @intCast(raster.height), + @intCast(raster.stride), + @intCast(band.y), + @intCast(band.height), + ) != c.PARDES_PDF_OK) return error.RenderFailed; + } + + pub const Rows = struct { start: usize, end: usize }; + + /// The rows of `request`'s raster that painting `highlights` can touch, + /// by the transform the render itself uses (rotation included). Empty + /// when nothing would paint. + pub fn highlightRows( + document: *Document, + page: usize, + request: RenderRequest, + highlights: []const Highlight, + ) !Rows { + const bounded = try boundedRequest(document, page, request); + var row_start: c_int = 0; + var row_end: c_int = 0; + if (c.pardes_pdf_highlight_rows( + document.handle, + @intCast(page), + bounded.dpi, + bounded.minimum_width, + bounded.minimum_height, + bounded.max_dimension, + if (highlights.len == 0) null else @ptrCast(highlights.ptr), + highlights.len, + &row_start, + &row_end, + ) != c.PARDES_PDF_OK) return error.RenderFailed; + return .{ .start = @intCast(row_start), .end = @intCast(row_end) }; + } + const BoundedRequest = struct { dpi: c_int, minimum_width: c_int, diff --git a/src/pdf_bridge.c b/src/pdf_bridge.c index 976ed838..2c723dbb 100644 --- a/src/pdf_bridge.c +++ b/src/pdf_bridge.c @@ -572,6 +572,55 @@ pardes_pdf_measure_render( return PARDES_PDF_OK; } +/* The highlight pass of a render: fills over whatever the pixmap holds. */ +static void +pardes_pdf_fill_highlights(fz_context *ctx, pardes_pdf_document *document, + fz_device *device, const pardes_pdf_highlight *highlights, size_t highlight_count) +{ + fz_path *path = NULL; + size_t i; + + fz_var(path); + fz_try(ctx) + { + for (i = 0; i < highlight_count; ++i) { + fz_quad quad; + float color[3]; + float alpha; + + if (!pardes_pdf_valid_quad(highlights[i].quad)) + fz_throw(ctx, FZ_ERROR_ARGUMENT, + "PDF highlight contains a non-finite point"); + if (highlights[i].rgba[3] == 0) + continue; + + /* Kind is semantic metadata; caller-supplied RGBA is final. */ + (void)highlights[i].kind; + quad = pardes_pdf_quad_to_page(document, highlights[i].quad); + color[0] = highlights[i].rgba[0] / 255.0f; + color[1] = highlights[i].rgba[1] / 255.0f; + color[2] = highlights[i].rgba[2] / 255.0f; + alpha = highlights[i].rgba[3] / 255.0f; + + path = fz_new_path(ctx); + fz_moveto(ctx, path, quad.ul.x, quad.ul.y); + fz_lineto(ctx, path, quad.ur.x, quad.ur.y); + fz_lineto(ctx, path, quad.lr.x, quad.lr.y); + fz_lineto(ctx, path, quad.ll.x, quad.ll.y); + fz_closepath(ctx, path); + fz_fill_path(ctx, device, path, 0, fz_identity, + fz_device_rgb(ctx), color, alpha, + fz_default_color_params); + fz_drop_path(ctx, path); + path = NULL; + } + } + fz_always(ctx) + fz_drop_path(ctx, path); + fz_catch(ctx) + fz_rethrow(ctx); +} + int pardes_pdf_render_into( pardes_pdf_document *document, @@ -594,10 +643,8 @@ pardes_pdf_render_into( fz_context *ctx; fz_pixmap *pixmap = NULL; fz_device *device = NULL; - fz_path *path = NULL; fz_matrix ctm; fz_irect bbox; - size_t i; if (document == NULL || page_number < 0 || page_number >= document->page_count || dpi < 1 || @@ -614,7 +661,6 @@ pardes_pdf_render_into( ctx = document->ctx; fz_var(pixmap); fz_var(device); - fz_var(path); fz_try(ctx) { pardes_pdf_render_geometry(document, page_number, dpi, @@ -627,10 +673,12 @@ pardes_pdf_render_into( * The BAND: rows [band_y, band_y + band_height) of the page raster, * and nothing else. A pixmap's bbox IS the draw device's clip, so the * page runs under the same CTM it would for a full raster and MuPDF - * discards everything outside these rows. Every row inside them is - * therefore bit-identical to the same row of the full-page raster — - * "band rows equal full-page rows" in pdf.zig proves it, because the - * whole point of a band is that the reader cannot tell. + * discards everything outside these rows. The rows are NOT always + * bit-identical to the full page's: rows at the band's edges, and a + * resampled image anywhere in it, can differ (measured on + * docs/registry.pdf and docs/design.pdf). Good enough for a band that + * is only shown while flinging; never use a band to patch rows into a + * whole-page raster -- `pardes_pdf_paint_highlights` exists for that. */ bbox.y0 += band_y; bbox.y1 = bbox.y0 + band_height; @@ -674,43 +722,12 @@ pardes_pdf_render_into( if (highlight_count != 0) { device = fz_new_draw_device(ctx, ctm, pixmap); - for (i = 0; i < highlight_count; ++i) { - fz_quad quad; - float color[3]; - float alpha; - - if (!pardes_pdf_valid_quad(highlights[i].quad)) - fz_throw(ctx, FZ_ERROR_ARGUMENT, - "PDF highlight contains a non-finite point"); - if (highlights[i].rgba[3] == 0) - continue; - - /* Kind is semantic metadata; caller-supplied RGBA is final. */ - (void)highlights[i].kind; - quad = pardes_pdf_quad_to_page(document, highlights[i].quad); - color[0] = highlights[i].rgba[0] / 255.0f; - color[1] = highlights[i].rgba[1] / 255.0f; - color[2] = highlights[i].rgba[2] / 255.0f; - alpha = highlights[i].rgba[3] / 255.0f; - - path = fz_new_path(ctx); - fz_moveto(ctx, path, quad.ul.x, quad.ul.y); - fz_lineto(ctx, path, quad.ur.x, quad.ur.y); - fz_lineto(ctx, path, quad.lr.x, quad.lr.y); - fz_lineto(ctx, path, quad.ll.x, quad.ll.y); - fz_closepath(ctx, path); - fz_fill_path(ctx, device, path, 0, fz_identity, - fz_device_rgb(ctx), color, alpha, - fz_default_color_params); - fz_drop_path(ctx, path); - path = NULL; - } + pardes_pdf_fill_highlights(ctx, document, device, highlights, highlight_count); fz_close_device(ctx, device); } } fz_always(ctx) { - fz_drop_path(ctx, path); fz_drop_device(ctx, device); /* Drops only the wrapper: caller-owned samples remain untouched. */ fz_drop_pixmap(ctx, pixmap); @@ -742,6 +759,139 @@ pardes_pdf_render_into( return PARDES_PDF_OK; } +int +pardes_pdf_paint_highlights( + pardes_pdf_document *document, + int page_number, + int dpi, + int minimum_width, + int minimum_height, + int max_dimension, + const pardes_pdf_highlight *highlights, + size_t highlight_count, + unsigned char *samples, + size_t samples_len, + int width, + int height, + int stride, + int band_y, + int band_height) +{ + fz_context *ctx; + fz_pixmap *pixmap = NULL; + fz_device *device = NULL; + fz_matrix ctm; + fz_irect bbox; + + if (document == NULL || page_number < 0 || + page_number >= document->page_count || dpi < 1 || + minimum_width < 0 || minimum_height < 0 || max_dimension < 1 || + (highlight_count != 0 && highlights == NULL) || + highlight_count > PARDES_PDF_MAX_RESULT_QUADS || samples == NULL || + width < 1 || height < 1 || width > INT_MAX / 4 || stride != width * 4 || + band_y < 0 || band_height < 1 || band_y > height - band_height || + (size_t)band_height > SIZE_MAX / (size_t)stride || + samples_len != (size_t)stride * (size_t)band_height) + return PARDES_PDF_ERROR; + if (highlight_count == 0) + return PARDES_PDF_OK; + + ctx = document->ctx; + fz_var(pixmap); + fz_var(device); + fz_try(ctx) + { + pardes_pdf_render_geometry(document, page_number, dpi, + minimum_width, minimum_height, max_dimension, &ctm, &bbox); + if (fz_irect_width(bbox) != width || fz_irect_height(bbox) != height) + fz_throw(ctx, FZ_ERROR_ARGUMENT, + "PDF raster layout changed between measure and paint"); + bbox.y0 += band_y; + bbox.y1 = bbox.y0 + band_height; + pixmap = fz_new_pixmap_with_bbox_and_data( + ctx, fz_device_rgb(ctx), bbox, NULL, 1, samples); + device = fz_new_draw_device(ctx, ctm, pixmap); + pardes_pdf_fill_highlights(ctx, document, device, highlights, highlight_count); + fz_close_device(ctx, device); + } + fz_always(ctx) + { + fz_drop_device(ctx, device); + fz_drop_pixmap(ctx, pixmap); + } + fz_catch(ctx) + { + fz_report_error(ctx); + return PARDES_PDF_ERROR; + } + return PARDES_PDF_OK; +} + +int +pardes_pdf_highlight_rows( + pardes_pdf_document *document, + int page_number, + int dpi, + int minimum_width, + int minimum_height, + int max_dimension, + const pardes_pdf_highlight *highlights, + size_t highlight_count, + int *row_start, + int *row_end) +{ + fz_context *ctx; + fz_matrix ctm; + fz_irect bbox; + float y0 = 0, y1 = 0; + int any = 0; + size_t i; + + if (row_start == NULL || row_end == NULL) + return PARDES_PDF_ERROR; + *row_start = *row_end = 0; + if (document == NULL || page_number < 0 || + page_number >= document->page_count || dpi < 1 || + minimum_width < 0 || minimum_height < 0 || max_dimension < 1 || + (highlight_count != 0 && highlights == NULL)) + return PARDES_PDF_ERROR; + + ctx = document->ctx; + fz_try(ctx) + { + pardes_pdf_render_geometry(document, page_number, dpi, + minimum_width, minimum_height, max_dimension, &ctm, &bbox); + for (i = 0; i < highlight_count; ++i) { + fz_rect r; + if (highlights[i].rgba[3] == 0 || + !pardes_pdf_valid_quad(highlights[i].quad)) + continue; + r = fz_rect_from_quad(fz_transform_quad( + pardes_pdf_quad_to_page(document, highlights[i].quad), ctm)); + if (!any || r.y0 < y0) y0 = r.y0; + if (!any || r.y1 > y1) y1 = r.y1; + any = 1; + } + } + fz_catch(ctx) + { + fz_report_error(ctx); + return PARDES_PDF_ERROR; + } + if (any) { + /* + * Antialiasing covers the pixel a fractional edge falls in, and the + * rasterizer paints row floor(y1) even for a zero-height quad. + */ + int lo = (int)floorf(y0) - bbox.y0; + int hi = (int)floorf(y1) + 1 - bbox.y0; + int h = fz_irect_height(bbox); + *row_start = lo < 0 ? 0 : (lo > h ? h : lo); + *row_end = hi < *row_start ? *row_start : (hi > h ? h : hi); + } + return PARDES_PDF_OK; +} + int pardes_pdf_page_text( pardes_pdf_document *document, diff --git a/src/pdf_bridge.h b/src/pdf_bridge.h index cda426aa..e3514437 100644 --- a/src/pdf_bridge.h +++ b/src/pdf_bridge.h @@ -222,8 +222,9 @@ int pardes_pdf_measure_render( * MuPDF wraps but never owns or frees samples. Every successful pixel is * opaque unless transparent_paper is nonzero. That mode preserves content * coverage and returns straight-alpha RGBA over an unpainted page. - * The CTM does not depend on the band, so a band's rows are bit-identical to - * the same rows of the whole page: it is a clip, not a different rendering. + * The CTM does not depend on the band, so a band is a clip of the same + * rendering -- but not a bit-exact one: its edge rows and resampled images can + * differ from the whole page's (see pardes_pdf_render_into). */ int pardes_pdf_render_into( pardes_pdf_document *document, @@ -244,6 +245,47 @@ int pardes_pdf_render_into( int transparent_paper ); +/* + * The highlight pass of `pardes_pdf_render_into` alone, over caller-supplied + * rows of that page's opaque raster: render_into(h) == paint(render_into({}), h) + * row for row, because a render draws its highlights over the finished page. + */ +int pardes_pdf_paint_highlights( + pardes_pdf_document *document, + int page, + int dpi, + int minimum_width, + int minimum_height, + int max_dimension, + const pardes_pdf_highlight *highlights, + size_t highlight_count, + unsigned char *samples, + size_t samples_len, + int width, + int height, + int stride, + int band_y, + int band_height +); + +/* + * The raster rows [*row_start, *row_end) that painting `highlights` can touch + * under the same request, in the coordinates `pardes_pdf_render_into` bands + * use. An empty set (or only transparent ones) yields start == end == 0. + */ +int pardes_pdf_highlight_rows( + pardes_pdf_document *document, + int page, + int dpi, + int minimum_width, + int minimum_height, + int max_dimension, + const pardes_pdf_highlight *highlights, + size_t highlight_count, + int *row_start, + int *row_end +); + int pardes_pdf_page_text( pardes_pdf_document *document, int page, diff --git a/src/tag_layer.zig b/src/tag_layer.zig index 0fb2297d..f8cc6eca 100644 --- a/src/tag_layer.zig +++ b/src/tag_layer.zig @@ -26,6 +26,10 @@ pub const Layer = struct { bg: [3]u8 = .{ 0, 0, 0 }, cells: []pardes.Cell = &.{}, cursor: ?struct { col: u16, bar: bool = false } = null, + /// Vertical offset in rows (negative: above its viewport), for a band + /// that is moving into place. A pixel shell draws it offset and clipped + /// to the rows below the viewport's top; the grid has no such thing. + slide: f32 = 0, pub fn capacity(layer: *const Layer, metrics: pardes.RowMetrics) u16 { return @intCast(@min(std.math.maxInt(u16), @max(1, @as(u32, layer.viewport.w) * @max(1, metrics.body_w) / @max(1, metrics.tagline_w)))); diff --git a/src/tty/tty.zig b/src/tty/tty.zig index 03ccd3e2..5976852f 100644 --- a/src/tty/tty.zig +++ b/src/tty/tty.zig @@ -21,6 +21,56 @@ extern "c" fn setenv(name: [*:0]const u8, value: [*:0]const u8, overwrite: c_int const TIOCSWINSZ: c_int = @bitCast(@as(u32, if (@hasDecl(posix.T, "IOCSWINSZ")) posix.T.IOCSWINSZ else 0x80087467)); +/// The terminal answered the shared-memory probe (`kittyShmProbe`): it can +/// read a raster from a POSIX shm object, so a page costs a name on the wire +/// instead of its whole base64 body. Set by the input reader, which sees the +/// reply before vaxis' parser swallows every graphics APC alike. +var kitty_shm = std.atomic.Value(bool).init(false); +/// Only a reply that arrives while the probe is out counts. The id is one +/// vaxis' own image numbering (1, 2, ...) never reaches, because a terminal +/// answers every transmission `i=;OK` and one of those must not pass. +var kitty_shm_probing = std.atomic.Value(bool).init(false); +const kitty_shm_probe_id = 0x7fff_fff1; +var kitty_shm_serial: u32 = 0; + +fn kittyShmName(buf: []u8, n: u32) ![:0]const u8 { + return std.fmt.bufPrintSentinel(buf, "/pardes-{d}-{d}", .{ libc.getpid(), n }, 0); +} + +/// Write `bytes` to a fresh shm object; the terminal unlinks it after reading. +fn kittyShmWrite(name: [:0]const u8, bytes: []const u8) bool { + const fd = libc.shm_open(name, @bitCast(libc.O{ .ACCMODE = .RDWR, .CREAT = true, .EXCL = true }), @as(c_uint, 0o600)); + if (fd < 0) return false; + defer _ = libc.close(fd); + if (libc.ftruncate(fd, @intCast(bytes.len)) != 0) { + _ = libc.shm_unlink(name); + return false; + } + var off: usize = 0; + while (off < bytes.len) { + const n = libc.write(fd, bytes[off..].ptr, bytes.len - off); + if (n <= 0) { + _ = libc.shm_unlink(name); + return false; + } + off += @intCast(n); + } + return true; +} + +/// Ask with a 1x1 RGB image in shm whether the terminal reads that medium. A +/// remote terminal cannot see our shm and answers an error (or nothing). +fn kittyShmProbe(w: *std.Io.Writer) void { + var buf: [64]u8 = undefined; + const name = kittyShmName(&buf, 0) catch return; + if (!kittyShmWrite(name, &.{ 0, 0, 0 })) return; + var b64: [64]u8 = undefined; + const enc = std.base64.standard.Encoder.encode(&b64, name); + kitty_shm_probing.store(true, .release); + w.print("\x1b_Gi={d},s=1,v=1,a=q,t=s,f=24;{s}\x1b\\", .{ kitty_shm_probe_id, enc }) catch return; + w.flush() catch {}; +} + pub const Command = struct { pub var value: union(enum) { nop, @@ -81,6 +131,13 @@ fn readInput(loop: *Loop, tty: anytype, cache: *vaxis.GraphemeCache) !void { const received = try tty.read(buf[carried..]); if (received == 0) return; const end = carried + received; + if (kitty_shm_probing.load(.acquire)) if (std.mem.indexOf(u8, buf[0..end], std.fmt.comptimePrint("\x1b_Gi={d};", .{kitty_shm_probe_id}))) |at| { + kitty_shm_probing.store(false, .release); + kitty_shm.store(std.mem.startsWith(u8, buf[at..end], std.fmt.comptimePrint("\x1b_Gi={d};OK", .{kitty_shm_probe_id})), .release); + // Answered either way: a terminal that could not read it left it. + var name_buf: [64]u8 = undefined; + if (kittyShmName(&name_buf, 0)) |name| _ = libc.shm_unlink(name) else |_| {} + }; var parse_end = end; var lead = end; while (lead > 0 and buf[lead - 1] & 0xc0 == 0x80) lead -= 1; @@ -717,6 +774,7 @@ fn localSession( try startInput(loop, input_cache); defer if (attached.* == null) stopInput(loop); (try std.Thread.spawn(.{}, winchWatch, .{ loop, vx, tty })).detach(); + (try std.Thread.spawn(.{}, tickWatch, .{ io, loop })).detach(); if (fs) |f| try f.watch(loop, wakeFs); try vx.queryTerminalSend(tty.writer()); @@ -726,11 +784,20 @@ fn localSession( }; if (sh.inotify_fd >= 0) sh.watch_task = io.concurrent(watchFiles, .{ io, sh.inotify_fd, loop }) catch null; + // A terminal unlinks what it reads; whatever it never read (the probe + // unanswered, a transmission lost with the terminal) is ours to remove. + defer { + var name_buf: [64]u8 = undefined; + var n: u32 = 0; + while (n <= kitty_shm_serial) : (n += 1) { + if (kittyShmName(&name_buf, n)) |name| _ = libc.shm_unlink(name) else |_| {} + } + } frames: while (!core.quit) { pardes.turn.restoreSettled(); try core.pump(host); if (core.takeRestore()) |rp| blk: { - const bytes = filesystem.readRestore(gpa, rp) catch |err| { + const bytes = filesystem.readRestore(gpa, rp, core.settings.dump_dir.get()) catch |err| { core.reportError(core.active, "Restore", err); break :blk; }; @@ -872,29 +939,39 @@ const Shell = struct { fn waitInput(ctx: ?*anyopaque, timeout_ms: u32) void { const s = of(ctx); var batch: usize = 0; - // The wait is the 9P connections' turn with the core. - if (timeout_ms == 0) { - pardes.turn.rest(); - const first = s.loop.nextEvent() catch { - pardes.turn.wake(); - s.core.quit = true; - return s.reloadWatched(); - }; - pardes.turn.wake(); - batch = 1; - if (s.apply(first)) return s.reloadWatched(); - } else { - pardes.turn.rest(); - std.Io.sleep(s.io, .fromMilliseconds(timeout_ms), .awake) catch {}; + // The wait is the 9P connections' turn with the core. Animating, the + // frame's tick arrives through the same queue (`tickWatch`). + if (timeout_ms != 0) tick_request.set(s.io); + pardes.turn.rest(); + const first = s.loop.nextEvent() catch { pardes.turn.wake(); - _ = s.apply(.tick); - batch = 1; - } - while (s.in_paste or batch < 64) { - const ev = (s.loop.tryEvent() catch null) orelse break; + s.core.quit = true; + return s.reloadWatched(); + }; + pardes.turn.wake(); + batch = 1; + // A run of queued motions is one move to its last cell: each would + // otherwise redo hover and selection work the next one undoes. + var motion: ?@TypeOf(Command.value) = null; + var ev = first; + while (true) { + if (ev == .mouse and (ev.mouse.type == .motion or ev.mouse.type == .drag)) { + if (motion) |m| if (m.mouse.button != ev.mouse.button or m.mouse.type != ev.mouse.type or + @as(u3, @bitCast(m.mouse.mods)) != @as(u3, @bitCast(ev.mouse.mods))) + { + _ = s.apply(m); + }; + motion = ev; + } else { + if (motion) |m| _ = s.apply(m); + motion = null; + if (s.apply(ev)) break; + } + if (!s.in_paste and batch >= 64) break; + ev = (s.loop.tryEvent() catch null) orelse break; batch += 1; - if (s.apply(ev)) break; } + if (motion) |m| _ = s.apply(m); s.reloadWatched(); } @@ -1001,6 +1078,7 @@ const Shell = struct { fn pollFrame(ctx: ?*anyopaque) void { const s = of(ctx); + s.core.native_image_patches = kitty_shm.load(.acquire); if (s.fs) |f| if (f.tick().pending) { _ = s.loop.tryPostEvent(.fs_ready) catch {}; }; @@ -1013,6 +1091,7 @@ const Shell = struct { s.caps_pending = false; s.vx.enableDetectedFeatures(s.tty.writer()) catch {}; s.core.native_images = s.vx.caps.kitty_graphics; + if (s.vx.caps.kitty_graphics) kittyShmProbe(s.tty.writer()); s.vx.queueRefresh(); } } @@ -1039,6 +1118,16 @@ const Shell = struct { if (!kittyImageRepresentable(place)) continue; } const key = place.cacheKey(); + if (!s.kitty.contains(key) and vx.caps.kitty_graphics and kitty_shm.load(.acquire)) shm: { + var buf: [64]u8 = undefined; + kitty_shm_serial +%= 1; + const name = kittyShmName(&buf, kitty_shm_serial) catch break :shm; + if (!kittyShmWrite(name, place.rgba)) break :shm; + if (vx.transmitLocalImagePath(s.gpa, s.tty.writer(), name, @intCast(place.iw), @intCast(place.ih), .shared_mem, .rgba) catch null) |handle| + s.kitty.put(key, handle) catch vx.freeImage(s.tty.writer(), handle.id) + else + _ = libc.shm_unlink(name); + } if (!s.kitty.contains(key) and vx.caps.kitty_graphics) { const enc = std.base64.standard.Encoder; if (s.gpa.alloc(u8, enc.calcSize(place.rgba.len))) |b64| { @@ -1160,7 +1249,7 @@ const Shell = struct { fn writeDump(ctx: ?*anyopaque, bytes: []const u8) void { const s = of(ctx); var pbuf: [1024:0]u8 = undefined; - const path = pardes.dump.outPath(&pbuf) orelse return; + const path = pardes.dump.outPath(&pbuf, s.core.settings.dump_dir.get()) orelse return; filesystem.write(s.core, path, bytes) catch |err| return s.core.reportError(0, "dump", err); s.core.setLastDump(path); } @@ -1415,6 +1504,21 @@ fn winchWatch(loop: *Loop, vx: *vaxis.Vaxis, tty: *vaxis.Tty) void { } } +/// Set by an animating frame's wait: post one `.tick` a frame from now. The +/// tick joins the input queue, so a key or a click that lands inside the +/// frame is handled at once instead of after a blind sleep. +var tick_request: std.Io.Event = .unset; + +fn tickWatch(io: std.Io, loop: *Loop) void { + while (true) { + tick_request.waitUncancelable(io); + tick_request.reset(); + var ts: libc.timespec = .{ .sec = 0, .nsec = @as(isize, pardes.layout.Animation.frame_ms) * std.time.ns_per_ms }; + _ = libc.nanosleep(&ts, null); + loop.postEvent(.tick) catch {}; + } +} + fn wakeFs(ctx: ?*anyopaque) void { const loop: *Loop = @ptrCast(@alignCast(ctx.?)); _ = loop.tryPostEvent(.fs_ready) catch {}; diff --git a/test/output.zig b/test/output.zig index ad33954f..7c80e105 100644 --- a/test/output.zig +++ b/test/output.zig @@ -1089,7 +1089,8 @@ test "identical result refresh keeps warm content caches without allocation" { try std.testing.expectEqual(revision + 1, file.revision); try std.testing.expectEqualStrings("short\n", file.content); try std.testing.expectEqualStrings("changed", file.output.?.arg()); - try std.testing.expectEqual(@as(usize, 0), file.line_starts.len); + // The warm index is carried through the edit, not dropped. + try std.testing.expectEqualSlices(usize, &.{ 0, 6 }, file.line_starts); try std.testing.expectEqual(@as(usize, 0), file.highlights.len); try std.testing.expect(file.syntax_dirty); try std.testing.expect(!result.vsel.active and !result.select); diff --git a/test/panes.zig b/test/panes.zig index 8e71e69d..2d3aed43 100644 --- a/test/panes.zig +++ b/test/panes.zig @@ -394,6 +394,42 @@ const BodyHitTests = struct { } }; +const LineNumberLookTests = struct { + test "right-click on a line number looks at that line, sticky context headers included" { + if (!syntax.enabled) return error.SkipZigTest; + 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"); + try std.testing.expect(p.executeBuiltinLine(0, "TreeContext")); + pane.scrollBy(30); + var frame = std.heap.ArenaAllocator.init(p.gpa); + defer frame.deinit(); + _ = try p.render(frame.allocator()); + const layer = &p.surface.body_layers[0]; + try std.testing.expect(layer.context_rows >= 2); + // A header row's number is its declaration's own source line, not the + // body line it sits over (`pub fn work(` is line 1); a body row's is + // its own. + try std.testing.expectEqual(@as(i32, 1), pane.wrapAt(1).line); + const rows = [_]u16{ 1, pane.context_rows + 3 }; + for (rows) |row| { + // Each Look recentres the view; come back under the headers. + pane.scrollBy(30 - pane.scroll()); + _ = frame.reset(.retain_capacity); + _ = try p.render(frame.allocator()); + const expected = pane.wrapAt(row).line; + var press = BodyHitTests.mouse(&p.surface.body_layers[0], row, 1, .press); + press.button = .right; + var release = BodyHitTests.mouse(&p.surface.body_layers[0], row, 1, .release); + release.button = .right; + p.update(.{ .mouse = press }); + p.update(.{ .mouse = release }); + try std.testing.expectEqual(expected, pane.cur_row); + } + } +}; + const TreeContextTests = struct { const source = "const Box = struct {\n" ++ " pub fn work(\n" ++ @@ -4069,6 +4105,7 @@ test { _ = TagNameTintTests; _ = TreeContextTests; _ = BodyHitTests; + _ = LineNumberLookTests; _ = TtySelectionTests; _ = ClickCursorTests; _ = JumpSelectionTests; diff --git a/test/pdf_pointer_bench.zig b/test/pdf_pointer_bench.zig new file mode 100644 index 00000000..f1d61229 --- /dev/null +++ b/test/pdf_pointer_bench.zig @@ -0,0 +1,224 @@ +//! Pointer gestures over a native PDF pane: hovering words (the Look preview +//! highlight), and dragging a selection to its release. +//! +//! zig build pdf-pointer-bench -Doptimize=ReleaseFast -- [--label L] [--reps N] [--path FILE] +//! [--cell WxH] [--scroll NOTCHES] [--verify 1] [--live 1] +//! +//! Every frame is timed the way a shell pump spends it: the event through +//! `Pardes.update`, one `render()` into a reset arena, the effect drain. A +//! hover step is its motion frame plus every tick frame the preview animates +//! before settling, which is when the highlight lands. Stdout is CSV, +//! `label,scenario:kind,round,ns`, one row per frame and one per step +//! (`kind=step`), for an external statistics pass. +//! +//! `visual` hashes every presented raster in full, with its placement, on the +//! frame each step settles on. It is the no-regression proof: a change to how highlights +//! are painted may change what it costs, never one presented pixel. +const std = @import("std"); +const pardes = @import("pardes"); +const pdf = @import("mupdf"); + +pub const std_options: std.Options = .{ .log_level = .err }; + +const gpa = std.heap.smp_allocator; +const cols: u16 = 120; +const rows: u16 = 40; + +const Config = struct { + path: []const u8 = "docs/design.pdf", + label: []const u8 = "run", + reps: usize = 5, + /// Wheel notches before the gestures, off the sparse title page. + scroll: usize = 40, + /// 8x16 is the Kitty policy's cell; the SDL shell's is closer to 16x35. + cell_w: u16 = 8, + cell_h: u16 = 16, + /// Re-render every raster that claims to hold the current highlights and + /// compare it row by row: exactness without a baseline build. + verify: bool = false, + /// A shell that takes row patches: selections repaint while dragged. + live: bool = false, +}; + +pub fn main(init: std.process.Init) !void { + const args = try init.minimal.args.toSlice(init.arena.allocator()); + var config: Config = .{}; + var i: usize = 1; + while (i + 1 < args.len) : (i += 2) { + const value = args[i + 1]; + if (std.mem.eql(u8, args[i], "--path")) config.path = value else if (std.mem.eql(u8, args[i], "--label")) config.label = value else if (std.mem.eql(u8, args[i], "--reps")) config.reps = try std.fmt.parseUnsigned(usize, value, 10) else if (std.mem.eql(u8, args[i], "--scroll")) config.scroll = try std.fmt.parseUnsigned(usize, value, 10) else if (std.mem.eql(u8, args[i], "--verify")) config.verify = std.mem.eql(u8, value, "1") else if (std.mem.eql(u8, args[i], "--live")) config.live = std.mem.eql(u8, value, "1") else if (std.mem.eql(u8, args[i], "--cell")) { + var it = std.mem.splitScalar(u8, value, 'x'); + config.cell_w = try std.fmt.parseUnsigned(u16, it.next() orelse "", 10); + config.cell_h = try std.fmt.parseUnsigned(u16, it.next() orelse "", 10); + } else return error.UnknownOption; + } + if (i != args.len) return error.MissingValue; + + var visual: ?u64 = null; + for (0..config.reps) |round| { + const got = try measure(config, round); + if (visual) |want| if (want != got) { + std.debug.print("pdf-pointer-bench: visual changed between rounds: {x} vs {x}\n", .{ want, got }); + return error.Unstable; + }; + visual = got; + } + std.debug.print("pdf-pointer-bench {s}: visual={x:0>16}\n", .{ config.label, visual.? }); +} + +const Run = struct { + core: *pardes.Pardes, + arena: std.heap.ArenaAllocator, + config: Config, + round: usize, + visual: u64 = 0x7061_7264_6573_5050, + step_ns: u64 = 0, + frames: usize = 0, + steps: usize = 0, + last: ?*const pardes.Surface = null, + + fn frame(run: *Run, scenario: []const u8, kind: []const u8, event: pardes.Event) !void { + const started = nowNs(); + run.core.update(event); + while (run.core.nextEffect()) |_| {} + _ = run.arena.reset(.retain_capacity); + const surface = try run.core.render(run.arena.allocator()); + while (run.core.nextEffect()) |_| {} + const elapsed = nowNs() - started; + run.step_ns += elapsed; + run.frames += 1; + print("{s},{s}:{s},{d},{d}\n", .{ run.config.label, scenario, kind, run.round, elapsed }); + run.last = surface; + if (run.config.verify) try verify(run.core, run.arena.allocator()); + } + + /// The step, then the tick frames its animation asks for (a hover's + /// preview arrives on one of them), as a pump with nothing else queued. + fn step(run: *Run, scenario: []const u8, kind: []const u8, event: pardes.Event) !void { + run.step_ns = 0; + try run.frame(scenario, kind, event); + var ticks: usize = 0; + while (run.core.animationActive() and ticks < 32) : (ticks += 1) + try run.frame(scenario, "tick", .tick); + print("{s},{s}:step,{d},{d}\n", .{ run.config.label, scenario, run.round, run.step_ns }); + // Only the settled frame is the invariant: how many frames a preview + // takes to arrive is a setting (look_preview_delay_frames). + run.observe(run.last.?); + run.steps += 1; + } + + fn observe(run: *Run, surface: *const pardes.Surface) void { + for (surface.images[0..surface.nimages]) |maybe| { + const place = maybe orelse continue; + run.visual = mix(run.visual, [_]u64{ place.pane, place.x, place.y, place.w, place.h, place.native.page, place.iw, place.ih }); + if (place.native.geometry) |g| run.visual = mix(run.visual, [_]u64{ g.src.x, g.src.y, g.src.w, g.src.h, g.dst.x, g.dst.y, g.dst.w, g.dst.h }); + run.visual = std.hash.Wyhash.hash(run.visual, place.rgba); + } + } +}; + +var verify_failures: usize = 0; + +fn verify(core: *pardes.Pardes, arena: std.mem.Allocator) !void { + const Pdf = pardes.panes.Pdf; + const pane = core.panes[0] orelse return; + const state = &(pane.pdf orelse return); + const highlights = try Pdf.buildHighlights(state, arena, Pdf.highlightInput(core, 0, pane)); + for (state.rasters[0..state.rasters_len]) |*r| { + if (!r.valid or r.rgba.len == 0 or r.tint_key == null) continue; + const want = highlights.forPage(r.page); + if (comptime !@hasField(@TypeOf(r.*), "baked")) return else if (!std.mem.eql(u8, std.mem.sliceAsBytes(want), std.mem.sliceAsBytes(r.baked))) continue; + const shape = try state.document.measureRenderAt(r.page, r.request); + // The oracle is the WHOLE page: a band's own edge rows can differ. + const whole = try arena.alloc(u8, shape.len); + try state.document.renderIntoAtWithPaper(r.page, r.request, shape, shape.wholePage(), want, whole, false); + try pdf.tintRgba(whole, r.tint_key.?.mode, r.tint_key.?.colors); + const fresh = whole[r.band_y * shape.stride ..][0 .. r.band_h * shape.stride]; + var first: ?usize = null; + var last: usize = 0; + var count: usize = 0; + for (0..r.band_h) |y| { + const row = fresh[y * shape.stride ..][0..shape.stride]; + if (std.mem.eql(u8, row, r.rgba[y * shape.stride ..][0..shape.stride])) continue; + if (first == null) first = y; + last = y; + count += 1; + } + if (first) |f| { + verify_failures += 1; + if (verify_failures <= 20) std.debug.print("verify: page {d} rows {d}..{d} ({d} differ), highlights {d}, band {d}+{d}\n", .{ r.page, f + r.band_y, last + r.band_y, count, want.len, r.band_y, r.band_h }); + } + } +} + +fn measure(config: Config, round: usize) !u64 { + const core = try pardes.Pardes.init(gpa, .{ .file = config.path, .cols = cols, .rows = rows }); + defer core.deinit(); + core.native_images = true; + if (comptime @hasField(pardes.Pardes, "native_image_patches")) core.native_image_patches = config.live; + var run: Run = .{ .core = core, .arena = .init(gpa), .config = config, .round = round }; + defer run.arena.deinit(); + const cell: pardes.CellPixels = .{ .w = config.cell_w, .h = config.cell_h }; + core.update(.{ .resize = .{ .cols = cols, .rows = rows, .cell_pixels = cell } }); + _ = try core.render(run.arena.allocator()); + const pane = core.panes[0] orelse return error.NoPane; + if (pane.pdf == null) return error.NotPdf; + const rect = core.rects[0]; + const mid_col = rect.x + rect.w / 2; + const mid_row = rect.y + rect.h / 2; + for (0..config.scroll) |_| { + core.update(.{ .mouse = .{ .button = .wheel_down, .kind = .press, .col = mid_col, .row = mid_row } }); + _ = run.arena.reset(.retain_capacity); + _ = try core.render(run.arena.allocator()); + while (core.nextEffect()) |_| {} + } + + const top = rect.y + 4; + const bottom = rect.y + rect.h -| 3; + const left = rect.x + 4; + const right = rect.x + rect.w -| 4; + + // Hover: walk four rows of the body, a word-ish stride at a time. + var row: u16 = top; + while (row < bottom) : (row += (bottom - top) / 4) { + var col: u16 = left; + while (col < right) : (col += 3) + try run.step("hover", "motion", .{ .mouse = .{ .button = .none, .kind = .motion, .col = col, .row = row } }); + } + // Leave the page so the last preview is withdrawn like a real exit. + try run.step("hover", "leave", .pointer_leave); + + // Select: press, drag across three lines, release; five times down the page. + row = top; + while (row + 3 < bottom) : (row += (bottom - top) / 5) { + try run.step("select", "press", .{ .mouse = .{ .button = .left, .kind = .press, .col = left, .row = row } }); + var n: u16 = 1; + while (n <= 24) : (n += 1) { + const col = left + (right - left) * (n % 8) / 8; + try run.step("select", "drag", .{ .mouse = .{ .button = .left, .kind = .drag, .col = col, .row = row + n / 8 } }); + } + try run.step("select", "release", .{ .mouse = .{ .button = .left, .kind = .release, .col = right, .row = row + 3 } }); + } + return mix(run.visual, @as(u64, run.steps)); +} + +fn print(comptime format: []const u8, args: anytype) void { + var buf: [256]u8 = undefined; + const line = std.fmt.bufPrint(&buf, format, args) catch return; + _ = std.c.write(1, line.ptr, line.len); +} + +fn mix(seed: u64, value: anytype) u64 { + var copy = value; + return std.hash.Wyhash.hash(seed, std.mem.asBytes(©)); +} + +fn nowNs() u64 { + var ts: std.c.timespec = undefined; + _ = std.c.clock_gettime(.MONOTONIC, &ts); + return @as(u64, @intCast(ts.sec)) * 1_000_000_000 + @as(u64, @intCast(ts.nsec)); +} + +comptime { + _ = pdf.Document; +} diff --git a/test/snapshot.zig b/test/snapshot.zig index 7cc5eb91..bdabb56e 100644 --- a/test/snapshot.zig +++ b/test/snapshot.zig @@ -569,7 +569,9 @@ fn runScript(arena: std.mem.Allocator, exe_z: [:0]const u8, script_path: []const try mkdir(arena, config_home, false); const pardes_config = try std.fmt.allocPrint(arena, "{s}/pardes", .{config_home}); try mkdir(arena, pardes_config, false); - try eh.writeFile(try std.fmt.allocPrintSentinel(arena, "{s}/init", .{pardes_config}, 0), "Shell bash\n"); + // Messages leave the moment they are dismissed, as goldens have always + // recorded: a linger or a dissolve is time, and time cannot be a golden. + try eh.writeFile(try std.fmt.allocPrintSentinel(arena, "{s}/init", .{pardes_config}, 0), "Shell bash\nMessageAnimation off\nMessageLinger 0\n"); _ = setenv("TERM", "xterm-256color", 1); _ = setenv("LC_ALL", "C", 1); // a wall clock cannot live in a golden; everything that would print one diff --git a/test/snapshots/builtins.snap b/test/snapshots/builtins.snap index cd47209f..02547b91 100644 --- a/test/snapshots/builtins.snap +++ b/test/snapshots/builtins.snap @@ -19,6 +19,10 @@ wheel up 110 50 wheel up 110 50 wheel up 110 50 wheel up 110 50 +wheel up 110 50 +wheel up 110 50 +wheel up 110 50 +wheel up 110 50 wait 10000 Look enter, right-click wait 10000 Exec tab, middle-click wait 10000 Filter diff --git a/test/snapshots/dump.golden b/test/snapshots/dump.golden index 8f920136..e466dbf1 100644 --- a/test/snapshots/dump.golden +++ b/test/snapshots/dump.golden @@ -38,6 +38,7 @@ .cwd = "/tmp/pardes-snap/dump/cwd", .stream = "ls\nd.txt\n", .stream_b64 = + .stream_is_screen = true, .cursor = .{ .col = 2, .row = 2 }, }, .file = null, @@ -57,6 +58,7 @@ .cwd = "/tmp/pardes-snap/dump/cwd", .stream = "ls\nd.txt\n", .stream_b64 = + .stream_is_screen = true, .cursor = .{ .col = 2, .row = 2 }, }, .file = null, @@ -76,6 +78,7 @@ .cwd = "/tmp/pardes-snap/dump/cwd", .stream = "ls\nd.txt\n", .stream_b64 = + .stream_is_screen = true, .cursor = .{ .col = 2, .row = 2 }, }, .file = null, diff --git a/test/snapshots/load.golden b/test/snapshots/load.golden index 994ab83e..32024cec 100644 --- a/test/snapshots/load.golden +++ b/test/snapshots/load.golden @@ -2,10 +2,10 @@ |Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill | New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol | /tmp/pardes-snap/load/cwd Tty Save Mode Filter /tmp/pardes-snap/load/cwd Tty Save Mode Filter -| echo LOAD''MARK; seq 1 40; echo E''ND ls +| $ echo LOAD''MARK; seq 1 40; echo E''ND $ ls | LOADMARK d.txt -| 1 -| 2 +| 1 $ +| 2 ── restored history ── | 3 | 4 | 5 @@ -17,8 +17,10 @@ | 11 | 12 | /tmp/pardes-snap/load/cwd Tty Save Mode Filter -| ls +| $ ls | d.txt +| $ +| ── restored history ── == style loaded grid=100x31 |0: 0-70 #b2c3b8,#1d2824, 71-99 d,#1d2824, |1: 0-1 #ffffff,#887455, 2-2 d,#26362d, 3-34 #becfc4,#26362d, 35-49 d,#26362d, 50-51 #ffffff,#887455, 52-52 d,#1d2824, 53-84 #b2c3b8,#1d2824, 85-99 d,#1d2824, @@ -26,8 +28,8 @@ |3: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, |4: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, |5: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|6: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|7: 0-0 d,#152019, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|6: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-73 #e5eee5,#0d1410,f 74-99 #e5eee5,#0d1410, +|7: 0-0 d,#152019, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-99 d,#0d1410, |8: 0-0 d,#152019, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, |9: 0-0 d,#152019, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, |10: 0-0 d,#152019, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, @@ -41,8 +43,8 @@ |18: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, |19: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, |20: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|21: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, -|22: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|21: 0-0 d,#608269, 1-1 d,#0d1410, 2-23 #e5eee5,#0d1410,f 24-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, +|22: 0-0 d,#608269, 1-49 d,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, |23: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, |24: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, |25: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, diff --git a/test/snapshots/restore.golden b/test/snapshots/restore.golden index 11d92288..01b52984 100644 --- a/test/snapshots/restore.golden +++ b/test/snapshots/restore.golden @@ -6,9 +6,7 @@ | $ echo KEEP''ME | KEEPME | $ -== snap restored grid=100x31 cursor=4,6 +== snap restored grid=100x31 cursor=4,8 |0: Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill |2: /tmp/pardes-snap/restore/cwd Tty Save Mode Filter Collapse Del -|3: ls -|4: echo KEEP''ME -|6: +|7: ── restored history ── -- cgit v1.3 From f6738c7edfff2249e0b13f2a76962f45d02c86bb Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Wed, 23 Sep 2026 02:00:00 -0300 Subject: Center tagline bands, frame anchors evenly, fill to the window edge, and resize columns from their grip Every tag band (workspace, column, pane) is centred in its row, so text sits at one baseline offset. Anchors are inset from the column rule by that same margin, so they are square and the band frames them on the left, top and bottom; the pane mark moves to stay centred. When the window is not a whole number of cells, the bands, rules, spines and scroll thumbs at the right and bottom edges run on through the leftover pixels. A column grip dropped short of another column's place now moves the column's left edge, with a dashed rail preview, sharing setColumnPairWidth with the border drag. A release still on the grip changes nothing, and a pair too narrow for two MINW columns is left alone. PARDES_TEST_PAD adds leftover pixels to a test-mode window and capture. --- docs/config.md | 16 ++++--- features.txt | 2 +- src/gui/gui.zig | 88 ++++++++++++++++++++++++++------------ src/layout.zig | 17 ++++++++ src/macos.zig | 2 +- src/macos/Sources/PardesView.swift | 5 +-- src/pardes.zig | 60 +++++++++++++------------- src/web.zig | 2 +- test/column_drag.zig | 40 +++++++++++++++++ 9 files changed, 161 insertions(+), 71 deletions(-) (limited to 'src/gui') diff --git a/docs/config.md b/docs/config.md index 27818b5b..ab5e5617 100644 --- a/docs/config.md +++ b/docs/config.md @@ -398,16 +398,18 @@ band would overlap its pane body or a neighbour instead of leaving the body grid stable. `Config` reports the active percentage. The browser applies the same compiled percentage to its DOM glyphs but has no runtime setter. -Both native GUIs join the reduced-height global and pane tagline bands with -`gui_topbar_pane_border_px` physical pixels. Set it to zero for a direct join. +Both native GUIs separate the reduced-height global and pane tagline bands with +a `gui_topbar_pane_border_px` physical-pixel rule. Set it to zero to leave it out. `gui_topbar_pane_border_rgb` can pin an RGB color; its default `null` follows the theme's `border` role in SDL (falling back to `scroll_track` for older -themes), and `scroll_track` in the macOS shell. With `Tagbottom` enabled, a tagline -on the final grid row is bottom-aligned so the same unused half-band does not -show beneath it. The rule itself lives in the core +themes), and `scroll_track` in the macOS shell. Every band is centred in its +row, so the workspace, column and pane tag text share one baseline offset and +the anchors get the same margin above, below and to the left. With `Tagbottom` +enabled, a tagline on the final grid row is bottom-aligned so the unused +half-band does not show beneath it. The rule lives in the core (`pardes.taglineBandOffset`), and the macOS shell reaches it over the C ABI -rather than keeping its own copy — it had one, it only ever centred, and the -seam that leaves between the two bands is what this setting exists to close. +rather than keeping its own copy. When the window is not a whole number of cells, +bands and rules at the right and bottom edges run on through the leftover pixels. What happens to a codepoint the chosen face has no glyph for differs by shell. The SDL GUI falls back through a chain it builds itself: embedded Adwaita diff --git a/features.txt b/features.txt index 0db7c497..86b2a834 100644 --- a/features.txt +++ b/features.txt @@ -162,7 +162,7 @@ Found by adversarial review and NOT fixed, because they are upstream or macOS-on contributes 0, and PardesView's liquid-glass affordance never draws. The tests pass only because they set the flag by hand. The comment in the look_hover_preview paint block claims it carries those cells out to the hosts; it does not. - -Dworkspace-tag is read only in src/macos.zig, and core.settings.workspace_tag is assigned only there, so the option builds cleanly for gui/tty/web and is - silently ignored. gui.zig hard-codes `true` at six taglineBandOffset call sites and still uses raw TOPBAR_H at five more. + silently ignored. (taglineBandOffset no longer takes it: every band is centred since 2026-09-23.) gui.zig still uses raw TOPBAR_H at five sites. - The detached wire encodes the pointer shape in the frame header variant (full_link/diff_link), so the newer `.target` shape collapses to `.arrow` for an attached frontend. Fixing it means a new header variant, i.e. a protocol change. - A shell that outlives its editor keeps PARDES_PID; if that pid is reused, `pardes ` now exits 1 instead of falling back to starting an editor. Exiting 1 diff --git a/src/gui/gui.zig b/src/gui/gui.zig index 7f28124c..48087d0b 100644 --- a/src/gui/gui.zig +++ b/src/gui/gui.zig @@ -1809,6 +1809,8 @@ const Gui = struct { pointer_cell: ?MouseCell = null, capture: bool = false, + /// Pixels the capture holds past the grid (PARDES_TEST_PAD). + capture_pad: u32 = 0, capture_dir: []const u8 = "", capture_tex: ?*c.SDL_GPUTexture = null, capture_tex_w: u32 = 0, @@ -2196,7 +2198,9 @@ fn runNative(init: std.process.Init, opts_in: pardes.Options, attach: ?[]const u if (test_mode) { const cols = envU16(env, "PARDES_TEST_COLS") orelse 80; const rows = envU16(env, "PARDES_TEST_ROWS") orelse 24; - _ = c.SDL_SetWindowSize(window, @intCast(cols * cell_w), @intCast(rows * cell_h)); + // PARDES_TEST_PAD: extra pixels past the grid, as a real window has. + const pad = envU16(env, "PARDES_TEST_PAD") orelse 0; + _ = c.SDL_SetWindowSize(window, @intCast(cols * cell_w + pad), @intCast(rows * cell_h + pad)); _ = c.SDL_SyncWindow(window); } @@ -2284,6 +2288,7 @@ fn runNative(init: std.process.Init, opts_in: pardes.Options, attach: ?[]const u .atlas_stage = atlas_stage, .glyphs = std.AutoHashMap(GlyphKey, Slot).init(gpa), .capture = test_mode, + .capture_pad = if (test_mode) envU16(env, "PARDES_TEST_PAD") orelse 0 else 0, .capture_dir = capture_dir orelse "", .soft_present = soft_present, .transparent = config.gui_transparent, @@ -4909,8 +4914,8 @@ fn renderFrame( var sh: u32 = 0; var target: *c.SDL_GPUTexture = undefined; if (g.capture) { - sw = @as(u32, surface.cols) * g.cell_w; - sh = @as(u32, surface.rows) * g.cell_h; + sw = @as(u32, surface.cols) * g.cell_w + g.capture_pad; + sh = @as(u32, surface.rows) * g.cell_h + g.capture_pad; if (sw == 0 or sh == 0) { command_consumed = true; _ = c.SDL_SubmitGPUCommandBuffer(cmd); @@ -5360,18 +5365,14 @@ fn bottomTaglinePresent(surface: *const pardes.Surface) bool { return false; } -test "tagline bands face the topbar rule and Tagbottom faces the window edge" { +test "tagline bands center in their cells and Tagbottom faces the window edge" { const cell_h: u32 = 20; const tagline_h: u32 = 16; const canvas_h: f32 = 200; - const border = topbarPaneBorderPixels(cell_h, tagline_h); - try std.testing.expectEqual(@as(u32, 1), border); - try std.testing.expectEqual(@as(u32, 4), taglineBandOffset(0, canvas_h, cell_h, tagline_h, true)); - try std.testing.expectEqual(@as(u32, 2), taglineBandOffset(0, canvas_h, cell_h, tagline_h, false)); - try std.testing.expectEqual(@as(u32, 1), taglineBandOffset(1, canvas_h, cell_h, tagline_h, true)); - try std.testing.expectEqual(@as(u32, 2), taglineBandOffset(1, canvas_h, cell_h, tagline_h, false)); - try std.testing.expectEqual(@as(u32, 2), taglineBandOffset(5, canvas_h, cell_h, tagline_h, true)); - try std.testing.expectEqual(@as(u32, 4), taglineBandOffset(9, canvas_h, cell_h, tagline_h, true)); + // Workspace, column and pane rows alike: text lines up across bands. + for ([_]u16{ 0, 1, 2, 5, 8 }) |row| + try std.testing.expectEqual(@as(u32, 2), taglineBandOffset(row, canvas_h, cell_h, tagline_h)); + try std.testing.expectEqual(@as(u32, 4), taglineBandOffset(9, canvas_h, cell_h, tagline_h)); } fn resolveCell(g: *Gui, cell: *const pardes.Cell, role: pardes.FontRole, is_cursor: bool, page: Ground) ResolvedCell { @@ -5502,7 +5503,10 @@ fn emitTagLayer(g: *Gui, instances: [*]CellInstance, next: *u32, layer: *const p // it comes out from under whatever is above it. const slide = layer.slide * bh; const top = @as(f32, @floatFromInt(layer.viewport.y)) * bh; - emitInstance(g, instances, next.*, 0, layer.viewport.y, .{ .w = right - left, .h = bh, .x_off = left, .y_off = slide }, win_w, win_h, track, .body, &background, old_layer, false, page); + // A window is rarely a whole number of cells wide: a band that ends at + // the last column runs on through the leftover pixels to the edge. + const band_right = if (win_w - right < bw) @max(right, win_w) else right; + emitInstance(g, instances, next.*, 0, layer.viewport.y, .{ .w = band_right - left, .h = bh, .x_off = left, .y_off = slide }, win_w, win_h, track, .body, &background, old_layer, false, page); if (slide != 0) clipInstanceTop(&instances[next.*], top, win_h); next.* += 1; for (0..tagLayerCellCount(g, layer)) |col| { @@ -5578,7 +5582,7 @@ fn emitBodyLayer(g: *Gui, instances: [*]CellInstance, next: *u32, layer: *const if (left + @as(f32, @floatFromInt(col)) * width >= right) break; const cell = &layer.cells[index * layer.cols + col]; const cursor = if (layer.cursor) |cu| show_cursor and !cu.bar and cu.x == col and cu.y == row else false; - const glyph_top = top - (if (header) @as(f32, @floatFromInt(taglineBandOffset(0, win_h, g.cell_h, g.tagline_height, true))) else 0); + const glyph_top = top - (if (header) @as(f32, @floatFromInt(taglineBandOffset(0, win_h, g.cell_h, g.tagline_height))) else 0); emitInstance(g, instances, next.*, 0, 0, .{ .w = width, .h = height, .x_off = left + @as(f32, @floatFromInt(col)) * width, .y_off = glyph_top }, win_w, win_h, track, role, cell, old_layer, cursor, page); clipBodyInstance(&instances[next.*], bottom, win_h); clipInstanceRight(&instances[next.*], right, win_w); @@ -5628,6 +5632,10 @@ fn paneGripCell(layers: []const pardes.TagLayer, cells: []const pardes.Cell, col return null; } +fn anchorInset(g: *const Gui, row: u16, win_h: f32) u32 { + return taglineBandOffset(row, win_h, g.cell_h, g.tagline_height); +} + fn emitSurfaceCell( g: *Gui, core: ?*const pardes.Pardes, @@ -5657,19 +5665,27 @@ fn emitSurfaceCell( next.* += 1; // Tag glyphs keep their font size inside a full physical-width grip. emitInstance(g, instances, next.*, col, row, body_layout, win_w, win_h, track, .tagline, cell, old_layer, is_cursor, page); + // An anchor starts at its column's rule: its left edge is inset by + // its top margin so the band frames it on the left as above and + // below, and its mark moves right by half that to stay centered. + const inset: u32 = if (core) |p| if (std.mem.indexOfScalar(u16, p.col_x[0..p.ncol], col -| (if (grip) |indicator| indicator.offset else 0)) != null) anchorInset(g, row, win_h) else 0 else 0; if (grip) |indicator| { const cached = cachedGlyph(g, cellCodepoint(indicator.cell), .tagline, GlyphDecoration.fromCell(indicator.cell), true); const slot = cached orelse g.space_slot; - const offset: u32 = if (cached != null) @as(u32, indicator.offset) * g.cell_w else 0; + const offset: f32 = if (cached != null) @as(f32, @floatFromInt(@as(u32, indicator.offset) * g.cell_w)) - @as(f32, @floatFromInt(inset / 2)) else 0; const resolved = resolveCell(g, indicator.cell, .tagline, false, page); instances[next.*].fr = @as(f32, @floatFromInt(resolved.fg[0])) / 255; instances[next.*].fg = @as(f32, @floatFromInt(resolved.fg[1])) / 255; instances[next.*].fb = @as(f32, @floatFromInt(resolved.fg[2])) / 255; - instances[next.*].u0 = @as(f32, @floatFromInt(slot.u + offset)) / atlas_w; + instances[next.*].u0 = (@as(f32, @floatFromInt(slot.u)) + offset) / atlas_w; instances[next.*].v0 = @as(f32, @floatFromInt(slot.v)) / atlas_h; instances[next.*].v1 = @as(f32, @floatFromInt(slot.v + g.tagline_height)) / atlas_h; } instances[next.*].u1 = instances[next.*].u0 + @as(f32, @floatFromInt(g.cell_w)) / atlas_w; + if (inset > 0 and (grip == null or grip.?.offset == 0)) { + instances[next.*].x0 += @as(f32, @floatFromInt(inset)) / win_w * 2; + instances[next.*].u0 += @as(f32, @floatFromInt(inset)) / atlas_w; + } next.* += 1; return; } @@ -5690,7 +5706,8 @@ test "small tagline fonts leave no background gutters between adjacent tags" { var instances: [6]CellInstance = undefined; var next: u32 = 0; for (0..3) |row| { - emitSurfaceCell(&g, core, &instances, &next, 0, @intCast(row), fixedCellLayout(&g), 800, 480, null, &cell, &cell, null, false, false, Ground.opaqueRgb(bg_default)); + // Column 1: past the anchor's inset edge at the column's left. + emitSurfaceCell(&g, core, &instances, &next, 1, @intCast(row), fixedCellLayout(&g), 800, 480, null, &cell, &cell, null, false, false, Ground.opaqueRgb(bg_default)); const base = instances[row * 2]; const ink = instances[row * 2 + 1]; try std.testing.expectApproxEqAbs(@as(f32, 20.0 / 480.0 * 2), base.y0 - base.y1, 0.0001); @@ -5700,6 +5717,13 @@ test "small tagline fonts leave no background gutters between adjacent tags" { try std.testing.expectApproxEqAbs(@as(f32, 10) / atlas_w, ink.u1 - ink.u0, 0.0001); if (row > 0) try std.testing.expectApproxEqAbs(instances[(row - 1) * 2].y1, base.y0, 0.0001); } + // Column 0 is an anchor's edge: its ink is inset by the band's margin + // (2 px here) and its underlay still covers the whole cell. + next = 0; + emitSurfaceCell(&g, core, &instances, &next, 0, 1, fixedCellLayout(&g), 800, 480, null, &cell, &cell, null, false, false, Ground.opaqueRgb(bg_default)); + try std.testing.expectApproxEqAbs(@as(f32, 10.0 / 800.0 * 2), instances[0].x1 - instances[0].x0, 0.0001); + try std.testing.expectApproxEqAbs(@as(f32, 8.0 / 800.0 * 2), instances[1].x1 - instances[1].x0, 0.0001); + try std.testing.expectApproxEqAbs(@as(f32, 8) / atlas_w, instances[1].u1 - instances[1].u0, 0.0001); next = 0; emitSurfaceCell(&g, null, &instances, &next, 0, 2, fixedCellLayout(&g), 800, 480, null, &cell, &cell, null, true, false, Ground.opaqueRgb(bg_default)); try std.testing.expectEqual(@as(u32, 2), next); @@ -5730,7 +5754,7 @@ fn emitInstance( else layout.h; const band_offset: f32 = if (resolved.role == .tagline) - @floatFromInt(taglineBandOffset(row, win_h, g.cell_h, g.tagline_height, true)) + @floatFromInt(taglineBandOffset(row, win_h, g.cell_h, g.tagline_height)) else 0; const py0 = layout.y_off + @as(f32, @floatFromInt(row)) * layout.h + band_offset; @@ -6562,7 +6586,7 @@ fn addCursorBar( const x0 = layout.x_off + @as(f32, @floatFromInt(x)) * layout.w; const height = std.math.clamp(visual_height, 1.0, layout.h); const y0 = layout.y_off + @as(f32, @floatFromInt(y)) * layout.h + - @as(f32, @floatFromInt(taglineBandOffset(y, builder.win_h, @intFromFloat(layout.h), @intFromFloat(height), true))); + @as(f32, @floatFromInt(taglineBandOffset(y, builder.win_h, @intFromFloat(layout.h), @intFromFloat(height)))); builder.addRect( x0, y0, @@ -6662,7 +6686,7 @@ fn buildOverlay( const right = left + @as(f32, @floatFromInt(layer.viewport.w)) * layout.w; const x = left + @as(f32, @floatFromInt(cursor.col)) * width; if (x >= right) continue; - const top = @as(f32, @floatFromInt(layer.viewport.y)) * layout.h + @as(f32, @floatFromInt(taglineBandOffset(layer.viewport.y, builder.win_h, g.cell_h, g.tagline_height, true))); + const top = @as(f32, @floatFromInt(layer.viewport.y)) * layout.h + @as(f32, @floatFromInt(taglineBandOffset(layer.viewport.y, builder.win_h, g.cell_h, g.tagline_height))); builder.addRect(x, top, @min(right, x + @max(1, width / 8)), top + @as(f32, @floatFromInt(g.tagline_height)), overlayRgb(cursorColor(core, &layer.cells[cursor.col], .tagline))); }; if (transient_on) appendTouchOverlay(g, &builder, debug_on); @@ -6683,7 +6707,7 @@ fn appendWorkspacePet(g: *Gui, core: ?*const pardes.Pardes, surface: *const pard if (cellCodepoint(cell) != ' ') occupied = i + 1; } const editing = p.topbar_col != null and p.header_column == null; - const band_top: f32 = @floatFromInt(taglineBandOffset(0, builder.win_h, g.cell_h, g.tagline_height, true)); + const band_top: f32 = @floatFromInt(taglineBandOffset(0, builder.win_h, g.cell_h, g.tagline_height)); const region = if (occupied >= surface.cols) null else pet.lane( occupied, @floatFromInt(g.tagline_width), @@ -6810,7 +6834,10 @@ fn appendPaneChrome( } else true; if (tag_visible) { const rule_y = @as(f32, @floatFromInt(tag_y + @as(u16, if (core.settings.tag_bottom) 0 else 1))) * layout.h; - builder.addRect(x0, rule_y - @as(f32, if (core.settings.tag_bottom) 0 else 1), x1, rule_y + @as(f32, if (core.settings.tag_bottom) 1 else 0), overlayRgb(chrome.border)); + // Like the band above it, the rule of a pane at the right edge + // runs on through the pixels past the last whole cell. + const rule_x1 = if (builder.win_w - x1 < layout.w) @max(x1, builder.win_w) else x1; + builder.addRect(x0, rule_y - @as(f32, if (core.settings.tag_bottom) 0 else 1), rule_x1, rule_y + @as(f32, if (core.settings.tag_bottom) 1 else 0), overlayRgb(chrome.border)); } // Do not paint over resize previews or debug text occupying the rail. @@ -6827,12 +6854,13 @@ fn appendPaneChrome( } if (row != body_end) continue; const y0 = @as(f32, @floatFromInt(body_y)) * layout.h; - const y1 = @as(f32, @floatFromInt(body_end)) * layout.h; + const body_y1 = @as(f32, @floatFromInt(body_end)) * layout.h; + const y1 = if (body_end == surface.rows and builder.win_h - body_y1 < layout.h) @max(body_y1, builder.win_h) else body_y1; builder.addRect(x0, y0, x0 + layout.w, y1, page); appendSquareRail(builder, x0, y0, y1, layout.w, false, overlayRgb(chrome.scroll_track)); if (thumb_start) |first| { const thumb_y0 = @as(f32, @floatFromInt(first)) * layout.h; - const thumb_y1 = @as(f32, @floatFromInt(thumb_end)) * layout.h; + const thumb_y1 = if (thumb_end == body_end) y1 else @as(f32, @floatFromInt(thumb_end)) * layout.h; appendSquareRail(builder, x0, thumb_y0, thumb_y1, layout.w, true, overlayRgb(chrome.scroll_thumb)); } } @@ -6854,8 +6882,8 @@ fn appendTagGrips(g: *const Gui, surface: *const pardes.Surface, layout: CellLay .rgb => |rgb| rgb, else => continue, }; - const center_x = (@as(f32, @floatFromInt(x)) + @as(f32, @floatFromInt(config.GUTTER)) / 2) * layout.w; - const center_y = @as(f32, @floatFromInt(y)) * layout.h + @as(f32, @floatFromInt(taglineBandOffset(y, builder.win_h, g.cell_h, g.tagline_height, true))) + @as(f32, @floatFromInt(g.tagline_height)) / 2; + const center_x = (@as(f32, @floatFromInt(x)) + @as(f32, @floatFromInt(config.GUTTER)) / 2) * layout.w + @as(f32, @floatFromInt(anchorInset(g, y, builder.win_h) / 2)); + const center_y = @as(f32, @floatFromInt(y)) * layout.h + @as(f32, @floatFromInt(taglineBandOffset(y, builder.win_h, g.cell_h, g.tagline_height))) + @as(f32, @floatFromInt(g.tagline_height)) / 2; const half_w = @max(1, @min(3, layout.w - 2)); builder.addRect(@floor(center_x - half_w), @floor(center_y - 2), @floor(center_x + half_w), @floor(center_y - 1), overlayRgb(rgb)); builder.addRect(@floor(center_x - half_w), @floor(center_y + 1), @floor(center_x + half_w), @floor(center_y + 2), overlayRgb(rgb)); @@ -6875,7 +6903,9 @@ test "column grips stay unmarked while pane marks retain physical centering" { var builder: OverlayBuilder = .{ .vertices = &vertices, .win_w = 200, .win_h = 80 }; appendTagGrips(&g, &surface, .{ .w = 10, .h = 20, .x_off = 0, .y_off = 0 }, &builder); try std.testing.expectEqual(@as(usize, 12), builder.len); - try std.testing.expectApproxEqAbs(@as(f32, 57.0 / 200.0 * 2.0 - 1.0), vertices[0].x, 0.0001); + // Centered in the anchor, whose left edge is inset by the band's offset + // (8 px on this last row): the mark moves right by half of it. + try std.testing.expectApproxEqAbs(@as(f32, 61.0 / 200.0 * 2.0 - 1.0), vertices[0].x, 0.0001); } fn appendSquareRail(builder: *OverlayBuilder, x: f32, y0: f32, y1: f32, cell_w: f32, thumb: bool, color: OverlayColor) void { @@ -6885,7 +6915,9 @@ fn appendSquareRail(builder: *OverlayBuilder, x: f32, y0: f32, y1: f32, cell_w: fn appendColumnSpines(core: *const pardes.Pardes, rows: u16, layout: CellLayout, builder: *OverlayBuilder) void { const y0 = @as(f32, @floatFromInt(pardes.TOPBAR_H)) * layout.h; - const y1 = @as(f32, @floatFromInt(rows)) * layout.h; + const grid_y1 = @as(f32, @floatFromInt(rows)) * layout.h; + // Down through the pixels past the last whole row, as tags run right. + const y1 = if (builder.win_h - grid_y1 < layout.h) @max(grid_y1, builder.win_h) else grid_y1; if (y1 <= y0) return; // A single boundary spans all panes, including their tags. Its left edge // agrees with the square scroll markers and existing move-box hit area. diff --git a/src/layout.zig b/src/layout.zig index c6cb7503..8db05a07 100644 --- a/src/layout.zig +++ b/src/layout.zig @@ -723,6 +723,23 @@ pub fn columnMoveTarget(p: *const Pardes, source: usize, x: u16) usize { return insertion; } +/// Share out the width of columns `left` and `left + 1` so the left one is +/// `left_width` cells, neither below MINW. A border drag and a column grip +/// dropped inside its own place both end here. +pub fn setColumnPairWidth(p: *Pardes, left: usize, left_width: u64) void { + if (left + 1 >= p.ncol) return; + const combined: u64 = p.col_w[left] + p.col_w[left + 1]; + // Too narrow for both to keep MINW: any split would squeeze one away. + if (combined < 2 * @as(u64, config.MINW)) return; + const width = std.math.clamp(left_width, config.MINW, @max(@as(u64, config.MINW), combined -| config.MINW)); + const pair = p.col_weight[left] + p.col_weight[left + 1]; + if (pair <= 1 or combined == 0) return; + const numerator = @as(u128, pair) * width + combined / 2; + const share = std.math.clamp(@as(u64, @intCast(numerator / combined)), 1, pair - 1); + p.col_weight[left] = share; + p.col_weight[left + 1] = pair - share; +} + pub fn reorderColumn(p: *Pardes, from: usize, to: usize) void { if (from >= p.ncol or to >= p.ncol or from == to) return; const ids = p.col_panes[from]; diff --git a/src/macos.zig b/src/macos.zig index c359eb3f..3ff8bdfa 100644 --- a/src/macos.zig +++ b/src/macos.zig @@ -951,7 +951,7 @@ export fn pardes_gui_tagline_font_percent() u8 { export fn pardes_tagline_band_offset(row: u16, canvas_h: f32, cell_h: u32, tagline_h: u32) u32 { pardes.turn.wake(); defer pardes.turn.rest(); - return pardes.taglineBandOffset(row, canvas_h, cell_h, tagline_h, if (state) |*st| st.core.settings.workspace_tag else true); + return pardes.taglineBandOffset(row, canvas_h, cell_h, tagline_h); } export fn pardes_topbar_pane_border_px(cell_h: u32, tagline_h: u32) u32 { diff --git a/src/macos/Sources/PardesView.swift b/src/macos/Sources/PardesView.swift index 5ad09c38..70f467e3 100644 --- a/src/macos/Sources/PardesView.swift +++ b/src/macos/Sources/PardesView.swift @@ -523,9 +523,8 @@ private struct TaglineMetrics { /// Where this band sits inside row `row`, measured down from the row's top. /// The rule belongs to the core (`pardes_tagline_band_offset`) so that this - /// shell and the SDL one cannot disagree about it: row zero and the first - /// pane-tag row meet at a shared rule, a Tagbottom band on the last row - /// faces the window edge, and everything between is centred. + /// shell and the SDL one cannot disagree about it: every band is centred, + /// except a Tagbottom band on the last row, which faces the window edge. func top(row: Int, canvasHeight: CGFloat) -> CGFloat { CGFloat(pardes_tagline_band_offset( UInt16(clamping: row), Float(canvasHeight * scale), cellPixels, bandPixels)) / scale diff --git a/src/pardes.zig b/src/pardes.zig index fae14f47..ca2c34a4 100644 --- a/src/pardes.zig +++ b/src/pardes.zig @@ -232,19 +232,12 @@ pub const BOX_H: u16 = 1; pub const TAG_GAP: u16 = 1; pub const TAG_TEXT_INSET: u16 = config.GUTTER + TAG_GAP; -pub fn taglineBandOffset(row: u16, canvas_h: f32, cell_h: u32, tagline_h: u32, workspace: bool) u32 { +pub fn taglineBandOffset(row: u16, canvas_h: f32, cell_h: u32, tagline_h: u32) u32 { const spare = cell_h -| tagline_h; - const border = topbarPaneBorderPixels(cell_h, tagline_h); const rows: u32 = @max(1, @as(u32, @intFromFloat(@floor(canvas_h / @as(f32, @floatFromInt(cell_h)))))); - if (!workspace) { - // No workspace row: nothing above row 0 to share a rule with, so - // every band centers in its cell the way the middle rows always - // have. The anchor boxes this lets the hosts draw stay symmetric. - if (@as(u32, row) + 1 >= rows) return spare; - return spare / 2; - } - if (row == 0) return spare - border / 2; - if (row == TOPBAR_H) return border - border / 2; + // Every band centers in its cell, so text and anchors sit at the same + // height in the workspace, column and pane tags alike. Only the last row + // faces the window edge (Tagbottom). if (@as(u32, row) + 1 >= rows) return spare; return spare / 2; } @@ -5160,7 +5153,9 @@ const Drag = union(enum) { border_v: struct { left_col: usize, cur_x: u16, corner: ?struct { col: usize, idx: usize } = null, cur_y: u16 = 0 }, border_h: struct { col: usize, top_idx: usize, cur_y: u16 }, move: struct { id: usize, cur_x: u16, cur_y: u16 }, - column_move: struct { column: usize, serial: u32, cur_x: u16 }, + /// `grab`: how far into the grip it was pressed, so the column's left + /// edge lands at `cur_x - grab`. A release still on the grip moves nothing. + column_move: struct { column: usize, serial: u32, cur_x: u16, grab: u16 = 0 }, tag: struct { id: usize }, /// chorded: a 1-2/1-3 cut/paste chord fired during this left drag — /// the drag's own release is then inert @@ -12022,7 +12017,7 @@ pub const Pardes = struct { if (mcol < p.col_x[column] or mcol >= p.col_x[column] + @min(config.GUTTER, p.col_w[column])) continue; if (m.button == config.select_button) { p.header_drag = false; - p.drag = .{ .column_move = .{ .column = column, .serial = p.col_serial[column], .cur_x = mcol } }; + p.drag = .{ .column_move = .{ .column = column, .serial = p.col_serial[column], .cur_x = mcol, .grab = mcol - p.col_x[column] } }; } return; } @@ -12482,20 +12477,10 @@ pub const Pardes = struct { .border_v => |d| { const c = d.left_col; const old_seam = p.col_x[c] + p.col_w[c] -| 1; - if (c + 1 < p.ncol and d.cur_x != old_seam) { - const combined: u64 = p.col_w[c] + p.col_w[c + 1]; - // the handle is the left pane's LAST column (inclusive), so - // the new width includes it — a no-drag click changes nothing - var nl: u64 = (d.cur_x + 1) -| p.col_x[c]; - nl = std.math.clamp(nl, config.MINW, @max(@as(u64, config.MINW), combined -| config.MINW)); - const pair = p.col_weight[c] + p.col_weight[c + 1]; - if (pair > 1 and combined > 0) { - const numerator = @as(u128, pair) * nl + combined / 2; - const left = std.math.clamp(@as(u64, @intCast(numerator / combined)), 1, pair - 1); - p.col_weight[c] = left; - p.col_weight[c + 1] = pair - left; - } - } + // the handle is the left pane's LAST column (inclusive), so + // the new width includes it — a no-drag click changes nothing + if (c + 1 < p.ncol and d.cur_x != old_seam) + layout.setColumnPairWidth(p, c, (d.cur_x + 1) -| p.col_x[c]); if (d.corner) |k| { if (d.cur_y != seamRowOf(p, k.col, k.idx)) layout.applyRowSplit(p, k.col, k.idx, d.cur_y); @@ -12503,9 +12488,15 @@ pub const Pardes = struct { }, .border_h => |d| if (d.cur_y != seamRowOf(p, d.col, d.top_idx)) layout.applyRowSplit(p, d.col, d.top_idx, d.cur_y), - .column_move => |d| { - if (layout.columnBySerial(p, d.serial)) |column| - layout.reorderColumn(p, column, layout.columnMoveTarget(p, column, d.cur_x)); + .column_move => |d| if (layout.columnBySerial(p, d.serial)) |column| { + const target = layout.columnMoveTarget(p, column, d.cur_x); + if (target != column) { + layout.reorderColumn(p, column, target); + } else if (column > 0 and (d.cur_x < p.col_x[column] or d.cur_x >= p.col_x[column] + config.GUTTER)) { + // Dropped short of another column's place: as in acme, + // the column's left edge moves to where it was dropped. + layout.setColumnPairWidth(p, column - 1, (d.cur_x -| d.grab) -| p.col_x[column - 1]); + } }, .move => |d| { layout.movePane(p, d.id, d.cur_x, d.cur_y); @@ -14181,6 +14172,15 @@ pub const Pardes = struct { } var row: u16 = p.topBarHeight(); while (row < s.rows) : (row += 1) s.overlayDash(x, row, "╎"); + } else if (source > 0 and source < p.ncol and (d.cur_x < p.col_x[source] or d.cur_x >= p.col_x[source] + config.GUTTER) and + p.col_w[source - 1] + p.col_w[source] >= 2 * config.MINW) + { + // Where the left edge would land: the border drag's rail. + const lo = p.col_x[source - 1] + config.MINW; + const hi = (p.col_x[source] + p.col_w[source]) -| config.MINW; + const x = @min(std.math.clamp(d.cur_x -| d.grab, lo, @max(lo, hi)), s.cols -| 1); + var row: u16 = p.topBarHeight(); + while (row < s.rows) : (row += 1) s.overlayDash(x, row, "╎"); } }, .move => |d| if (d.cur_x < s.cols) { diff --git a/src/web.zig b/src/web.zig index 7325af54..b5a992ae 100644 --- a/src/web.zig +++ b/src/web.zig @@ -376,7 +376,7 @@ export fn pardes_tag_layer_cells(index: u32) ?[*]const WebCell { } export fn pardes_tagline_band_offset(row: u16, canvas_h: f32, cell_h: u32, tagline_h: u32) u32 { - return pardes.taglineBandOffset(row, canvas_h, cell_h, tagline_h, true); + return pardes.taglineBandOffset(row, canvas_h, cell_h, tagline_h); } export fn pardes_body_layer_value(index: u32, field: u32) u32 { diff --git a/test/column_drag.zig b/test/column_drag.zig index be4e33a3..85dca66b 100644 --- a/test/column_drag.zig +++ b/test/column_drag.zig @@ -212,3 +212,43 @@ test "column grips stay blank and muted across focus hover and drag" { } } } + +test "column grip dropped in its own place moves the column's left edge" { + const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 120, .rows = 24 }); + defer p.deinit(); + _ = try p.setTestFile("body\n"); + p.presentation.enabled = false; + p.settings.column_tags = true; + try std.testing.expect(p.executeBuiltinLine(0, "New")); + try std.testing.expect(layout.splitColumn(p, p.active, p.active, false)); + p.update(.tick); + var frame = std.heap.ArenaAllocator.init(p.gpa); + defer frame.deinit(); + _ = try p.render(frame.allocator()); + const serials = .{ p.col_serial[0], p.col_serial[1] }; + const edge = p.col_x[1]; + const total = p.col_w[0] + p.col_w[1]; + // A click in place, from either grip cell, changes nothing. + for (0..config.GUTTER) |offset| { + const x = edge + @as(u16, @intCast(offset)); + mouse(p, .press, x); + mouse(p, .release, x); + _ = try p.render(frame.allocator()); + try std.testing.expectEqual(edge, p.col_x[1]); + } + // Grabbed by its second cell and dropped 7 cells left: the edge follows. + mouse(p, .press, edge + 1); + mouse(p, .drag, edge + 1 - 7); + _ = try p.render(frame.allocator()); + mouse(p, .release, edge + 1 - 7); + _ = try p.render(frame.allocator()); + try std.testing.expectEqual(edge - 7, p.col_x[1]); + try std.testing.expectEqual(total, p.col_w[0] + p.col_w[1]); + try std.testing.expectEqual(serials[0], p.col_serial[0]); + try std.testing.expectEqual(serials[1], p.col_serial[1]); + // Past the neighbour's middle it is still a reorder, not a resize. + mouse(p, .press, p.col_x[1]); + mouse(p, .release, p.col_x[0] + 1); + try std.testing.expectEqual(serials[1], p.col_serial[0]); + try std.testing.expectEqual(serials[0], p.col_serial[1]); +} -- cgit v1.3 From d32452950262b4ec2b50b0e0af66f7870c8e5d5d Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Thu, 24 Sep 2026 09:51:50 -0300 Subject: Embolden bold text's outline before it is rasterized, and drop the old stb_truetype sources Bold in the SDL shell was a smear of the finished glyph: every pixel took the larger of itself and three quarters of its left neighbour. That added a grey fringe on the right of each stem instead of a thicker stem, so bold read as blurred regular text, and at large sizes it barely read as bold at all. The rasterizer now does what Ghostty's FreeType face does: it loads the hinted glyph, thickens the outline with FT_Outline_Embolden, and renders that. The stems widen as one shape with hinted edges, and the advance is untouched, so the cell grid, caret and selection do not move. The strength is Ghostty's heuristic, 1/32 of the line height rounded up (one pixel at a 32 px line). A bitmap strike has no outline; it is widened by one whole pixel with FT_Bitmap_Embolden, the classic overstrike. Underline and strikethrough are still drawn into the cached cell mask (decorateLine). vendor/stb (stb_truetype.h and its implementation unit) was left over from the rasterizer FreeType replaced; nothing built or referenced it. Co-Authored-By: Claude Opus 5.5 (1M context) --- src/gui/font.c | 30 +- src/gui/font.h | 8 +- src/gui/gui.zig | 46 +- vendor/stb/stb_truetype.h | 5077 ---------------------------------------- vendor/stb/stb_truetype_impl.c | 5 - 5 files changed, 50 insertions(+), 5116 deletions(-) delete mode 100644 vendor/stb/stb_truetype.h delete mode 100644 vendor/stb/stb_truetype_impl.c (limited to 'src/gui') diff --git a/src/gui/font.c b/src/gui/font.c index 5989dd4e..5ea595f9 100644 --- a/src/gui/font.c +++ b/src/gui/font.c @@ -3,6 +3,7 @@ // fallback, and the light target for shape-preserving grayscale text. #include "font.h" #include +#include #include #include @@ -126,7 +127,7 @@ void ui_font_cell_metrics(UIFont *f, float px, int32_t *cell_w, int32_t *cell_h, *ascent = asc > 0 ? asc : 1; } -static int raster(UIFont *f, float px, int32_t cp, uint8_t *out, +static int raster(UIFont *f, float px, int32_t cp, int bold, uint8_t *out, int32_t stride, int32_t cell_w, int32_t cell_h, int32_t ascent, int centered) { if (!f || !out || stride < cell_w || cell_w <= 0 || cell_h <= 0) @@ -140,6 +141,22 @@ static int raster(UIFont *f, float px, int32_t cp, uint8_t *out, FT_Get_Char_Index(f->face, (FT_ULong)(uint32_t)cp); if (FT_Load_Glyph(f->face, glyph_index, load_flags()) != 0) return 0; + if (bold) { + // Synthetic bold thickens the hinted outline before it is rendered, so + // the wider stems are rasterized as one shape and keep hinted edges; the + // advance is untouched, as the cell grid requires. Strength is Ghostty's + // heuristic: 1/32 of the line height in 26.6, rounded up (one pixel at a + // 32 px line). A bitmap strike has no outline: widen it by one whole pixel, + // the classic overstrike, which keeps its pixels sharp. + FT_GlyphSlot slot = f->face->glyph; + if (slot->format == FT_GLYPH_FORMAT_OUTLINE) { + const FT_Pos height = f->face->size->metrics.height; + FT_Outline_Embolden(&slot->outline, (height + 31) / 32); + } else if (slot->format == FT_GLYPH_FORMAT_BITMAP && + FT_GlyphSlot_Own_Bitmap(slot) == 0) { + FT_Bitmap_Embolden(f->library, &slot->bitmap, 64, 0); + } + } if (FT_Render_Glyph(f->face->glyph, FT_RENDER_MODE_NORMAL) != 0) return 0; @@ -187,13 +204,14 @@ static int raster(UIFont *f, float px, int32_t cp, uint8_t *out, return 1; } -int ui_font_raster(UIFont *f, float px, int32_t cp, uint8_t *out, +int ui_font_raster(UIFont *f, float px, int32_t cp, int bold, uint8_t *out, int32_t stride, int32_t cell_w, int32_t cell_h, int32_t ascent) { - return raster(f, px, cp, out, stride, cell_w, cell_h, ascent, 0); + return raster(f, px, cp, bold, out, stride, cell_w, cell_h, ascent, 0); } -int ui_font_raster_centered(UIFont *f, float px, int32_t cp, uint8_t *out, - int32_t stride, int32_t width, int32_t height) { - return raster(f, px, cp, out, stride, width, height, 0, 1); +int ui_font_raster_centered(UIFont *f, float px, int32_t cp, int bold, + uint8_t *out, int32_t stride, int32_t width, + int32_t height) { + return raster(f, px, cp, bold, out, stride, width, height, 0, 1); } diff --git a/src/gui/font.h b/src/gui/font.h index d965b418..4410bb7c 100644 --- a/src/gui/font.h +++ b/src/gui/font.h @@ -33,14 +33,16 @@ void ui_font_cell_metrics(UIFont *f, float px, int32_t *cell_w, int32_t *cell_h, // Rasterize `cp` into `out` as a hinted grayscale cell mask (`stride` bytes per // row). The origin is the baseline `ascent` pixels from the top. Pixels outside // the glyph are zero. Missing codepoints render the face's .notdef glyph. +// `bold` emboldens the outline before rendering (synthetic bold, same advance). // Returns 1 when the glyph produced coverage, 0 for blank/error. -int ui_font_raster(UIFont *f, float px, int32_t cp, uint8_t *out, +int ui_font_raster(UIFont *f, float px, int32_t cp, int bold, uint8_t *out, int32_t stride, int32_t cell_w, int32_t cell_h, int32_t ascent); // Center bitmap ink bounds, independent of advance and baseline bearings. -int ui_font_raster_centered(UIFont *f, float px, int32_t cp, uint8_t *out, - int32_t stride, int32_t width, int32_t height); +int ui_font_raster_centered(UIFont *f, float px, int32_t cp, int bold, + uint8_t *out, int32_t stride, int32_t width, + int32_t height); void ui_font_free(UIFont *f); diff --git a/src/gui/gui.zig b/src/gui/gui.zig index 48087d0b..7ad9fe9a 100644 --- a/src/gui/gui.zig +++ b/src/gui/gui.zig @@ -253,7 +253,7 @@ test "FreeType atlas raster is grayscale, bounded, and clears blank cells" { var bitmap: [128 * 128]u8 = @splat(0xaa); try std.testing.expectEqual( @as(c_int, 1), - c.ui_font_raster(font, size, 'H', &bitmap, stride, cell_w, cell_h, ascent), + c.ui_font_raster(font, size, 'H', 0, &bitmap, stride, cell_w, cell_h, ascent), ); var ink: usize = 0; @@ -269,7 +269,11 @@ test "FreeType atlas raster is grayscale, bounded, and clears blank cells" { } try std.testing.expect(ink > 0); try std.testing.expect(soft > 0); - decorateGlyph(&bitmap, @intCast(stride), @intCast(cell_w), @intCast(cell_h), ascent, .{ .bold = true }); + // Synthetic bold thickens the outline inside the same cell. + try std.testing.expectEqual( + @as(c_int, 1), + c.ui_font_raster(font, size, 'H', 1, &bitmap, stride, cell_w, cell_h, ascent), + ); var bold_coverage: usize = 0; for (0..@intCast(cell_h)) |y| { for (0..@intCast(cell_w)) |x| bold_coverage += bitmap[y * @as(usize, @intCast(stride)) + x]; @@ -280,7 +284,7 @@ test "FreeType atlas raster is grayscale, bounded, and clears blank cells" { try std.testing.expectEqual( @as(c_int, 0), - c.ui_font_raster(font, size, ' ', &bitmap, stride, cell_w, cell_h, ascent), + c.ui_font_raster(font, size, ' ', 0, &bitmap, stride, cell_w, cell_h, ascent), ); for (0..@intCast(cell_h)) |y| for (0..@intCast(cell_w)) |x| @@ -326,6 +330,7 @@ test "tagline glyph shrinks into its own cell and stays vertically centered" { font, body_scale, 'H', + 0, &body, stride, cell_w, @@ -336,6 +341,7 @@ test "tagline glyph shrinks into its own cell and stays vertically centered" { font, tag.scale, 'H', + 0, &tagline, stride, @intCast(tag.width), @@ -2311,7 +2317,7 @@ fn runNative(init: std.process.Init, opts_in: pardes.Options, attach: ?[]const u defer if (g.font_bytes.len != 0) gpa.free(g.font_bytes); // set by Font, if it ran defer c.ui_font_free(g.font); defer gpa.free(g.scroll_edge); // grown on demand by stepScroll - _ = c.ui_font_raster(font, scale, ' ', atlas_stage.ptr, @intCast(atlas_w), @intCast(cell_w), @intCast(cell_h), asc); + _ = c.ui_font_raster(font, scale, ' ', 0, atlas_stage.ptr, @intCast(atlas_w), @intCast(cell_w), @intCast(cell_h), asc); g.pen_x = cell_w; if (attach) |requested| return attachRequested(gpa, &g, requested); @@ -5896,7 +5902,7 @@ fn refitFont(g: *Gui, core: ?*pardes.Pardes) void { fn resetGlyphAtlas(g: *Gui) void { g.glyphs.clearRetainingCapacity(); @memset(g.atlas_stage, 0); - _ = c.ui_font_raster(g.font, g.scale, ' ', g.atlas_stage.ptr, @intCast(atlas_w), @intCast(g.cell_w), @intCast(g.cell_h), g.ascent); + _ = c.ui_font_raster(g.font, g.scale, ' ', 0, g.atlas_stage.ptr, @intCast(atlas_w), @intCast(g.cell_w), @intCast(g.cell_h), g.ascent); g.space_slot = .{ .u = 0, .v = 0 }; g.pen_x = g.cell_w; g.pen_y = 0; @@ -5938,11 +5944,11 @@ fn cachedGlyph(g: *Gui, cp: u32, role: pardes.FontRole, decoration: GlyphDecorat const raster_w = if (centered) slot_w else if (role == .tagline) g.tagline_width else g.cell_w; const raster_h = if (role == .tagline) g.tagline_height else g.cell_h; if (centered) { - _ = c.ui_font_raster_centered(face, scale, @intCast(cp), out, @intCast(atlas_w), @intCast(raster_w), @intCast(raster_h)); + _ = c.ui_font_raster_centered(face, scale, @intCast(cp), @intFromBool(decoration.bold), out, @intCast(atlas_w), @intCast(raster_w), @intCast(raster_h)); } else { - _ = c.ui_font_raster(face, scale, @intCast(cp), out, @intCast(atlas_w), @intCast(raster_w), @intCast(raster_h), baseline); + _ = c.ui_font_raster(face, scale, @intCast(cp), @intFromBool(decoration.bold), out, @intCast(atlas_w), @intCast(raster_w), @intCast(raster_h), baseline); } - decorateGlyph(out, atlas_w, raster_w, raster_h, baseline, decoration); + decorateLine(out, atlas_w, raster_w, raster_h, baseline, decoration); if (centered) centerGlyphInk(out, raster_w, raster_h); g.glyphs.put(key, s) catch return null; g.pen_x += slot_w; @@ -6056,23 +6062,13 @@ test "pane indicator halves share dissolve changes and safe exhausted atlas" { } } -// Decorations stay inside the existing atlas slot, so text advance, caret and -// selection geometry are identical to the regular glyph. The cached mask keeps -// this work out of steady-state rendering and also decorates terminal spaces. -fn decorateGlyph(out: [*]u8, stride: usize, width: usize, height: usize, baseline: i32, decoration: GlyphDecoration) void { +// Underline and strikethrough stay inside the existing atlas slot, so text +// advance, caret and selection geometry are identical to the regular glyph. +// The cached mask keeps this work out of steady-state rendering and also +// decorates terminal spaces. Bold is not drawn here: the rasterizer emboldens +// the outline. +fn decorateLine(out: [*]u8, stride: usize, width: usize, height: usize, baseline: i32, decoration: GlyphDecoration) void { if (width == 0 or height == 0) return; - if (decoration.bold) { - // A fractional one-pixel embolden preserves counters at small UI sizes. - // Right-to-left traversal reads the original left neighbour each time. - for (0..height) |y| { - var x = width - 1; - while (x > 0) : (x -= 1) { - const previous = out[y * stride + x - 1]; - const target = &out[y * stride + x]; - target.* = @max(target.*, @as(u8, @intCast(@as(u16, previous) * 3 / 4))); - } - } - } if (decoration.underline != .off) { const base: usize = @intCast(@max(0, baseline)); const row = @min(base + 1, height - 1); @@ -6115,7 +6111,7 @@ test "glyph decorations render spaces and stay inside their atlas slot" { }) |decoration| { var mask: [stride * (height + 1)]u8 = @splat(0xa5); for (0..height) |y| @memset(mask[y * stride ..][0..width], 0); - decorateGlyph(&mask, stride, width, height, 5, decoration); + decorateLine(&mask, stride, width, height, 5, decoration); try std.testing.expect(inkBounds(&mask, stride, width, height) != null); for (0..height) |y| for (mask[y * stride + width ..][0 .. stride - width]) |guard| try std.testing.expectEqual(@as(u8, 0xa5), guard); diff --git a/vendor/stb/stb_truetype.h b/vendor/stb/stb_truetype.h deleted file mode 100644 index bbf2284b..00000000 --- a/vendor/stb/stb_truetype.h +++ /dev/null @@ -1,5077 +0,0 @@ -// stb_truetype.h - v1.26 - public domain -// authored from 2009-2021 by Sean Barrett / RAD Game Tools -// -// ======================================================================= -// -// NO SECURITY GUARANTEE -- DO NOT USE THIS ON UNTRUSTED FONT FILES -// -// This library does no range checking of the offsets found in the file, -// meaning an attacker can use it to read arbitrary memory. -// -// ======================================================================= -// -// This library processes TrueType files: -// parse files -// extract glyph metrics -// extract glyph shapes -// render glyphs to one-channel bitmaps with antialiasing (box filter) -// render glyphs to one-channel SDF bitmaps (signed-distance field/function) -// -// Todo: -// non-MS cmaps -// crashproof on bad data -// hinting? (no longer patented) -// cleartype-style AA? -// optimize: use simple memory allocator for intermediates -// optimize: build edge-list directly from curves -// optimize: rasterize directly from curves? -// -// ADDITIONAL CONTRIBUTORS -// -// Mikko Mononen: compound shape support, more cmap formats -// Tor Andersson: kerning, subpixel rendering -// Dougall Johnson: OpenType / Type 2 font handling -// Daniel Ribeiro Maciel: basic GPOS-based kerning -// -// Misc other: -// Ryan Gordon -// Simon Glass -// github:IntellectualKitty -// Imanol Celaya -// Daniel Ribeiro Maciel -// -// Bug/warning reports/fixes: -// "Zer" on mollyrocket Fabian "ryg" Giesen github:NiLuJe -// Cass Everitt Martins Mozeiko github:aloucks -// stoiko (Haemimont Games) Cap Petschulat github:oyvindjam -// Brian Hook Omar Cornut github:vassvik -// Walter van Niftrik Ryan Griege -// David Gow Peter LaValle -// David Given Sergey Popov -// Ivan-Assen Ivanov Giumo X. Clanjor -// Anthony Pesch Higor Euripedes -// Johan Duparc Thomas Fields -// Hou Qiming Derek Vinyard -// Rob Loach Cort Stratton -// Kenney Phillis Jr. Brian Costabile -// Ken Voskuil (kaesve) -// -// VERSION HISTORY -// -// 1.26 (2021-08-28) fix broken rasterizer -// 1.25 (2021-07-11) many fixes -// 1.24 (2020-02-05) fix warning -// 1.23 (2020-02-02) query SVG data for glyphs; query whole kerning table (but only kern not GPOS) -// 1.22 (2019-08-11) minimize missing-glyph duplication; fix kerning if both 'GPOS' and 'kern' are defined -// 1.21 (2019-02-25) fix warning -// 1.20 (2019-02-07) PackFontRange skips missing codepoints; GetScaleFontVMetrics() -// 1.19 (2018-02-11) GPOS kerning, STBTT_fmod -// 1.18 (2018-01-29) add missing function -// 1.17 (2017-07-23) make more arguments const; doc fix -// 1.16 (2017-07-12) SDF support -// 1.15 (2017-03-03) make more arguments const -// 1.14 (2017-01-16) num-fonts-in-TTC function -// 1.13 (2017-01-02) support OpenType fonts, certain Apple fonts -// 1.12 (2016-10-25) suppress warnings about casting away const with -Wcast-qual -// 1.11 (2016-04-02) fix unused-variable warning -// 1.10 (2016-04-02) user-defined fabs(); rare memory leak; remove duplicate typedef -// 1.09 (2016-01-16) warning fix; avoid crash on outofmem; use allocation userdata properly -// 1.08 (2015-09-13) document stbtt_Rasterize(); fixes for vertical & horizontal edges -// 1.07 (2015-08-01) allow PackFontRanges to accept arrays of sparse codepoints; -// variant PackFontRanges to pack and render in separate phases; -// fix stbtt_GetFontOFfsetForIndex (never worked for non-0 input?); -// fixed an assert() bug in the new rasterizer -// replace assert() with STBTT_assert() in new rasterizer -// -// Full history can be found at the end of this file. -// -// LICENSE -// -// See end of file for license information. -// -// USAGE -// -// Include this file in whatever places need to refer to it. In ONE C/C++ -// file, write: -// #define STB_TRUETYPE_IMPLEMENTATION -// before the #include of this file. This expands out the actual -// implementation into that C/C++ file. -// -// To make the implementation private to the file that generates the implementation, -// #define STBTT_STATIC -// -// Simple 3D API (don't ship this, but it's fine for tools and quick start) -// stbtt_BakeFontBitmap() -- bake a font to a bitmap for use as texture -// stbtt_GetBakedQuad() -- compute quad to draw for a given char -// -// Improved 3D API (more shippable): -// #include "stb_rect_pack.h" -- optional, but you really want it -// stbtt_PackBegin() -// stbtt_PackSetOversampling() -- for improved quality on small fonts -// stbtt_PackFontRanges() -- pack and renders -// stbtt_PackEnd() -// stbtt_GetPackedQuad() -// -// "Load" a font file from a memory buffer (you have to keep the buffer loaded) -// stbtt_InitFont() -// stbtt_GetFontOffsetForIndex() -- indexing for TTC font collections -// stbtt_GetNumberOfFonts() -- number of fonts for TTC font collections -// -// Render a unicode codepoint to a bitmap -// stbtt_GetCodepointBitmap() -- allocates and returns a bitmap -// stbtt_MakeCodepointBitmap() -- renders into bitmap you provide -// stbtt_GetCodepointBitmapBox() -- how big the bitmap must be -// -// Character advance/positioning -// stbtt_GetCodepointHMetrics() -// stbtt_GetFontVMetrics() -// stbtt_GetFontVMetricsOS2() -// stbtt_GetCodepointKernAdvance() -// -// Starting with version 1.06, the rasterizer was replaced with a new, -// faster and generally-more-precise rasterizer. The new rasterizer more -// accurately measures pixel coverage for anti-aliasing, except in the case -// where multiple shapes overlap, in which case it overestimates the AA pixel -// coverage. Thus, anti-aliasing of intersecting shapes may look wrong. If -// this turns out to be a problem, you can re-enable the old rasterizer with -// #define STBTT_RASTERIZER_VERSION 1 -// which will incur about a 15% speed hit. -// -// ADDITIONAL DOCUMENTATION -// -// Immediately after this block comment are a series of sample programs. -// -// After the sample programs is the "header file" section. This section -// includes documentation for each API function. -// -// Some important concepts to understand to use this library: -// -// Codepoint -// Characters are defined by unicode codepoints, e.g. 65 is -// uppercase A, 231 is lowercase c with a cedilla, 0x7e30 is -// the hiragana for "ma". -// -// Glyph -// A visual character shape (every codepoint is rendered as -// some glyph) -// -// Glyph index -// A font-specific integer ID representing a glyph -// -// Baseline -// Glyph shapes are defined relative to a baseline, which is the -// bottom of uppercase characters. Characters extend both above -// and below the baseline. -// -// Current Point -// As you draw text to the screen, you keep track of a "current point" -// which is the origin of each character. The current point's vertical -// position is the baseline. Even "baked fonts" use this model. -// -// Vertical Font Metrics -// The vertical qualities of the font, used to vertically position -// and space the characters. See docs for stbtt_GetFontVMetrics. -// -// Font Size in Pixels or Points -// The preferred interface for specifying font sizes in stb_truetype -// is to specify how tall the font's vertical extent should be in pixels. -// If that sounds good enough, skip the next paragraph. -// -// Most font APIs instead use "points", which are a common typographic -// measurement for describing font size, defined as 72 points per inch. -// stb_truetype provides a point API for compatibility. However, true -// "per inch" conventions don't make much sense on computer displays -// since different monitors have different number of pixels per -// inch. For example, Windows traditionally uses a convention that -// there are 96 pixels per inch, thus making 'inch' measurements have -// nothing to do with inches, and thus effectively defining a point to -// be 1.333 pixels. Additionally, the TrueType font data provides -// an explicit scale factor to scale a given font's glyphs to points, -// but the author has observed that this scale factor is often wrong -// for non-commercial fonts, thus making fonts scaled in points -// according to the TrueType spec incoherently sized in practice. -// -// DETAILED USAGE: -// -// Scale: -// Select how high you want the font to be, in points or pixels. -// Call ScaleForPixelHeight or ScaleForMappingEmToPixels to compute -// a scale factor SF that will be used by all other functions. -// -// Baseline: -// You need to select a y-coordinate that is the baseline of where -// your text will appear. Call GetFontBoundingBox to get the baseline-relative -// bounding box for all characters. SF*-y0 will be the distance in pixels -// that the worst-case character could extend above the baseline, so if -// you want the top edge of characters to appear at the top of the -// screen where y=0, then you would set the baseline to SF*-y0. -// -// Current point: -// Set the current point where the first character will appear. The -// first character could extend left of the current point; this is font -// dependent. You can either choose a current point that is the leftmost -// point and hope, or add some padding, or check the bounding box or -// left-side-bearing of the first character to be displayed and set -// the current point based on that. -// -// Displaying a character: -// Compute the bounding box of the character. It will contain signed values -// relative to . I.e. if it returns x0,y0,x1,y1, -// then the character should be displayed in the rectangle from -// to = 32 && *text < 128) { - stbtt_aligned_quad q; - stbtt_GetBakedQuad(cdata, 512,512, *text-32, &x,&y,&q,1);//1=opengl & d3d10+,0=d3d9 - glTexCoord2f(q.s0,q.t0); glVertex2f(q.x0,q.y0); - glTexCoord2f(q.s1,q.t0); glVertex2f(q.x1,q.y0); - glTexCoord2f(q.s1,q.t1); glVertex2f(q.x1,q.y1); - glTexCoord2f(q.s0,q.t1); glVertex2f(q.x0,q.y1); - } - ++text; - } - glEnd(); -} -#endif -// -// -////////////////////////////////////////////////////////////////////////////// -// -// Complete program (this compiles): get a single bitmap, print as ASCII art -// -#if 0 -#include -#define STB_TRUETYPE_IMPLEMENTATION // force following include to generate implementation -#include "stb_truetype.h" - -char ttf_buffer[1<<25]; - -int main(int argc, char **argv) -{ - stbtt_fontinfo font; - unsigned char *bitmap; - int w,h,i,j,c = (argc > 1 ? atoi(argv[1]) : 'a'), s = (argc > 2 ? atoi(argv[2]) : 20); - - fread(ttf_buffer, 1, 1<<25, fopen(argc > 3 ? argv[3] : "c:/windows/fonts/arialbd.ttf", "rb")); - - stbtt_InitFont(&font, ttf_buffer, stbtt_GetFontOffsetForIndex(ttf_buffer,0)); - bitmap = stbtt_GetCodepointBitmap(&font, 0,stbtt_ScaleForPixelHeight(&font, s), c, &w, &h, 0,0); - - for (j=0; j < h; ++j) { - for (i=0; i < w; ++i) - putchar(" .:ioVM@"[bitmap[j*w+i]>>5]); - putchar('\n'); - } - return 0; -} -#endif -// -// Output: -// -// .ii. -// @@@@@@. -// V@Mio@@o -// :i. V@V -// :oM@@M -// :@@@MM@M -// @@o o@M -// :@@. M@M -// @@@o@@@@ -// :M@@V:@@. -// -////////////////////////////////////////////////////////////////////////////// -// -// Complete program: print "Hello World!" banner, with bugs -// -#if 0 -char buffer[24<<20]; -unsigned char screen[20][79]; - -int main(int arg, char **argv) -{ - stbtt_fontinfo font; - int i,j,ascent,baseline,ch=0; - float scale, xpos=2; // leave a little padding in case the character extends left - char *text = "Heljo World!"; // intentionally misspelled to show 'lj' brokenness - - fread(buffer, 1, 1000000, fopen("c:/windows/fonts/arialbd.ttf", "rb")); - stbtt_InitFont(&font, buffer, 0); - - scale = stbtt_ScaleForPixelHeight(&font, 15); - stbtt_GetFontVMetrics(&font, &ascent,0,0); - baseline = (int) (ascent*scale); - - while (text[ch]) { - int advance,lsb,x0,y0,x1,y1; - float x_shift = xpos - (float) floor(xpos); - stbtt_GetCodepointHMetrics(&font, text[ch], &advance, &lsb); - stbtt_GetCodepointBitmapBoxSubpixel(&font, text[ch], scale,scale,x_shift,0, &x0,&y0,&x1,&y1); - stbtt_MakeCodepointBitmapSubpixel(&font, &screen[baseline + y0][(int) xpos + x0], x1-x0,y1-y0, 79, scale,scale,x_shift,0, text[ch]); - // note that this stomps the old data, so where character boxes overlap (e.g. 'lj') it's wrong - // because this API is really for baking character bitmaps into textures. if you want to render - // a sequence of characters, you really need to render each bitmap to a temp buffer, then - // "alpha blend" that into the working buffer - xpos += (advance * scale); - if (text[ch+1]) - xpos += scale*stbtt_GetCodepointKernAdvance(&font, text[ch],text[ch+1]); - ++ch; - } - - for (j=0; j < 20; ++j) { - for (i=0; i < 78; ++i) - putchar(" .:ioVM@"[screen[j][i]>>5]); - putchar('\n'); - } - - return 0; -} -#endif - - -////////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// -//// -//// INTEGRATION WITH YOUR CODEBASE -//// -//// The following sections allow you to supply alternate definitions -//// of C library functions used by stb_truetype, e.g. if you don't -//// link with the C runtime library. - -#ifdef STB_TRUETYPE_IMPLEMENTATION - // #define your own (u)stbtt_int8/16/32 before including to override this - #ifndef stbtt_uint8 - typedef unsigned char stbtt_uint8; - typedef signed char stbtt_int8; - typedef unsigned short stbtt_uint16; - typedef signed short stbtt_int16; - typedef unsigned int stbtt_uint32; - typedef signed int stbtt_int32; - #endif - - typedef char stbtt__check_size32[sizeof(stbtt_int32)==4 ? 1 : -1]; - typedef char stbtt__check_size16[sizeof(stbtt_int16)==2 ? 1 : -1]; - - // e.g. #define your own STBTT_ifloor/STBTT_iceil() to avoid math.h - #ifndef STBTT_ifloor - #include - #define STBTT_ifloor(x) ((int) floor(x)) - #define STBTT_iceil(x) ((int) ceil(x)) - #endif - - #ifndef STBTT_sqrt - #include - #define STBTT_sqrt(x) sqrt(x) - #define STBTT_pow(x,y) pow(x,y) - #endif - - #ifndef STBTT_fmod - #include - #define STBTT_fmod(x,y) fmod(x,y) - #endif - - #ifndef STBTT_cos - #include - #define STBTT_cos(x) cos(x) - #define STBTT_acos(x) acos(x) - #endif - - #ifndef STBTT_fabs - #include - #define STBTT_fabs(x) fabs(x) - #endif - - // #define your own functions "STBTT_malloc" / "STBTT_free" to avoid malloc.h - #ifndef STBTT_malloc - #include - #define STBTT_malloc(x,u) ((void)(u),malloc(x)) - #define STBTT_free(x,u) ((void)(u),free(x)) - #endif - - #ifndef STBTT_assert - #include - #define STBTT_assert(x) assert(x) - #endif - - #ifndef STBTT_strlen - #include - #define STBTT_strlen(x) strlen(x) - #endif - - #ifndef STBTT_memcpy - #include - #define STBTT_memcpy memcpy - #define STBTT_memset memset - #endif -#endif - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -//// -//// INTERFACE -//// -//// - -#ifndef __STB_INCLUDE_STB_TRUETYPE_H__ -#define __STB_INCLUDE_STB_TRUETYPE_H__ - -#ifdef STBTT_STATIC -#define STBTT_DEF static -#else -#define STBTT_DEF extern -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -// private structure -typedef struct -{ - unsigned char *data; - int cursor; - int size; -} stbtt__buf; - -////////////////////////////////////////////////////////////////////////////// -// -// TEXTURE BAKING API -// -// If you use this API, you only have to call two functions ever. -// - -typedef struct -{ - unsigned short x0,y0,x1,y1; // coordinates of bbox in bitmap - float xoff,yoff,xadvance; -} stbtt_bakedchar; - -STBTT_DEF int stbtt_BakeFontBitmap(const unsigned char *data, int offset, // font location (use offset=0 for plain .ttf) - float pixel_height, // height of font in pixels - unsigned char *pixels, int pw, int ph, // bitmap to be filled in - int first_char, int num_chars, // characters to bake - stbtt_bakedchar *chardata); // you allocate this, it's num_chars long -// if return is positive, the first unused row of the bitmap -// if return is negative, returns the negative of the number of characters that fit -// if return is 0, no characters fit and no rows were used -// This uses a very crappy packing. - -typedef struct -{ - float x0,y0,s0,t0; // top-left - float x1,y1,s1,t1; // bottom-right -} stbtt_aligned_quad; - -STBTT_DEF void stbtt_GetBakedQuad(const stbtt_bakedchar *chardata, int pw, int ph, // same data as above - int char_index, // character to display - float *xpos, float *ypos, // pointers to current position in screen pixel space - stbtt_aligned_quad *q, // output: quad to draw - int opengl_fillrule); // true if opengl fill rule; false if DX9 or earlier -// Call GetBakedQuad with char_index = 'character - first_char', and it -// creates the quad you need to draw and advances the current position. -// -// The coordinate system used assumes y increases downwards. -// -// Characters will extend both above and below the current position; -// see discussion of "BASELINE" above. -// -// It's inefficient; you might want to c&p it and optimize it. - -STBTT_DEF void stbtt_GetScaledFontVMetrics(const unsigned char *fontdata, int index, float size, float *ascent, float *descent, float *lineGap); -// Query the font vertical metrics without having to create a font first. - - -////////////////////////////////////////////////////////////////////////////// -// -// NEW TEXTURE BAKING API -// -// This provides options for packing multiple fonts into one atlas, not -// perfectly but better than nothing. - -typedef struct -{ - unsigned short x0,y0,x1,y1; // coordinates of bbox in bitmap - float xoff,yoff,xadvance; - float xoff2,yoff2; -} stbtt_packedchar; - -typedef struct stbtt_pack_context stbtt_pack_context; -typedef struct stbtt_fontinfo stbtt_fontinfo; -#ifndef STB_RECT_PACK_VERSION -typedef struct stbrp_rect stbrp_rect; -#endif - -STBTT_DEF int stbtt_PackBegin(stbtt_pack_context *spc, unsigned char *pixels, int width, int height, int stride_in_bytes, int padding, void *alloc_context); -// Initializes a packing context stored in the passed-in stbtt_pack_context. -// Future calls using this context will pack characters into the bitmap passed -// in here: a 1-channel bitmap that is width * height. stride_in_bytes is -// the distance from one row to the next (or 0 to mean they are packed tightly -// together). "padding" is the amount of padding to leave between each -// character (normally you want '1' for bitmaps you'll use as textures with -// bilinear filtering). -// -// Returns 0 on failure, 1 on success. - -STBTT_DEF void stbtt_PackEnd (stbtt_pack_context *spc); -// Cleans up the packing context and frees all memory. - -#define STBTT_POINT_SIZE(x) (-(x)) - -STBTT_DEF int stbtt_PackFontRange(stbtt_pack_context *spc, const unsigned char *fontdata, int font_index, float font_size, - int first_unicode_char_in_range, int num_chars_in_range, stbtt_packedchar *chardata_for_range); -// Creates character bitmaps from the font_index'th font found in fontdata (use -// font_index=0 if you don't know what that is). It creates num_chars_in_range -// bitmaps for characters with unicode values starting at first_unicode_char_in_range -// and increasing. Data for how to render them is stored in chardata_for_range; -// pass these to stbtt_GetPackedQuad to get back renderable quads. -// -// font_size is the full height of the character from ascender to descender, -// as computed by stbtt_ScaleForPixelHeight. To use a point size as computed -// by stbtt_ScaleForMappingEmToPixels, wrap the point size in STBTT_POINT_SIZE() -// and pass that result as 'font_size': -// ..., 20 , ... // font max minus min y is 20 pixels tall -// ..., STBTT_POINT_SIZE(20), ... // 'M' is 20 pixels tall - -typedef struct -{ - float font_size; - int first_unicode_codepoint_in_range; // if non-zero, then the chars are continuous, and this is the first codepoint - int *array_of_unicode_codepoints; // if non-zero, then this is an array of unicode codepoints - int num_chars; - stbtt_packedchar *chardata_for_range; // output - unsigned char h_oversample, v_oversample; // don't set these, they're used internally -} stbtt_pack_range; - -STBTT_DEF int stbtt_PackFontRanges(stbtt_pack_context *spc, const unsigned char *fontdata, int font_index, stbtt_pack_range *ranges, int num_ranges); -// Creates character bitmaps from multiple ranges of characters stored in -// ranges. This will usually create a better-packed bitmap than multiple -// calls to stbtt_PackFontRange. Note that you can call this multiple -// times within a single PackBegin/PackEnd. - -STBTT_DEF void stbtt_PackSetOversampling(stbtt_pack_context *spc, unsigned int h_oversample, unsigned int v_oversample); -// Oversampling a font increases the quality by allowing higher-quality subpixel -// positioning, and is especially valuable at smaller text sizes. -// -// This function sets the amount of oversampling for all following calls to -// stbtt_PackFontRange(s) or stbtt_PackFontRangesGatherRects for a given -// pack context. The default (no oversampling) is achieved by h_oversample=1 -// and v_oversample=1. The total number of pixels required is -// h_oversample*v_oversample larger than the default; for example, 2x2 -// oversampling requires 4x the storage of 1x1. For best results, render -// oversampled textures with bilinear filtering. Look at the readme in -// stb/tests/oversample for information about oversampled fonts -// -// To use with PackFontRangesGather etc., you must set it before calls -// call to PackFontRangesGatherRects. - -STBTT_DEF void stbtt_PackSetSkipMissingCodepoints(stbtt_pack_context *spc, int skip); -// If skip != 0, this tells stb_truetype to skip any codepoints for which -// there is no corresponding glyph. If skip=0, which is the default, then -// codepoints without a glyph recived the font's "missing character" glyph, -// typically an empty box by convention. - -STBTT_DEF void stbtt_GetPackedQuad(const stbtt_packedchar *chardata, int pw, int ph, // same data as above - int char_index, // character to display - float *xpos, float *ypos, // pointers to current position in screen pixel space - stbtt_aligned_quad *q, // output: quad to draw - int align_to_integer); - -STBTT_DEF int stbtt_PackFontRangesGatherRects(stbtt_pack_context *spc, const stbtt_fontinfo *info, stbtt_pack_range *ranges, int num_ranges, stbrp_rect *rects); -STBTT_DEF void stbtt_PackFontRangesPackRects(stbtt_pack_context *spc, stbrp_rect *rects, int num_rects); -STBTT_DEF int stbtt_PackFontRangesRenderIntoRects(stbtt_pack_context *spc, const stbtt_fontinfo *info, stbtt_pack_range *ranges, int num_ranges, stbrp_rect *rects); -// Calling these functions in sequence is roughly equivalent to calling -// stbtt_PackFontRanges(). If you more control over the packing of multiple -// fonts, or if you want to pack custom data into a font texture, take a look -// at the source to of stbtt_PackFontRanges() and create a custom version -// using these functions, e.g. call GatherRects multiple times, -// building up a single array of rects, then call PackRects once, -// then call RenderIntoRects repeatedly. This may result in a -// better packing than calling PackFontRanges multiple times -// (or it may not). - -// this is an opaque structure that you shouldn't mess with which holds -// all the context needed from PackBegin to PackEnd. -struct stbtt_pack_context { - void *user_allocator_context; - void *pack_info; - int width; - int height; - int stride_in_bytes; - int padding; - int skip_missing; - unsigned int h_oversample, v_oversample; - unsigned char *pixels; - void *nodes; -}; - -////////////////////////////////////////////////////////////////////////////// -// -// FONT LOADING -// -// - -STBTT_DEF int stbtt_GetNumberOfFonts(const unsigned char *data); -// This function will determine the number of fonts in a font file. TrueType -// collection (.ttc) files may contain multiple fonts, while TrueType font -// (.ttf) files only contain one font. The number of fonts can be used for -// indexing with the previous function where the index is between zero and one -// less than the total fonts. If an error occurs, -1 is returned. - -STBTT_DEF int stbtt_GetFontOffsetForIndex(const unsigned char *data, int index); -// Each .ttf/.ttc file may have more than one font. Each font has a sequential -// index number starting from 0. Call this function to get the font offset for -// a given index; it returns -1 if the index is out of range. A regular .ttf -// file will only define one font and it always be at offset 0, so it will -// return '0' for index 0, and -1 for all other indices. - -// The following structure is defined publicly so you can declare one on -// the stack or as a global or etc, but you should treat it as opaque. -struct stbtt_fontinfo -{ - void * userdata; - unsigned char * data; // pointer to .ttf file - int fontstart; // offset of start of font - - int numGlyphs; // number of glyphs, needed for range checking - - int loca,head,glyf,hhea,hmtx,kern,gpos,svg; // table locations as offset from start of .ttf - int index_map; // a cmap mapping for our chosen character encoding - int indexToLocFormat; // format needed to map from glyph index to glyph - - stbtt__buf cff; // cff font data - stbtt__buf charstrings; // the charstring index - stbtt__buf gsubrs; // global charstring subroutines index - stbtt__buf subrs; // private charstring subroutines index - stbtt__buf fontdicts; // array of font dicts - stbtt__buf fdselect; // map from glyph to fontdict -}; - -STBTT_DEF int stbtt_InitFont(stbtt_fontinfo *info, const unsigned char *data, int offset); -// Given an offset into the file that defines a font, this function builds -// the necessary cached info for the rest of the system. You must allocate -// the stbtt_fontinfo yourself, and stbtt_InitFont will fill it out. You don't -// need to do anything special to free it, because the contents are pure -// value data with no additional data structures. Returns 0 on failure. - - -////////////////////////////////////////////////////////////////////////////// -// -// CHARACTER TO GLYPH-INDEX CONVERSIOn - -STBTT_DEF int stbtt_FindGlyphIndex(const stbtt_fontinfo *info, int unicode_codepoint); -// If you're going to perform multiple operations on the same character -// and you want a speed-up, call this function with the character you're -// going to process, then use glyph-based functions instead of the -// codepoint-based functions. -// Returns 0 if the character codepoint is not defined in the font. - - -////////////////////////////////////////////////////////////////////////////// -// -// CHARACTER PROPERTIES -// - -STBTT_DEF float stbtt_ScaleForPixelHeight(const stbtt_fontinfo *info, float pixels); -// computes a scale factor to produce a font whose "height" is 'pixels' tall. -// Height is measured as the distance from the highest ascender to the lowest -// descender; in other words, it's equivalent to calling stbtt_GetFontVMetrics -// and computing: -// scale = pixels / (ascent - descent) -// so if you prefer to measure height by the ascent only, use a similar calculation. - -STBTT_DEF float stbtt_ScaleForMappingEmToPixels(const stbtt_fontinfo *info, float pixels); -// computes a scale factor to produce a font whose EM size is mapped to -// 'pixels' tall. This is probably what traditional APIs compute, but -// I'm not positive. - -STBTT_DEF void stbtt_GetFontVMetrics(const stbtt_fontinfo *info, int *ascent, int *descent, int *lineGap); -// ascent is the coordinate above the baseline the font extends; descent -// is the coordinate below the baseline the font extends (i.e. it is typically negative) -// lineGap is the spacing between one row's descent and the next row's ascent... -// so you should advance the vertical position by "*ascent - *descent + *lineGap" -// these are expressed in unscaled coordinates, so you must multiply by -// the scale factor for a given size - -STBTT_DEF int stbtt_GetFontVMetricsOS2(const stbtt_fontinfo *info, int *typoAscent, int *typoDescent, int *typoLineGap); -// analogous to GetFontVMetrics, but returns the "typographic" values from the OS/2 -// table (specific to MS/Windows TTF files). -// -// Returns 1 on success (table present), 0 on failure. - -STBTT_DEF void stbtt_GetFontBoundingBox(const stbtt_fontinfo *info, int *x0, int *y0, int *x1, int *y1); -// the bounding box around all possible characters - -STBTT_DEF void stbtt_GetCodepointHMetrics(const stbtt_fontinfo *info, int codepoint, int *advanceWidth, int *leftSideBearing); -// leftSideBearing is the offset from the current horizontal position to the left edge of the character -// advanceWidth is the offset from the current horizontal position to the next horizontal position -// these are expressed in unscaled coordinates - -STBTT_DEF int stbtt_GetCodepointKernAdvance(const stbtt_fontinfo *info, int ch1, int ch2); -// an additional amount to add to the 'advance' value between ch1 and ch2 - -STBTT_DEF int stbtt_GetCodepointBox(const stbtt_fontinfo *info, int codepoint, int *x0, int *y0, int *x1, int *y1); -// Gets the bounding box of the visible part of the glyph, in unscaled coordinates - -STBTT_DEF void stbtt_GetGlyphHMetrics(const stbtt_fontinfo *info, int glyph_index, int *advanceWidth, int *leftSideBearing); -STBTT_DEF int stbtt_GetGlyphKernAdvance(const stbtt_fontinfo *info, int glyph1, int glyph2); -STBTT_DEF int stbtt_GetGlyphBox(const stbtt_fontinfo *info, int glyph_index, int *x0, int *y0, int *x1, int *y1); -// as above, but takes one or more glyph indices for greater efficiency - -typedef struct stbtt_kerningentry -{ - int glyph1; // use stbtt_FindGlyphIndex - int glyph2; - int advance; -} stbtt_kerningentry; - -STBTT_DEF int stbtt_GetKerningTableLength(const stbtt_fontinfo *info); -STBTT_DEF int stbtt_GetKerningTable(const stbtt_fontinfo *info, stbtt_kerningentry* table, int table_length); -// Retrieves a complete list of all of the kerning pairs provided by the font -// stbtt_GetKerningTable never writes more than table_length entries and returns how many entries it did write. -// The table will be sorted by (a.glyph1 == b.glyph1)?(a.glyph2 < b.glyph2):(a.glyph1 < b.glyph1) - -////////////////////////////////////////////////////////////////////////////// -// -// GLYPH SHAPES (you probably don't need these, but they have to go before -// the bitmaps for C declaration-order reasons) -// - -#ifndef STBTT_vmove // you can predefine these to use different values (but why?) - enum { - STBTT_vmove=1, - STBTT_vline, - STBTT_vcurve, - STBTT_vcubic - }; -#endif - -#ifndef stbtt_vertex // you can predefine this to use different values - // (we share this with other code at RAD) - #define stbtt_vertex_type short // can't use stbtt_int16 because that's not visible in the header file - typedef struct - { - stbtt_vertex_type x,y,cx,cy,cx1,cy1; - unsigned char type,padding; - } stbtt_vertex; -#endif - -STBTT_DEF int stbtt_IsGlyphEmpty(const stbtt_fontinfo *info, int glyph_index); -// returns non-zero if nothing is drawn for this glyph - -STBTT_DEF int stbtt_GetCodepointShape(const stbtt_fontinfo *info, int unicode_codepoint, stbtt_vertex **vertices); -STBTT_DEF int stbtt_GetGlyphShape(const stbtt_fontinfo *info, int glyph_index, stbtt_vertex **vertices); -// returns # of vertices and fills *vertices with the pointer to them -// these are expressed in "unscaled" coordinates -// -// The shape is a series of contours. Each one starts with -// a STBTT_moveto, then consists of a series of mixed -// STBTT_lineto and STBTT_curveto segments. A lineto -// draws a line from previous endpoint to its x,y; a curveto -// draws a quadratic bezier from previous endpoint to -// its x,y, using cx,cy as the bezier control point. - -STBTT_DEF void stbtt_FreeShape(const stbtt_fontinfo *info, stbtt_vertex *vertices); -// frees the data allocated above - -STBTT_DEF unsigned char *stbtt_FindSVGDoc(const stbtt_fontinfo *info, int gl); -STBTT_DEF int stbtt_GetCodepointSVG(const stbtt_fontinfo *info, int unicode_codepoint, const char **svg); -STBTT_DEF int stbtt_GetGlyphSVG(const stbtt_fontinfo *info, int gl, const char **svg); -// fills svg with the character's SVG data. -// returns data size or 0 if SVG not found. - -////////////////////////////////////////////////////////////////////////////// -// -// BITMAP RENDERING -// - -STBTT_DEF void stbtt_FreeBitmap(unsigned char *bitmap, void *userdata); -// frees the bitmap allocated below - -STBTT_DEF unsigned char *stbtt_GetCodepointBitmap(const stbtt_fontinfo *info, float scale_x, float scale_y, int codepoint, int *width, int *height, int *xoff, int *yoff); -// allocates a large-enough single-channel 8bpp bitmap and renders the -// specified character/glyph at the specified scale into it, with -// antialiasing. 0 is no coverage (transparent), 255 is fully covered (opaque). -// *width & *height are filled out with the width & height of the bitmap, -// which is stored left-to-right, top-to-bottom. -// -// xoff/yoff are the offset it pixel space from the glyph origin to the top-left of the bitmap - -STBTT_DEF unsigned char *stbtt_GetCodepointBitmapSubpixel(const stbtt_fontinfo *info, float scale_x, float scale_y, float shift_x, float shift_y, int codepoint, int *width, int *height, int *xoff, int *yoff); -// the same as stbtt_GetCodepoitnBitmap, but you can specify a subpixel -// shift for the character - -STBTT_DEF void stbtt_MakeCodepointBitmap(const stbtt_fontinfo *info, unsigned char *output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, int codepoint); -// the same as stbtt_GetCodepointBitmap, but you pass in storage for the bitmap -// in the form of 'output', with row spacing of 'out_stride' bytes. the bitmap -// is clipped to out_w/out_h bytes. Call stbtt_GetCodepointBitmapBox to get the -// width and height and positioning info for it first. - -STBTT_DEF void stbtt_MakeCodepointBitmapSubpixel(const stbtt_fontinfo *info, unsigned char *output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, float shift_x, float shift_y, int codepoint); -// same as stbtt_MakeCodepointBitmap, but you can specify a subpixel -// shift for the character - -STBTT_DEF void stbtt_MakeCodepointBitmapSubpixelPrefilter(const stbtt_fontinfo *info, unsigned char *output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, float shift_x, float shift_y, int oversample_x, int oversample_y, float *sub_x, float *sub_y, int codepoint); -// same as stbtt_MakeCodepointBitmapSubpixel, but prefiltering -// is performed (see stbtt_PackSetOversampling) - -STBTT_DEF void stbtt_GetCodepointBitmapBox(const stbtt_fontinfo *font, int codepoint, float scale_x, float scale_y, int *ix0, int *iy0, int *ix1, int *iy1); -// get the bbox of the bitmap centered around the glyph origin; so the -// bitmap width is ix1-ix0, height is iy1-iy0, and location to place -// the bitmap top left is (leftSideBearing*scale,iy0). -// (Note that the bitmap uses y-increases-down, but the shape uses -// y-increases-up, so CodepointBitmapBox and CodepointBox are inverted.) - -STBTT_DEF void stbtt_GetCodepointBitmapBoxSubpixel(const stbtt_fontinfo *font, int codepoint, float scale_x, float scale_y, float shift_x, float shift_y, int *ix0, int *iy0, int *ix1, int *iy1); -// same as stbtt_GetCodepointBitmapBox, but you can specify a subpixel -// shift for the character - -// the following functions are equivalent to the above functions, but operate -// on glyph indices instead of Unicode codepoints (for efficiency) -STBTT_DEF unsigned char *stbtt_GetGlyphBitmap(const stbtt_fontinfo *info, float scale_x, float scale_y, int glyph, int *width, int *height, int *xoff, int *yoff); -STBTT_DEF unsigned char *stbtt_GetGlyphBitmapSubpixel(const stbtt_fontinfo *info, float scale_x, float scale_y, float shift_x, float shift_y, int glyph, int *width, int *height, int *xoff, int *yoff); -STBTT_DEF void stbtt_MakeGlyphBitmap(const stbtt_fontinfo *info, unsigned char *output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, int glyph); -STBTT_DEF void stbtt_MakeGlyphBitmapSubpixel(const stbtt_fontinfo *info, unsigned char *output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, float shift_x, float shift_y, int glyph); -STBTT_DEF void stbtt_MakeGlyphBitmapSubpixelPrefilter(const stbtt_fontinfo *info, unsigned char *output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, float shift_x, float shift_y, int oversample_x, int oversample_y, float *sub_x, float *sub_y, int glyph); -STBTT_DEF void stbtt_GetGlyphBitmapBox(const stbtt_fontinfo *font, int glyph, float scale_x, float scale_y, int *ix0, int *iy0, int *ix1, int *iy1); -STBTT_DEF void stbtt_GetGlyphBitmapBoxSubpixel(const stbtt_fontinfo *font, int glyph, float scale_x, float scale_y,float shift_x, float shift_y, int *ix0, int *iy0, int *ix1, int *iy1); - - -// @TODO: don't expose this structure -typedef struct -{ - int w,h,stride; - unsigned char *pixels; -} stbtt__bitmap; - -// rasterize a shape with quadratic beziers into a bitmap -STBTT_DEF void stbtt_Rasterize(stbtt__bitmap *result, // 1-channel bitmap to draw into - float flatness_in_pixels, // allowable error of curve in pixels - stbtt_vertex *vertices, // array of vertices defining shape - int num_verts, // number of vertices in above array - float scale_x, float scale_y, // scale applied to input vertices - float shift_x, float shift_y, // translation applied to input vertices - int x_off, int y_off, // another translation applied to input - int invert, // if non-zero, vertically flip shape - void *userdata); // context for to STBTT_MALLOC - -////////////////////////////////////////////////////////////////////////////// -// -// Signed Distance Function (or Field) rendering - -STBTT_DEF void stbtt_FreeSDF(unsigned char *bitmap, void *userdata); -// frees the SDF bitmap allocated below - -STBTT_DEF unsigned char * stbtt_GetGlyphSDF(const stbtt_fontinfo *info, float scale, int glyph, int padding, unsigned char onedge_value, float pixel_dist_scale, int *width, int *height, int *xoff, int *yoff); -STBTT_DEF unsigned char * stbtt_GetCodepointSDF(const stbtt_fontinfo *info, float scale, int codepoint, int padding, unsigned char onedge_value, float pixel_dist_scale, int *width, int *height, int *xoff, int *yoff); -// These functions compute a discretized SDF field for a single character, suitable for storing -// in a single-channel texture, sampling with bilinear filtering, and testing against -// larger than some threshold to produce scalable fonts. -// info -- the font -// scale -- controls the size of the resulting SDF bitmap, same as it would be creating a regular bitmap -// glyph/codepoint -- the character to generate the SDF for -// padding -- extra "pixels" around the character which are filled with the distance to the character (not 0), -// which allows effects like bit outlines -// onedge_value -- value 0-255 to test the SDF against to reconstruct the character (i.e. the isocontour of the character) -// pixel_dist_scale -- what value the SDF should increase by when moving one SDF "pixel" away from the edge (on the 0..255 scale) -// if positive, > onedge_value is inside; if negative, < onedge_value is inside -// width,height -- output height & width of the SDF bitmap (including padding) -// xoff,yoff -- output origin of the character -// return value -- a 2D array of bytes 0..255, width*height in size -// -// pixel_dist_scale & onedge_value are a scale & bias that allows you to make -// optimal use of the limited 0..255 for your application, trading off precision -// and special effects. SDF values outside the range 0..255 are clamped to 0..255. -// -// Example: -// scale = stbtt_ScaleForPixelHeight(22) -// padding = 5 -// onedge_value = 180 -// pixel_dist_scale = 180/5.0 = 36.0 -// -// This will create an SDF bitmap in which the character is about 22 pixels -// high but the whole bitmap is about 22+5+5=32 pixels high. To produce a filled -// shape, sample the SDF at each pixel and fill the pixel if the SDF value -// is greater than or equal to 180/255. (You'll actually want to antialias, -// which is beyond the scope of this example.) Additionally, you can compute -// offset outlines (e.g. to stroke the character border inside & outside, -// or only outside). For example, to fill outside the character up to 3 SDF -// pixels, you would compare against (180-36.0*3)/255 = 72/255. The above -// choice of variables maps a range from 5 pixels outside the shape to -// 2 pixels inside the shape to 0..255; this is intended primarily for apply -// outside effects only (the interior range is needed to allow proper -// antialiasing of the font at *smaller* sizes) -// -// The function computes the SDF analytically at each SDF pixel, not by e.g. -// building a higher-res bitmap and approximating it. In theory the quality -// should be as high as possible for an SDF of this size & representation, but -// unclear if this is true in practice (perhaps building a higher-res bitmap -// and computing from that can allow drop-out prevention). -// -// The algorithm has not been optimized at all, so expect it to be slow -// if computing lots of characters or very large sizes. - - - -////////////////////////////////////////////////////////////////////////////// -// -// Finding the right font... -// -// You should really just solve this offline, keep your own tables -// of what font is what, and don't try to get it out of the .ttf file. -// That's because getting it out of the .ttf file is really hard, because -// the names in the file can appear in many possible encodings, in many -// possible languages, and e.g. if you need a case-insensitive comparison, -// the details of that depend on the encoding & language in a complex way -// (actually underspecified in truetype, but also gigantic). -// -// But you can use the provided functions in two possible ways: -// stbtt_FindMatchingFont() will use *case-sensitive* comparisons on -// unicode-encoded names to try to find the font you want; -// you can run this before calling stbtt_InitFont() -// -// stbtt_GetFontNameString() lets you get any of the various strings -// from the file yourself and do your own comparisons on them. -// You have to have called stbtt_InitFont() first. - - -STBTT_DEF int stbtt_FindMatchingFont(const unsigned char *fontdata, const char *name, int flags); -// returns the offset (not index) of the font that matches, or -1 if none -// if you use STBTT_MACSTYLE_DONTCARE, use a font name like "Arial Bold". -// if you use any other flag, use a font name like "Arial"; this checks -// the 'macStyle' header field; i don't know if fonts set this consistently -#define STBTT_MACSTYLE_DONTCARE 0 -#define STBTT_MACSTYLE_BOLD 1 -#define STBTT_MACSTYLE_ITALIC 2 -#define STBTT_MACSTYLE_UNDERSCORE 4 -#define STBTT_MACSTYLE_NONE 8 // <= not same as 0, this makes us check the bitfield is 0 - -STBTT_DEF int stbtt_CompareUTF8toUTF16_bigendian(const char *s1, int len1, const char *s2, int len2); -// returns 1/0 whether the first string interpreted as utf8 is identical to -// the second string interpreted as big-endian utf16... useful for strings from next func - -STBTT_DEF const char *stbtt_GetFontNameString(const stbtt_fontinfo *font, int *length, int platformID, int encodingID, int languageID, int nameID); -// returns the string (which may be big-endian double byte, e.g. for unicode) -// and puts the length in bytes in *length. -// -// some of the values for the IDs are below; for more see the truetype spec: -// http://developer.apple.com/textfonts/TTRefMan/RM06/Chap6name.html -// http://www.microsoft.com/typography/otspec/name.htm - -enum { // platformID - STBTT_PLATFORM_ID_UNICODE =0, - STBTT_PLATFORM_ID_MAC =1, - STBTT_PLATFORM_ID_ISO =2, - STBTT_PLATFORM_ID_MICROSOFT =3 -}; - -enum { // encodingID for STBTT_PLATFORM_ID_UNICODE - STBTT_UNICODE_EID_UNICODE_1_0 =0, - STBTT_UNICODE_EID_UNICODE_1_1 =1, - STBTT_UNICODE_EID_ISO_10646 =2, - STBTT_UNICODE_EID_UNICODE_2_0_BMP=3, - STBTT_UNICODE_EID_UNICODE_2_0_FULL=4 -}; - -enum { // encodingID for STBTT_PLATFORM_ID_MICROSOFT - STBTT_MS_EID_SYMBOL =0, - STBTT_MS_EID_UNICODE_BMP =1, - STBTT_MS_EID_SHIFTJIS =2, - STBTT_MS_EID_UNICODE_FULL =10 -}; - -enum { // encodingID for STBTT_PLATFORM_ID_MAC; same as Script Manager codes - STBTT_MAC_EID_ROMAN =0, STBTT_MAC_EID_ARABIC =4, - STBTT_MAC_EID_JAPANESE =1, STBTT_MAC_EID_HEBREW =5, - STBTT_MAC_EID_CHINESE_TRAD =2, STBTT_MAC_EID_GREEK =6, - STBTT_MAC_EID_KOREAN =3, STBTT_MAC_EID_RUSSIAN =7 -}; - -enum { // languageID for STBTT_PLATFORM_ID_MICROSOFT; same as LCID... - // problematic because there are e.g. 16 english LCIDs and 16 arabic LCIDs - STBTT_MS_LANG_ENGLISH =0x0409, STBTT_MS_LANG_ITALIAN =0x0410, - STBTT_MS_LANG_CHINESE =0x0804, STBTT_MS_LANG_JAPANESE =0x0411, - STBTT_MS_LANG_DUTCH =0x0413, STBTT_MS_LANG_KOREAN =0x0412, - STBTT_MS_LANG_FRENCH =0x040c, STBTT_MS_LANG_RUSSIAN =0x0419, - STBTT_MS_LANG_GERMAN =0x0407, STBTT_MS_LANG_SPANISH =0x0409, - STBTT_MS_LANG_HEBREW =0x040d, STBTT_MS_LANG_SWEDISH =0x041D -}; - -enum { // languageID for STBTT_PLATFORM_ID_MAC - STBTT_MAC_LANG_ENGLISH =0 , STBTT_MAC_LANG_JAPANESE =11, - STBTT_MAC_LANG_ARABIC =12, STBTT_MAC_LANG_KOREAN =23, - STBTT_MAC_LANG_DUTCH =4 , STBTT_MAC_LANG_RUSSIAN =32, - STBTT_MAC_LANG_FRENCH =1 , STBTT_MAC_LANG_SPANISH =6 , - STBTT_MAC_LANG_GERMAN =2 , STBTT_MAC_LANG_SWEDISH =5 , - STBTT_MAC_LANG_HEBREW =10, STBTT_MAC_LANG_CHINESE_SIMPLIFIED =33, - STBTT_MAC_LANG_ITALIAN =3 , STBTT_MAC_LANG_CHINESE_TRAD =19 -}; - -#ifdef __cplusplus -} -#endif - -#endif // __STB_INCLUDE_STB_TRUETYPE_H__ - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -//// -//// IMPLEMENTATION -//// -//// - -#ifdef STB_TRUETYPE_IMPLEMENTATION - -#ifndef STBTT_MAX_OVERSAMPLE -#define STBTT_MAX_OVERSAMPLE 8 -#endif - -#if STBTT_MAX_OVERSAMPLE > 255 -#error "STBTT_MAX_OVERSAMPLE cannot be > 255" -#endif - -typedef int stbtt__test_oversample_pow2[(STBTT_MAX_OVERSAMPLE & (STBTT_MAX_OVERSAMPLE-1)) == 0 ? 1 : -1]; - -#ifndef STBTT_RASTERIZER_VERSION -#define STBTT_RASTERIZER_VERSION 2 -#endif - -#ifdef _MSC_VER -#define STBTT__NOTUSED(v) (void)(v) -#else -#define STBTT__NOTUSED(v) (void)sizeof(v) -#endif - -////////////////////////////////////////////////////////////////////////// -// -// stbtt__buf helpers to parse data from file -// - -static stbtt_uint8 stbtt__buf_get8(stbtt__buf *b) -{ - if (b->cursor >= b->size) - return 0; - return b->data[b->cursor++]; -} - -static stbtt_uint8 stbtt__buf_peek8(stbtt__buf *b) -{ - if (b->cursor >= b->size) - return 0; - return b->data[b->cursor]; -} - -static void stbtt__buf_seek(stbtt__buf *b, int o) -{ - STBTT_assert(!(o > b->size || o < 0)); - b->cursor = (o > b->size || o < 0) ? b->size : o; -} - -static void stbtt__buf_skip(stbtt__buf *b, int o) -{ - stbtt__buf_seek(b, b->cursor + o); -} - -static stbtt_uint32 stbtt__buf_get(stbtt__buf *b, int n) -{ - stbtt_uint32 v = 0; - int i; - STBTT_assert(n >= 1 && n <= 4); - for (i = 0; i < n; i++) - v = (v << 8) | stbtt__buf_get8(b); - return v; -} - -static stbtt__buf stbtt__new_buf(const void *p, size_t size) -{ - stbtt__buf r; - STBTT_assert(size < 0x40000000); - r.data = (stbtt_uint8*) p; - r.size = (int) size; - r.cursor = 0; - return r; -} - -#define stbtt__buf_get16(b) stbtt__buf_get((b), 2) -#define stbtt__buf_get32(b) stbtt__buf_get((b), 4) - -static stbtt__buf stbtt__buf_range(const stbtt__buf *b, int o, int s) -{ - stbtt__buf r = stbtt__new_buf(NULL, 0); - if (o < 0 || s < 0 || o > b->size || s > b->size - o) return r; - r.data = b->data + o; - r.size = s; - return r; -} - -static stbtt__buf stbtt__cff_get_index(stbtt__buf *b) -{ - int count, start, offsize; - start = b->cursor; - count = stbtt__buf_get16(b); - if (count) { - offsize = stbtt__buf_get8(b); - STBTT_assert(offsize >= 1 && offsize <= 4); - stbtt__buf_skip(b, offsize * count); - stbtt__buf_skip(b, stbtt__buf_get(b, offsize) - 1); - } - return stbtt__buf_range(b, start, b->cursor - start); -} - -static stbtt_uint32 stbtt__cff_int(stbtt__buf *b) -{ - int b0 = stbtt__buf_get8(b); - if (b0 >= 32 && b0 <= 246) return b0 - 139; - else if (b0 >= 247 && b0 <= 250) return (b0 - 247)*256 + stbtt__buf_get8(b) + 108; - else if (b0 >= 251 && b0 <= 254) return -(b0 - 251)*256 - stbtt__buf_get8(b) - 108; - else if (b0 == 28) return stbtt__buf_get16(b); - else if (b0 == 29) return stbtt__buf_get32(b); - STBTT_assert(0); - return 0; -} - -static void stbtt__cff_skip_operand(stbtt__buf *b) { - int v, b0 = stbtt__buf_peek8(b); - STBTT_assert(b0 >= 28); - if (b0 == 30) { - stbtt__buf_skip(b, 1); - while (b->cursor < b->size) { - v = stbtt__buf_get8(b); - if ((v & 0xF) == 0xF || (v >> 4) == 0xF) - break; - } - } else { - stbtt__cff_int(b); - } -} - -static stbtt__buf stbtt__dict_get(stbtt__buf *b, int key) -{ - stbtt__buf_seek(b, 0); - while (b->cursor < b->size) { - int start = b->cursor, end, op; - while (stbtt__buf_peek8(b) >= 28) - stbtt__cff_skip_operand(b); - end = b->cursor; - op = stbtt__buf_get8(b); - if (op == 12) op = stbtt__buf_get8(b) | 0x100; - if (op == key) return stbtt__buf_range(b, start, end-start); - } - return stbtt__buf_range(b, 0, 0); -} - -static void stbtt__dict_get_ints(stbtt__buf *b, int key, int outcount, stbtt_uint32 *out) -{ - int i; - stbtt__buf operands = stbtt__dict_get(b, key); - for (i = 0; i < outcount && operands.cursor < operands.size; i++) - out[i] = stbtt__cff_int(&operands); -} - -static int stbtt__cff_index_count(stbtt__buf *b) -{ - stbtt__buf_seek(b, 0); - return stbtt__buf_get16(b); -} - -static stbtt__buf stbtt__cff_index_get(stbtt__buf b, int i) -{ - int count, offsize, start, end; - stbtt__buf_seek(&b, 0); - count = stbtt__buf_get16(&b); - offsize = stbtt__buf_get8(&b); - STBTT_assert(i >= 0 && i < count); - STBTT_assert(offsize >= 1 && offsize <= 4); - stbtt__buf_skip(&b, i*offsize); - start = stbtt__buf_get(&b, offsize); - end = stbtt__buf_get(&b, offsize); - return stbtt__buf_range(&b, 2+(count+1)*offsize+start, end - start); -} - -////////////////////////////////////////////////////////////////////////// -// -// accessors to parse data from file -// - -// on platforms that don't allow misaligned reads, if we want to allow -// truetype fonts that aren't padded to alignment, define ALLOW_UNALIGNED_TRUETYPE - -#define ttBYTE(p) (* (stbtt_uint8 *) (p)) -#define ttCHAR(p) (* (stbtt_int8 *) (p)) -#define ttFixed(p) ttLONG(p) - -static stbtt_uint16 ttUSHORT(stbtt_uint8 *p) { return p[0]*256 + p[1]; } -static stbtt_int16 ttSHORT(stbtt_uint8 *p) { return p[0]*256 + p[1]; } -static stbtt_uint32 ttULONG(stbtt_uint8 *p) { return (p[0]<<24) + (p[1]<<16) + (p[2]<<8) + p[3]; } -static stbtt_int32 ttLONG(stbtt_uint8 *p) { return (p[0]<<24) + (p[1]<<16) + (p[2]<<8) + p[3]; } - -#define stbtt_tag4(p,c0,c1,c2,c3) ((p)[0] == (c0) && (p)[1] == (c1) && (p)[2] == (c2) && (p)[3] == (c3)) -#define stbtt_tag(p,str) stbtt_tag4(p,str[0],str[1],str[2],str[3]) - -static int stbtt__isfont(stbtt_uint8 *font) -{ - // check the version number - if (stbtt_tag4(font, '1',0,0,0)) return 1; // TrueType 1 - if (stbtt_tag(font, "typ1")) return 1; // TrueType with type 1 font -- we don't support this! - if (stbtt_tag(font, "OTTO")) return 1; // OpenType with CFF - if (stbtt_tag4(font, 0,1,0,0)) return 1; // OpenType 1.0 - if (stbtt_tag(font, "true")) return 1; // Apple specification for TrueType fonts - return 0; -} - -// @OPTIMIZE: binary search -static stbtt_uint32 stbtt__find_table(stbtt_uint8 *data, stbtt_uint32 fontstart, const char *tag) -{ - stbtt_int32 num_tables = ttUSHORT(data+fontstart+4); - stbtt_uint32 tabledir = fontstart + 12; - stbtt_int32 i; - for (i=0; i < num_tables; ++i) { - stbtt_uint32 loc = tabledir + 16*i; - if (stbtt_tag(data+loc+0, tag)) - return ttULONG(data+loc+8); - } - return 0; -} - -static int stbtt_GetFontOffsetForIndex_internal(unsigned char *font_collection, int index) -{ - // if it's just a font, there's only one valid index - if (stbtt__isfont(font_collection)) - return index == 0 ? 0 : -1; - - // check if it's a TTC - if (stbtt_tag(font_collection, "ttcf")) { - // version 1? - if (ttULONG(font_collection+4) == 0x00010000 || ttULONG(font_collection+4) == 0x00020000) { - stbtt_int32 n = ttLONG(font_collection+8); - if (index >= n) - return -1; - return ttULONG(font_collection+12+index*4); - } - } - return -1; -} - -static int stbtt_GetNumberOfFonts_internal(unsigned char *font_collection) -{ - // if it's just a font, there's only one valid font - if (stbtt__isfont(font_collection)) - return 1; - - // check if it's a TTC - if (stbtt_tag(font_collection, "ttcf")) { - // version 1? - if (ttULONG(font_collection+4) == 0x00010000 || ttULONG(font_collection+4) == 0x00020000) { - return ttLONG(font_collection+8); - } - } - return 0; -} - -static stbtt__buf stbtt__get_subrs(stbtt__buf cff, stbtt__buf fontdict) -{ - stbtt_uint32 subrsoff = 0, private_loc[2] = { 0, 0 }; - stbtt__buf pdict; - stbtt__dict_get_ints(&fontdict, 18, 2, private_loc); - if (!private_loc[1] || !private_loc[0]) return stbtt__new_buf(NULL, 0); - pdict = stbtt__buf_range(&cff, private_loc[1], private_loc[0]); - stbtt__dict_get_ints(&pdict, 19, 1, &subrsoff); - if (!subrsoff) return stbtt__new_buf(NULL, 0); - stbtt__buf_seek(&cff, private_loc[1]+subrsoff); - return stbtt__cff_get_index(&cff); -} - -// since most people won't use this, find this table the first time it's needed -static int stbtt__get_svg(stbtt_fontinfo *info) -{ - stbtt_uint32 t; - if (info->svg < 0) { - t = stbtt__find_table(info->data, info->fontstart, "SVG "); - if (t) { - stbtt_uint32 offset = ttULONG(info->data + t + 2); - info->svg = t + offset; - } else { - info->svg = 0; - } - } - return info->svg; -} - -static int stbtt_InitFont_internal(stbtt_fontinfo *info, unsigned char *data, int fontstart) -{ - stbtt_uint32 cmap, t; - stbtt_int32 i,numTables; - - info->data = data; - info->fontstart = fontstart; - info->cff = stbtt__new_buf(NULL, 0); - - cmap = stbtt__find_table(data, fontstart, "cmap"); // required - info->loca = stbtt__find_table(data, fontstart, "loca"); // required - info->head = stbtt__find_table(data, fontstart, "head"); // required - info->glyf = stbtt__find_table(data, fontstart, "glyf"); // required - info->hhea = stbtt__find_table(data, fontstart, "hhea"); // required - info->hmtx = stbtt__find_table(data, fontstart, "hmtx"); // required - info->kern = stbtt__find_table(data, fontstart, "kern"); // not required - info->gpos = stbtt__find_table(data, fontstart, "GPOS"); // not required - - if (!cmap || !info->head || !info->hhea || !info->hmtx) - return 0; - if (info->glyf) { - // required for truetype - if (!info->loca) return 0; - } else { - // initialization for CFF / Type2 fonts (OTF) - stbtt__buf b, topdict, topdictidx; - stbtt_uint32 cstype = 2, charstrings = 0, fdarrayoff = 0, fdselectoff = 0; - stbtt_uint32 cff; - - cff = stbtt__find_table(data, fontstart, "CFF "); - if (!cff) return 0; - - info->fontdicts = stbtt__new_buf(NULL, 0); - info->fdselect = stbtt__new_buf(NULL, 0); - - // @TODO this should use size from table (not 512MB) - info->cff = stbtt__new_buf(data+cff, 512*1024*1024); - b = info->cff; - - // read the header - stbtt__buf_skip(&b, 2); - stbtt__buf_seek(&b, stbtt__buf_get8(&b)); // hdrsize - - // @TODO the name INDEX could list multiple fonts, - // but we just use the first one. - stbtt__cff_get_index(&b); // name INDEX - topdictidx = stbtt__cff_get_index(&b); - topdict = stbtt__cff_index_get(topdictidx, 0); - stbtt__cff_get_index(&b); // string INDEX - info->gsubrs = stbtt__cff_get_index(&b); - - stbtt__dict_get_ints(&topdict, 17, 1, &charstrings); - stbtt__dict_get_ints(&topdict, 0x100 | 6, 1, &cstype); - stbtt__dict_get_ints(&topdict, 0x100 | 36, 1, &fdarrayoff); - stbtt__dict_get_ints(&topdict, 0x100 | 37, 1, &fdselectoff); - info->subrs = stbtt__get_subrs(b, topdict); - - // we only support Type 2 charstrings - if (cstype != 2) return 0; - if (charstrings == 0) return 0; - - if (fdarrayoff) { - // looks like a CID font - if (!fdselectoff) return 0; - stbtt__buf_seek(&b, fdarrayoff); - info->fontdicts = stbtt__cff_get_index(&b); - info->fdselect = stbtt__buf_range(&b, fdselectoff, b.size-fdselectoff); - } - - stbtt__buf_seek(&b, charstrings); - info->charstrings = stbtt__cff_get_index(&b); - } - - t = stbtt__find_table(data, fontstart, "maxp"); - if (t) - info->numGlyphs = ttUSHORT(data+t+4); - else - info->numGlyphs = 0xffff; - - info->svg = -1; - - // find a cmap encoding table we understand *now* to avoid searching - // later. (todo: could make this installable) - // the same regardless of glyph. - numTables = ttUSHORT(data + cmap + 2); - info->index_map = 0; - for (i=0; i < numTables; ++i) { - stbtt_uint32 encoding_record = cmap + 4 + 8 * i; - // find an encoding we understand: - switch(ttUSHORT(data+encoding_record)) { - case STBTT_PLATFORM_ID_MICROSOFT: - switch (ttUSHORT(data+encoding_record+2)) { - case STBTT_MS_EID_UNICODE_BMP: - case STBTT_MS_EID_UNICODE_FULL: - // MS/Unicode - info->index_map = cmap + ttULONG(data+encoding_record+4); - break; - } - break; - case STBTT_PLATFORM_ID_UNICODE: - // Mac/iOS has these - // all the encodingIDs are unicode, so we don't bother to check it - info->index_map = cmap + ttULONG(data+encoding_record+4); - break; - } - } - if (info->index_map == 0) - return 0; - - info->indexToLocFormat = ttUSHORT(data+info->head + 50); - return 1; -} - -STBTT_DEF int stbtt_FindGlyphIndex(const stbtt_fontinfo *info, int unicode_codepoint) -{ - stbtt_uint8 *data = info->data; - stbtt_uint32 index_map = info->index_map; - - stbtt_uint16 format = ttUSHORT(data + index_map + 0); - if (format == 0) { // apple byte encoding - stbtt_int32 bytes = ttUSHORT(data + index_map + 2); - if (unicode_codepoint < bytes-6) - return ttBYTE(data + index_map + 6 + unicode_codepoint); - return 0; - } else if (format == 6) { - stbtt_uint32 first = ttUSHORT(data + index_map + 6); - stbtt_uint32 count = ttUSHORT(data + index_map + 8); - if ((stbtt_uint32) unicode_codepoint >= first && (stbtt_uint32) unicode_codepoint < first+count) - return ttUSHORT(data + index_map + 10 + (unicode_codepoint - first)*2); - return 0; - } else if (format == 2) { - STBTT_assert(0); // @TODO: high-byte mapping for japanese/chinese/korean - return 0; - } else if (format == 4) { // standard mapping for windows fonts: binary search collection of ranges - stbtt_uint16 segcount = ttUSHORT(data+index_map+6) >> 1; - stbtt_uint16 searchRange = ttUSHORT(data+index_map+8) >> 1; - stbtt_uint16 entrySelector = ttUSHORT(data+index_map+10); - stbtt_uint16 rangeShift = ttUSHORT(data+index_map+12) >> 1; - - // do a binary search of the segments - stbtt_uint32 endCount = index_map + 14; - stbtt_uint32 search = endCount; - - if (unicode_codepoint > 0xffff) - return 0; - - // they lie from endCount .. endCount + segCount - // but searchRange is the nearest power of two, so... - if (unicode_codepoint >= ttUSHORT(data + search + rangeShift*2)) - search += rangeShift*2; - - // now decrement to bias correctly to find smallest - search -= 2; - while (entrySelector) { - stbtt_uint16 end; - searchRange >>= 1; - end = ttUSHORT(data + search + searchRange*2); - if (unicode_codepoint > end) - search += searchRange*2; - --entrySelector; - } - search += 2; - - { - stbtt_uint16 offset, start, last; - stbtt_uint16 item = (stbtt_uint16) ((search - endCount) >> 1); - - start = ttUSHORT(data + index_map + 14 + segcount*2 + 2 + 2*item); - last = ttUSHORT(data + endCount + 2*item); - if (unicode_codepoint < start || unicode_codepoint > last) - return 0; - - offset = ttUSHORT(data + index_map + 14 + segcount*6 + 2 + 2*item); - if (offset == 0) - return (stbtt_uint16) (unicode_codepoint + ttSHORT(data + index_map + 14 + segcount*4 + 2 + 2*item)); - - return ttUSHORT(data + offset + (unicode_codepoint-start)*2 + index_map + 14 + segcount*6 + 2 + 2*item); - } - } else if (format == 12 || format == 13) { - stbtt_uint32 ngroups = ttULONG(data+index_map+12); - stbtt_int32 low,high; - low = 0; high = (stbtt_int32)ngroups; - // Binary search the right group. - while (low < high) { - stbtt_int32 mid = low + ((high-low) >> 1); // rounds down, so low <= mid < high - stbtt_uint32 start_char = ttULONG(data+index_map+16+mid*12); - stbtt_uint32 end_char = ttULONG(data+index_map+16+mid*12+4); - if ((stbtt_uint32) unicode_codepoint < start_char) - high = mid; - else if ((stbtt_uint32) unicode_codepoint > end_char) - low = mid+1; - else { - stbtt_uint32 start_glyph = ttULONG(data+index_map+16+mid*12+8); - if (format == 12) - return start_glyph + unicode_codepoint-start_char; - else // format == 13 - return start_glyph; - } - } - return 0; // not found - } - // @TODO - STBTT_assert(0); - return 0; -} - -STBTT_DEF int stbtt_GetCodepointShape(const stbtt_fontinfo *info, int unicode_codepoint, stbtt_vertex **vertices) -{ - return stbtt_GetGlyphShape(info, stbtt_FindGlyphIndex(info, unicode_codepoint), vertices); -} - -static void stbtt_setvertex(stbtt_vertex *v, stbtt_uint8 type, stbtt_int32 x, stbtt_int32 y, stbtt_int32 cx, stbtt_int32 cy) -{ - v->type = type; - v->x = (stbtt_int16) x; - v->y = (stbtt_int16) y; - v->cx = (stbtt_int16) cx; - v->cy = (stbtt_int16) cy; -} - -static int stbtt__GetGlyfOffset(const stbtt_fontinfo *info, int glyph_index) -{ - int g1,g2; - - STBTT_assert(!info->cff.size); - - if (glyph_index >= info->numGlyphs) return -1; // glyph index out of range - if (info->indexToLocFormat >= 2) return -1; // unknown index->glyph map format - - if (info->indexToLocFormat == 0) { - g1 = info->glyf + ttUSHORT(info->data + info->loca + glyph_index * 2) * 2; - g2 = info->glyf + ttUSHORT(info->data + info->loca + glyph_index * 2 + 2) * 2; - } else { - g1 = info->glyf + ttULONG (info->data + info->loca + glyph_index * 4); - g2 = info->glyf + ttULONG (info->data + info->loca + glyph_index * 4 + 4); - } - - return g1==g2 ? -1 : g1; // if length is 0, return -1 -} - -static int stbtt__GetGlyphInfoT2(const stbtt_fontinfo *info, int glyph_index, int *x0, int *y0, int *x1, int *y1); - -STBTT_DEF int stbtt_GetGlyphBox(const stbtt_fontinfo *info, int glyph_index, int *x0, int *y0, int *x1, int *y1) -{ - if (info->cff.size) { - stbtt__GetGlyphInfoT2(info, glyph_index, x0, y0, x1, y1); - } else { - int g = stbtt__GetGlyfOffset(info, glyph_index); - if (g < 0) return 0; - - if (x0) *x0 = ttSHORT(info->data + g + 2); - if (y0) *y0 = ttSHORT(info->data + g + 4); - if (x1) *x1 = ttSHORT(info->data + g + 6); - if (y1) *y1 = ttSHORT(info->data + g + 8); - } - return 1; -} - -STBTT_DEF int stbtt_GetCodepointBox(const stbtt_fontinfo *info, int codepoint, int *x0, int *y0, int *x1, int *y1) -{ - return stbtt_GetGlyphBox(info, stbtt_FindGlyphIndex(info,codepoint), x0,y0,x1,y1); -} - -STBTT_DEF int stbtt_IsGlyphEmpty(const stbtt_fontinfo *info, int glyph_index) -{ - stbtt_int16 numberOfContours; - int g; - if (info->cff.size) - return stbtt__GetGlyphInfoT2(info, glyph_index, NULL, NULL, NULL, NULL) == 0; - g = stbtt__GetGlyfOffset(info, glyph_index); - if (g < 0) return 1; - numberOfContours = ttSHORT(info->data + g); - return numberOfContours == 0; -} - -static int stbtt__close_shape(stbtt_vertex *vertices, int num_vertices, int was_off, int start_off, - stbtt_int32 sx, stbtt_int32 sy, stbtt_int32 scx, stbtt_int32 scy, stbtt_int32 cx, stbtt_int32 cy) -{ - if (start_off) { - if (was_off) - stbtt_setvertex(&vertices[num_vertices++], STBTT_vcurve, (cx+scx)>>1, (cy+scy)>>1, cx,cy); - stbtt_setvertex(&vertices[num_vertices++], STBTT_vcurve, sx,sy,scx,scy); - } else { - if (was_off) - stbtt_setvertex(&vertices[num_vertices++], STBTT_vcurve,sx,sy,cx,cy); - else - stbtt_setvertex(&vertices[num_vertices++], STBTT_vline,sx,sy,0,0); - } - return num_vertices; -} - -static int stbtt__GetGlyphShapeTT(const stbtt_fontinfo *info, int glyph_index, stbtt_vertex **pvertices) -{ - stbtt_int16 numberOfContours; - stbtt_uint8 *endPtsOfContours; - stbtt_uint8 *data = info->data; - stbtt_vertex *vertices=0; - int num_vertices=0; - int g = stbtt__GetGlyfOffset(info, glyph_index); - - *pvertices = NULL; - - if (g < 0) return 0; - - numberOfContours = ttSHORT(data + g); - - if (numberOfContours > 0) { - stbtt_uint8 flags=0,flagcount; - stbtt_int32 ins, i,j=0,m,n, next_move, was_off=0, off, start_off=0; - stbtt_int32 x,y,cx,cy,sx,sy, scx,scy; - stbtt_uint8 *points; - endPtsOfContours = (data + g + 10); - ins = ttUSHORT(data + g + 10 + numberOfContours * 2); - points = data + g + 10 + numberOfContours * 2 + 2 + ins; - - n = 1+ttUSHORT(endPtsOfContours + numberOfContours*2-2); - - m = n + 2*numberOfContours; // a loose bound on how many vertices we might need - vertices = (stbtt_vertex *) STBTT_malloc(m * sizeof(vertices[0]), info->userdata); - if (vertices == 0) - return 0; - - next_move = 0; - flagcount=0; - - // in first pass, we load uninterpreted data into the allocated array - // above, shifted to the end of the array so we won't overwrite it when - // we create our final data starting from the front - - off = m - n; // starting offset for uninterpreted data, regardless of how m ends up being calculated - - // first load flags - - for (i=0; i < n; ++i) { - if (flagcount == 0) { - flags = *points++; - if (flags & 8) - flagcount = *points++; - } else - --flagcount; - vertices[off+i].type = flags; - } - - // now load x coordinates - x=0; - for (i=0; i < n; ++i) { - flags = vertices[off+i].type; - if (flags & 2) { - stbtt_int16 dx = *points++; - x += (flags & 16) ? dx : -dx; // ??? - } else { - if (!(flags & 16)) { - x = x + (stbtt_int16) (points[0]*256 + points[1]); - points += 2; - } - } - vertices[off+i].x = (stbtt_int16) x; - } - - // now load y coordinates - y=0; - for (i=0; i < n; ++i) { - flags = vertices[off+i].type; - if (flags & 4) { - stbtt_int16 dy = *points++; - y += (flags & 32) ? dy : -dy; // ??? - } else { - if (!(flags & 32)) { - y = y + (stbtt_int16) (points[0]*256 + points[1]); - points += 2; - } - } - vertices[off+i].y = (stbtt_int16) y; - } - - // now convert them to our format - num_vertices=0; - sx = sy = cx = cy = scx = scy = 0; - for (i=0; i < n; ++i) { - flags = vertices[off+i].type; - x = (stbtt_int16) vertices[off+i].x; - y = (stbtt_int16) vertices[off+i].y; - - if (next_move == i) { - if (i != 0) - num_vertices = stbtt__close_shape(vertices, num_vertices, was_off, start_off, sx,sy,scx,scy,cx,cy); - - // now start the new one - start_off = !(flags & 1); - if (start_off) { - // if we start off with an off-curve point, then when we need to find a point on the curve - // where we can start, and we need to save some state for when we wraparound. - scx = x; - scy = y; - if (!(vertices[off+i+1].type & 1)) { - // next point is also a curve point, so interpolate an on-point curve - sx = (x + (stbtt_int32) vertices[off+i+1].x) >> 1; - sy = (y + (stbtt_int32) vertices[off+i+1].y) >> 1; - } else { - // otherwise just use the next point as our start point - sx = (stbtt_int32) vertices[off+i+1].x; - sy = (stbtt_int32) vertices[off+i+1].y; - ++i; // we're using point i+1 as the starting point, so skip it - } - } else { - sx = x; - sy = y; - } - stbtt_setvertex(&vertices[num_vertices++], STBTT_vmove,sx,sy,0,0); - was_off = 0; - next_move = 1 + ttUSHORT(endPtsOfContours+j*2); - ++j; - } else { - if (!(flags & 1)) { // if it's a curve - if (was_off) // two off-curve control points in a row means interpolate an on-curve midpoint - stbtt_setvertex(&vertices[num_vertices++], STBTT_vcurve, (cx+x)>>1, (cy+y)>>1, cx, cy); - cx = x; - cy = y; - was_off = 1; - } else { - if (was_off) - stbtt_setvertex(&vertices[num_vertices++], STBTT_vcurve, x,y, cx, cy); - else - stbtt_setvertex(&vertices[num_vertices++], STBTT_vline, x,y,0,0); - was_off = 0; - } - } - } - num_vertices = stbtt__close_shape(vertices, num_vertices, was_off, start_off, sx,sy,scx,scy,cx,cy); - } else if (numberOfContours < 0) { - // Compound shapes. - int more = 1; - stbtt_uint8 *comp = data + g + 10; - num_vertices = 0; - vertices = 0; - while (more) { - stbtt_uint16 flags, gidx; - int comp_num_verts = 0, i; - stbtt_vertex *comp_verts = 0, *tmp = 0; - float mtx[6] = {1,0,0,1,0,0}, m, n; - - flags = ttSHORT(comp); comp+=2; - gidx = ttSHORT(comp); comp+=2; - - if (flags & 2) { // XY values - if (flags & 1) { // shorts - mtx[4] = ttSHORT(comp); comp+=2; - mtx[5] = ttSHORT(comp); comp+=2; - } else { - mtx[4] = ttCHAR(comp); comp+=1; - mtx[5] = ttCHAR(comp); comp+=1; - } - } - else { - // @TODO handle matching point - STBTT_assert(0); - } - if (flags & (1<<3)) { // WE_HAVE_A_SCALE - mtx[0] = mtx[3] = ttSHORT(comp)/16384.0f; comp+=2; - mtx[1] = mtx[2] = 0; - } else if (flags & (1<<6)) { // WE_HAVE_AN_X_AND_YSCALE - mtx[0] = ttSHORT(comp)/16384.0f; comp+=2; - mtx[1] = mtx[2] = 0; - mtx[3] = ttSHORT(comp)/16384.0f; comp+=2; - } else if (flags & (1<<7)) { // WE_HAVE_A_TWO_BY_TWO - mtx[0] = ttSHORT(comp)/16384.0f; comp+=2; - mtx[1] = ttSHORT(comp)/16384.0f; comp+=2; - mtx[2] = ttSHORT(comp)/16384.0f; comp+=2; - mtx[3] = ttSHORT(comp)/16384.0f; comp+=2; - } - - // Find transformation scales. - m = (float) STBTT_sqrt(mtx[0]*mtx[0] + mtx[1]*mtx[1]); - n = (float) STBTT_sqrt(mtx[2]*mtx[2] + mtx[3]*mtx[3]); - - // Get indexed glyph. - comp_num_verts = stbtt_GetGlyphShape(info, gidx, &comp_verts); - if (comp_num_verts > 0) { - // Transform vertices. - for (i = 0; i < comp_num_verts; ++i) { - stbtt_vertex* v = &comp_verts[i]; - stbtt_vertex_type x,y; - x=v->x; y=v->y; - v->x = (stbtt_vertex_type)(m * (mtx[0]*x + mtx[2]*y + mtx[4])); - v->y = (stbtt_vertex_type)(n * (mtx[1]*x + mtx[3]*y + mtx[5])); - x=v->cx; y=v->cy; - v->cx = (stbtt_vertex_type)(m * (mtx[0]*x + mtx[2]*y + mtx[4])); - v->cy = (stbtt_vertex_type)(n * (mtx[1]*x + mtx[3]*y + mtx[5])); - } - // Append vertices. - tmp = (stbtt_vertex*)STBTT_malloc((num_vertices+comp_num_verts)*sizeof(stbtt_vertex), info->userdata); - if (!tmp) { - if (vertices) STBTT_free(vertices, info->userdata); - if (comp_verts) STBTT_free(comp_verts, info->userdata); - return 0; - } - if (num_vertices > 0 && vertices) STBTT_memcpy(tmp, vertices, num_vertices*sizeof(stbtt_vertex)); - STBTT_memcpy(tmp+num_vertices, comp_verts, comp_num_verts*sizeof(stbtt_vertex)); - if (vertices) STBTT_free(vertices, info->userdata); - vertices = tmp; - STBTT_free(comp_verts, info->userdata); - num_vertices += comp_num_verts; - } - // More components ? - more = flags & (1<<5); - } - } else { - // numberOfCounters == 0, do nothing - } - - *pvertices = vertices; - return num_vertices; -} - -typedef struct -{ - int bounds; - int started; - float first_x, first_y; - float x, y; - stbtt_int32 min_x, max_x, min_y, max_y; - - stbtt_vertex *pvertices; - int num_vertices; -} stbtt__csctx; - -#define STBTT__CSCTX_INIT(bounds) {bounds,0, 0,0, 0,0, 0,0,0,0, NULL, 0} - -static void stbtt__track_vertex(stbtt__csctx *c, stbtt_int32 x, stbtt_int32 y) -{ - if (x > c->max_x || !c->started) c->max_x = x; - if (y > c->max_y || !c->started) c->max_y = y; - if (x < c->min_x || !c->started) c->min_x = x; - if (y < c->min_y || !c->started) c->min_y = y; - c->started = 1; -} - -static void stbtt__csctx_v(stbtt__csctx *c, stbtt_uint8 type, stbtt_int32 x, stbtt_int32 y, stbtt_int32 cx, stbtt_int32 cy, stbtt_int32 cx1, stbtt_int32 cy1) -{ - if (c->bounds) { - stbtt__track_vertex(c, x, y); - if (type == STBTT_vcubic) { - stbtt__track_vertex(c, cx, cy); - stbtt__track_vertex(c, cx1, cy1); - } - } else { - stbtt_setvertex(&c->pvertices[c->num_vertices], type, x, y, cx, cy); - c->pvertices[c->num_vertices].cx1 = (stbtt_int16) cx1; - c->pvertices[c->num_vertices].cy1 = (stbtt_int16) cy1; - } - c->num_vertices++; -} - -static void stbtt__csctx_close_shape(stbtt__csctx *ctx) -{ - if (ctx->first_x != ctx->x || ctx->first_y != ctx->y) - stbtt__csctx_v(ctx, STBTT_vline, (int)ctx->first_x, (int)ctx->first_y, 0, 0, 0, 0); -} - -static void stbtt__csctx_rmove_to(stbtt__csctx *ctx, float dx, float dy) -{ - stbtt__csctx_close_shape(ctx); - ctx->first_x = ctx->x = ctx->x + dx; - ctx->first_y = ctx->y = ctx->y + dy; - stbtt__csctx_v(ctx, STBTT_vmove, (int)ctx->x, (int)ctx->y, 0, 0, 0, 0); -} - -static void stbtt__csctx_rline_to(stbtt__csctx *ctx, float dx, float dy) -{ - ctx->x += dx; - ctx->y += dy; - stbtt__csctx_v(ctx, STBTT_vline, (int)ctx->x, (int)ctx->y, 0, 0, 0, 0); -} - -static void stbtt__csctx_rccurve_to(stbtt__csctx *ctx, float dx1, float dy1, float dx2, float dy2, float dx3, float dy3) -{ - float cx1 = ctx->x + dx1; - float cy1 = ctx->y + dy1; - float cx2 = cx1 + dx2; - float cy2 = cy1 + dy2; - ctx->x = cx2 + dx3; - ctx->y = cy2 + dy3; - stbtt__csctx_v(ctx, STBTT_vcubic, (int)ctx->x, (int)ctx->y, (int)cx1, (int)cy1, (int)cx2, (int)cy2); -} - -static stbtt__buf stbtt__get_subr(stbtt__buf idx, int n) -{ - int count = stbtt__cff_index_count(&idx); - int bias = 107; - if (count >= 33900) - bias = 32768; - else if (count >= 1240) - bias = 1131; - n += bias; - if (n < 0 || n >= count) - return stbtt__new_buf(NULL, 0); - return stbtt__cff_index_get(idx, n); -} - -static stbtt__buf stbtt__cid_get_glyph_subrs(const stbtt_fontinfo *info, int glyph_index) -{ - stbtt__buf fdselect = info->fdselect; - int nranges, start, end, v, fmt, fdselector = -1, i; - - stbtt__buf_seek(&fdselect, 0); - fmt = stbtt__buf_get8(&fdselect); - if (fmt == 0) { - // untested - stbtt__buf_skip(&fdselect, glyph_index); - fdselector = stbtt__buf_get8(&fdselect); - } else if (fmt == 3) { - nranges = stbtt__buf_get16(&fdselect); - start = stbtt__buf_get16(&fdselect); - for (i = 0; i < nranges; i++) { - v = stbtt__buf_get8(&fdselect); - end = stbtt__buf_get16(&fdselect); - if (glyph_index >= start && glyph_index < end) { - fdselector = v; - break; - } - start = end; - } - } - if (fdselector == -1) stbtt__new_buf(NULL, 0); - return stbtt__get_subrs(info->cff, stbtt__cff_index_get(info->fontdicts, fdselector)); -} - -static int stbtt__run_charstring(const stbtt_fontinfo *info, int glyph_index, stbtt__csctx *c) -{ - int in_header = 1, maskbits = 0, subr_stack_height = 0, sp = 0, v, i, b0; - int has_subrs = 0, clear_stack; - float s[48]; - stbtt__buf subr_stack[10], subrs = info->subrs, b; - float f; - -#define STBTT__CSERR(s) (0) - - // this currently ignores the initial width value, which isn't needed if we have hmtx - b = stbtt__cff_index_get(info->charstrings, glyph_index); - while (b.cursor < b.size) { - i = 0; - clear_stack = 1; - b0 = stbtt__buf_get8(&b); - switch (b0) { - // @TODO implement hinting - case 0x13: // hintmask - case 0x14: // cntrmask - if (in_header) - maskbits += (sp / 2); // implicit "vstem" - in_header = 0; - stbtt__buf_skip(&b, (maskbits + 7) / 8); - break; - - case 0x01: // hstem - case 0x03: // vstem - case 0x12: // hstemhm - case 0x17: // vstemhm - maskbits += (sp / 2); - break; - - case 0x15: // rmoveto - in_header = 0; - if (sp < 2) return STBTT__CSERR("rmoveto stack"); - stbtt__csctx_rmove_to(c, s[sp-2], s[sp-1]); - break; - case 0x04: // vmoveto - in_header = 0; - if (sp < 1) return STBTT__CSERR("vmoveto stack"); - stbtt__csctx_rmove_to(c, 0, s[sp-1]); - break; - case 0x16: // hmoveto - in_header = 0; - if (sp < 1) return STBTT__CSERR("hmoveto stack"); - stbtt__csctx_rmove_to(c, s[sp-1], 0); - break; - - case 0x05: // rlineto - if (sp < 2) return STBTT__CSERR("rlineto stack"); - for (; i + 1 < sp; i += 2) - stbtt__csctx_rline_to(c, s[i], s[i+1]); - break; - - // hlineto/vlineto and vhcurveto/hvcurveto alternate horizontal and vertical - // starting from a different place. - - case 0x07: // vlineto - if (sp < 1) return STBTT__CSERR("vlineto stack"); - goto vlineto; - case 0x06: // hlineto - if (sp < 1) return STBTT__CSERR("hlineto stack"); - for (;;) { - if (i >= sp) break; - stbtt__csctx_rline_to(c, s[i], 0); - i++; - vlineto: - if (i >= sp) break; - stbtt__csctx_rline_to(c, 0, s[i]); - i++; - } - break; - - case 0x1F: // hvcurveto - if (sp < 4) return STBTT__CSERR("hvcurveto stack"); - goto hvcurveto; - case 0x1E: // vhcurveto - if (sp < 4) return STBTT__CSERR("vhcurveto stack"); - for (;;) { - if (i + 3 >= sp) break; - stbtt__csctx_rccurve_to(c, 0, s[i], s[i+1], s[i+2], s[i+3], (sp - i == 5) ? s[i + 4] : 0.0f); - i += 4; - hvcurveto: - if (i + 3 >= sp) break; - stbtt__csctx_rccurve_to(c, s[i], 0, s[i+1], s[i+2], (sp - i == 5) ? s[i+4] : 0.0f, s[i+3]); - i += 4; - } - break; - - case 0x08: // rrcurveto - if (sp < 6) return STBTT__CSERR("rcurveline stack"); - for (; i + 5 < sp; i += 6) - stbtt__csctx_rccurve_to(c, s[i], s[i+1], s[i+2], s[i+3], s[i+4], s[i+5]); - break; - - case 0x18: // rcurveline - if (sp < 8) return STBTT__CSERR("rcurveline stack"); - for (; i + 5 < sp - 2; i += 6) - stbtt__csctx_rccurve_to(c, s[i], s[i+1], s[i+2], s[i+3], s[i+4], s[i+5]); - if (i + 1 >= sp) return STBTT__CSERR("rcurveline stack"); - stbtt__csctx_rline_to(c, s[i], s[i+1]); - break; - - case 0x19: // rlinecurve - if (sp < 8) return STBTT__CSERR("rlinecurve stack"); - for (; i + 1 < sp - 6; i += 2) - stbtt__csctx_rline_to(c, s[i], s[i+1]); - if (i + 5 >= sp) return STBTT__CSERR("rlinecurve stack"); - stbtt__csctx_rccurve_to(c, s[i], s[i+1], s[i+2], s[i+3], s[i+4], s[i+5]); - break; - - case 0x1A: // vvcurveto - case 0x1B: // hhcurveto - if (sp < 4) return STBTT__CSERR("(vv|hh)curveto stack"); - f = 0.0; - if (sp & 1) { f = s[i]; i++; } - for (; i + 3 < sp; i += 4) { - if (b0 == 0x1B) - stbtt__csctx_rccurve_to(c, s[i], f, s[i+1], s[i+2], s[i+3], 0.0); - else - stbtt__csctx_rccurve_to(c, f, s[i], s[i+1], s[i+2], 0.0, s[i+3]); - f = 0.0; - } - break; - - case 0x0A: // callsubr - if (!has_subrs) { - if (info->fdselect.size) - subrs = stbtt__cid_get_glyph_subrs(info, glyph_index); - has_subrs = 1; - } - // FALLTHROUGH - case 0x1D: // callgsubr - if (sp < 1) return STBTT__CSERR("call(g|)subr stack"); - v = (int) s[--sp]; - if (subr_stack_height >= 10) return STBTT__CSERR("recursion limit"); - subr_stack[subr_stack_height++] = b; - b = stbtt__get_subr(b0 == 0x0A ? subrs : info->gsubrs, v); - if (b.size == 0) return STBTT__CSERR("subr not found"); - b.cursor = 0; - clear_stack = 0; - break; - - case 0x0B: // return - if (subr_stack_height <= 0) return STBTT__CSERR("return outside subr"); - b = subr_stack[--subr_stack_height]; - clear_stack = 0; - break; - - case 0x0E: // endchar - stbtt__csctx_close_shape(c); - return 1; - - case 0x0C: { // two-byte escape - float dx1, dx2, dx3, dx4, dx5, dx6, dy1, dy2, dy3, dy4, dy5, dy6; - float dx, dy; - int b1 = stbtt__buf_get8(&b); - switch (b1) { - // @TODO These "flex" implementations ignore the flex-depth and resolution, - // and always draw beziers. - case 0x22: // hflex - if (sp < 7) return STBTT__CSERR("hflex stack"); - dx1 = s[0]; - dx2 = s[1]; - dy2 = s[2]; - dx3 = s[3]; - dx4 = s[4]; - dx5 = s[5]; - dx6 = s[6]; - stbtt__csctx_rccurve_to(c, dx1, 0, dx2, dy2, dx3, 0); - stbtt__csctx_rccurve_to(c, dx4, 0, dx5, -dy2, dx6, 0); - break; - - case 0x23: // flex - if (sp < 13) return STBTT__CSERR("flex stack"); - dx1 = s[0]; - dy1 = s[1]; - dx2 = s[2]; - dy2 = s[3]; - dx3 = s[4]; - dy3 = s[5]; - dx4 = s[6]; - dy4 = s[7]; - dx5 = s[8]; - dy5 = s[9]; - dx6 = s[10]; - dy6 = s[11]; - //fd is s[12] - stbtt__csctx_rccurve_to(c, dx1, dy1, dx2, dy2, dx3, dy3); - stbtt__csctx_rccurve_to(c, dx4, dy4, dx5, dy5, dx6, dy6); - break; - - case 0x24: // hflex1 - if (sp < 9) return STBTT__CSERR("hflex1 stack"); - dx1 = s[0]; - dy1 = s[1]; - dx2 = s[2]; - dy2 = s[3]; - dx3 = s[4]; - dx4 = s[5]; - dx5 = s[6]; - dy5 = s[7]; - dx6 = s[8]; - stbtt__csctx_rccurve_to(c, dx1, dy1, dx2, dy2, dx3, 0); - stbtt__csctx_rccurve_to(c, dx4, 0, dx5, dy5, dx6, -(dy1+dy2+dy5)); - break; - - case 0x25: // flex1 - if (sp < 11) return STBTT__CSERR("flex1 stack"); - dx1 = s[0]; - dy1 = s[1]; - dx2 = s[2]; - dy2 = s[3]; - dx3 = s[4]; - dy3 = s[5]; - dx4 = s[6]; - dy4 = s[7]; - dx5 = s[8]; - dy5 = s[9]; - dx6 = dy6 = s[10]; - dx = dx1+dx2+dx3+dx4+dx5; - dy = dy1+dy2+dy3+dy4+dy5; - if (STBTT_fabs(dx) > STBTT_fabs(dy)) - dy6 = -dy; - else - dx6 = -dx; - stbtt__csctx_rccurve_to(c, dx1, dy1, dx2, dy2, dx3, dy3); - stbtt__csctx_rccurve_to(c, dx4, dy4, dx5, dy5, dx6, dy6); - break; - - default: - return STBTT__CSERR("unimplemented"); - } - } break; - - default: - if (b0 != 255 && b0 != 28 && b0 < 32) - return STBTT__CSERR("reserved operator"); - - // push immediate - if (b0 == 255) { - f = (float)(stbtt_int32)stbtt__buf_get32(&b) / 0x10000; - } else { - stbtt__buf_skip(&b, -1); - f = (float)(stbtt_int16)stbtt__cff_int(&b); - } - if (sp >= 48) return STBTT__CSERR("push stack overflow"); - s[sp++] = f; - clear_stack = 0; - break; - } - if (clear_stack) sp = 0; - } - return STBTT__CSERR("no endchar"); - -#undef STBTT__CSERR -} - -static int stbtt__GetGlyphShapeT2(const stbtt_fontinfo *info, int glyph_index, stbtt_vertex **pvertices) -{ - // runs the charstring twice, once to count and once to output (to avoid realloc) - stbtt__csctx count_ctx = STBTT__CSCTX_INIT(1); - stbtt__csctx output_ctx = STBTT__CSCTX_INIT(0); - if (stbtt__run_charstring(info, glyph_index, &count_ctx)) { - *pvertices = (stbtt_vertex*)STBTT_malloc(count_ctx.num_vertices*sizeof(stbtt_vertex), info->userdata); - output_ctx.pvertices = *pvertices; - if (stbtt__run_charstring(info, glyph_index, &output_ctx)) { - STBTT_assert(output_ctx.num_vertices == count_ctx.num_vertices); - return output_ctx.num_vertices; - } - } - *pvertices = NULL; - return 0; -} - -static int stbtt__GetGlyphInfoT2(const stbtt_fontinfo *info, int glyph_index, int *x0, int *y0, int *x1, int *y1) -{ - stbtt__csctx c = STBTT__CSCTX_INIT(1); - int r = stbtt__run_charstring(info, glyph_index, &c); - if (x0) *x0 = r ? c.min_x : 0; - if (y0) *y0 = r ? c.min_y : 0; - if (x1) *x1 = r ? c.max_x : 0; - if (y1) *y1 = r ? c.max_y : 0; - return r ? c.num_vertices : 0; -} - -STBTT_DEF int stbtt_GetGlyphShape(const stbtt_fontinfo *info, int glyph_index, stbtt_vertex **pvertices) -{ - if (!info->cff.size) - return stbtt__GetGlyphShapeTT(info, glyph_index, pvertices); - else - return stbtt__GetGlyphShapeT2(info, glyph_index, pvertices); -} - -STBTT_DEF void stbtt_GetGlyphHMetrics(const stbtt_fontinfo *info, int glyph_index, int *advanceWidth, int *leftSideBearing) -{ - stbtt_uint16 numOfLongHorMetrics = ttUSHORT(info->data+info->hhea + 34); - if (glyph_index < numOfLongHorMetrics) { - if (advanceWidth) *advanceWidth = ttSHORT(info->data + info->hmtx + 4*glyph_index); - if (leftSideBearing) *leftSideBearing = ttSHORT(info->data + info->hmtx + 4*glyph_index + 2); - } else { - if (advanceWidth) *advanceWidth = ttSHORT(info->data + info->hmtx + 4*(numOfLongHorMetrics-1)); - if (leftSideBearing) *leftSideBearing = ttSHORT(info->data + info->hmtx + 4*numOfLongHorMetrics + 2*(glyph_index - numOfLongHorMetrics)); - } -} - -STBTT_DEF int stbtt_GetKerningTableLength(const stbtt_fontinfo *info) -{ - stbtt_uint8 *data = info->data + info->kern; - - // we only look at the first table. it must be 'horizontal' and format 0. - if (!info->kern) - return 0; - if (ttUSHORT(data+2) < 1) // number of tables, need at least 1 - return 0; - if (ttUSHORT(data+8) != 1) // horizontal flag must be set in format - return 0; - - return ttUSHORT(data+10); -} - -STBTT_DEF int stbtt_GetKerningTable(const stbtt_fontinfo *info, stbtt_kerningentry* table, int table_length) -{ - stbtt_uint8 *data = info->data + info->kern; - int k, length; - - // we only look at the first table. it must be 'horizontal' and format 0. - if (!info->kern) - return 0; - if (ttUSHORT(data+2) < 1) // number of tables, need at least 1 - return 0; - if (ttUSHORT(data+8) != 1) // horizontal flag must be set in format - return 0; - - length = ttUSHORT(data+10); - if (table_length < length) - length = table_length; - - for (k = 0; k < length; k++) - { - table[k].glyph1 = ttUSHORT(data+18+(k*6)); - table[k].glyph2 = ttUSHORT(data+20+(k*6)); - table[k].advance = ttSHORT(data+22+(k*6)); - } - - return length; -} - -static int stbtt__GetGlyphKernInfoAdvance(const stbtt_fontinfo *info, int glyph1, int glyph2) -{ - stbtt_uint8 *data = info->data + info->kern; - stbtt_uint32 needle, straw; - int l, r, m; - - // we only look at the first table. it must be 'horizontal' and format 0. - if (!info->kern) - return 0; - if (ttUSHORT(data+2) < 1) // number of tables, need at least 1 - return 0; - if (ttUSHORT(data+8) != 1) // horizontal flag must be set in format - return 0; - - l = 0; - r = ttUSHORT(data+10) - 1; - needle = glyph1 << 16 | glyph2; - while (l <= r) { - m = (l + r) >> 1; - straw = ttULONG(data+18+(m*6)); // note: unaligned read - if (needle < straw) - r = m - 1; - else if (needle > straw) - l = m + 1; - else - return ttSHORT(data+22+(m*6)); - } - return 0; -} - -static stbtt_int32 stbtt__GetCoverageIndex(stbtt_uint8 *coverageTable, int glyph) -{ - stbtt_uint16 coverageFormat = ttUSHORT(coverageTable); - switch (coverageFormat) { - case 1: { - stbtt_uint16 glyphCount = ttUSHORT(coverageTable + 2); - - // Binary search. - stbtt_int32 l=0, r=glyphCount-1, m; - int straw, needle=glyph; - while (l <= r) { - stbtt_uint8 *glyphArray = coverageTable + 4; - stbtt_uint16 glyphID; - m = (l + r) >> 1; - glyphID = ttUSHORT(glyphArray + 2 * m); - straw = glyphID; - if (needle < straw) - r = m - 1; - else if (needle > straw) - l = m + 1; - else { - return m; - } - } - break; - } - - case 2: { - stbtt_uint16 rangeCount = ttUSHORT(coverageTable + 2); - stbtt_uint8 *rangeArray = coverageTable + 4; - - // Binary search. - stbtt_int32 l=0, r=rangeCount-1, m; - int strawStart, strawEnd, needle=glyph; - while (l <= r) { - stbtt_uint8 *rangeRecord; - m = (l + r) >> 1; - rangeRecord = rangeArray + 6 * m; - strawStart = ttUSHORT(rangeRecord); - strawEnd = ttUSHORT(rangeRecord + 2); - if (needle < strawStart) - r = m - 1; - else if (needle > strawEnd) - l = m + 1; - else { - stbtt_uint16 startCoverageIndex = ttUSHORT(rangeRecord + 4); - return startCoverageIndex + glyph - strawStart; - } - } - break; - } - - default: return -1; // unsupported - } - - return -1; -} - -static stbtt_int32 stbtt__GetGlyphClass(stbtt_uint8 *classDefTable, int glyph) -{ - stbtt_uint16 classDefFormat = ttUSHORT(classDefTable); - switch (classDefFormat) - { - case 1: { - stbtt_uint16 startGlyphID = ttUSHORT(classDefTable + 2); - stbtt_uint16 glyphCount = ttUSHORT(classDefTable + 4); - stbtt_uint8 *classDef1ValueArray = classDefTable + 6; - - if (glyph >= startGlyphID && glyph < startGlyphID + glyphCount) - return (stbtt_int32)ttUSHORT(classDef1ValueArray + 2 * (glyph - startGlyphID)); - break; - } - - case 2: { - stbtt_uint16 classRangeCount = ttUSHORT(classDefTable + 2); - stbtt_uint8 *classRangeRecords = classDefTable + 4; - - // Binary search. - stbtt_int32 l=0, r=classRangeCount-1, m; - int strawStart, strawEnd, needle=glyph; - while (l <= r) { - stbtt_uint8 *classRangeRecord; - m = (l + r) >> 1; - classRangeRecord = classRangeRecords + 6 * m; - strawStart = ttUSHORT(classRangeRecord); - strawEnd = ttUSHORT(classRangeRecord + 2); - if (needle < strawStart) - r = m - 1; - else if (needle > strawEnd) - l = m + 1; - else - return (stbtt_int32)ttUSHORT(classRangeRecord + 4); - } - break; - } - - default: - return -1; // Unsupported definition type, return an error. - } - - // "All glyphs not assigned to a class fall into class 0". (OpenType spec) - return 0; -} - -// Define to STBTT_assert(x) if you want to break on unimplemented formats. -#define STBTT_GPOS_TODO_assert(x) - -static stbtt_int32 stbtt__GetGlyphGPOSInfoAdvance(const stbtt_fontinfo *info, int glyph1, int glyph2) -{ - stbtt_uint16 lookupListOffset; - stbtt_uint8 *lookupList; - stbtt_uint16 lookupCount; - stbtt_uint8 *data; - stbtt_int32 i, sti; - - if (!info->gpos) return 0; - - data = info->data + info->gpos; - - if (ttUSHORT(data+0) != 1) return 0; // Major version 1 - if (ttUSHORT(data+2) != 0) return 0; // Minor version 0 - - lookupListOffset = ttUSHORT(data+8); - lookupList = data + lookupListOffset; - lookupCount = ttUSHORT(lookupList); - - for (i=0; i= pairSetCount) return 0; - - needle=glyph2; - r=pairValueCount-1; - l=0; - - // Binary search. - while (l <= r) { - stbtt_uint16 secondGlyph; - stbtt_uint8 *pairValue; - m = (l + r) >> 1; - pairValue = pairValueArray + (2 + valueRecordPairSizeInBytes) * m; - secondGlyph = ttUSHORT(pairValue); - straw = secondGlyph; - if (needle < straw) - r = m - 1; - else if (needle > straw) - l = m + 1; - else { - stbtt_int16 xAdvance = ttSHORT(pairValue + 2); - return xAdvance; - } - } - } else - return 0; - break; - } - - case 2: { - stbtt_uint16 valueFormat1 = ttUSHORT(table + 4); - stbtt_uint16 valueFormat2 = ttUSHORT(table + 6); - if (valueFormat1 == 4 && valueFormat2 == 0) { // Support more formats? - stbtt_uint16 classDef1Offset = ttUSHORT(table + 8); - stbtt_uint16 classDef2Offset = ttUSHORT(table + 10); - int glyph1class = stbtt__GetGlyphClass(table + classDef1Offset, glyph1); - int glyph2class = stbtt__GetGlyphClass(table + classDef2Offset, glyph2); - - stbtt_uint16 class1Count = ttUSHORT(table + 12); - stbtt_uint16 class2Count = ttUSHORT(table + 14); - stbtt_uint8 *class1Records, *class2Records; - stbtt_int16 xAdvance; - - if (glyph1class < 0 || glyph1class >= class1Count) return 0; // malformed - if (glyph2class < 0 || glyph2class >= class2Count) return 0; // malformed - - class1Records = table + 16; - class2Records = class1Records + 2 * (glyph1class * class2Count); - xAdvance = ttSHORT(class2Records + 2 * glyph2class); - return xAdvance; - } else - return 0; - break; - } - - default: - return 0; // Unsupported position format - } - } - } - - return 0; -} - -STBTT_DEF int stbtt_GetGlyphKernAdvance(const stbtt_fontinfo *info, int g1, int g2) -{ - int xAdvance = 0; - - if (info->gpos) - xAdvance += stbtt__GetGlyphGPOSInfoAdvance(info, g1, g2); - else if (info->kern) - xAdvance += stbtt__GetGlyphKernInfoAdvance(info, g1, g2); - - return xAdvance; -} - -STBTT_DEF int stbtt_GetCodepointKernAdvance(const stbtt_fontinfo *info, int ch1, int ch2) -{ - if (!info->kern && !info->gpos) // if no kerning table, don't waste time looking up both codepoint->glyphs - return 0; - return stbtt_GetGlyphKernAdvance(info, stbtt_FindGlyphIndex(info,ch1), stbtt_FindGlyphIndex(info,ch2)); -} - -STBTT_DEF void stbtt_GetCodepointHMetrics(const stbtt_fontinfo *info, int codepoint, int *advanceWidth, int *leftSideBearing) -{ - stbtt_GetGlyphHMetrics(info, stbtt_FindGlyphIndex(info,codepoint), advanceWidth, leftSideBearing); -} - -STBTT_DEF void stbtt_GetFontVMetrics(const stbtt_fontinfo *info, int *ascent, int *descent, int *lineGap) -{ - if (ascent ) *ascent = ttSHORT(info->data+info->hhea + 4); - if (descent) *descent = ttSHORT(info->data+info->hhea + 6); - if (lineGap) *lineGap = ttSHORT(info->data+info->hhea + 8); -} - -STBTT_DEF int stbtt_GetFontVMetricsOS2(const stbtt_fontinfo *info, int *typoAscent, int *typoDescent, int *typoLineGap) -{ - int tab = stbtt__find_table(info->data, info->fontstart, "OS/2"); - if (!tab) - return 0; - if (typoAscent ) *typoAscent = ttSHORT(info->data+tab + 68); - if (typoDescent) *typoDescent = ttSHORT(info->data+tab + 70); - if (typoLineGap) *typoLineGap = ttSHORT(info->data+tab + 72); - return 1; -} - -STBTT_DEF void stbtt_GetFontBoundingBox(const stbtt_fontinfo *info, int *x0, int *y0, int *x1, int *y1) -{ - *x0 = ttSHORT(info->data + info->head + 36); - *y0 = ttSHORT(info->data + info->head + 38); - *x1 = ttSHORT(info->data + info->head + 40); - *y1 = ttSHORT(info->data + info->head + 42); -} - -STBTT_DEF float stbtt_ScaleForPixelHeight(const stbtt_fontinfo *info, float height) -{ - int fheight = ttSHORT(info->data + info->hhea + 4) - ttSHORT(info->data + info->hhea + 6); - return (float) height / fheight; -} - -STBTT_DEF float stbtt_ScaleForMappingEmToPixels(const stbtt_fontinfo *info, float pixels) -{ - int unitsPerEm = ttUSHORT(info->data + info->head + 18); - return pixels / unitsPerEm; -} - -STBTT_DEF void stbtt_FreeShape(const stbtt_fontinfo *info, stbtt_vertex *v) -{ - STBTT_free(v, info->userdata); -} - -STBTT_DEF stbtt_uint8 *stbtt_FindSVGDoc(const stbtt_fontinfo *info, int gl) -{ - int i; - stbtt_uint8 *data = info->data; - stbtt_uint8 *svg_doc_list = data + stbtt__get_svg((stbtt_fontinfo *) info); - - int numEntries = ttUSHORT(svg_doc_list); - stbtt_uint8 *svg_docs = svg_doc_list + 2; - - for(i=0; i= ttUSHORT(svg_doc)) && (gl <= ttUSHORT(svg_doc + 2))) - return svg_doc; - } - return 0; -} - -STBTT_DEF int stbtt_GetGlyphSVG(const stbtt_fontinfo *info, int gl, const char **svg) -{ - stbtt_uint8 *data = info->data; - stbtt_uint8 *svg_doc; - - if (info->svg == 0) - return 0; - - svg_doc = stbtt_FindSVGDoc(info, gl); - if (svg_doc != NULL) { - *svg = (char *) data + info->svg + ttULONG(svg_doc + 4); - return ttULONG(svg_doc + 8); - } else { - return 0; - } -} - -STBTT_DEF int stbtt_GetCodepointSVG(const stbtt_fontinfo *info, int unicode_codepoint, const char **svg) -{ - return stbtt_GetGlyphSVG(info, stbtt_FindGlyphIndex(info, unicode_codepoint), svg); -} - -////////////////////////////////////////////////////////////////////////////// -// -// antialiasing software rasterizer -// - -STBTT_DEF void stbtt_GetGlyphBitmapBoxSubpixel(const stbtt_fontinfo *font, int glyph, float scale_x, float scale_y,float shift_x, float shift_y, int *ix0, int *iy0, int *ix1, int *iy1) -{ - int x0=0,y0=0,x1,y1; // =0 suppresses compiler warning - if (!stbtt_GetGlyphBox(font, glyph, &x0,&y0,&x1,&y1)) { - // e.g. space character - if (ix0) *ix0 = 0; - if (iy0) *iy0 = 0; - if (ix1) *ix1 = 0; - if (iy1) *iy1 = 0; - } else { - // move to integral bboxes (treating pixels as little squares, what pixels get touched)? - if (ix0) *ix0 = STBTT_ifloor( x0 * scale_x + shift_x); - if (iy0) *iy0 = STBTT_ifloor(-y1 * scale_y + shift_y); - if (ix1) *ix1 = STBTT_iceil ( x1 * scale_x + shift_x); - if (iy1) *iy1 = STBTT_iceil (-y0 * scale_y + shift_y); - } -} - -STBTT_DEF void stbtt_GetGlyphBitmapBox(const stbtt_fontinfo *font, int glyph, float scale_x, float scale_y, int *ix0, int *iy0, int *ix1, int *iy1) -{ - stbtt_GetGlyphBitmapBoxSubpixel(font, glyph, scale_x, scale_y,0.0f,0.0f, ix0, iy0, ix1, iy1); -} - -STBTT_DEF void stbtt_GetCodepointBitmapBoxSubpixel(const stbtt_fontinfo *font, int codepoint, float scale_x, float scale_y, float shift_x, float shift_y, int *ix0, int *iy0, int *ix1, int *iy1) -{ - stbtt_GetGlyphBitmapBoxSubpixel(font, stbtt_FindGlyphIndex(font,codepoint), scale_x, scale_y,shift_x,shift_y, ix0,iy0,ix1,iy1); -} - -STBTT_DEF void stbtt_GetCodepointBitmapBox(const stbtt_fontinfo *font, int codepoint, float scale_x, float scale_y, int *ix0, int *iy0, int *ix1, int *iy1) -{ - stbtt_GetCodepointBitmapBoxSubpixel(font, codepoint, scale_x, scale_y,0.0f,0.0f, ix0,iy0,ix1,iy1); -} - -////////////////////////////////////////////////////////////////////////////// -// -// Rasterizer - -typedef struct stbtt__hheap_chunk -{ - struct stbtt__hheap_chunk *next; -} stbtt__hheap_chunk; - -typedef struct stbtt__hheap -{ - struct stbtt__hheap_chunk *head; - void *first_free; - int num_remaining_in_head_chunk; -} stbtt__hheap; - -static void *stbtt__hheap_alloc(stbtt__hheap *hh, size_t size, void *userdata) -{ - if (hh->first_free) { - void *p = hh->first_free; - hh->first_free = * (void **) p; - return p; - } else { - if (hh->num_remaining_in_head_chunk == 0) { - int count = (size < 32 ? 2000 : size < 128 ? 800 : 100); - stbtt__hheap_chunk *c = (stbtt__hheap_chunk *) STBTT_malloc(sizeof(stbtt__hheap_chunk) + size * count, userdata); - if (c == NULL) - return NULL; - c->next = hh->head; - hh->head = c; - hh->num_remaining_in_head_chunk = count; - } - --hh->num_remaining_in_head_chunk; - return (char *) (hh->head) + sizeof(stbtt__hheap_chunk) + size * hh->num_remaining_in_head_chunk; - } -} - -static void stbtt__hheap_free(stbtt__hheap *hh, void *p) -{ - *(void **) p = hh->first_free; - hh->first_free = p; -} - -static void stbtt__hheap_cleanup(stbtt__hheap *hh, void *userdata) -{ - stbtt__hheap_chunk *c = hh->head; - while (c) { - stbtt__hheap_chunk *n = c->next; - STBTT_free(c, userdata); - c = n; - } -} - -typedef struct stbtt__edge { - float x0,y0, x1,y1; - int invert; -} stbtt__edge; - - -typedef struct stbtt__active_edge -{ - struct stbtt__active_edge *next; - #if STBTT_RASTERIZER_VERSION==1 - int x,dx; - float ey; - int direction; - #elif STBTT_RASTERIZER_VERSION==2 - float fx,fdx,fdy; - float direction; - float sy; - float ey; - #else - #error "Unrecognized value of STBTT_RASTERIZER_VERSION" - #endif -} stbtt__active_edge; - -#if STBTT_RASTERIZER_VERSION == 1 -#define STBTT_FIXSHIFT 10 -#define STBTT_FIX (1 << STBTT_FIXSHIFT) -#define STBTT_FIXMASK (STBTT_FIX-1) - -static stbtt__active_edge *stbtt__new_active(stbtt__hheap *hh, stbtt__edge *e, int off_x, float start_point, void *userdata) -{ - stbtt__active_edge *z = (stbtt__active_edge *) stbtt__hheap_alloc(hh, sizeof(*z), userdata); - float dxdy = (e->x1 - e->x0) / (e->y1 - e->y0); - STBTT_assert(z != NULL); - if (!z) return z; - - // round dx down to avoid overshooting - if (dxdy < 0) - z->dx = -STBTT_ifloor(STBTT_FIX * -dxdy); - else - z->dx = STBTT_ifloor(STBTT_FIX * dxdy); - - z->x = STBTT_ifloor(STBTT_FIX * e->x0 + z->dx * (start_point - e->y0)); // use z->dx so when we offset later it's by the same amount - z->x -= off_x * STBTT_FIX; - - z->ey = e->y1; - z->next = 0; - z->direction = e->invert ? 1 : -1; - return z; -} -#elif STBTT_RASTERIZER_VERSION == 2 -static stbtt__active_edge *stbtt__new_active(stbtt__hheap *hh, stbtt__edge *e, int off_x, float start_point, void *userdata) -{ - stbtt__active_edge *z = (stbtt__active_edge *) stbtt__hheap_alloc(hh, sizeof(*z), userdata); - float dxdy = (e->x1 - e->x0) / (e->y1 - e->y0); - STBTT_assert(z != NULL); - //STBTT_assert(e->y0 <= start_point); - if (!z) return z; - z->fdx = dxdy; - z->fdy = dxdy != 0.0f ? (1.0f/dxdy) : 0.0f; - z->fx = e->x0 + dxdy * (start_point - e->y0); - z->fx -= off_x; - z->direction = e->invert ? 1.0f : -1.0f; - z->sy = e->y0; - z->ey = e->y1; - z->next = 0; - return z; -} -#else -#error "Unrecognized value of STBTT_RASTERIZER_VERSION" -#endif - -#if STBTT_RASTERIZER_VERSION == 1 -// note: this routine clips fills that extend off the edges... ideally this -// wouldn't happen, but it could happen if the truetype glyph bounding boxes -// are wrong, or if the user supplies a too-small bitmap -static void stbtt__fill_active_edges(unsigned char *scanline, int len, stbtt__active_edge *e, int max_weight) -{ - // non-zero winding fill - int x0=0, w=0; - - while (e) { - if (w == 0) { - // if we're currently at zero, we need to record the edge start point - x0 = e->x; w += e->direction; - } else { - int x1 = e->x; w += e->direction; - // if we went to zero, we need to draw - if (w == 0) { - int i = x0 >> STBTT_FIXSHIFT; - int j = x1 >> STBTT_FIXSHIFT; - - if (i < len && j >= 0) { - if (i == j) { - // x0,x1 are the same pixel, so compute combined coverage - scanline[i] = scanline[i] + (stbtt_uint8) ((x1 - x0) * max_weight >> STBTT_FIXSHIFT); - } else { - if (i >= 0) // add antialiasing for x0 - scanline[i] = scanline[i] + (stbtt_uint8) (((STBTT_FIX - (x0 & STBTT_FIXMASK)) * max_weight) >> STBTT_FIXSHIFT); - else - i = -1; // clip - - if (j < len) // add antialiasing for x1 - scanline[j] = scanline[j] + (stbtt_uint8) (((x1 & STBTT_FIXMASK) * max_weight) >> STBTT_FIXSHIFT); - else - j = len; // clip - - for (++i; i < j; ++i) // fill pixels between x0 and x1 - scanline[i] = scanline[i] + (stbtt_uint8) max_weight; - } - } - } - } - - e = e->next; - } -} - -static void stbtt__rasterize_sorted_edges(stbtt__bitmap *result, stbtt__edge *e, int n, int vsubsample, int off_x, int off_y, void *userdata) -{ - stbtt__hheap hh = { 0, 0, 0 }; - stbtt__active_edge *active = NULL; - int y,j=0; - int max_weight = (255 / vsubsample); // weight per vertical scanline - int s; // vertical subsample index - unsigned char scanline_data[512], *scanline; - - if (result->w > 512) - scanline = (unsigned char *) STBTT_malloc(result->w, userdata); - else - scanline = scanline_data; - - y = off_y * vsubsample; - e[n].y0 = (off_y + result->h) * (float) vsubsample + 1; - - while (j < result->h) { - STBTT_memset(scanline, 0, result->w); - for (s=0; s < vsubsample; ++s) { - // find center of pixel for this scanline - float scan_y = y + 0.5f; - stbtt__active_edge **step = &active; - - // update all active edges; - // remove all active edges that terminate before the center of this scanline - while (*step) { - stbtt__active_edge * z = *step; - if (z->ey <= scan_y) { - *step = z->next; // delete from list - STBTT_assert(z->direction); - z->direction = 0; - stbtt__hheap_free(&hh, z); - } else { - z->x += z->dx; // advance to position for current scanline - step = &((*step)->next); // advance through list - } - } - - // resort the list if needed - for(;;) { - int changed=0; - step = &active; - while (*step && (*step)->next) { - if ((*step)->x > (*step)->next->x) { - stbtt__active_edge *t = *step; - stbtt__active_edge *q = t->next; - - t->next = q->next; - q->next = t; - *step = q; - changed = 1; - } - step = &(*step)->next; - } - if (!changed) break; - } - - // insert all edges that start before the center of this scanline -- omit ones that also end on this scanline - while (e->y0 <= scan_y) { - if (e->y1 > scan_y) { - stbtt__active_edge *z = stbtt__new_active(&hh, e, off_x, scan_y, userdata); - if (z != NULL) { - // find insertion point - if (active == NULL) - active = z; - else if (z->x < active->x) { - // insert at front - z->next = active; - active = z; - } else { - // find thing to insert AFTER - stbtt__active_edge *p = active; - while (p->next && p->next->x < z->x) - p = p->next; - // at this point, p->next->x is NOT < z->x - z->next = p->next; - p->next = z; - } - } - } - ++e; - } - - // now process all active edges in XOR fashion - if (active) - stbtt__fill_active_edges(scanline, result->w, active, max_weight); - - ++y; - } - STBTT_memcpy(result->pixels + j * result->stride, scanline, result->w); - ++j; - } - - stbtt__hheap_cleanup(&hh, userdata); - - if (scanline != scanline_data) - STBTT_free(scanline, userdata); -} - -#elif STBTT_RASTERIZER_VERSION == 2 - -// the edge passed in here does not cross the vertical line at x or the vertical line at x+1 -// (i.e. it has already been clipped to those) -static void stbtt__handle_clipped_edge(float *scanline, int x, stbtt__active_edge *e, float x0, float y0, float x1, float y1) -{ - if (y0 == y1) return; - STBTT_assert(y0 < y1); - STBTT_assert(e->sy <= e->ey); - if (y0 > e->ey) return; - if (y1 < e->sy) return; - if (y0 < e->sy) { - x0 += (x1-x0) * (e->sy - y0) / (y1-y0); - y0 = e->sy; - } - if (y1 > e->ey) { - x1 += (x1-x0) * (e->ey - y1) / (y1-y0); - y1 = e->ey; - } - - if (x0 == x) - STBTT_assert(x1 <= x+1); - else if (x0 == x+1) - STBTT_assert(x1 >= x); - else if (x0 <= x) - STBTT_assert(x1 <= x); - else if (x0 >= x+1) - STBTT_assert(x1 >= x+1); - else - STBTT_assert(x1 >= x && x1 <= x+1); - - if (x0 <= x && x1 <= x) - scanline[x] += e->direction * (y1-y0); - else if (x0 >= x+1 && x1 >= x+1) - ; - else { - STBTT_assert(x0 >= x && x0 <= x+1 && x1 >= x && x1 <= x+1); - scanline[x] += e->direction * (y1-y0) * (1-((x0-x)+(x1-x))/2); // coverage = 1 - average x position - } -} - -static float stbtt__sized_trapezoid_area(float height, float top_width, float bottom_width) -{ - STBTT_assert(top_width >= 0); - STBTT_assert(bottom_width >= 0); - return (top_width + bottom_width) / 2.0f * height; -} - -static float stbtt__position_trapezoid_area(float height, float tx0, float tx1, float bx0, float bx1) -{ - return stbtt__sized_trapezoid_area(height, tx1 - tx0, bx1 - bx0); -} - -static float stbtt__sized_triangle_area(float height, float width) -{ - return height * width / 2; -} - -static void stbtt__fill_active_edges_new(float *scanline, float *scanline_fill, int len, stbtt__active_edge *e, float y_top) -{ - float y_bottom = y_top+1; - - while (e) { - // brute force every pixel - - // compute intersection points with top & bottom - STBTT_assert(e->ey >= y_top); - - if (e->fdx == 0) { - float x0 = e->fx; - if (x0 < len) { - if (x0 >= 0) { - stbtt__handle_clipped_edge(scanline,(int) x0,e, x0,y_top, x0,y_bottom); - stbtt__handle_clipped_edge(scanline_fill-1,(int) x0+1,e, x0,y_top, x0,y_bottom); - } else { - stbtt__handle_clipped_edge(scanline_fill-1,0,e, x0,y_top, x0,y_bottom); - } - } - } else { - float x0 = e->fx; - float dx = e->fdx; - float xb = x0 + dx; - float x_top, x_bottom; - float sy0,sy1; - float dy = e->fdy; - STBTT_assert(e->sy <= y_bottom && e->ey >= y_top); - - // compute endpoints of line segment clipped to this scanline (if the - // line segment starts on this scanline. x0 is the intersection of the - // line with y_top, but that may be off the line segment. - if (e->sy > y_top) { - x_top = x0 + dx * (e->sy - y_top); - sy0 = e->sy; - } else { - x_top = x0; - sy0 = y_top; - } - if (e->ey < y_bottom) { - x_bottom = x0 + dx * (e->ey - y_top); - sy1 = e->ey; - } else { - x_bottom = xb; - sy1 = y_bottom; - } - - if (x_top >= 0 && x_bottom >= 0 && x_top < len && x_bottom < len) { - // from here on, we don't have to range check x values - - if ((int) x_top == (int) x_bottom) { - float height; - // simple case, only spans one pixel - int x = (int) x_top; - height = (sy1 - sy0) * e->direction; - STBTT_assert(x >= 0 && x < len); - scanline[x] += stbtt__position_trapezoid_area(height, x_top, x+1.0f, x_bottom, x+1.0f); - scanline_fill[x] += height; // everything right of this pixel is filled - } else { - int x,x1,x2; - float y_crossing, y_final, step, sign, area; - // covers 2+ pixels - if (x_top > x_bottom) { - // flip scanline vertically; signed area is the same - float t; - sy0 = y_bottom - (sy0 - y_top); - sy1 = y_bottom - (sy1 - y_top); - t = sy0, sy0 = sy1, sy1 = t; - t = x_bottom, x_bottom = x_top, x_top = t; - dx = -dx; - dy = -dy; - t = x0, x0 = xb, xb = t; - } - STBTT_assert(dy >= 0); - STBTT_assert(dx >= 0); - - x1 = (int) x_top; - x2 = (int) x_bottom; - // compute intersection with y axis at x1+1 - y_crossing = y_top + dy * (x1+1 - x0); - - // compute intersection with y axis at x2 - y_final = y_top + dy * (x2 - x0); - - // x1 x_top x2 x_bottom - // y_top +------|-----+------------+------------+--------|---+------------+ - // | | | | | | - // | | | | | | - // sy0 | Txxxxx|............|............|............|............| - // y_crossing | *xxxxx.......|............|............|............| - // | | xxxxx..|............|............|............| - // | | /- xx*xxxx........|............|............| - // | | dy < | xxxxxx..|............|............| - // y_final | | \- | xx*xxx.........|............| - // sy1 | | | | xxxxxB...|............| - // | | | | | | - // | | | | | | - // y_bottom +------------+------------+------------+------------+------------+ - // - // goal is to measure the area covered by '.' in each pixel - - // if x2 is right at the right edge of x1, y_crossing can blow up, github #1057 - // @TODO: maybe test against sy1 rather than y_bottom? - if (y_crossing > y_bottom) - y_crossing = y_bottom; - - sign = e->direction; - - // area of the rectangle covered from sy0..y_crossing - area = sign * (y_crossing-sy0); - - // area of the triangle (x_top,sy0), (x1+1,sy0), (x1+1,y_crossing) - scanline[x1] += stbtt__sized_triangle_area(area, x1+1 - x_top); - - // check if final y_crossing is blown up; no test case for this - if (y_final > y_bottom) { - y_final = y_bottom; - dy = (y_final - y_crossing ) / (x2 - (x1+1)); // if denom=0, y_final = y_crossing, so y_final <= y_bottom - } - - // in second pixel, area covered by line segment found in first pixel - // is always a rectangle 1 wide * the height of that line segment; this - // is exactly what the variable 'area' stores. it also gets a contribution - // from the line segment within it. the THIRD pixel will get the first - // pixel's rectangle contribution, the second pixel's rectangle contribution, - // and its own contribution. the 'own contribution' is the same in every pixel except - // the leftmost and rightmost, a trapezoid that slides down in each pixel. - // the second pixel's contribution to the third pixel will be the - // rectangle 1 wide times the height change in the second pixel, which is dy. - - step = sign * dy * 1; // dy is dy/dx, change in y for every 1 change in x, - // which multiplied by 1-pixel-width is how much pixel area changes for each step in x - // so the area advances by 'step' every time - - for (x = x1+1; x < x2; ++x) { - scanline[x] += area + step/2; // area of trapezoid is 1*step/2 - area += step; - } - STBTT_assert(STBTT_fabs(area) <= 1.01f); // accumulated error from area += step unless we round step down - STBTT_assert(sy1 > y_final-0.01f); - - // area covered in the last pixel is the rectangle from all the pixels to the left, - // plus the trapezoid filled by the line segment in this pixel all the way to the right edge - scanline[x2] += area + sign * stbtt__position_trapezoid_area(sy1-y_final, (float) x2, x2+1.0f, x_bottom, x2+1.0f); - - // the rest of the line is filled based on the total height of the line segment in this pixel - scanline_fill[x2] += sign * (sy1-sy0); - } - } else { - // if edge goes outside of box we're drawing, we require - // clipping logic. since this does not match the intended use - // of this library, we use a different, very slow brute - // force implementation - // note though that this does happen some of the time because - // x_top and x_bottom can be extrapolated at the top & bottom of - // the shape and actually lie outside the bounding box - int x; - for (x=0; x < len; ++x) { - // cases: - // - // there can be up to two intersections with the pixel. any intersection - // with left or right edges can be handled by splitting into two (or three) - // regions. intersections with top & bottom do not necessitate case-wise logic. - // - // the old way of doing this found the intersections with the left & right edges, - // then used some simple logic to produce up to three segments in sorted order - // from top-to-bottom. however, this had a problem: if an x edge was epsilon - // across the x border, then the corresponding y position might not be distinct - // from the other y segment, and it might ignored as an empty segment. to avoid - // that, we need to explicitly produce segments based on x positions. - - // rename variables to clearly-defined pairs - float y0 = y_top; - float x1 = (float) (x); - float x2 = (float) (x+1); - float x3 = xb; - float y3 = y_bottom; - - // x = e->x + e->dx * (y-y_top) - // (y-y_top) = (x - e->x) / e->dx - // y = (x - e->x) / e->dx + y_top - float y1 = (x - x0) / dx + y_top; - float y2 = (x+1 - x0) / dx + y_top; - - if (x0 < x1 && x3 > x2) { // three segments descending down-right - stbtt__handle_clipped_edge(scanline,x,e, x0,y0, x1,y1); - stbtt__handle_clipped_edge(scanline,x,e, x1,y1, x2,y2); - stbtt__handle_clipped_edge(scanline,x,e, x2,y2, x3,y3); - } else if (x3 < x1 && x0 > x2) { // three segments descending down-left - stbtt__handle_clipped_edge(scanline,x,e, x0,y0, x2,y2); - stbtt__handle_clipped_edge(scanline,x,e, x2,y2, x1,y1); - stbtt__handle_clipped_edge(scanline,x,e, x1,y1, x3,y3); - } else if (x0 < x1 && x3 > x1) { // two segments across x, down-right - stbtt__handle_clipped_edge(scanline,x,e, x0,y0, x1,y1); - stbtt__handle_clipped_edge(scanline,x,e, x1,y1, x3,y3); - } else if (x3 < x1 && x0 > x1) { // two segments across x, down-left - stbtt__handle_clipped_edge(scanline,x,e, x0,y0, x1,y1); - stbtt__handle_clipped_edge(scanline,x,e, x1,y1, x3,y3); - } else if (x0 < x2 && x3 > x2) { // two segments across x+1, down-right - stbtt__handle_clipped_edge(scanline,x,e, x0,y0, x2,y2); - stbtt__handle_clipped_edge(scanline,x,e, x2,y2, x3,y3); - } else if (x3 < x2 && x0 > x2) { // two segments across x+1, down-left - stbtt__handle_clipped_edge(scanline,x,e, x0,y0, x2,y2); - stbtt__handle_clipped_edge(scanline,x,e, x2,y2, x3,y3); - } else { // one segment - stbtt__handle_clipped_edge(scanline,x,e, x0,y0, x3,y3); - } - } - } - } - e = e->next; - } -} - -// directly AA rasterize edges w/o supersampling -static void stbtt__rasterize_sorted_edges(stbtt__bitmap *result, stbtt__edge *e, int n, int vsubsample, int off_x, int off_y, void *userdata) -{ - stbtt__hheap hh = { 0, 0, 0 }; - stbtt__active_edge *active = NULL; - int y,j=0, i; - float scanline_data[129], *scanline, *scanline2; - - STBTT__NOTUSED(vsubsample); - - if (result->w > 64) - scanline = (float *) STBTT_malloc((result->w*2+1) * sizeof(float), userdata); - else - scanline = scanline_data; - - scanline2 = scanline + result->w; - - y = off_y; - e[n].y0 = (float) (off_y + result->h) + 1; - - while (j < result->h) { - // find center of pixel for this scanline - float scan_y_top = y + 0.0f; - float scan_y_bottom = y + 1.0f; - stbtt__active_edge **step = &active; - - STBTT_memset(scanline , 0, result->w*sizeof(scanline[0])); - STBTT_memset(scanline2, 0, (result->w+1)*sizeof(scanline[0])); - - // update all active edges; - // remove all active edges that terminate before the top of this scanline - while (*step) { - stbtt__active_edge * z = *step; - if (z->ey <= scan_y_top) { - *step = z->next; // delete from list - STBTT_assert(z->direction); - z->direction = 0; - stbtt__hheap_free(&hh, z); - } else { - step = &((*step)->next); // advance through list - } - } - - // insert all edges that start before the bottom of this scanline - while (e->y0 <= scan_y_bottom) { - if (e->y0 != e->y1) { - stbtt__active_edge *z = stbtt__new_active(&hh, e, off_x, scan_y_top, userdata); - if (z != NULL) { - if (j == 0 && off_y != 0) { - if (z->ey < scan_y_top) { - // this can happen due to subpixel positioning and some kind of fp rounding error i think - z->ey = scan_y_top; - } - } - STBTT_assert(z->ey >= scan_y_top); // if we get really unlucky a tiny bit of an edge can be out of bounds - // insert at front - z->next = active; - active = z; - } - } - ++e; - } - - // now process all active edges - if (active) - stbtt__fill_active_edges_new(scanline, scanline2+1, result->w, active, scan_y_top); - - { - float sum = 0; - for (i=0; i < result->w; ++i) { - float k; - int m; - sum += scanline2[i]; - k = scanline[i] + sum; - k = (float) STBTT_fabs(k)*255 + 0.5f; - m = (int) k; - if (m > 255) m = 255; - result->pixels[j*result->stride + i] = (unsigned char) m; - } - } - // advance all the edges - step = &active; - while (*step) { - stbtt__active_edge *z = *step; - z->fx += z->fdx; // advance to position for current scanline - step = &((*step)->next); // advance through list - } - - ++y; - ++j; - } - - stbtt__hheap_cleanup(&hh, userdata); - - if (scanline != scanline_data) - STBTT_free(scanline, userdata); -} -#else -#error "Unrecognized value of STBTT_RASTERIZER_VERSION" -#endif - -#define STBTT__COMPARE(a,b) ((a)->y0 < (b)->y0) - -static void stbtt__sort_edges_ins_sort(stbtt__edge *p, int n) -{ - int i,j; - for (i=1; i < n; ++i) { - stbtt__edge t = p[i], *a = &t; - j = i; - while (j > 0) { - stbtt__edge *b = &p[j-1]; - int c = STBTT__COMPARE(a,b); - if (!c) break; - p[j] = p[j-1]; - --j; - } - if (i != j) - p[j] = t; - } -} - -static void stbtt__sort_edges_quicksort(stbtt__edge *p, int n) -{ - /* threshold for transitioning to insertion sort */ - while (n > 12) { - stbtt__edge t; - int c01,c12,c,m,i,j; - - /* compute median of three */ - m = n >> 1; - c01 = STBTT__COMPARE(&p[0],&p[m]); - c12 = STBTT__COMPARE(&p[m],&p[n-1]); - /* if 0 >= mid >= end, or 0 < mid < end, then use mid */ - if (c01 != c12) { - /* otherwise, we'll need to swap something else to middle */ - int z; - c = STBTT__COMPARE(&p[0],&p[n-1]); - /* 0>mid && midn => n; 0 0 */ - /* 0n: 0>n => 0; 0 n */ - z = (c == c12) ? 0 : n-1; - t = p[z]; - p[z] = p[m]; - p[m] = t; - } - /* now p[m] is the median-of-three */ - /* swap it to the beginning so it won't move around */ - t = p[0]; - p[0] = p[m]; - p[m] = t; - - /* partition loop */ - i=1; - j=n-1; - for(;;) { - /* handling of equality is crucial here */ - /* for sentinels & efficiency with duplicates */ - for (;;++i) { - if (!STBTT__COMPARE(&p[i], &p[0])) break; - } - for (;;--j) { - if (!STBTT__COMPARE(&p[0], &p[j])) break; - } - /* make sure we haven't crossed */ - if (i >= j) break; - t = p[i]; - p[i] = p[j]; - p[j] = t; - - ++i; - --j; - } - /* recurse on smaller side, iterate on larger */ - if (j < (n-i)) { - stbtt__sort_edges_quicksort(p,j); - p = p+i; - n = n-i; - } else { - stbtt__sort_edges_quicksort(p+i, n-i); - n = j; - } - } -} - -static void stbtt__sort_edges(stbtt__edge *p, int n) -{ - stbtt__sort_edges_quicksort(p, n); - stbtt__sort_edges_ins_sort(p, n); -} - -typedef struct -{ - float x,y; -} stbtt__point; - -static void stbtt__rasterize(stbtt__bitmap *result, stbtt__point *pts, int *wcount, int windings, float scale_x, float scale_y, float shift_x, float shift_y, int off_x, int off_y, int invert, void *userdata) -{ - float y_scale_inv = invert ? -scale_y : scale_y; - stbtt__edge *e; - int n,i,j,k,m; -#if STBTT_RASTERIZER_VERSION == 1 - int vsubsample = result->h < 8 ? 15 : 5; -#elif STBTT_RASTERIZER_VERSION == 2 - int vsubsample = 1; -#else - #error "Unrecognized value of STBTT_RASTERIZER_VERSION" -#endif - // vsubsample should divide 255 evenly; otherwise we won't reach full opacity - - // now we have to blow out the windings into explicit edge lists - n = 0; - for (i=0; i < windings; ++i) - n += wcount[i]; - - e = (stbtt__edge *) STBTT_malloc(sizeof(*e) * (n+1), userdata); // add an extra one as a sentinel - if (e == 0) return; - n = 0; - - m=0; - for (i=0; i < windings; ++i) { - stbtt__point *p = pts + m; - m += wcount[i]; - j = wcount[i]-1; - for (k=0; k < wcount[i]; j=k++) { - int a=k,b=j; - // skip the edge if horizontal - if (p[j].y == p[k].y) - continue; - // add edge from j to k to the list - e[n].invert = 0; - if (invert ? p[j].y > p[k].y : p[j].y < p[k].y) { - e[n].invert = 1; - a=j,b=k; - } - e[n].x0 = p[a].x * scale_x + shift_x; - e[n].y0 = (p[a].y * y_scale_inv + shift_y) * vsubsample; - e[n].x1 = p[b].x * scale_x + shift_x; - e[n].y1 = (p[b].y * y_scale_inv + shift_y) * vsubsample; - ++n; - } - } - - // now sort the edges by their highest point (should snap to integer, and then by x) - //STBTT_sort(e, n, sizeof(e[0]), stbtt__edge_compare); - stbtt__sort_edges(e, n); - - // now, traverse the scanlines and find the intersections on each scanline, use xor winding rule - stbtt__rasterize_sorted_edges(result, e, n, vsubsample, off_x, off_y, userdata); - - STBTT_free(e, userdata); -} - -static void stbtt__add_point(stbtt__point *points, int n, float x, float y) -{ - if (!points) return; // during first pass, it's unallocated - points[n].x = x; - points[n].y = y; -} - -// tessellate until threshold p is happy... @TODO warped to compensate for non-linear stretching -static int stbtt__tesselate_curve(stbtt__point *points, int *num_points, float x0, float y0, float x1, float y1, float x2, float y2, float objspace_flatness_squared, int n) -{ - // midpoint - float mx = (x0 + 2*x1 + x2)/4; - float my = (y0 + 2*y1 + y2)/4; - // versus directly drawn line - float dx = (x0+x2)/2 - mx; - float dy = (y0+y2)/2 - my; - if (n > 16) // 65536 segments on one curve better be enough! - return 1; - if (dx*dx+dy*dy > objspace_flatness_squared) { // half-pixel error allowed... need to be smaller if AA - stbtt__tesselate_curve(points, num_points, x0,y0, (x0+x1)/2.0f,(y0+y1)/2.0f, mx,my, objspace_flatness_squared,n+1); - stbtt__tesselate_curve(points, num_points, mx,my, (x1+x2)/2.0f,(y1+y2)/2.0f, x2,y2, objspace_flatness_squared,n+1); - } else { - stbtt__add_point(points, *num_points,x2,y2); - *num_points = *num_points+1; - } - return 1; -} - -static void stbtt__tesselate_cubic(stbtt__point *points, int *num_points, float x0, float y0, float x1, float y1, float x2, float y2, float x3, float y3, float objspace_flatness_squared, int n) -{ - // @TODO this "flatness" calculation is just made-up nonsense that seems to work well enough - float dx0 = x1-x0; - float dy0 = y1-y0; - float dx1 = x2-x1; - float dy1 = y2-y1; - float dx2 = x3-x2; - float dy2 = y3-y2; - float dx = x3-x0; - float dy = y3-y0; - float longlen = (float) (STBTT_sqrt(dx0*dx0+dy0*dy0)+STBTT_sqrt(dx1*dx1+dy1*dy1)+STBTT_sqrt(dx2*dx2+dy2*dy2)); - float shortlen = (float) STBTT_sqrt(dx*dx+dy*dy); - float flatness_squared = longlen*longlen-shortlen*shortlen; - - if (n > 16) // 65536 segments on one curve better be enough! - return; - - if (flatness_squared > objspace_flatness_squared) { - float x01 = (x0+x1)/2; - float y01 = (y0+y1)/2; - float x12 = (x1+x2)/2; - float y12 = (y1+y2)/2; - float x23 = (x2+x3)/2; - float y23 = (y2+y3)/2; - - float xa = (x01+x12)/2; - float ya = (y01+y12)/2; - float xb = (x12+x23)/2; - float yb = (y12+y23)/2; - - float mx = (xa+xb)/2; - float my = (ya+yb)/2; - - stbtt__tesselate_cubic(points, num_points, x0,y0, x01,y01, xa,ya, mx,my, objspace_flatness_squared,n+1); - stbtt__tesselate_cubic(points, num_points, mx,my, xb,yb, x23,y23, x3,y3, objspace_flatness_squared,n+1); - } else { - stbtt__add_point(points, *num_points,x3,y3); - *num_points = *num_points+1; - } -} - -// returns number of contours -static stbtt__point *stbtt_FlattenCurves(stbtt_vertex *vertices, int num_verts, float objspace_flatness, int **contour_lengths, int *num_contours, void *userdata) -{ - stbtt__point *points=0; - int num_points=0; - - float objspace_flatness_squared = objspace_flatness * objspace_flatness; - int i,n=0,start=0, pass; - - // count how many "moves" there are to get the contour count - for (i=0; i < num_verts; ++i) - if (vertices[i].type == STBTT_vmove) - ++n; - - *num_contours = n; - if (n == 0) return 0; - - *contour_lengths = (int *) STBTT_malloc(sizeof(**contour_lengths) * n, userdata); - - if (*contour_lengths == 0) { - *num_contours = 0; - return 0; - } - - // make two passes through the points so we don't need to realloc - for (pass=0; pass < 2; ++pass) { - float x=0,y=0; - if (pass == 1) { - points = (stbtt__point *) STBTT_malloc(num_points * sizeof(points[0]), userdata); - if (points == NULL) goto error; - } - num_points = 0; - n= -1; - for (i=0; i < num_verts; ++i) { - switch (vertices[i].type) { - case STBTT_vmove: - // start the next contour - if (n >= 0) - (*contour_lengths)[n] = num_points - start; - ++n; - start = num_points; - - x = vertices[i].x, y = vertices[i].y; - stbtt__add_point(points, num_points++, x,y); - break; - case STBTT_vline: - x = vertices[i].x, y = vertices[i].y; - stbtt__add_point(points, num_points++, x, y); - break; - case STBTT_vcurve: - stbtt__tesselate_curve(points, &num_points, x,y, - vertices[i].cx, vertices[i].cy, - vertices[i].x, vertices[i].y, - objspace_flatness_squared, 0); - x = vertices[i].x, y = vertices[i].y; - break; - case STBTT_vcubic: - stbtt__tesselate_cubic(points, &num_points, x,y, - vertices[i].cx, vertices[i].cy, - vertices[i].cx1, vertices[i].cy1, - vertices[i].x, vertices[i].y, - objspace_flatness_squared, 0); - x = vertices[i].x, y = vertices[i].y; - break; - } - } - (*contour_lengths)[n] = num_points - start; - } - - return points; -error: - STBTT_free(points, userdata); - STBTT_free(*contour_lengths, userdata); - *contour_lengths = 0; - *num_contours = 0; - return NULL; -} - -STBTT_DEF void stbtt_Rasterize(stbtt__bitmap *result, float flatness_in_pixels, stbtt_vertex *vertices, int num_verts, float scale_x, float scale_y, float shift_x, float shift_y, int x_off, int y_off, int invert, void *userdata) -{ - float scale = scale_x > scale_y ? scale_y : scale_x; - int winding_count = 0; - int *winding_lengths = NULL; - stbtt__point *windings = stbtt_FlattenCurves(vertices, num_verts, flatness_in_pixels / scale, &winding_lengths, &winding_count, userdata); - if (windings) { - stbtt__rasterize(result, windings, winding_lengths, winding_count, scale_x, scale_y, shift_x, shift_y, x_off, y_off, invert, userdata); - STBTT_free(winding_lengths, userdata); - STBTT_free(windings, userdata); - } -} - -STBTT_DEF void stbtt_FreeBitmap(unsigned char *bitmap, void *userdata) -{ - STBTT_free(bitmap, userdata); -} - -STBTT_DEF unsigned char *stbtt_GetGlyphBitmapSubpixel(const stbtt_fontinfo *info, float scale_x, float scale_y, float shift_x, float shift_y, int glyph, int *width, int *height, int *xoff, int *yoff) -{ - int ix0,iy0,ix1,iy1; - stbtt__bitmap gbm; - stbtt_vertex *vertices; - int num_verts = stbtt_GetGlyphShape(info, glyph, &vertices); - - if (scale_x == 0) scale_x = scale_y; - if (scale_y == 0) { - if (scale_x == 0) { - STBTT_free(vertices, info->userdata); - return NULL; - } - scale_y = scale_x; - } - - stbtt_GetGlyphBitmapBoxSubpixel(info, glyph, scale_x, scale_y, shift_x, shift_y, &ix0,&iy0,&ix1,&iy1); - - // now we get the size - gbm.w = (ix1 - ix0); - gbm.h = (iy1 - iy0); - gbm.pixels = NULL; // in case we error - - if (width ) *width = gbm.w; - if (height) *height = gbm.h; - if (xoff ) *xoff = ix0; - if (yoff ) *yoff = iy0; - - if (gbm.w && gbm.h) { - gbm.pixels = (unsigned char *) STBTT_malloc(gbm.w * gbm.h, info->userdata); - if (gbm.pixels) { - gbm.stride = gbm.w; - - stbtt_Rasterize(&gbm, 0.35f, vertices, num_verts, scale_x, scale_y, shift_x, shift_y, ix0, iy0, 1, info->userdata); - } - } - STBTT_free(vertices, info->userdata); - return gbm.pixels; -} - -STBTT_DEF unsigned char *stbtt_GetGlyphBitmap(const stbtt_fontinfo *info, float scale_x, float scale_y, int glyph, int *width, int *height, int *xoff, int *yoff) -{ - return stbtt_GetGlyphBitmapSubpixel(info, scale_x, scale_y, 0.0f, 0.0f, glyph, width, height, xoff, yoff); -} - -STBTT_DEF void stbtt_MakeGlyphBitmapSubpixel(const stbtt_fontinfo *info, unsigned char *output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, float shift_x, float shift_y, int glyph) -{ - int ix0,iy0; - stbtt_vertex *vertices; - int num_verts = stbtt_GetGlyphShape(info, glyph, &vertices); - stbtt__bitmap gbm; - - stbtt_GetGlyphBitmapBoxSubpixel(info, glyph, scale_x, scale_y, shift_x, shift_y, &ix0,&iy0,0,0); - gbm.pixels = output; - gbm.w = out_w; - gbm.h = out_h; - gbm.stride = out_stride; - - if (gbm.w && gbm.h) - stbtt_Rasterize(&gbm, 0.35f, vertices, num_verts, scale_x, scale_y, shift_x, shift_y, ix0,iy0, 1, info->userdata); - - STBTT_free(vertices, info->userdata); -} - -STBTT_DEF void stbtt_MakeGlyphBitmap(const stbtt_fontinfo *info, unsigned char *output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, int glyph) -{ - stbtt_MakeGlyphBitmapSubpixel(info, output, out_w, out_h, out_stride, scale_x, scale_y, 0.0f,0.0f, glyph); -} - -STBTT_DEF unsigned char *stbtt_GetCodepointBitmapSubpixel(const stbtt_fontinfo *info, float scale_x, float scale_y, float shift_x, float shift_y, int codepoint, int *width, int *height, int *xoff, int *yoff) -{ - return stbtt_GetGlyphBitmapSubpixel(info, scale_x, scale_y,shift_x,shift_y, stbtt_FindGlyphIndex(info,codepoint), width,height,xoff,yoff); -} - -STBTT_DEF void stbtt_MakeCodepointBitmapSubpixelPrefilter(const stbtt_fontinfo *info, unsigned char *output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, float shift_x, float shift_y, int oversample_x, int oversample_y, float *sub_x, float *sub_y, int codepoint) -{ - stbtt_MakeGlyphBitmapSubpixelPrefilter(info, output, out_w, out_h, out_stride, scale_x, scale_y, shift_x, shift_y, oversample_x, oversample_y, sub_x, sub_y, stbtt_FindGlyphIndex(info,codepoint)); -} - -STBTT_DEF void stbtt_MakeCodepointBitmapSubpixel(const stbtt_fontinfo *info, unsigned char *output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, float shift_x, float shift_y, int codepoint) -{ - stbtt_MakeGlyphBitmapSubpixel(info, output, out_w, out_h, out_stride, scale_x, scale_y, shift_x, shift_y, stbtt_FindGlyphIndex(info,codepoint)); -} - -STBTT_DEF unsigned char *stbtt_GetCodepointBitmap(const stbtt_fontinfo *info, float scale_x, float scale_y, int codepoint, int *width, int *height, int *xoff, int *yoff) -{ - return stbtt_GetCodepointBitmapSubpixel(info, scale_x, scale_y, 0.0f,0.0f, codepoint, width,height,xoff,yoff); -} - -STBTT_DEF void stbtt_MakeCodepointBitmap(const stbtt_fontinfo *info, unsigned char *output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, int codepoint) -{ - stbtt_MakeCodepointBitmapSubpixel(info, output, out_w, out_h, out_stride, scale_x, scale_y, 0.0f,0.0f, codepoint); -} - -////////////////////////////////////////////////////////////////////////////// -// -// bitmap baking -// -// This is SUPER-CRAPPY packing to keep source code small - -static int stbtt_BakeFontBitmap_internal(unsigned char *data, int offset, // font location (use offset=0 for plain .ttf) - float pixel_height, // height of font in pixels - unsigned char *pixels, int pw, int ph, // bitmap to be filled in - int first_char, int num_chars, // characters to bake - stbtt_bakedchar *chardata) -{ - float scale; - int x,y,bottom_y, i; - stbtt_fontinfo f; - f.userdata = NULL; - if (!stbtt_InitFont(&f, data, offset)) - return -1; - STBTT_memset(pixels, 0, pw*ph); // background of 0 around pixels - x=y=1; - bottom_y = 1; - - scale = stbtt_ScaleForPixelHeight(&f, pixel_height); - - for (i=0; i < num_chars; ++i) { - int advance, lsb, x0,y0,x1,y1,gw,gh; - int g = stbtt_FindGlyphIndex(&f, first_char + i); - stbtt_GetGlyphHMetrics(&f, g, &advance, &lsb); - stbtt_GetGlyphBitmapBox(&f, g, scale,scale, &x0,&y0,&x1,&y1); - gw = x1-x0; - gh = y1-y0; - if (x + gw + 1 >= pw) - y = bottom_y, x = 1; // advance to next row - if (y + gh + 1 >= ph) // check if it fits vertically AFTER potentially moving to next row - return -i; - STBTT_assert(x+gw < pw); - STBTT_assert(y+gh < ph); - stbtt_MakeGlyphBitmap(&f, pixels+x+y*pw, gw,gh,pw, scale,scale, g); - chardata[i].x0 = (stbtt_int16) x; - chardata[i].y0 = (stbtt_int16) y; - chardata[i].x1 = (stbtt_int16) (x + gw); - chardata[i].y1 = (stbtt_int16) (y + gh); - chardata[i].xadvance = scale * advance; - chardata[i].xoff = (float) x0; - chardata[i].yoff = (float) y0; - x = x + gw + 1; - if (y+gh+1 > bottom_y) - bottom_y = y+gh+1; - } - return bottom_y; -} - -STBTT_DEF void stbtt_GetBakedQuad(const stbtt_bakedchar *chardata, int pw, int ph, int char_index, float *xpos, float *ypos, stbtt_aligned_quad *q, int opengl_fillrule) -{ - float d3d_bias = opengl_fillrule ? 0 : -0.5f; - float ipw = 1.0f / pw, iph = 1.0f / ph; - const stbtt_bakedchar *b = chardata + char_index; - int round_x = STBTT_ifloor((*xpos + b->xoff) + 0.5f); - int round_y = STBTT_ifloor((*ypos + b->yoff) + 0.5f); - - q->x0 = round_x + d3d_bias; - q->y0 = round_y + d3d_bias; - q->x1 = round_x + b->x1 - b->x0 + d3d_bias; - q->y1 = round_y + b->y1 - b->y0 + d3d_bias; - - q->s0 = b->x0 * ipw; - q->t0 = b->y0 * iph; - q->s1 = b->x1 * ipw; - q->t1 = b->y1 * iph; - - *xpos += b->xadvance; -} - -////////////////////////////////////////////////////////////////////////////// -// -// rectangle packing replacement routines if you don't have stb_rect_pack.h -// - -#ifndef STB_RECT_PACK_VERSION - -typedef int stbrp_coord; - -//////////////////////////////////////////////////////////////////////////////////// -// // -// // -// COMPILER WARNING ?!?!? // -// // -// // -// if you get a compile warning due to these symbols being defined more than // -// once, move #include "stb_rect_pack.h" before #include "stb_truetype.h" // -// // -//////////////////////////////////////////////////////////////////////////////////// - -typedef struct -{ - int width,height; - int x,y,bottom_y; -} stbrp_context; - -typedef struct -{ - unsigned char x; -} stbrp_node; - -struct stbrp_rect -{ - stbrp_coord x,y; - int id,w,h,was_packed; -}; - -static void stbrp_init_target(stbrp_context *con, int pw, int ph, stbrp_node *nodes, int num_nodes) -{ - con->width = pw; - con->height = ph; - con->x = 0; - con->y = 0; - con->bottom_y = 0; - STBTT__NOTUSED(nodes); - STBTT__NOTUSED(num_nodes); -} - -static void stbrp_pack_rects(stbrp_context *con, stbrp_rect *rects, int num_rects) -{ - int i; - for (i=0; i < num_rects; ++i) { - if (con->x + rects[i].w > con->width) { - con->x = 0; - con->y = con->bottom_y; - } - if (con->y + rects[i].h > con->height) - break; - rects[i].x = con->x; - rects[i].y = con->y; - rects[i].was_packed = 1; - con->x += rects[i].w; - if (con->y + rects[i].h > con->bottom_y) - con->bottom_y = con->y + rects[i].h; - } - for ( ; i < num_rects; ++i) - rects[i].was_packed = 0; -} -#endif - -////////////////////////////////////////////////////////////////////////////// -// -// bitmap baking -// -// This is SUPER-AWESOME (tm Ryan Gordon) packing using stb_rect_pack.h. If -// stb_rect_pack.h isn't available, it uses the BakeFontBitmap strategy. - -STBTT_DEF int stbtt_PackBegin(stbtt_pack_context *spc, unsigned char *pixels, int pw, int ph, int stride_in_bytes, int padding, void *alloc_context) -{ - stbrp_context *context = (stbrp_context *) STBTT_malloc(sizeof(*context) ,alloc_context); - int num_nodes = pw - padding; - stbrp_node *nodes = (stbrp_node *) STBTT_malloc(sizeof(*nodes ) * num_nodes,alloc_context); - - if (context == NULL || nodes == NULL) { - if (context != NULL) STBTT_free(context, alloc_context); - if (nodes != NULL) STBTT_free(nodes , alloc_context); - return 0; - } - - spc->user_allocator_context = alloc_context; - spc->width = pw; - spc->height = ph; - spc->pixels = pixels; - spc->pack_info = context; - spc->nodes = nodes; - spc->padding = padding; - spc->stride_in_bytes = stride_in_bytes != 0 ? stride_in_bytes : pw; - spc->h_oversample = 1; - spc->v_oversample = 1; - spc->skip_missing = 0; - - stbrp_init_target(context, pw-padding, ph-padding, nodes, num_nodes); - - if (pixels) - STBTT_memset(pixels, 0, pw*ph); // background of 0 around pixels - - return 1; -} - -STBTT_DEF void stbtt_PackEnd (stbtt_pack_context *spc) -{ - STBTT_free(spc->nodes , spc->user_allocator_context); - STBTT_free(spc->pack_info, spc->user_allocator_context); -} - -STBTT_DEF void stbtt_PackSetOversampling(stbtt_pack_context *spc, unsigned int h_oversample, unsigned int v_oversample) -{ - STBTT_assert(h_oversample <= STBTT_MAX_OVERSAMPLE); - STBTT_assert(v_oversample <= STBTT_MAX_OVERSAMPLE); - if (h_oversample <= STBTT_MAX_OVERSAMPLE) - spc->h_oversample = h_oversample; - if (v_oversample <= STBTT_MAX_OVERSAMPLE) - spc->v_oversample = v_oversample; -} - -STBTT_DEF void stbtt_PackSetSkipMissingCodepoints(stbtt_pack_context *spc, int skip) -{ - spc->skip_missing = skip; -} - -#define STBTT__OVER_MASK (STBTT_MAX_OVERSAMPLE-1) - -static void stbtt__h_prefilter(unsigned char *pixels, int w, int h, int stride_in_bytes, unsigned int kernel_width) -{ - unsigned char buffer[STBTT_MAX_OVERSAMPLE]; - int safe_w = w - kernel_width; - int j; - STBTT_memset(buffer, 0, STBTT_MAX_OVERSAMPLE); // suppress bogus warning from VS2013 -analyze - for (j=0; j < h; ++j) { - int i; - unsigned int total; - STBTT_memset(buffer, 0, kernel_width); - - total = 0; - - // make kernel_width a constant in common cases so compiler can optimize out the divide - switch (kernel_width) { - case 2: - for (i=0; i <= safe_w; ++i) { - total += pixels[i] - buffer[i & STBTT__OVER_MASK]; - buffer[(i+kernel_width) & STBTT__OVER_MASK] = pixels[i]; - pixels[i] = (unsigned char) (total / 2); - } - break; - case 3: - for (i=0; i <= safe_w; ++i) { - total += pixels[i] - buffer[i & STBTT__OVER_MASK]; - buffer[(i+kernel_width) & STBTT__OVER_MASK] = pixels[i]; - pixels[i] = (unsigned char) (total / 3); - } - break; - case 4: - for (i=0; i <= safe_w; ++i) { - total += pixels[i] - buffer[i & STBTT__OVER_MASK]; - buffer[(i+kernel_width) & STBTT__OVER_MASK] = pixels[i]; - pixels[i] = (unsigned char) (total / 4); - } - break; - case 5: - for (i=0; i <= safe_w; ++i) { - total += pixels[i] - buffer[i & STBTT__OVER_MASK]; - buffer[(i+kernel_width) & STBTT__OVER_MASK] = pixels[i]; - pixels[i] = (unsigned char) (total / 5); - } - break; - default: - for (i=0; i <= safe_w; ++i) { - total += pixels[i] - buffer[i & STBTT__OVER_MASK]; - buffer[(i+kernel_width) & STBTT__OVER_MASK] = pixels[i]; - pixels[i] = (unsigned char) (total / kernel_width); - } - break; - } - - for (; i < w; ++i) { - STBTT_assert(pixels[i] == 0); - total -= buffer[i & STBTT__OVER_MASK]; - pixels[i] = (unsigned char) (total / kernel_width); - } - - pixels += stride_in_bytes; - } -} - -static void stbtt__v_prefilter(unsigned char *pixels, int w, int h, int stride_in_bytes, unsigned int kernel_width) -{ - unsigned char buffer[STBTT_MAX_OVERSAMPLE]; - int safe_h = h - kernel_width; - int j; - STBTT_memset(buffer, 0, STBTT_MAX_OVERSAMPLE); // suppress bogus warning from VS2013 -analyze - for (j=0; j < w; ++j) { - int i; - unsigned int total; - STBTT_memset(buffer, 0, kernel_width); - - total = 0; - - // make kernel_width a constant in common cases so compiler can optimize out the divide - switch (kernel_width) { - case 2: - for (i=0; i <= safe_h; ++i) { - total += pixels[i*stride_in_bytes] - buffer[i & STBTT__OVER_MASK]; - buffer[(i+kernel_width) & STBTT__OVER_MASK] = pixels[i*stride_in_bytes]; - pixels[i*stride_in_bytes] = (unsigned char) (total / 2); - } - break; - case 3: - for (i=0; i <= safe_h; ++i) { - total += pixels[i*stride_in_bytes] - buffer[i & STBTT__OVER_MASK]; - buffer[(i+kernel_width) & STBTT__OVER_MASK] = pixels[i*stride_in_bytes]; - pixels[i*stride_in_bytes] = (unsigned char) (total / 3); - } - break; - case 4: - for (i=0; i <= safe_h; ++i) { - total += pixels[i*stride_in_bytes] - buffer[i & STBTT__OVER_MASK]; - buffer[(i+kernel_width) & STBTT__OVER_MASK] = pixels[i*stride_in_bytes]; - pixels[i*stride_in_bytes] = (unsigned char) (total / 4); - } - break; - case 5: - for (i=0; i <= safe_h; ++i) { - total += pixels[i*stride_in_bytes] - buffer[i & STBTT__OVER_MASK]; - buffer[(i+kernel_width) & STBTT__OVER_MASK] = pixels[i*stride_in_bytes]; - pixels[i*stride_in_bytes] = (unsigned char) (total / 5); - } - break; - default: - for (i=0; i <= safe_h; ++i) { - total += pixels[i*stride_in_bytes] - buffer[i & STBTT__OVER_MASK]; - buffer[(i+kernel_width) & STBTT__OVER_MASK] = pixels[i*stride_in_bytes]; - pixels[i*stride_in_bytes] = (unsigned char) (total / kernel_width); - } - break; - } - - for (; i < h; ++i) { - STBTT_assert(pixels[i*stride_in_bytes] == 0); - total -= buffer[i & STBTT__OVER_MASK]; - pixels[i*stride_in_bytes] = (unsigned char) (total / kernel_width); - } - - pixels += 1; - } -} - -static float stbtt__oversample_shift(int oversample) -{ - if (!oversample) - return 0.0f; - - // The prefilter is a box filter of width "oversample", - // which shifts phase by (oversample - 1)/2 pixels in - // oversampled space. We want to shift in the opposite - // direction to counter this. - return (float)-(oversample - 1) / (2.0f * (float)oversample); -} - -// rects array must be big enough to accommodate all characters in the given ranges -STBTT_DEF int stbtt_PackFontRangesGatherRects(stbtt_pack_context *spc, const stbtt_fontinfo *info, stbtt_pack_range *ranges, int num_ranges, stbrp_rect *rects) -{ - int i,j,k; - int missing_glyph_added = 0; - - k=0; - for (i=0; i < num_ranges; ++i) { - float fh = ranges[i].font_size; - float scale = fh > 0 ? stbtt_ScaleForPixelHeight(info, fh) : stbtt_ScaleForMappingEmToPixels(info, -fh); - ranges[i].h_oversample = (unsigned char) spc->h_oversample; - ranges[i].v_oversample = (unsigned char) spc->v_oversample; - for (j=0; j < ranges[i].num_chars; ++j) { - int x0,y0,x1,y1; - int codepoint = ranges[i].array_of_unicode_codepoints == NULL ? ranges[i].first_unicode_codepoint_in_range + j : ranges[i].array_of_unicode_codepoints[j]; - int glyph = stbtt_FindGlyphIndex(info, codepoint); - if (glyph == 0 && (spc->skip_missing || missing_glyph_added)) { - rects[k].w = rects[k].h = 0; - } else { - stbtt_GetGlyphBitmapBoxSubpixel(info,glyph, - scale * spc->h_oversample, - scale * spc->v_oversample, - 0,0, - &x0,&y0,&x1,&y1); - rects[k].w = (stbrp_coord) (x1-x0 + spc->padding + spc->h_oversample-1); - rects[k].h = (stbrp_coord) (y1-y0 + spc->padding + spc->v_oversample-1); - if (glyph == 0) - missing_glyph_added = 1; - } - ++k; - } - } - - return k; -} - -STBTT_DEF void stbtt_MakeGlyphBitmapSubpixelPrefilter(const stbtt_fontinfo *info, unsigned char *output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, float shift_x, float shift_y, int prefilter_x, int prefilter_y, float *sub_x, float *sub_y, int glyph) -{ - stbtt_MakeGlyphBitmapSubpixel(info, - output, - out_w - (prefilter_x - 1), - out_h - (prefilter_y - 1), - out_stride, - scale_x, - scale_y, - shift_x, - shift_y, - glyph); - - if (prefilter_x > 1) - stbtt__h_prefilter(output, out_w, out_h, out_stride, prefilter_x); - - if (prefilter_y > 1) - stbtt__v_prefilter(output, out_w, out_h, out_stride, prefilter_y); - - *sub_x = stbtt__oversample_shift(prefilter_x); - *sub_y = stbtt__oversample_shift(prefilter_y); -} - -// rects array must be big enough to accommodate all characters in the given ranges -STBTT_DEF int stbtt_PackFontRangesRenderIntoRects(stbtt_pack_context *spc, const stbtt_fontinfo *info, stbtt_pack_range *ranges, int num_ranges, stbrp_rect *rects) -{ - int i,j,k, missing_glyph = -1, return_value = 1; - - // save current values - int old_h_over = spc->h_oversample; - int old_v_over = spc->v_oversample; - - k = 0; - for (i=0; i < num_ranges; ++i) { - float fh = ranges[i].font_size; - float scale = fh > 0 ? stbtt_ScaleForPixelHeight(info, fh) : stbtt_ScaleForMappingEmToPixels(info, -fh); - float recip_h,recip_v,sub_x,sub_y; - spc->h_oversample = ranges[i].h_oversample; - spc->v_oversample = ranges[i].v_oversample; - recip_h = 1.0f / spc->h_oversample; - recip_v = 1.0f / spc->v_oversample; - sub_x = stbtt__oversample_shift(spc->h_oversample); - sub_y = stbtt__oversample_shift(spc->v_oversample); - for (j=0; j < ranges[i].num_chars; ++j) { - stbrp_rect *r = &rects[k]; - if (r->was_packed && r->w != 0 && r->h != 0) { - stbtt_packedchar *bc = &ranges[i].chardata_for_range[j]; - int advance, lsb, x0,y0,x1,y1; - int codepoint = ranges[i].array_of_unicode_codepoints == NULL ? ranges[i].first_unicode_codepoint_in_range + j : ranges[i].array_of_unicode_codepoints[j]; - int glyph = stbtt_FindGlyphIndex(info, codepoint); - stbrp_coord pad = (stbrp_coord) spc->padding; - - // pad on left and top - r->x += pad; - r->y += pad; - r->w -= pad; - r->h -= pad; - stbtt_GetGlyphHMetrics(info, glyph, &advance, &lsb); - stbtt_GetGlyphBitmapBox(info, glyph, - scale * spc->h_oversample, - scale * spc->v_oversample, - &x0,&y0,&x1,&y1); - stbtt_MakeGlyphBitmapSubpixel(info, - spc->pixels + r->x + r->y*spc->stride_in_bytes, - r->w - spc->h_oversample+1, - r->h - spc->v_oversample+1, - spc->stride_in_bytes, - scale * spc->h_oversample, - scale * spc->v_oversample, - 0,0, - glyph); - - if (spc->h_oversample > 1) - stbtt__h_prefilter(spc->pixels + r->x + r->y*spc->stride_in_bytes, - r->w, r->h, spc->stride_in_bytes, - spc->h_oversample); - - if (spc->v_oversample > 1) - stbtt__v_prefilter(spc->pixels + r->x + r->y*spc->stride_in_bytes, - r->w, r->h, spc->stride_in_bytes, - spc->v_oversample); - - bc->x0 = (stbtt_int16) r->x; - bc->y0 = (stbtt_int16) r->y; - bc->x1 = (stbtt_int16) (r->x + r->w); - bc->y1 = (stbtt_int16) (r->y + r->h); - bc->xadvance = scale * advance; - bc->xoff = (float) x0 * recip_h + sub_x; - bc->yoff = (float) y0 * recip_v + sub_y; - bc->xoff2 = (x0 + r->w) * recip_h + sub_x; - bc->yoff2 = (y0 + r->h) * recip_v + sub_y; - - if (glyph == 0) - missing_glyph = j; - } else if (spc->skip_missing) { - return_value = 0; - } else if (r->was_packed && r->w == 0 && r->h == 0 && missing_glyph >= 0) { - ranges[i].chardata_for_range[j] = ranges[i].chardata_for_range[missing_glyph]; - } else { - return_value = 0; // if any fail, report failure - } - - ++k; - } - } - - // restore original values - spc->h_oversample = old_h_over; - spc->v_oversample = old_v_over; - - return return_value; -} - -STBTT_DEF void stbtt_PackFontRangesPackRects(stbtt_pack_context *spc, stbrp_rect *rects, int num_rects) -{ - stbrp_pack_rects((stbrp_context *) spc->pack_info, rects, num_rects); -} - -STBTT_DEF int stbtt_PackFontRanges(stbtt_pack_context *spc, const unsigned char *fontdata, int font_index, stbtt_pack_range *ranges, int num_ranges) -{ - stbtt_fontinfo info; - int i,j,n, return_value = 1; - //stbrp_context *context = (stbrp_context *) spc->pack_info; - stbrp_rect *rects; - - // flag all characters as NOT packed - for (i=0; i < num_ranges; ++i) - for (j=0; j < ranges[i].num_chars; ++j) - ranges[i].chardata_for_range[j].x0 = - ranges[i].chardata_for_range[j].y0 = - ranges[i].chardata_for_range[j].x1 = - ranges[i].chardata_for_range[j].y1 = 0; - - n = 0; - for (i=0; i < num_ranges; ++i) - n += ranges[i].num_chars; - - rects = (stbrp_rect *) STBTT_malloc(sizeof(*rects) * n, spc->user_allocator_context); - if (rects == NULL) - return 0; - - info.userdata = spc->user_allocator_context; - stbtt_InitFont(&info, fontdata, stbtt_GetFontOffsetForIndex(fontdata,font_index)); - - n = stbtt_PackFontRangesGatherRects(spc, &info, ranges, num_ranges, rects); - - stbtt_PackFontRangesPackRects(spc, rects, n); - - return_value = stbtt_PackFontRangesRenderIntoRects(spc, &info, ranges, num_ranges, rects); - - STBTT_free(rects, spc->user_allocator_context); - return return_value; -} - -STBTT_DEF int stbtt_PackFontRange(stbtt_pack_context *spc, const unsigned char *fontdata, int font_index, float font_size, - int first_unicode_codepoint_in_range, int num_chars_in_range, stbtt_packedchar *chardata_for_range) -{ - stbtt_pack_range range; - range.first_unicode_codepoint_in_range = first_unicode_codepoint_in_range; - range.array_of_unicode_codepoints = NULL; - range.num_chars = num_chars_in_range; - range.chardata_for_range = chardata_for_range; - range.font_size = font_size; - return stbtt_PackFontRanges(spc, fontdata, font_index, &range, 1); -} - -STBTT_DEF void stbtt_GetScaledFontVMetrics(const unsigned char *fontdata, int index, float size, float *ascent, float *descent, float *lineGap) -{ - int i_ascent, i_descent, i_lineGap; - float scale; - stbtt_fontinfo info; - stbtt_InitFont(&info, fontdata, stbtt_GetFontOffsetForIndex(fontdata, index)); - scale = size > 0 ? stbtt_ScaleForPixelHeight(&info, size) : stbtt_ScaleForMappingEmToPixels(&info, -size); - stbtt_GetFontVMetrics(&info, &i_ascent, &i_descent, &i_lineGap); - *ascent = (float) i_ascent * scale; - *descent = (float) i_descent * scale; - *lineGap = (float) i_lineGap * scale; -} - -STBTT_DEF void stbtt_GetPackedQuad(const stbtt_packedchar *chardata, int pw, int ph, int char_index, float *xpos, float *ypos, stbtt_aligned_quad *q, int align_to_integer) -{ - float ipw = 1.0f / pw, iph = 1.0f / ph; - const stbtt_packedchar *b = chardata + char_index; - - if (align_to_integer) { - float x = (float) STBTT_ifloor((*xpos + b->xoff) + 0.5f); - float y = (float) STBTT_ifloor((*ypos + b->yoff) + 0.5f); - q->x0 = x; - q->y0 = y; - q->x1 = x + b->xoff2 - b->xoff; - q->y1 = y + b->yoff2 - b->yoff; - } else { - q->x0 = *xpos + b->xoff; - q->y0 = *ypos + b->yoff; - q->x1 = *xpos + b->xoff2; - q->y1 = *ypos + b->yoff2; - } - - q->s0 = b->x0 * ipw; - q->t0 = b->y0 * iph; - q->s1 = b->x1 * ipw; - q->t1 = b->y1 * iph; - - *xpos += b->xadvance; -} - -////////////////////////////////////////////////////////////////////////////// -// -// sdf computation -// - -#define STBTT_min(a,b) ((a) < (b) ? (a) : (b)) -#define STBTT_max(a,b) ((a) < (b) ? (b) : (a)) - -static int stbtt__ray_intersect_bezier(float orig[2], float ray[2], float q0[2], float q1[2], float q2[2], float hits[2][2]) -{ - float q0perp = q0[1]*ray[0] - q0[0]*ray[1]; - float q1perp = q1[1]*ray[0] - q1[0]*ray[1]; - float q2perp = q2[1]*ray[0] - q2[0]*ray[1]; - float roperp = orig[1]*ray[0] - orig[0]*ray[1]; - - float a = q0perp - 2*q1perp + q2perp; - float b = q1perp - q0perp; - float c = q0perp - roperp; - - float s0 = 0., s1 = 0.; - int num_s = 0; - - if (a != 0.0) { - float discr = b*b - a*c; - if (discr > 0.0) { - float rcpna = -1 / a; - float d = (float) STBTT_sqrt(discr); - s0 = (b+d) * rcpna; - s1 = (b-d) * rcpna; - if (s0 >= 0.0 && s0 <= 1.0) - num_s = 1; - if (d > 0.0 && s1 >= 0.0 && s1 <= 1.0) { - if (num_s == 0) s0 = s1; - ++num_s; - } - } - } else { - // 2*b*s + c = 0 - // s = -c / (2*b) - s0 = c / (-2 * b); - if (s0 >= 0.0 && s0 <= 1.0) - num_s = 1; - } - - if (num_s == 0) - return 0; - else { - float rcp_len2 = 1 / (ray[0]*ray[0] + ray[1]*ray[1]); - float rayn_x = ray[0] * rcp_len2, rayn_y = ray[1] * rcp_len2; - - float q0d = q0[0]*rayn_x + q0[1]*rayn_y; - float q1d = q1[0]*rayn_x + q1[1]*rayn_y; - float q2d = q2[0]*rayn_x + q2[1]*rayn_y; - float rod = orig[0]*rayn_x + orig[1]*rayn_y; - - float q10d = q1d - q0d; - float q20d = q2d - q0d; - float q0rd = q0d - rod; - - hits[0][0] = q0rd + s0*(2.0f - 2.0f*s0)*q10d + s0*s0*q20d; - hits[0][1] = a*s0+b; - - if (num_s > 1) { - hits[1][0] = q0rd + s1*(2.0f - 2.0f*s1)*q10d + s1*s1*q20d; - hits[1][1] = a*s1+b; - return 2; - } else { - return 1; - } - } -} - -static int equal(float *a, float *b) -{ - return (a[0] == b[0] && a[1] == b[1]); -} - -static int stbtt__compute_crossings_x(float x, float y, int nverts, stbtt_vertex *verts) -{ - int i; - float orig[2], ray[2] = { 1, 0 }; - float y_frac; - int winding = 0; - - // make sure y never passes through a vertex of the shape - y_frac = (float) STBTT_fmod(y, 1.0f); - if (y_frac < 0.01f) - y += 0.01f; - else if (y_frac > 0.99f) - y -= 0.01f; - - orig[0] = x; - orig[1] = y; - - // test a ray from (-infinity,y) to (x,y) - for (i=0; i < nverts; ++i) { - if (verts[i].type == STBTT_vline) { - int x0 = (int) verts[i-1].x, y0 = (int) verts[i-1].y; - int x1 = (int) verts[i ].x, y1 = (int) verts[i ].y; - if (y > STBTT_min(y0,y1) && y < STBTT_max(y0,y1) && x > STBTT_min(x0,x1)) { - float x_inter = (y - y0) / (y1 - y0) * (x1-x0) + x0; - if (x_inter < x) - winding += (y0 < y1) ? 1 : -1; - } - } - if (verts[i].type == STBTT_vcurve) { - int x0 = (int) verts[i-1].x , y0 = (int) verts[i-1].y ; - int x1 = (int) verts[i ].cx, y1 = (int) verts[i ].cy; - int x2 = (int) verts[i ].x , y2 = (int) verts[i ].y ; - int ax = STBTT_min(x0,STBTT_min(x1,x2)), ay = STBTT_min(y0,STBTT_min(y1,y2)); - int by = STBTT_max(y0,STBTT_max(y1,y2)); - if (y > ay && y < by && x > ax) { - float q0[2],q1[2],q2[2]; - float hits[2][2]; - q0[0] = (float)x0; - q0[1] = (float)y0; - q1[0] = (float)x1; - q1[1] = (float)y1; - q2[0] = (float)x2; - q2[1] = (float)y2; - if (equal(q0,q1) || equal(q1,q2)) { - x0 = (int)verts[i-1].x; - y0 = (int)verts[i-1].y; - x1 = (int)verts[i ].x; - y1 = (int)verts[i ].y; - if (y > STBTT_min(y0,y1) && y < STBTT_max(y0,y1) && x > STBTT_min(x0,x1)) { - float x_inter = (y - y0) / (y1 - y0) * (x1-x0) + x0; - if (x_inter < x) - winding += (y0 < y1) ? 1 : -1; - } - } else { - int num_hits = stbtt__ray_intersect_bezier(orig, ray, q0, q1, q2, hits); - if (num_hits >= 1) - if (hits[0][0] < 0) - winding += (hits[0][1] < 0 ? -1 : 1); - if (num_hits >= 2) - if (hits[1][0] < 0) - winding += (hits[1][1] < 0 ? -1 : 1); - } - } - } - } - return winding; -} - -static float stbtt__cuberoot( float x ) -{ - if (x<0) - return -(float) STBTT_pow(-x,1.0f/3.0f); - else - return (float) STBTT_pow( x,1.0f/3.0f); -} - -// x^3 + a*x^2 + b*x + c = 0 -static int stbtt__solve_cubic(float a, float b, float c, float* r) -{ - float s = -a / 3; - float p = b - a*a / 3; - float q = a * (2*a*a - 9*b) / 27 + c; - float p3 = p*p*p; - float d = q*q + 4*p3 / 27; - if (d >= 0) { - float z = (float) STBTT_sqrt(d); - float u = (-q + z) / 2; - float v = (-q - z) / 2; - u = stbtt__cuberoot(u); - v = stbtt__cuberoot(v); - r[0] = s + u + v; - return 1; - } else { - float u = (float) STBTT_sqrt(-p/3); - float v = (float) STBTT_acos(-STBTT_sqrt(-27/p3) * q / 2) / 3; // p3 must be negative, since d is negative - float m = (float) STBTT_cos(v); - float n = (float) STBTT_cos(v-3.141592/2)*1.732050808f; - r[0] = s + u * 2 * m; - r[1] = s - u * (m + n); - r[2] = s - u * (m - n); - - //STBTT_assert( STBTT_fabs(((r[0]+a)*r[0]+b)*r[0]+c) < 0.05f); // these asserts may not be safe at all scales, though they're in bezier t parameter units so maybe? - //STBTT_assert( STBTT_fabs(((r[1]+a)*r[1]+b)*r[1]+c) < 0.05f); - //STBTT_assert( STBTT_fabs(((r[2]+a)*r[2]+b)*r[2]+c) < 0.05f); - return 3; - } -} - -STBTT_DEF unsigned char * stbtt_GetGlyphSDF(const stbtt_fontinfo *info, float scale, int glyph, int padding, unsigned char onedge_value, float pixel_dist_scale, int *width, int *height, int *xoff, int *yoff) -{ - float scale_x = scale, scale_y = scale; - int ix0,iy0,ix1,iy1; - int w,h; - unsigned char *data; - - if (scale == 0) return NULL; - - stbtt_GetGlyphBitmapBoxSubpixel(info, glyph, scale, scale, 0.0f,0.0f, &ix0,&iy0,&ix1,&iy1); - - // if empty, return NULL - if (ix0 == ix1 || iy0 == iy1) - return NULL; - - ix0 -= padding; - iy0 -= padding; - ix1 += padding; - iy1 += padding; - - w = (ix1 - ix0); - h = (iy1 - iy0); - - if (width ) *width = w; - if (height) *height = h; - if (xoff ) *xoff = ix0; - if (yoff ) *yoff = iy0; - - // invert for y-downwards bitmaps - scale_y = -scale_y; - - { - int x,y,i,j; - float *precompute; - stbtt_vertex *verts; - int num_verts = stbtt_GetGlyphShape(info, glyph, &verts); - data = (unsigned char *) STBTT_malloc(w * h, info->userdata); - precompute = (float *) STBTT_malloc(num_verts * sizeof(float), info->userdata); - - for (i=0,j=num_verts-1; i < num_verts; j=i++) { - if (verts[i].type == STBTT_vline) { - float x0 = verts[i].x*scale_x, y0 = verts[i].y*scale_y; - float x1 = verts[j].x*scale_x, y1 = verts[j].y*scale_y; - float dist = (float) STBTT_sqrt((x1-x0)*(x1-x0) + (y1-y0)*(y1-y0)); - precompute[i] = (dist == 0) ? 0.0f : 1.0f / dist; - } else if (verts[i].type == STBTT_vcurve) { - float x2 = verts[j].x *scale_x, y2 = verts[j].y *scale_y; - float x1 = verts[i].cx*scale_x, y1 = verts[i].cy*scale_y; - float x0 = verts[i].x *scale_x, y0 = verts[i].y *scale_y; - float bx = x0 - 2*x1 + x2, by = y0 - 2*y1 + y2; - float len2 = bx*bx + by*by; - if (len2 != 0.0f) - precompute[i] = 1.0f / (bx*bx + by*by); - else - precompute[i] = 0.0f; - } else - precompute[i] = 0.0f; - } - - for (y=iy0; y < iy1; ++y) { - for (x=ix0; x < ix1; ++x) { - float val; - float min_dist = 999999.0f; - float sx = (float) x + 0.5f; - float sy = (float) y + 0.5f; - float x_gspace = (sx / scale_x); - float y_gspace = (sy / scale_y); - - int winding = stbtt__compute_crossings_x(x_gspace, y_gspace, num_verts, verts); // @OPTIMIZE: this could just be a rasterization, but needs to be line vs. non-tesselated curves so a new path - - for (i=0; i < num_verts; ++i) { - float x0 = verts[i].x*scale_x, y0 = verts[i].y*scale_y; - - if (verts[i].type == STBTT_vline && precompute[i] != 0.0f) { - float x1 = verts[i-1].x*scale_x, y1 = verts[i-1].y*scale_y; - - float dist,dist2 = (x0-sx)*(x0-sx) + (y0-sy)*(y0-sy); - if (dist2 < min_dist*min_dist) - min_dist = (float) STBTT_sqrt(dist2); - - // coarse culling against bbox - //if (sx > STBTT_min(x0,x1)-min_dist && sx < STBTT_max(x0,x1)+min_dist && - // sy > STBTT_min(y0,y1)-min_dist && sy < STBTT_max(y0,y1)+min_dist) - dist = (float) STBTT_fabs((x1-x0)*(y0-sy) - (y1-y0)*(x0-sx)) * precompute[i]; - STBTT_assert(i != 0); - if (dist < min_dist) { - // check position along line - // x' = x0 + t*(x1-x0), y' = y0 + t*(y1-y0) - // minimize (x'-sx)*(x'-sx)+(y'-sy)*(y'-sy) - float dx = x1-x0, dy = y1-y0; - float px = x0-sx, py = y0-sy; - // minimize (px+t*dx)^2 + (py+t*dy)^2 = px*px + 2*px*dx*t + t^2*dx*dx + py*py + 2*py*dy*t + t^2*dy*dy - // derivative: 2*px*dx + 2*py*dy + (2*dx*dx+2*dy*dy)*t, set to 0 and solve - float t = -(px*dx + py*dy) / (dx*dx + dy*dy); - if (t >= 0.0f && t <= 1.0f) - min_dist = dist; - } - } else if (verts[i].type == STBTT_vcurve) { - float x2 = verts[i-1].x *scale_x, y2 = verts[i-1].y *scale_y; - float x1 = verts[i ].cx*scale_x, y1 = verts[i ].cy*scale_y; - float box_x0 = STBTT_min(STBTT_min(x0,x1),x2); - float box_y0 = STBTT_min(STBTT_min(y0,y1),y2); - float box_x1 = STBTT_max(STBTT_max(x0,x1),x2); - float box_y1 = STBTT_max(STBTT_max(y0,y1),y2); - // coarse culling against bbox to avoid computing cubic unnecessarily - if (sx > box_x0-min_dist && sx < box_x1+min_dist && sy > box_y0-min_dist && sy < box_y1+min_dist) { - int num=0; - float ax = x1-x0, ay = y1-y0; - float bx = x0 - 2*x1 + x2, by = y0 - 2*y1 + y2; - float mx = x0 - sx, my = y0 - sy; - float res[3] = {0.f,0.f,0.f}; - float px,py,t,it,dist2; - float a_inv = precompute[i]; - if (a_inv == 0.0) { // if a_inv is 0, it's 2nd degree so use quadratic formula - float a = 3*(ax*bx + ay*by); - float b = 2*(ax*ax + ay*ay) + (mx*bx+my*by); - float c = mx*ax+my*ay; - if (a == 0.0) { // if a is 0, it's linear - if (b != 0.0) { - res[num++] = -c/b; - } - } else { - float discriminant = b*b - 4*a*c; - if (discriminant < 0) - num = 0; - else { - float root = (float) STBTT_sqrt(discriminant); - res[0] = (-b - root)/(2*a); - res[1] = (-b + root)/(2*a); - num = 2; // don't bother distinguishing 1-solution case, as code below will still work - } - } - } else { - float b = 3*(ax*bx + ay*by) * a_inv; // could precompute this as it doesn't depend on sample point - float c = (2*(ax*ax + ay*ay) + (mx*bx+my*by)) * a_inv; - float d = (mx*ax+my*ay) * a_inv; - num = stbtt__solve_cubic(b, c, d, res); - } - dist2 = (x0-sx)*(x0-sx) + (y0-sy)*(y0-sy); - if (dist2 < min_dist*min_dist) - min_dist = (float) STBTT_sqrt(dist2); - - if (num >= 1 && res[0] >= 0.0f && res[0] <= 1.0f) { - t = res[0], it = 1.0f - t; - px = it*it*x0 + 2*t*it*x1 + t*t*x2; - py = it*it*y0 + 2*t*it*y1 + t*t*y2; - dist2 = (px-sx)*(px-sx) + (py-sy)*(py-sy); - if (dist2 < min_dist * min_dist) - min_dist = (float) STBTT_sqrt(dist2); - } - if (num >= 2 && res[1] >= 0.0f && res[1] <= 1.0f) { - t = res[1], it = 1.0f - t; - px = it*it*x0 + 2*t*it*x1 + t*t*x2; - py = it*it*y0 + 2*t*it*y1 + t*t*y2; - dist2 = (px-sx)*(px-sx) + (py-sy)*(py-sy); - if (dist2 < min_dist * min_dist) - min_dist = (float) STBTT_sqrt(dist2); - } - if (num >= 3 && res[2] >= 0.0f && res[2] <= 1.0f) { - t = res[2], it = 1.0f - t; - px = it*it*x0 + 2*t*it*x1 + t*t*x2; - py = it*it*y0 + 2*t*it*y1 + t*t*y2; - dist2 = (px-sx)*(px-sx) + (py-sy)*(py-sy); - if (dist2 < min_dist * min_dist) - min_dist = (float) STBTT_sqrt(dist2); - } - } - } - } - if (winding == 0) - min_dist = -min_dist; // if outside the shape, value is negative - val = onedge_value + pixel_dist_scale * min_dist; - if (val < 0) - val = 0; - else if (val > 255) - val = 255; - data[(y-iy0)*w+(x-ix0)] = (unsigned char) val; - } - } - STBTT_free(precompute, info->userdata); - STBTT_free(verts, info->userdata); - } - return data; -} - -STBTT_DEF unsigned char * stbtt_GetCodepointSDF(const stbtt_fontinfo *info, float scale, int codepoint, int padding, unsigned char onedge_value, float pixel_dist_scale, int *width, int *height, int *xoff, int *yoff) -{ - return stbtt_GetGlyphSDF(info, scale, stbtt_FindGlyphIndex(info, codepoint), padding, onedge_value, pixel_dist_scale, width, height, xoff, yoff); -} - -STBTT_DEF void stbtt_FreeSDF(unsigned char *bitmap, void *userdata) -{ - STBTT_free(bitmap, userdata); -} - -////////////////////////////////////////////////////////////////////////////// -// -// font name matching -- recommended not to use this -// - -// check if a utf8 string contains a prefix which is the utf16 string; if so return length of matching utf8 string -static stbtt_int32 stbtt__CompareUTF8toUTF16_bigendian_prefix(stbtt_uint8 *s1, stbtt_int32 len1, stbtt_uint8 *s2, stbtt_int32 len2) -{ - stbtt_int32 i=0; - - // convert utf16 to utf8 and compare the results while converting - while (len2) { - stbtt_uint16 ch = s2[0]*256 + s2[1]; - if (ch < 0x80) { - if (i >= len1) return -1; - if (s1[i++] != ch) return -1; - } else if (ch < 0x800) { - if (i+1 >= len1) return -1; - if (s1[i++] != 0xc0 + (ch >> 6)) return -1; - if (s1[i++] != 0x80 + (ch & 0x3f)) return -1; - } else if (ch >= 0xd800 && ch < 0xdc00) { - stbtt_uint32 c; - stbtt_uint16 ch2 = s2[2]*256 + s2[3]; - if (i+3 >= len1) return -1; - c = ((ch - 0xd800) << 10) + (ch2 - 0xdc00) + 0x10000; - if (s1[i++] != 0xf0 + (c >> 18)) return -1; - if (s1[i++] != 0x80 + ((c >> 12) & 0x3f)) return -1; - if (s1[i++] != 0x80 + ((c >> 6) & 0x3f)) return -1; - if (s1[i++] != 0x80 + ((c ) & 0x3f)) return -1; - s2 += 2; // plus another 2 below - len2 -= 2; - } else if (ch >= 0xdc00 && ch < 0xe000) { - return -1; - } else { - if (i+2 >= len1) return -1; - if (s1[i++] != 0xe0 + (ch >> 12)) return -1; - if (s1[i++] != 0x80 + ((ch >> 6) & 0x3f)) return -1; - if (s1[i++] != 0x80 + ((ch ) & 0x3f)) return -1; - } - s2 += 2; - len2 -= 2; - } - return i; -} - -static int stbtt_CompareUTF8toUTF16_bigendian_internal(char *s1, int len1, char *s2, int len2) -{ - return len1 == stbtt__CompareUTF8toUTF16_bigendian_prefix((stbtt_uint8*) s1, len1, (stbtt_uint8*) s2, len2); -} - -// returns results in whatever encoding you request... but note that 2-byte encodings -// will be BIG-ENDIAN... use stbtt_CompareUTF8toUTF16_bigendian() to compare -STBTT_DEF const char *stbtt_GetFontNameString(const stbtt_fontinfo *font, int *length, int platformID, int encodingID, int languageID, int nameID) -{ - stbtt_int32 i,count,stringOffset; - stbtt_uint8 *fc = font->data; - stbtt_uint32 offset = font->fontstart; - stbtt_uint32 nm = stbtt__find_table(fc, offset, "name"); - if (!nm) return NULL; - - count = ttUSHORT(fc+nm+2); - stringOffset = nm + ttUSHORT(fc+nm+4); - for (i=0; i < count; ++i) { - stbtt_uint32 loc = nm + 6 + 12 * i; - if (platformID == ttUSHORT(fc+loc+0) && encodingID == ttUSHORT(fc+loc+2) - && languageID == ttUSHORT(fc+loc+4) && nameID == ttUSHORT(fc+loc+6)) { - *length = ttUSHORT(fc+loc+8); - return (const char *) (fc+stringOffset+ttUSHORT(fc+loc+10)); - } - } - return NULL; -} - -static int stbtt__matchpair(stbtt_uint8 *fc, stbtt_uint32 nm, stbtt_uint8 *name, stbtt_int32 nlen, stbtt_int32 target_id, stbtt_int32 next_id) -{ - stbtt_int32 i; - stbtt_int32 count = ttUSHORT(fc+nm+2); - stbtt_int32 stringOffset = nm + ttUSHORT(fc+nm+4); - - for (i=0; i < count; ++i) { - stbtt_uint32 loc = nm + 6 + 12 * i; - stbtt_int32 id = ttUSHORT(fc+loc+6); - if (id == target_id) { - // find the encoding - stbtt_int32 platform = ttUSHORT(fc+loc+0), encoding = ttUSHORT(fc+loc+2), language = ttUSHORT(fc+loc+4); - - // is this a Unicode encoding? - if (platform == 0 || (platform == 3 && encoding == 1) || (platform == 3 && encoding == 10)) { - stbtt_int32 slen = ttUSHORT(fc+loc+8); - stbtt_int32 off = ttUSHORT(fc+loc+10); - - // check if there's a prefix match - stbtt_int32 matchlen = stbtt__CompareUTF8toUTF16_bigendian_prefix(name, nlen, fc+stringOffset+off,slen); - if (matchlen >= 0) { - // check for target_id+1 immediately following, with same encoding & language - if (i+1 < count && ttUSHORT(fc+loc+12+6) == next_id && ttUSHORT(fc+loc+12) == platform && ttUSHORT(fc+loc+12+2) == encoding && ttUSHORT(fc+loc+12+4) == language) { - slen = ttUSHORT(fc+loc+12+8); - off = ttUSHORT(fc+loc+12+10); - if (slen == 0) { - if (matchlen == nlen) - return 1; - } else if (matchlen < nlen && name[matchlen] == ' ') { - ++matchlen; - if (stbtt_CompareUTF8toUTF16_bigendian_internal((char*) (name+matchlen), nlen-matchlen, (char*)(fc+stringOffset+off),slen)) - return 1; - } - } else { - // if nothing immediately following - if (matchlen == nlen) - return 1; - } - } - } - - // @TODO handle other encodings - } - } - return 0; -} - -static int stbtt__matches(stbtt_uint8 *fc, stbtt_uint32 offset, stbtt_uint8 *name, stbtt_int32 flags) -{ - stbtt_int32 nlen = (stbtt_int32) STBTT_strlen((char *) name); - stbtt_uint32 nm,hd; - if (!stbtt__isfont(fc+offset)) return 0; - - // check italics/bold/underline flags in macStyle... - if (flags) { - hd = stbtt__find_table(fc, offset, "head"); - if ((ttUSHORT(fc+hd+44) & 7) != (flags & 7)) return 0; - } - - nm = stbtt__find_table(fc, offset, "name"); - if (!nm) return 0; - - if (flags) { - // if we checked the macStyle flags, then just check the family and ignore the subfamily - if (stbtt__matchpair(fc, nm, name, nlen, 16, -1)) return 1; - if (stbtt__matchpair(fc, nm, name, nlen, 1, -1)) return 1; - if (stbtt__matchpair(fc, nm, name, nlen, 3, -1)) return 1; - } else { - if (stbtt__matchpair(fc, nm, name, nlen, 16, 17)) return 1; - if (stbtt__matchpair(fc, nm, name, nlen, 1, 2)) return 1; - if (stbtt__matchpair(fc, nm, name, nlen, 3, -1)) return 1; - } - - return 0; -} - -static int stbtt_FindMatchingFont_internal(unsigned char *font_collection, char *name_utf8, stbtt_int32 flags) -{ - stbtt_int32 i; - for (i=0;;++i) { - stbtt_int32 off = stbtt_GetFontOffsetForIndex(font_collection, i); - if (off < 0) return off; - if (stbtt__matches((stbtt_uint8 *) font_collection, off, (stbtt_uint8*) name_utf8, flags)) - return off; - } -} - -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wcast-qual" -#endif - -STBTT_DEF int stbtt_BakeFontBitmap(const unsigned char *data, int offset, - float pixel_height, unsigned char *pixels, int pw, int ph, - int first_char, int num_chars, stbtt_bakedchar *chardata) -{ - return stbtt_BakeFontBitmap_internal((unsigned char *) data, offset, pixel_height, pixels, pw, ph, first_char, num_chars, chardata); -} - -STBTT_DEF int stbtt_GetFontOffsetForIndex(const unsigned char *data, int index) -{ - return stbtt_GetFontOffsetForIndex_internal((unsigned char *) data, index); -} - -STBTT_DEF int stbtt_GetNumberOfFonts(const unsigned char *data) -{ - return stbtt_GetNumberOfFonts_internal((unsigned char *) data); -} - -STBTT_DEF int stbtt_InitFont(stbtt_fontinfo *info, const unsigned char *data, int offset) -{ - return stbtt_InitFont_internal(info, (unsigned char *) data, offset); -} - -STBTT_DEF int stbtt_FindMatchingFont(const unsigned char *fontdata, const char *name, int flags) -{ - return stbtt_FindMatchingFont_internal((unsigned char *) fontdata, (char *) name, flags); -} - -STBTT_DEF int stbtt_CompareUTF8toUTF16_bigendian(const char *s1, int len1, const char *s2, int len2) -{ - return stbtt_CompareUTF8toUTF16_bigendian_internal((char *) s1, len1, (char *) s2, len2); -} - -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic pop -#endif - -#endif // STB_TRUETYPE_IMPLEMENTATION - - -// FULL VERSION HISTORY -// -// 1.25 (2021-07-11) many fixes -// 1.24 (2020-02-05) fix warning -// 1.23 (2020-02-02) query SVG data for glyphs; query whole kerning table (but only kern not GPOS) -// 1.22 (2019-08-11) minimize missing-glyph duplication; fix kerning if both 'GPOS' and 'kern' are defined -// 1.21 (2019-02-25) fix warning -// 1.20 (2019-02-07) PackFontRange skips missing codepoints; GetScaleFontVMetrics() -// 1.19 (2018-02-11) OpenType GPOS kerning (horizontal only), STBTT_fmod -// 1.18 (2018-01-29) add missing function -// 1.17 (2017-07-23) make more arguments const; doc fix -// 1.16 (2017-07-12) SDF support -// 1.15 (2017-03-03) make more arguments const -// 1.14 (2017-01-16) num-fonts-in-TTC function -// 1.13 (2017-01-02) support OpenType fonts, certain Apple fonts -// 1.12 (2016-10-25) suppress warnings about casting away const with -Wcast-qual -// 1.11 (2016-04-02) fix unused-variable warning -// 1.10 (2016-04-02) allow user-defined fabs() replacement -// fix memory leak if fontsize=0.0 -// fix warning from duplicate typedef -// 1.09 (2016-01-16) warning fix; avoid crash on outofmem; use alloc userdata for PackFontRanges -// 1.08 (2015-09-13) document stbtt_Rasterize(); fixes for vertical & horizontal edges -// 1.07 (2015-08-01) allow PackFontRanges to accept arrays of sparse codepoints; -// allow PackFontRanges to pack and render in separate phases; -// fix stbtt_GetFontOFfsetForIndex (never worked for non-0 input?); -// fixed an assert() bug in the new rasterizer -// replace assert() with STBTT_assert() in new rasterizer -// 1.06 (2015-07-14) performance improvements (~35% faster on x86 and x64 on test machine) -// also more precise AA rasterizer, except if shapes overlap -// remove need for STBTT_sort -// 1.05 (2015-04-15) fix misplaced definitions for STBTT_STATIC -// 1.04 (2015-04-15) typo in example -// 1.03 (2015-04-12) STBTT_STATIC, fix memory leak in new packing, various fixes -// 1.02 (2014-12-10) fix various warnings & compile issues w/ stb_rect_pack, C++ -// 1.01 (2014-12-08) fix subpixel position when oversampling to exactly match -// non-oversampled; STBTT_POINT_SIZE for packed case only -// 1.00 (2014-12-06) add new PackBegin etc. API, w/ support for oversampling -// 0.99 (2014-09-18) fix multiple bugs with subpixel rendering (ryg) -// 0.9 (2014-08-07) support certain mac/iOS fonts without an MS platformID -// 0.8b (2014-07-07) fix a warning -// 0.8 (2014-05-25) fix a few more warnings -// 0.7 (2013-09-25) bugfix: subpixel glyph bug fixed in 0.5 had come back -// 0.6c (2012-07-24) improve documentation -// 0.6b (2012-07-20) fix a few more warnings -// 0.6 (2012-07-17) fix warnings; added stbtt_ScaleForMappingEmToPixels, -// stbtt_GetFontBoundingBox, stbtt_IsGlyphEmpty -// 0.5 (2011-12-09) bugfixes: -// subpixel glyph renderer computed wrong bounding box -// first vertex of shape can be off-curve (FreeSans) -// 0.4b (2011-12-03) fixed an error in the font baking example -// 0.4 (2011-12-01) kerning, subpixel rendering (tor) -// bugfixes for: -// codepoint-to-glyph conversion using table fmt=12 -// codepoint-to-glyph conversion using table fmt=4 -// stbtt_GetBakedQuad with non-square texture (Zer) -// updated Hello World! sample to use kerning and subpixel -// fixed some warnings -// 0.3 (2009-06-24) cmap fmt=12, compound shapes (MM) -// userdata, malloc-from-userdata, non-zero fill (stb) -// 0.2 (2009-03-11) Fix unsigned/signed char warnings -// 0.1 (2009-03-09) First public release -// - -/* ------------------------------------------------------------------------------- -This software is available under 2 licenses -- choose whichever you prefer. ------------------------------------------------------------------------------- -ALTERNATIVE A - MIT License -Copyright (c) 2017 Sean Barrett -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. ------------------------------------------------------------------------------- -ALTERNATIVE B - Public Domain (www.unlicense.org) -This is free and unencumbered software released into the public domain. -Anyone is free to copy, modify, publish, use, compile, sell, or distribute this -software, either in source code form or as a compiled binary, for any purpose, -commercial or non-commercial, and by any means. -In jurisdictions that recognize copyright laws, the author or authors of this -software dedicate any and all copyright interest in the software to the public -domain. We make this dedication for the benefit of the public at large and to -the detriment of our heirs and successors. We intend this dedication to be an -overt act of relinquishment in perpetuity of all present and future rights to -this software under copyright law. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ------------------------------------------------------------------------------- -*/ diff --git a/vendor/stb/stb_truetype_impl.c b/vendor/stb/stb_truetype_impl.c deleted file mode 100644 index ca6cf7b8..00000000 --- a/vendor/stb/stb_truetype_impl.c +++ /dev/null @@ -1,5 +0,0 @@ -// stb_truetype implementation unit — pulls the single-header lib's -// implementation into one TU. ui_sdl.zig only needs the declarations (via the -// include path); this .c defines STB_TRUETYPE_IMPLEMENTATION once. -#define STB_TRUETYPE_IMPLEMENTATION -#include "stb_truetype.h" -- cgit v1.3 From e5f764bd201df6554272427fc8cedffece18066f Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Thu, 24 Sep 2026 10:12:10 -0300 Subject: Shape text with HarfBuzz, so a font's programming ligatures draw across their cells The SDL shell rasterized every cell by its own codepoint, so a font's `->`, `!=` or `<=` ligature never appeared. Text is now shaped with HarfBuzz 11.0.0, built from source like FreeType: a lazy build.zig.zon dependency (the tarball Ghostty pins) compiled only for the gui shell, its FreeType integration linked against the freetype package, so the binary carries no system HarfBuzz or FreeType and a tty build never compiles it. Shaping turns on only the font's ligature features (liga, calt, clig, rlig, rclt); composition, local forms and fractions stay off, so a cell draws either its nominal glyph, as it always did, or part of a ligature. A glyph no lookup of those features covers cannot change, so its cell is resolved alone, and that resolution is cached by codepoint: in a font without ligatures (Adwaita Mono) no cell is ever shaped, and the pipeline draws pixel for pixel as before. A cell whose glyph a ligature could replace is shaped with its word: the cells between spaces that share a decoration and a role. A word ends either side of the cursor, block or bar, so the cell being edited shows its own character (Ghostty's rule), and inside f|i, f|l and s|t, whose typographic ligatures do not belong on a grid (Ghostty again). Colours never end a word: a ligature spans a syntax colour change or a selection edge. A codepoint the primary font lacks shapes in the fallback face that has it. Taglines are not shaped: they are drawn at two pitches, and a strip would not line up in one. HarfBuzz only chooses glyphs; the grid places them. A substituted glyph whose ink reaches over neighbouring cells that draw nothing of their own (the spacer glyphs of Fira Code-style fonts such as Maple Mono, or the cells a merged ligature cluster swallowed) claims them: it is rasterized once as a strip that many cells wide, and each cell samples its own slice, so selection, the cursor and per-cell colours work unchanged. Anything the grid cannot place (several glyphs in one cell, a positioned mark) keeps its nominal glyphs. A frame must not pay for this. A shaped word's atlas slots are cached by its text (checked against the stored text, not just its hash), so a frame costs one lookup per word and a compare for the rest of the word being walked. The atlas is keyed by (face, glyph, role, decoration, lead, span), packed into 64 bits so a lookup hashes one word; ASCII glyph ids are a table, and a face's HarfBuzz state is made when it is first asked about a glyph. Measured with the latency trace, whose F line now also carries the submit time (CPU = submit - present entry), in 10 interleaved rounds against main with an A/A pair, at 160x50 cells: with Adwaita Mono every scenario (idle, scrolling, typing, terminal output) is as fast or 1-3% faster, and the first frame and time to first paint are unchanged. With Maple Mono, ligatures cost the first frame about 0.8 ms (HarfBuzz setup and shaping the screen) and scrolling new text about 1-2%. With it the codepoint raster path is gone: grips look up their glyph and stay centered, since a grip is not text. ui_font_scale_for_height, an identity kept as a "size token", is removed (px is the size everywhere), ui_font_has_glyph becomes ui_font_glyph, and the space slot is simply the first, cleared cell of the atlas rather than a rasterized space. CellStyle.ul gets an explicit u3 tag so a decoration fits in the packed keys. Co-Authored-By: Claude Opus 5.5 (1M context) --- build.zig | 33 ++++ build.zig.zon | 9 + docs/design.typ | 6 +- src/gui/font.c | 283 ++++++++++++++++++++++++---- src/gui/font.h | 66 +++++-- src/gui/gui.zig | 565 +++++++++++++++++++++++++++++++++++++++++++------------- src/pardes.zig | 2 +- 7 files changed, 783 insertions(+), 181 deletions(-) (limited to 'src/gui') diff --git a/build.zig b/build.zig index 7010c863..21df1555 100644 --- a/build.zig +++ b/build.zig @@ -642,6 +642,39 @@ pub fn build(b: *std.Build) void { .@"enable-libpng" = false, }); gm.linkLibrary(freetype_dep.artifact("freetype")); + // HarfBuzz from source, like FreeType: its FreeType integration + // (HAVE_FREETYPE, hb-ft) links the freetype artifact above, so the two + // share one FreeType. The flags are the ones Ghostty builds it with. + if (b.lazyDependency("harfbuzz", .{})) |upstream| { + const harfbuzz = b.addLibrary(.{ + .name = "harfbuzz", + .linkage = .static, + .root_module = b.createModule(.{ + .target = target, + .optimize = optimize, + .link_libc = true, + .link_libcpp = true, + }), + }); + harfbuzz.root_module.linkLibrary(freetype_dep.artifact("freetype")); + harfbuzz.root_module.addIncludePath(upstream.path("src")); + harfbuzz.root_module.addCSourceFile(.{ + .file = upstream.path("src/harfbuzz.cc"), + .flags = &.{ + "-DHAVE_STDBOOL_H", + "-DHAVE_UNISTD_H", + "-DHAVE_SYS_MMAN_H", + "-DHAVE_PTHREAD=1", + "-DHAVE_FREETYPE=1", + "-DHAVE_FT_GET_VAR_BLEND_COORDINATES=1", + "-DHAVE_FT_SET_VAR_BLEND_COORDINATES=1", + "-DHAVE_FT_DONE_MM_VAR=1", + "-DHAVE_FT_GET_TRANSFORM=1", + }, + }); + gm.linkLibrary(harfbuzz); + gm.addIncludePath(upstream.path("src")); + } if (target.result.os.tag.isDarwin()) gm.addRPath(.{ .cwd_relative = "/usr/local/lib" }); gm.addIncludePath(b.path("src/gui")); diff --git a/build.zig.zon b/build.zig.zon index 8f1b8068..31649350 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -189,6 +189,15 @@ .url = "git+https://github.com/allyourcodebase/freetype#884fd2235e6ae1ec4306eda30b3259f20930ed2e", .hash = "freetype-2.14.3-C3-WdXSKAAB-kHs4qgRoeoFnRkNQn6M_SSlUGZ6ywgBQ", }, + // HarfBuzz shapes the SDL shell's text runs, which is what turns `->` + // into a font's arrow ligature. The upstream source release (the same + // tarball Ghostty pins); build.zig compiles harfbuzz.cc against the + // freetype above. Lazy: only a gui build fetches or compiles it. + .harfbuzz = .{ + .url = "https://deps.files.ghostty.org/harfbuzz-11.0.0.tar.xz", + .hash = "N-V-__8AAG02ugUcWec-Ndp-i7JTsJ0dgF8nnJRUInkGLG7G", + .lazy = true, + }, }, .minimum_zig_version = "0.16.0", .paths = .{""}, diff --git a/docs/design.typ b/docs/design.typ index f8f0b05c..8ec025f1 100644 --- a/docs/design.typ +++ b/docs/design.typ @@ -1632,7 +1632,8 @@ and web and macOS are libraries whose host owns `main()`. == Generated inputs Native dependencies are ghostty, vaxis, uucode (shared config), zstbi, SDL (a -pinned fork, lazy), FreeType, MuPDF (`-Dmupdf`, on by default everywhere but the +pinned fork, lazy), FreeType, HarfBuzz (the SDL shell's text shaping, lazy, +built against that FreeType), MuPDF (`-Dmupdf`, on by default everywhere but the web and the board, lazy), ZLS, mvzr (the regex engine behind `s`/`S`), zig-tree-sitter with 29 grammars for 28 languages (markdown takes two, block and inline) — all pinned through `zig fetch` and wired in `build.zig`. The board's @@ -2041,7 +2042,8 @@ tap-LOOK/drag-scroll, but finger-down on a tagline or a one-cell-tolerant pane separator latches to a left-mouse gesture for its lifetime, keeping layout drags out of the scroll heuristic. Touch input translation and scroll/tap state live entirely in the JavaScript shell. -The native SDL shell uses a FreeType light-hinted grayscale atlas over the SDL GPU API (SPIR-V). +The native SDL shell uses a FreeType light-hinted grayscale atlas over the SDL GPU API (SPIR-V), +with words shaped by HarfBuzz so a font's ligatures span their cells. The browser exposes each cell as selectable, inspectable text and applies the surface styles with CSS. The browser `.snap` harness drives real Chromium touch input and reads both text and per-cell styles from the DOM renderer's packed diff --git a/src/gui/font.c b/src/gui/font.c index 5ea595f9..5cb98e1a 100644 --- a/src/gui/font.c +++ b/src/gui/font.c @@ -1,9 +1,14 @@ -// FreeType wrapper for gui.zig. The policy intentionally follows Ghostty's -// FreeType backend: native hinting enabled, the auto-hinter available as a -// fallback, and the light target for shape-preserving grayscale text. +// FreeType and HarfBuzz wrapper for gui.zig. The policy intentionally follows +// Ghostty's FreeType backend: native hinting enabled, the auto-hinter available +// as a fallback, and the light target for shape-preserving grayscale text. +// HarfBuzz only picks glyphs (liga, calt); the grid, not the font's advances, +// places them. #include "font.h" #include #include +#include +#include +#include #include #include @@ -12,6 +17,22 @@ struct UIFont { FT_Library library; FT_Face face; FT_F26Dot6 size; + // The charmap's answer for ASCII, which is most of every screen: a word the + // renderer has not seen before looks up each of its cells. + uint32_t ascii[128]; + // HarfBuzz state, made by the first ui_font_substitutes question (most + // fallback faces are never asked). + hb_font_t *hb; + hb_buffer_t *buffer; + FT_F26Dot6 hb_size; + // Every glyph a lookup of a ligature feature could replace. Nothing else + // can change a glyph, so a cell outside it is its nominal glyph without + // shaping: every cell, in a font without ligatures. + hb_set_t *substitutes; + // ui_font_shape's per-cell scratch, grown to the longest run seen + uint32_t *own; + uint8_t *state; + int32_t scratch; }; static FT_F26Dot6 size_26_6(float px) { @@ -58,9 +79,33 @@ UIFont *ui_font_new(const uint8_t *data, int32_t len) { // Some symbol fonts do not expose a Unicode charmap. FreeType already // selects a usable default for those, so failure here is non-fatal. (void)FT_Select_Charmap(f->face, FT_ENCODING_UNICODE); + for (uint32_t cp = 0; cp < 128; cp++) + f->ascii[cp] = FT_Get_Char_Index(f->face, cp); return f; } +// HarfBuzz reads this same face (and its charmap) through FreeType, so shaping +// and rasterizing agree on glyph ids. None of these calls returns NULL: a +// failure is an inert empty object, and shaping then yields nominal glyphs. +static void start_harfbuzz(UIFont *f) { + f->hb = hb_ft_font_create_referenced(f->face); + f->buffer = hb_buffer_create(); + f->substitutes = hb_set_create(); + static const hb_tag_t features[] = { + HB_TAG('l', 'i', 'g', 'a'), HB_TAG('c', 'a', 'l', 't'), + HB_TAG('c', 'l', 'i', 'g'), HB_TAG('r', 'l', 'i', 'g'), + HB_TAG('r', 'c', 'l', 't'), HB_TAG_NONE}; + hb_face_t *face = hb_font_get_face(f->hb); + hb_set_t *lookups = hb_set_create(); + hb_ot_layout_collect_lookups(face, HB_OT_TAG_GSUB, NULL, NULL, features, + lookups); + hb_codepoint_t lookup = HB_SET_VALUE_INVALID; + while (hb_set_next(lookups, &lookup)) + hb_ot_layout_lookup_collect_glyphs(face, HB_OT_TAG_GSUB, lookup, NULL, + f->substitutes, NULL, NULL); + hb_set_destroy(lookups); +} + const char *ui_font_name(UIFont *f) { if (!f || !f->face) return NULL; @@ -72,29 +117,31 @@ const char *ui_font_name(UIFont *f) { return NULL; } -int ui_font_has_glyph(UIFont *f, int32_t cp) { +uint32_t ui_font_glyph(UIFont *f, int32_t cp) { if (!f || cp < 0) return 0; - return FT_Get_Char_Index(f->face, (FT_ULong)(uint32_t)cp) != 0; + if (cp < 128) + return f->ascii[cp]; + return FT_Get_Char_Index(f->face, (FT_ULong)(uint32_t)cp); } void ui_font_free(UIFont *f) { if (!f) return; + // The HarfBuzz font holds a reference on the face: release it first. (All + // three accept NULL, a face that never shaped.) + hb_set_destroy(f->substitutes); + hb_buffer_destroy(f->buffer); + hb_font_destroy(f->hb); if (f->face) FT_Done_Face(f->face); if (f->library) FT_Done_FreeType(f->library); + free(f->own); + free(f->state); free(f); } -float ui_font_scale_for_height(UIFont *f, float px) { - (void)f; - // Kept as a size token so the Zig renderer can continue to distinguish - // measurement size from high-DPI raster size. - return px; -} - void ui_font_cell_metrics(UIFont *f, float px, int32_t *cell_w, int32_t *cell_h, int32_t *ascent) { if (!f || !cell_w || !cell_h || !ascent || !set_size(f, px)) { @@ -127,18 +174,17 @@ void ui_font_cell_metrics(UIFont *f, float px, int32_t *cell_w, int32_t *cell_h, *ascent = asc > 0 ? asc : 1; } -static int raster(UIFont *f, float px, int32_t cp, int bold, uint8_t *out, - int32_t stride, int32_t cell_w, int32_t cell_h, - int32_t ascent, int centered) { - if (!f || !out || stride < cell_w || cell_w <= 0 || cell_h <= 0) +static int raster(UIFont *f, float px, uint32_t glyph_index, int bold, + uint8_t *out, int32_t stride, int32_t width, int32_t height, + int32_t cell_x, int32_t cell_w, int32_t ascent, + int centered) { + if (!f || !out || stride < width || width <= 0 || height <= 0) return 0; - for (int y = 0; y < cell_h; y++) - memset(out + (size_t)y * (size_t)stride, 0, (size_t)cell_w); + for (int y = 0; y < height; y++) + memset(out + (size_t)y * (size_t)stride, 0, (size_t)width); if (!set_size(f, px)) return 0; - const FT_UInt glyph_index = - FT_Get_Char_Index(f->face, (FT_ULong)(uint32_t)cp); if (FT_Load_Glyph(f->face, glyph_index, load_flags()) != 0) return 0; if (bold) { @@ -168,23 +214,24 @@ static int raster(UIFont *f, float px, int32_t cp, int bold, uint8_t *out, const int advance = ceil_26_6(glyph->advance.x); // Fallbacks may be proportional. Center their advance in the primary face's // fixed cell, exactly as Ghostty centers a narrower fallback face. - const int gx = centered ? (cell_w - (int)bitmap->width) / 2 - : glyph->bitmap_left + (cell_w - advance) / 2; - const int gy = centered ? (cell_h - (int)bitmap->rows) / 2 - : ascent - glyph->bitmap_top; + const int gx = centered + ? (width - (int)bitmap->width) / 2 + : cell_x + glyph->bitmap_left + (cell_w - advance) / 2; + const int gy = + centered ? (height - (int)bitmap->rows) / 2 : ascent - glyph->bitmap_top; const int pitch = bitmap->pitch; const int row_bytes = pitch < 0 ? -pitch : pitch; for (unsigned int y = 0; y < bitmap->rows; y++) { const int dy = gy + (int)y; - if (dy < 0 || dy >= cell_h) + if (dy < 0 || dy >= height) continue; const unsigned int source_y = pitch < 0 ? bitmap->rows - 1 - y : y; const uint8_t *src = bitmap->buffer + (size_t)source_y * (size_t)row_bytes; for (unsigned int x = 0; x < bitmap->width; x++) { const int dx = gx + (int)x; - if (dx < 0 || dx >= cell_w) + if (dx < 0 || dx >= width) continue; uint8_t coverage; @@ -204,14 +251,186 @@ static int raster(UIFont *f, float px, int32_t cp, int bold, uint8_t *out, return 1; } -int ui_font_raster(UIFont *f, float px, int32_t cp, int bold, uint8_t *out, - int32_t stride, int32_t cell_w, int32_t cell_h, - int32_t ascent) { - return raster(f, px, cp, bold, out, stride, cell_w, cell_h, ascent, 0); +int ui_font_raster(UIFont *f, float px, uint32_t glyph, int bold, uint8_t *out, + int32_t stride, int32_t width, int32_t height, + int32_t cell_x, int32_t cell_w, int32_t ascent) { + return raster(f, px, glyph, bold, out, stride, width, height, cell_x, cell_w, + ascent, 0); } -int ui_font_raster_centered(UIFont *f, float px, int32_t cp, int bold, +int ui_font_raster_centered(UIFont *f, float px, uint32_t glyph, int bold, uint8_t *out, int32_t stride, int32_t width, int32_t height) { - return raster(f, px, cp, bold, out, stride, width, height, 0, 1); + return raster(f, px, glyph, bold, out, stride, width, height, 0, width, 0, 1); +} + +// The horizontal ink of `glyph` placed as ui_font_raster places it in a cell +// `cell` wide (26.6), relative to the cell's left edge. 0 when it has no ink. +static int ink(UIFont *f, uint32_t glyph, FT_Pos cell, FT_Pos *left, + FT_Pos *right) { + if (FT_Load_Glyph(f->face, glyph, load_flags()) != 0) + return 0; + const FT_GlyphSlot slot = f->face->glyph; + if (slot->metrics.width <= 0 || slot->metrics.height <= 0) + return 0; + const FT_Pos origin = + (FT_Pos)(((int)(cell >> 6) - ceil_26_6(slot->advance.x)) / 2) * 64; + *left = origin + slot->metrics.horiBearingX; + *right = *left + slot->metrics.width; + return 1; +} + +// ui_font_shape's per-cell marks: no glyph of its own, keep the nominal glyph, +// drawn as a slice of another cell's glyph. +#define NONE UINT32_MAX +#define PLAIN 1 +#define CLAIMED 2 + +int ui_font_substitutes(UIFont *f, uint32_t glyph) { + if (!f) + return 0; + if (!f->hb) + start_harfbuzz(f); + return hb_set_has(f->substitutes, glyph); +} + +// The GSUB features shaping leaves on are the ligature ones; the others +// HarfBuzz would apply (glyph composition, local forms, fractions around +// U+2044, ...) are off, so a cell is either its nominal glyph, as the renderer +// always drew it, or part of a ligature. Positioning is untouched: the grid +// ignores advances and keeps nominal glyphs where marks would move. +static const hb_feature_t shaping_features[] = { + {HB_TAG('c', 'c', 'm', 'p'), 0, 0, (unsigned int)-1}, + {HB_TAG('l', 'o', 'c', 'l'), 0, 0, (unsigned int)-1}, + {HB_TAG('r', 'v', 'r', 'n'), 0, 0, (unsigned int)-1}, + {HB_TAG('l', 't', 'r', 'a'), 0, 0, (unsigned int)-1}, + {HB_TAG('l', 't', 'r', 'm'), 0, 0, (unsigned int)-1}, + {HB_TAG('r', 'a', 'n', 'd'), 0, 0, (unsigned int)-1}, + {HB_TAG('f', 'r', 'a', 'c'), 0, 0, (unsigned int)-1}, + {HB_TAG('n', 'u', 'm', 'r'), 0, 0, (unsigned int)-1}, + {HB_TAG('d', 'n', 'o', 'm'), 0, 0, (unsigned int)-1}, +}; + +void ui_font_shape(UIFont *f, float px, int32_t cell_w, const uint32_t *cps, + int32_t n, UIShapedCell *out) { + if (!f || !cps || !out || n <= 0) + return; + for (int32_t i = 0; i < n; i++) + out[i] = (UIShapedCell){ui_font_glyph(f, (int32_t)cps[i]), 0, 1, 0}; + if (!f->hb) + start_harfbuzz(f); + int substitutable = 0; + for (int32_t i = 0; i < n && !substitutable; i++) + substitutable = hb_set_has(f->substitutes, out[i].glyph); + if (!substitutable || cell_w <= 0 || !set_size(f, px)) + return; + if (n > f->scratch) { + uint32_t *own = (uint32_t *)realloc(f->own, (size_t)n * sizeof *own); + if (!own) + return; + f->own = own; + uint8_t *state = (uint8_t *)realloc(f->state, (size_t)n); + if (!state) + return; + f->state = state; + f->scratch = n; + } + // hb-ft reads the FreeType size when told; positions are only consulted + // for being nonzero, but a zero scale would hide exactly that. + if (f->hb_size != f->size) { + hb_ft_font_changed(f->hb); + f->hb_size = f->size; + } + hb_buffer_clear_contents(f->buffer); + // One codepoint per cell, so a cluster value IS a cell index. + hb_buffer_add_codepoints(f->buffer, cps, n, 0, n); + hb_buffer_set_direction(f->buffer, HB_DIRECTION_LTR); + hb_buffer_guess_segment_properties(f->buffer); + hb_shape(f->hb, f->buffer, shaping_features, + sizeof shaping_features / sizeof shaping_features[0]); + unsigned int count = 0; + const hb_glyph_info_t *info = hb_buffer_get_glyph_infos(f->buffer, &count); + const hb_glyph_position_t *pos = + hb_buffer_get_glyph_positions(f->buffer, &count); + + // Each cell's own glyph is the one HarfBuzz left in its cluster. A cell a + // ligature merged into an earlier cluster has NONE. A cluster the grid + // cannot place (several glyphs, a positioned mark) is PLAIN, and so are the + // cells merged into it: they keep their nominal glyphs. + uint32_t *own = f->own; + uint8_t *state = f->state; + for (int32_t i = 0; i < n; i++) { + own[i] = NONE; + state[i] = 0; + } + for (unsigned int k = 0; k < count; k++) { + const uint32_t cluster = info[k].cluster; + if (cluster >= (uint32_t)n) + continue; + if (own[cluster] != NONE || pos[k].x_offset != 0 || pos[k].y_offset != 0) + state[cluster] = PLAIN; + else + own[cluster] = info[k].codepoint; + } + for (int32_t i = 1; i < n; i++) + if (own[i] == NONE && (state[i - 1] & PLAIN)) + state[i] = PLAIN; + + // A substituted glyph (or one whose cluster swallowed cells) may reach over + // its neighbours: it claims those that draw nothing of their own, nearest + // first, and each draws its slice of the one strip. Ink past a cell edge by + // half a pixel or less is noise. + const FT_Pos cell = (FT_Pos)cell_w * 64; + for (int32_t i = 0; i < n; i++) { + if ((state[i] & (PLAIN | CLAIMED)) || own[i] == NONE) + continue; + int32_t merged = 0; + while (i + 1 + merged < n && own[i + 1 + merged] == NONE && + !(state[i + 1 + merged] & PLAIN)) + merged++; + if (own[i] == out[i].glyph && merged == 0) + continue; + FT_Pos left = 0, right = 0; + if (!ink(f, own[i], cell, &left, &right)) + continue; // a spacer: claimed, never claiming + int32_t want_left = + left < -32 ? (int32_t)((-left - 32 + cell - 1) / cell) : 0; + int32_t want_right = right > cell + 32 + ? (int32_t)((right - cell - 32 + cell - 1) / cell) + : 0; + if (want_right < merged) + want_right = merged; + int32_t lead = 0, trail = 0; + while (lead < want_left && 1 + lead + trail < UI_MAX_SPAN) { + const int32_t j = i - lead - 1; + FT_Pos l, r; + if (j < 0 || (state[j] & (PLAIN | CLAIMED)) || + (own[j] != NONE && + (own[j] == out[j].glyph || ink(f, own[j], cell, &l, &r)))) + break; + lead++; + } + while (trail < want_right && 1 + lead + trail < UI_MAX_SPAN) { + const int32_t j = i + trail + 1; + FT_Pos l, r; + if (j >= n || (state[j] & (PLAIN | CLAIMED)) || + (own[j] != NONE && + (own[j] == out[j].glyph || ink(f, own[j], cell, &l, &r)))) + break; + trail++; + } + for (int32_t j = i - lead; j <= i + trail; j++) { + out[j] = + (UIShapedCell){own[i], (uint8_t)lead, (uint8_t)(1 + lead + trail), + (uint8_t)(j - (i - lead))}; + state[j] |= CLAIMED; + } + } + // The rest draw their own glyph; a merged cell nothing claimed draws blank. + const uint32_t space = f->ascii[' ']; + for (int32_t i = 0; i < n; i++) { + if (state[i] & (PLAIN | CLAIMED)) + continue; + out[i].glyph = own[i] == NONE ? space : own[i]; + } } diff --git a/src/gui/font.h b/src/gui/font.h index 4410bb7c..b38f822a 100644 --- a/src/gui/font.h +++ b/src/gui/font.h @@ -1,6 +1,7 @@ -// Tiny C shim over FreeType, so gui.zig only imports the stable renderer API. -// The implementation owns FreeType's library and face objects and keeps the -// caller's font bytes borrowed for the face lifetime. +// Tiny C shim over FreeType and HarfBuzz, so gui.zig only imports the stable +// renderer API. The implementation owns FreeType's library and face objects +// and HarfBuzz's font and buffer, and keeps the caller's font bytes borrowed +// for the face lifetime. #ifndef UI_FONT_H #define UI_FONT_H #include @@ -20,27 +21,56 @@ UIFont *ui_font_new(const uint8_t *data, int32_t len); // font has no PostScript table. Borrowed for the UIFont lifetime. const char *ui_font_name(UIFont *f); -// Whether the selected Unicode charmap maps `cp` to a real glyph. Glyph zero is -// the face's .notdef box and deliberately does not count for fallback choice. -int ui_font_has_glyph(UIFont *f, int32_t cp); +// The glyph the selected Unicode charmap maps `cp` to. Glyph zero is the +// face's .notdef box: the codepoint is missing, which is what fallback choice +// asks. +uint32_t ui_font_glyph(UIFont *f, int32_t cp); -// The size token is a pixel height. Metrics and rasterization both configure -// FreeType at that size, so hinted advances, baseline and bitmaps stay in step. -float ui_font_scale_for_height(UIFont *f, float px); +// `px` is the pixel height. Metrics and rasterization both configure FreeType +// at that size, so hinted advances, baseline and bitmaps stay in step. void ui_font_cell_metrics(UIFont *f, float px, int32_t *cell_w, int32_t *cell_h, int32_t *ascent); -// Rasterize `cp` into `out` as a hinted grayscale cell mask (`stride` bytes per -// row). The origin is the baseline `ascent` pixels from the top. Pixels outside -// the glyph are zero. Missing codepoints render the face's .notdef glyph. -// `bold` emboldens the outline before rendering (synthetic bold, same advance). -// Returns 1 when the glyph produced coverage, 0 for blank/error. -int ui_font_raster(UIFont *f, float px, int32_t cp, int bold, uint8_t *out, - int32_t stride, int32_t cell_w, int32_t cell_h, - int32_t ascent); +// What one grid cell draws: `slice` of the glyph `glyph` rasterized across +// `span` cells with its own cell `lead` cells from the left. A plain cell is +// its own glyph, lead 0, span 1, slice 0. +typedef struct { + uint32_t glyph; + uint8_t lead; + uint8_t span; + uint8_t slice; +} UIShapedCell; + +// The longest glyph strip a ligature may claim, in cells. +#define UI_MAX_SPAN 8 + +// Whether a lookup of the font's ligature features (liga, calt, clig, rlig, +// rclt) could replace `glyph`. When it cannot, shaping leaves the glyph alone +// and its cell needs no shaping at all. +int ui_font_substitutes(UIFont *f, uint32_t glyph); + +// One cell per codepoint of `cps`, all in this face, shaped by HarfBuzz with +// the font's ligature features (a run with no glyph ui_font_substitutes +// reports comes back nominal without it). A substituted glyph whose ink +// reaches over neighbouring cells that draw nothing of their own (a +// ligature's spacers, or the cells a merged cluster swallowed) claims them as +// a strip. Otherwise, and for anything the grid cannot place (several glyphs +// in one cell, positioned marks), each cell is its nominal glyph. +void ui_font_shape(UIFont *f, float px, int32_t cell_w, const uint32_t *cps, + int32_t n, UIShapedCell *out); + +// Rasterize `glyph` into `out` as a hinted grayscale mask of `width` x +// `height` (`stride` bytes per row). The glyph's advance is centered in the +// `cell_w` pixels that start at `cell_x`, and its baseline is `ascent` pixels +// from the top; ink outside the mask is clipped. `bold` emboldens the outline +// before rendering (synthetic bold, same advance). Returns 1 when the glyph +// produced coverage, 0 for blank/error. +int ui_font_raster(UIFont *f, float px, uint32_t glyph, int bold, uint8_t *out, + int32_t stride, int32_t width, int32_t height, + int32_t cell_x, int32_t cell_w, int32_t ascent); // Center bitmap ink bounds, independent of advance and baseline bearings. -int ui_font_raster_centered(UIFont *f, float px, int32_t cp, int bold, +int ui_font_raster_centered(UIFont *f, float px, uint32_t glyph, int bold, uint8_t *out, int32_t stride, int32_t width, int32_t height); diff --git a/src/gui/gui.zig b/src/gui/gui.zig index 7ad9fe9a..5bcb2867 100644 --- a/src/gui/gui.zig +++ b/src/gui/gui.zig @@ -80,14 +80,22 @@ const p9_arrow_mask = blk: { const atlas_w: u32 = 2048; const atlas_h: u32 = 2048; const Slot = struct { u: u32, v: u32 }; -const GlyphKey = struct { - codepoint: u32, - centered: bool = false, +/// An atlas entry is a glyph of a face (0 the primary font, i the fallback +/// i - 1) at a role's size, drawn `span` cells wide with its own cell `lead` +/// cells in: a ligature is one strip whose cells sample their own slices. +/// Packed, so the atlas map hashes one word instead of walking fields. +const GlyphKey = packed struct(u64) { + face: u8, + glyph: u32, role: pardes.FontRole, decoration: GlyphDecoration = .{}, + centered: bool = false, + lead: u4 = 0, + span: u4 = 1, + _: u2 = 0, }; -const GlyphDecoration = struct { +const GlyphDecoration = packed struct(u5) { bold: bool = false, underline: @FieldType(pardes.CellStyle, "ul") = .off, strikethrough: bool = false, @@ -103,7 +111,7 @@ const GlyphDecoration = struct { }; const TaglineRaster = struct { - scale: f32, + px: f32, width: u32, baseline: i32, height: u32, @@ -111,16 +119,15 @@ const TaglineRaster = struct { fn taglineRaster(font: *c.UIFont, body_px: f32, body_cell_w: u32, body_cell_h: u32, percent: u8) TaglineRaster { const px = body_px * @as(f32, @floatFromInt(percent)) / 100.0; - const scale = c.ui_font_scale_for_height(font, px); var own_w: c_int = 1; var own_h: c_int = 1; var own_ascent: c_int = 1; - c.ui_font_cell_metrics(font, scale, &own_w, &own_h, &own_ascent); + c.ui_font_cell_metrics(font, px, &own_w, &own_h, &own_ascent); const fixed_w: c_int = @intCast(body_cell_w); const fixed_h: c_int = @intCast(body_cell_h); const band_h = std.math.clamp(own_h, 1, fixed_h); return .{ - .scale = scale, + .px = px, .width = @intCast(std.math.clamp(own_w, 1, fixed_w)), .baseline = std.math.clamp(own_ascent, 1, band_h), .height = @intCast(band_h), @@ -227,8 +234,8 @@ test "every font size step moves the cell, and the ends are reachable exactly" { var asc: c_int = 0; var pw: c_int = 0; var ph: c_int = 0; - c.ui_font_cell_metrics(font, c.ui_font_scale_for_height(font, px), &cw, &ch, &asc); - c.ui_font_cell_metrics(font, c.ui_font_scale_for_height(font, px - font_px_step), &pw, &ph, &asc); + c.ui_font_cell_metrics(font, px, &cw, &ch, &asc); + c.ui_font_cell_metrics(font, px - font_px_step, &pw, &ph, &asc); try std.testing.expect(cw > pw and ch > ph); } try std.testing.expectEqual(font_px_max, std.math.clamp(font_px_max + font_px_step, font_px_min, font_px_max)); @@ -238,10 +245,11 @@ test "every font size step moves the cell, and the ends are reachable exactly" { test "FreeType atlas raster is grayscale, bounded, and clears blank cells" { const font = c.ui_font_new(font_ttf.ptr, @intCast(font_ttf.len)).?; defer c.ui_font_free(font); - try std.testing.expectEqual(@as(c_int, 1), c.ui_font_has_glyph(font, 'H')); - try std.testing.expectEqual(@as(c_int, 0), c.ui_font_has_glyph(font, 0x10ffff)); + const h = c.ui_font_glyph(font, 'H'); + try std.testing.expect(h != 0); + try std.testing.expectEqual(@as(u32, 0), c.ui_font_glyph(font, 0x10ffff)); - const size = c.ui_font_scale_for_height(font, 13.0); + const size: f32 = 13.0; var cell_w: c_int = 0; var cell_h: c_int = 0; var ascent: c_int = 0; @@ -253,7 +261,7 @@ test "FreeType atlas raster is grayscale, bounded, and clears blank cells" { var bitmap: [128 * 128]u8 = @splat(0xaa); try std.testing.expectEqual( @as(c_int, 1), - c.ui_font_raster(font, size, 'H', 0, &bitmap, stride, cell_w, cell_h, ascent), + c.ui_font_raster(font, size, h, 0, &bitmap, stride, cell_w, cell_h, 0, cell_w, ascent), ); var ink: usize = 0; @@ -272,7 +280,7 @@ test "FreeType atlas raster is grayscale, bounded, and clears blank cells" { // Synthetic bold thickens the outline inside the same cell. try std.testing.expectEqual( @as(c_int, 1), - c.ui_font_raster(font, size, 'H', 1, &bitmap, stride, cell_w, cell_h, ascent), + c.ui_font_raster(font, size, h, 1, &bitmap, stride, cell_w, cell_h, 0, cell_w, ascent), ); var bold_coverage: usize = 0; for (0..@intCast(cell_h)) |y| { @@ -284,7 +292,7 @@ test "FreeType atlas raster is grayscale, bounded, and clears blank cells" { try std.testing.expectEqual( @as(c_int, 0), - c.ui_font_raster(font, size, ' ', 0, &bitmap, stride, cell_w, cell_h, ascent), + c.ui_font_raster(font, size, c.ui_font_glyph(font, ' '), 0, &bitmap, stride, cell_w, cell_h, 0, cell_w, ascent), ); for (0..@intCast(cell_h)) |y| for (0..@intCast(cell_w)) |x| @@ -314,40 +322,21 @@ test "tagline glyph shrinks into its own cell and stays vertically centered" { const font = c.ui_font_new(font_ttf.ptr, @intCast(font_ttf.len)).?; defer c.ui_font_free(font); - const body_scale = c.ui_font_scale_for_height(font, 27.0); + const body_px: f32 = 27.0; var cell_w: c_int = 1; var cell_h: c_int = 1; var body_ascent: c_int = 1; - c.ui_font_cell_metrics(font, body_scale, &cell_w, &cell_h, &body_ascent); - const tag = taglineRaster(font, 27.0, @intCast(cell_w), @intCast(cell_h), config.gui_tagline_font_percent); - try std.testing.expect(tag.scale < body_scale); + c.ui_font_cell_metrics(font, body_px, &cell_w, &cell_h, &body_ascent); + const tag = taglineRaster(font, body_px, @intCast(cell_w), @intCast(cell_h), config.gui_tagline_font_percent); + try std.testing.expect(tag.px < body_px); try std.testing.expect(tag.width < @as(u32, @intCast(cell_w))); const stride: c_int = 128; var body: [128 * 128]u8 = @splat(0); var tagline: [128 * 128]u8 = @splat(0); - try std.testing.expectEqual(@as(c_int, 1), c.ui_font_raster( - font, - body_scale, - 'H', - 0, - &body, - stride, - cell_w, - cell_h, - body_ascent, - )); - try std.testing.expectEqual(@as(c_int, 1), c.ui_font_raster( - font, - tag.scale, - 'H', - 0, - &tagline, - stride, - @intCast(tag.width), - @intCast(tag.height), - tag.baseline, - )); + const h = c.ui_font_glyph(font, 'H'); + try std.testing.expectEqual(@as(c_int, 1), c.ui_font_raster(font, body_px, h, 0, &body, stride, cell_w, cell_h, 0, cell_w, body_ascent)); + try std.testing.expectEqual(@as(c_int, 1), c.ui_font_raster(font, tag.px, h, 0, &tagline, stride, @intCast(tag.width), @intCast(tag.height), 0, @intCast(tag.width), tag.baseline)); const b = inkBounds(&body, @intCast(stride), @intCast(cell_w), @intCast(cell_h)).?; const t = inkBounds(&tagline, @intCast(stride), @intCast(tag.width), @intCast(tag.height)).?; try std.testing.expect(t.max_x - t.min_x < b.max_x - b.min_x); @@ -367,11 +356,10 @@ test "tagline glyph shrinks into its own cell and stays vertically centered" { test "tagline percentage changes measured band height without body metrics" { const font = c.ui_font_new(font_ttf.ptr, @intCast(font_ttf.len)).?; defer c.ui_font_free(font); - const body_scale = c.ui_font_scale_for_height(font, 27.0); var cell_w: c_int = 1; var cell_h: c_int = 1; var ascent: c_int = 1; - c.ui_font_cell_metrics(font, body_scale, &cell_w, &cell_h, &ascent); + c.ui_font_cell_metrics(font, 27.0, &cell_w, &cell_h, &ascent); const small = taglineRaster(font, 27.0, @intCast(cell_w), @intCast(cell_h), 40); const configured = taglineRaster(font, 27.0, @intCast(cell_w), @intCast(cell_h), 82); const full = taglineRaster(font, 27.0, @intCast(cell_w), @intCast(cell_h), 100); @@ -381,18 +369,17 @@ test "tagline percentage changes measured band height without body metrics" { try std.testing.expect(small.height < configured.height); try std.testing.expect(configured.height <= full.height); try std.testing.expect(full.height <= @as(u32, @intCast(cell_h))); - try std.testing.expectEqual(body_scale, c.ui_font_scale_for_height(font, 27.0)); } test "glyph atlas cache separates body and tagline roles" { var glyphs = std.AutoHashMap(GlyphKey, Slot).init(std.testing.allocator); defer glyphs.deinit(); - try glyphs.put(.{ .codepoint = 'A', .role = .body }, .{ .u = 0, .v = 0 }); - try glyphs.put(.{ .codepoint = 'A', .role = .tagline }, .{ .u = 10, .v = 0 }); - try glyphs.put(.{ .codepoint = 'A', .role = .body, .decoration = .{ .bold = true } }, .{ .u = 20, .v = 0 }); + try glyphs.put(.{ .face = 0, .glyph = 36, .role = .body }, .{ .u = 0, .v = 0 }); + try glyphs.put(.{ .face = 0, .glyph = 36, .role = .tagline }, .{ .u = 10, .v = 0 }); + try glyphs.put(.{ .face = 0, .glyph = 36, .role = .body, .decoration = .{ .bold = true } }, .{ .u = 20, .v = 0 }); try std.testing.expectEqual(@as(usize, 3), glyphs.count()); - try std.testing.expectEqual(@as(u32, 0), glyphs.get(.{ .codepoint = 'A', .role = .body }).?.u); - try std.testing.expectEqual(@as(u32, 10), glyphs.get(.{ .codepoint = 'A', .role = .tagline }).?.u); + try std.testing.expectEqual(@as(u32, 0), glyphs.get(.{ .face = 0, .glyph = 36, .role = .body }).?.u); + try std.testing.expectEqual(@as(u32, 10), glyphs.get(.{ .face = 0, .glyph = 36, .role = .tagline }).?.u); } test "installed Nerd Symbols fallback covers Yazi directory icons" { @@ -408,7 +395,7 @@ test "installed Nerd Symbols fallback covers Yazi directory icons" { defer std.testing.allocator.free(bytes); const face = c.ui_font_new(bytes.ptr, @intCast(bytes.len)) orelse return error.FontInit; defer c.ui_font_free(face); - try std.testing.expectEqual(@as(c_int, 1), c.ui_font_has_glyph(face, 0xe5ff)); + try std.testing.expect(c.ui_font_glyph(face, 0xe5ff) != 0); } const CellInstance = extern struct { @@ -1767,8 +1754,7 @@ const Gui = struct { fallbacks: [max_fallback_fonts]?LoadedFallback = @splat(null), fallback_count: usize = 0, px: f32, - scale: f32, - tagline_scale: f32, + tagline_px: f32, tagline_percent: u8, tagline_width: u32, tagline_height: u32, @@ -1785,6 +1771,7 @@ const Gui = struct { pen_y: u32 = 0, atlas_dirty: bool = true, space_slot: Slot = .{ .u = 0, .v = 0 }, + words: Words = .{}, touch: Touch = .{}, pet_state: pet.State = .{}, @@ -1894,13 +1881,19 @@ fn deinitFallbackFonts(g: *Gui, gpa: std.mem.Allocator) void { } } -fn fontForCodepoint(g: *const Gui, cp: u32) *c.UIFont { - if (c.ui_font_has_glyph(g.font, @intCast(cp)) != 0) return g.font; - for (g.fallbacks[0..g.fallback_count]) |loaded| { - const face = loaded.?.face; - if (c.ui_font_has_glyph(face, @intCast(cp)) != 0) return face; +const FaceGlyph = struct { face: u8, glyph: u32 }; + +/// The face and glyph that draw `cp`, the face as a GlyphKey face: 0 is the +/// primary font and i the fallback i - 1. A codepoint no face has draws the +/// primary's .notdef. +fn glyphForCodepoint(g: *const Gui, cp: u32) FaceGlyph { + const primary = c.ui_font_glyph(g.font, @intCast(cp)); + if (primary != 0) return .{ .face = 0, .glyph = primary }; + for (g.fallbacks[0..g.fallback_count], 1..) |loaded, face| { + const glyph = c.ui_font_glyph(loaded.?.face, @intCast(cp)); + if (glyph != 0) return .{ .face = @intCast(face), .glyph = glyph }; } - return g.font; + return .{ .face = 0, .glyph = 0 }; } const CellLayout = struct { w: f32, h: f32, x_off: f32, y_off: f32 }; @@ -2193,11 +2186,10 @@ fn runNative(init: std.process.Init, opts_in: pardes.Options, attach: ?[]const u return error.FontInit; }; const px: f32 = 27.0; - const scale = c.ui_font_scale_for_height(font, px); var cw: c_int = 10; var chh: c_int = 20; var asc: c_int = 16; - c.ui_font_cell_metrics(font, scale, &cw, &chh, &asc); + c.ui_font_cell_metrics(font, px, &cw, &chh, &asc); const cell_w: u32 = @intCast(@max(cw, 1)); const cell_h: u32 = @intCast(@max(chh, 1)); const tagline = taglineRaster(font, px, cell_w, cell_h, config.gui_tagline_font_percent); @@ -2282,8 +2274,7 @@ fn runNative(init: std.process.Init, opts_in: pardes.Options, attach: ?[]const u .image_capacity = initial_image_capacity, .font = font, .px = px, - .scale = scale, - .tagline_scale = tagline.scale, + .tagline_px = tagline.px, .tagline_percent = config.gui_tagline_font_percent, .tagline_width = tagline.width, .tagline_height = tagline.height, @@ -2305,6 +2296,7 @@ fn runNative(init: std.process.Init, opts_in: pardes.Options, attach: ?[]const u loadFallbackFonts(&g, gpa); defer deinitFallbackFonts(&g, gpa); defer g.glyphs.deinit(); + defer g.words.deinit(gpa); defer { clearNativeImages(&g); g.native_images.deinit(gpa); @@ -2317,8 +2309,7 @@ fn runNative(init: std.process.Init, opts_in: pardes.Options, attach: ?[]const u defer if (g.font_bytes.len != 0) gpa.free(g.font_bytes); // set by Font, if it ran defer c.ui_font_free(g.font); defer gpa.free(g.scroll_edge); // grown on demand by stepScroll - _ = c.ui_font_raster(font, scale, ' ', 0, atlas_stage.ptr, @intCast(atlas_w), @intCast(cell_w), @intCast(cell_h), asc); - g.pen_x = cell_w; + resetGlyphAtlas(&g); if (attach) |requested| return attachRequested(gpa, &g, requested); var attached: ?detached_client.Client = null; @@ -4392,10 +4383,12 @@ fn emitScrollRows(g: *Gui, instances: [*]CellInstance, base: u32, surface: *pard var n: u32 = 0; var row = y0; 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; var col = x0; while (col < x0 + bw) : (col += 1) { const sidx: u32 = @as(u32, row) * surface.cols + col; - emitInstance(g, instances, base + n, col, row, shifted, win_w, win_h, null, cellFontRole(surface.at(col, row)), surface.at(col, row), false, sidx == cursor_idx and !cursor_bar, page); + emitInstance(g, instances, base + n, col, row, shifted, win_w, win_h, null, cellFontRole(surface.at(col, row)), line, col, row_cursor, false, sidx == cursor_idx and !cursor_bar, page); n += 1; } } @@ -4403,7 +4396,7 @@ fn emitScrollRows(g: *Gui, instances: [*]CellInstance, base: u32, surface: *pard const erow: u16 = if (g.scroll_lag > 0) y0 + bh else y0 - 1; var i: u16 = 0; while (i < bw) : (i += 1) { - emitInstance(g, instances, base + n, x0 + i, erow, shifted, win_w, win_h, null, cellFontRole(&g.scroll_edge[i]), &g.scroll_edge[i], false, false, page); + emitInstance(g, instances, base + n, x0 + i, erow, shifted, win_w, win_h, null, cellFontRole(&g.scroll_edge[i]), g.scroll_edge[0..bw], i, null, false, false, page); n += 1; } } @@ -4911,6 +4904,7 @@ fn renderFrame( if (cursor) |value| _ = c.SDL_SetCursor(value); } g.scene_target_failed = false; + g.words.memo = .{}; // positional, and this frame's cells are new const cmd = c.SDL_AcquireGPUCommandBuffer(g.device) orelse return false; var command_consumed = false; defer if (!command_consumed) { @@ -5111,6 +5105,8 @@ fn renderFrame( const cursor_bar = if (surface.cursor) |cu| cu.bar else false; row = 0; while (row < surface.rows) : (row += 1) { + const line = surface.cells[@as(usize, row) * surface.cols ..][0..surface.cols]; + const line_cursor: ?usize = if (surface.cursor) |cu| if (cu.y == row) cu.x else null else null; var col: u16 = 0; while (col < surface.cols) : (col += 1) { if (bodyLayerAt(surface, col, row) != null or tagLayerIn(surface.tagLayers(), col, row) != null) continue; @@ -5134,7 +5130,9 @@ fn renderFrame( win_w, win_h, track, - &surface.previous_cells[logical_idx], + surface.previous_cells[@as(usize, row) * surface.cols ..][0..surface.cols], + col, + null, &tagline_base, paneGripCell(surface.previous_tag_layers, surface.previous_cells, surface.cols, col, row), true, @@ -5153,7 +5151,9 @@ fn renderFrame( win_w, win_h, if (data_effect and !data_diff) null else track, - surface.at(col, row), + line, + col, + line_cursor, &tagline_base, paneGripCell(surface.tagLayers(), surface.cells, surface.cols, col, row), false, @@ -5204,7 +5204,6 @@ fn renderFrame( while (col < surface.cols) : (col += 1) { if (!boxContains(track.contentBox(), col, row)) continue; if (bodyLayerIn(surface.previous_body_layers, col, row) != null or tagLayerIn(surface.previous_tag_layers, col, row) != null) continue; - const logical_idx: u32 = @as(u32, row) * surface.cols + col; const destination: usize = if (duplicate_under) 0 else batch_index; emitSurfaceCell( g, @@ -5217,7 +5216,9 @@ fn renderFrame( win_w, win_h, if (duplicate_under) null else track, - &surface.previous_cells[logical_idx], + surface.previous_cells[@as(usize, row) * surface.cols ..][0..surface.cols], + col, + null, &tagline_base, paneGripCell(surface.previous_tag_layers, surface.previous_cells, surface.cols, col, row), false, @@ -5381,12 +5382,14 @@ test "tagline bands center in their cells and Tagbottom faces the window edge" { try std.testing.expectEqual(@as(u32, 4), taglineBandOffset(9, canvas_h, cell_h, tagline_h)); } -fn resolveCell(g: *Gui, cell: *const pardes.Cell, role: pardes.FontRole, is_cursor: bool, page: Ground) ResolvedCell { +/// The colours and atlas slot of `line[at]`. `cursor` is where the cursor sits +/// in `line`, block or bar: shaping breaks around it. +fn resolveCell(g: *Gui, line: []const pardes.Cell, at: usize, cursor: ?usize, role: pardes.FontRole, is_cursor: bool, page: Ground) ResolvedCell { + const cell = &line[at]; var fg = fg_default; var bg = page.rgb; var clear_bg = page.clear; var reverse = is_cursor; - var blank = false; if (!cell.default) { const st = cell.style; fg = switch (st.fg) { @@ -5409,8 +5412,8 @@ fn resolveCell(g: *Gui, cell: *const pardes.Cell, role: pardes.FontRole, is_curs if (st.invisible) { fg = bg; // With a translucent background, painting bg-colored glyphs at - // full opacity would expose text that the terminal concealed. - blank = true; + // full opacity would expose text that the terminal concealed, so + // cellSlot draws a concealed cell blank. } if (st.dim) for (&fg) |*ch| { ch.* = @intCast(@as(u16, ch.*) * 6 / 10); @@ -5421,10 +5424,8 @@ fn resolveCell(g: *Gui, cell: *const pardes.Cell, role: pardes.FontRole, is_curs clear_bg = false; } - const cp = if (blank) ' ' else cellCodepoint(cell); - const decoration = GlyphDecoration.fromCell(cell); return .{ - .slot = if (cp == ' ' and !decoration.drawsBlank()) g.space_slot else ensureGlyph(g, cp, role, decoration), + .slot = cellSlot(g, line, at, cursor, role), .fg = fg, .bg = bg, .role = role, @@ -5439,10 +5440,11 @@ fn cellFontRole(cell: *const pardes.Cell) pardes.FontRole { test "concealed terminal text emits no ink on opaque or transparent ground" { var g: Gui = undefined; g.space_slot = .{ .u = 0, .v = 0 }; + g.words = .{}; var cell: pardes.Cell = .{ .default = false, .style = .{ .invisible = true, .ul = .single } }; cell.text[0] = 'X'; for ([_]Ground{ .opaqueRgb(bg_default), .{ .rgb = bg_default, .clear = true } }) |page| { - const resolved = resolveCell(&g, &cell, .body, false, page); + const resolved = resolveCell(&g, (&cell)[0..1], 0, null, .body, false, page); try std.testing.expectEqualDeep(g.space_slot, resolved.slot); try std.testing.expectEqual(page.rgb, resolved.bg); } @@ -5512,12 +5514,13 @@ fn emitTagLayer(g: *Gui, instances: [*]CellInstance, next: *u32, layer: *const p // A window is rarely a whole number of cells wide: a band that ends at // the last column runs on through the leftover pixels to the edge. const band_right = if (win_w - right < bw) @max(right, win_w) else right; - emitInstance(g, instances, next.*, 0, layer.viewport.y, .{ .w = band_right - left, .h = bh, .x_off = left, .y_off = slide }, win_w, win_h, track, .body, &background, old_layer, false, page); + emitInstance(g, instances, next.*, 0, layer.viewport.y, .{ .w = band_right - left, .h = bh, .x_off = left, .y_off = slide }, win_w, win_h, track, .body, (&background)[0..1], 0, null, old_layer, false, page); if (slide != 0) clipInstanceTop(&instances[next.*], top, win_h); next.* += 1; + const line_cursor: ?usize = if (layer.cursor) |cu| cu.col else null; for (0..tagLayerCellCount(g, layer)) |col| { const cursor = if (layer.cursor) |cu| show_cursor and !cu.bar and cu.col == col else false; - emitInstance(g, instances, next.*, @intCast(col), layer.viewport.y, .{ .w = tw, .h = bh, .x_off = left, .y_off = slide }, win_w, win_h, track, .tagline, &layer.cells[col], old_layer, cursor, page); + emitInstance(g, instances, next.*, @intCast(col), layer.viewport.y, .{ .w = tw, .h = bh, .x_off = left, .y_off = slide }, win_w, win_h, track, .tagline, layer.cells[0..layer.cols], col, line_cursor, old_layer, cursor, page); clipInstanceRight(&instances[next.*], right, win_w); if (slide != 0) clipInstanceTop(&instances[next.*], top, win_h); next.* += 1; @@ -5579,17 +5582,18 @@ fn emitBodyLayer(g: *Gui, instances: [*]CellInstance, next: *u32, layer: *const if (header) { var background: pardes.Cell = .{ .default = false, .style = layer.cells[index * layer.cols].style }; background.style.font_role = .body; - emitInstance(g, instances, next.*, 0, 0, .{ .w = @as(f32, @floatFromInt(layer.viewport.w)) * bw, .h = height, .x_off = left, .y_off = top }, win_w, win_h, track, .body, &background, old_layer, false, page); + emitInstance(g, instances, next.*, 0, 0, .{ .w = @as(f32, @floatFromInt(layer.viewport.w)) * bw, .h = height, .x_off = left, .y_off = top }, win_w, win_h, track, .body, (&background)[0..1], 0, null, old_layer, false, page); clipBodyInstance(&instances[next.*], bottom, win_h); clipInstanceRight(&instances[next.*], right, win_w); next.* += 1; } + const line = layer.cells[index * layer.cols ..][0..layer.cols]; + const line_cursor: ?usize = if (layer.cursor) |cu| if (cu.y == row) cu.x else null else null; for (0..layer.cols) |col| { if (left + @as(f32, @floatFromInt(col)) * width >= right) break; - const cell = &layer.cells[index * layer.cols + col]; const cursor = if (layer.cursor) |cu| show_cursor and !cu.bar and cu.x == col and cu.y == row else false; const glyph_top = top - (if (header) @as(f32, @floatFromInt(taglineBandOffset(0, win_h, g.cell_h, g.tagline_height))) else 0); - emitInstance(g, instances, next.*, 0, 0, .{ .w = width, .h = height, .x_off = left + @as(f32, @floatFromInt(col)) * width, .y_off = glyph_top }, win_w, win_h, track, role, cell, old_layer, cursor, page); + emitInstance(g, instances, next.*, 0, 0, .{ .w = width, .h = height, .x_off = left + @as(f32, @floatFromInt(col)) * width, .y_off = glyph_top }, win_w, win_h, track, role, line, col, line_cursor, old_layer, cursor, page); clipBodyInstance(&instances[next.*], bottom, win_h); clipInstanceRight(&instances[next.*], right, win_w); next.* += 1; @@ -5601,7 +5605,7 @@ fn emitBodyLayer(g: *Gui, instances: [*]CellInstance, next: *u32, layer: *const .h = 1, .x_off = left, .y_off = top + height - 1, - }, win_w, win_h, track, .body, &border, old_layer, false, page); + }, win_w, win_h, track, .body, (&border)[0..1], 0, null, old_layer, false, page); clipBodyInstance(&instances[next.*], bottom, win_h); clipInstanceRight(&instances[next.*], right, win_w); next.* += 1; @@ -5653,33 +5657,38 @@ fn emitSurfaceCell( win_w: f32, win_h: f32, track: ?pardes.layout.Track, - cell: *const pardes.Cell, + line: []const pardes.Cell, + at: usize, + cursor: ?usize, tagline_base: *const pardes.Cell, grip: ?GripCell, old_layer: bool, is_cursor: bool, page: Ground, ) void { - const role = cellFontRole(cell); + const role = cellFontRole(&line[at]); if (role == .tagline) { var band_base = tagline_base.*; if (core) |p| band_base.style.bg = .{ .rgb = taglineBaseRgb(p, col, row) }; // The smaller font changes the ink, not the chrome's coverage. Painting // this underlay at tagline height leaves page-colored gutters between // adjacent workspace, column and pane tags at TaglineSize < 100. - emitInstance(g, instances, next.*, col, row, body_layout, win_w, win_h, track, .body, &band_base, old_layer, false, page); + emitInstance(g, instances, next.*, col, row, body_layout, win_w, win_h, track, .body, (&band_base)[0..1], 0, null, old_layer, false, page); next.* += 1; // Tag glyphs keep their font size inside a full physical-width grip. - emitInstance(g, instances, next.*, col, row, body_layout, win_w, win_h, track, .tagline, cell, old_layer, is_cursor, page); + emitInstance(g, instances, next.*, col, row, body_layout, win_w, win_h, track, .tagline, line, at, cursor, old_layer, is_cursor, page); // An anchor starts at its column's rule: its left edge is inset by // its top margin so the band frames it on the left as above and // below, and its mark moves right by half that to stay centered. const inset: u32 = if (core) |p| if (std.mem.indexOfScalar(u16, p.col_x[0..p.ncol], col -| (if (grip) |indicator| indicator.offset else 0)) != null) anchorInset(g, row, win_h) else 0 else 0; if (grip) |indicator| { - const cached = cachedGlyph(g, cellCodepoint(indicator.cell), .tagline, GlyphDecoration.fromCell(indicator.cell), true); + // A grip is one glyph centered across the gutter, not text: it is + // looked up by its codepoint's glyph, never shaped. + const drawn = glyphForCodepoint(g, cellCodepoint(indicator.cell)); + const cached = cachedGlyph(g, .{ .face = drawn.face, .glyph = drawn.glyph, .role = .tagline, .decoration = GlyphDecoration.fromCell(indicator.cell), .centered = true }); const slot = cached orelse g.space_slot; const offset: f32 = if (cached != null) @as(f32, @floatFromInt(@as(u32, indicator.offset) * g.cell_w)) - @as(f32, @floatFromInt(inset / 2)) else 0; - const resolved = resolveCell(g, indicator.cell, .tagline, false, page); + const resolved = resolveCell(g, indicator.cell[0..1], 0, null, .tagline, false, page); instances[next.*].fr = @as(f32, @floatFromInt(resolved.fg[0])) / 255; instances[next.*].fg = @as(f32, @floatFromInt(resolved.fg[1])) / 255; instances[next.*].fb = @as(f32, @floatFromInt(resolved.fg[2])) / 255; @@ -5695,7 +5704,7 @@ fn emitSurfaceCell( next.* += 1; return; } - emitInstance(g, instances, next.*, col, row, body_layout, win_w, win_h, track, role, cell, old_layer, is_cursor, page); + emitInstance(g, instances, next.*, col, row, body_layout, win_w, win_h, track, role, line, at, cursor, old_layer, is_cursor, page); next.* += 1; } @@ -5703,6 +5712,7 @@ test "small tagline fonts leave no background gutters between adjacent tags" { const core = try pardes.Pardes.init(std.testing.allocator, .{ .cols = 80, .rows = 24 }); defer core.deinit(); var g: Gui = undefined; + g.words = .{}; g.cell_w = 10; g.cell_h = 20; g.tagline_width = 8; @@ -5713,7 +5723,7 @@ test "small tagline fonts leave no background gutters between adjacent tags" { var next: u32 = 0; for (0..3) |row| { // Column 1: past the anchor's inset edge at the column's left. - emitSurfaceCell(&g, core, &instances, &next, 1, @intCast(row), fixedCellLayout(&g), 800, 480, null, &cell, &cell, null, false, false, Ground.opaqueRgb(bg_default)); + emitSurfaceCell(&g, core, &instances, &next, 1, @intCast(row), fixedCellLayout(&g), 800, 480, null, (&cell)[0..1], 0, null, &cell, null, false, false, Ground.opaqueRgb(bg_default)); const base = instances[row * 2]; const ink = instances[row * 2 + 1]; try std.testing.expectApproxEqAbs(@as(f32, 20.0 / 480.0 * 2), base.y0 - base.y1, 0.0001); @@ -5726,12 +5736,12 @@ test "small tagline fonts leave no background gutters between adjacent tags" { // Column 0 is an anchor's edge: its ink is inset by the band's margin // (2 px here) and its underlay still covers the whole cell. next = 0; - emitSurfaceCell(&g, core, &instances, &next, 0, 1, fixedCellLayout(&g), 800, 480, null, &cell, &cell, null, false, false, Ground.opaqueRgb(bg_default)); + emitSurfaceCell(&g, core, &instances, &next, 0, 1, fixedCellLayout(&g), 800, 480, null, (&cell)[0..1], 0, null, &cell, null, false, false, Ground.opaqueRgb(bg_default)); try std.testing.expectApproxEqAbs(@as(f32, 10.0 / 800.0 * 2), instances[0].x1 - instances[0].x0, 0.0001); try std.testing.expectApproxEqAbs(@as(f32, 8.0 / 800.0 * 2), instances[1].x1 - instances[1].x0, 0.0001); try std.testing.expectApproxEqAbs(@as(f32, 8) / atlas_w, instances[1].u1 - instances[1].u0, 0.0001); next = 0; - emitSurfaceCell(&g, null, &instances, &next, 0, 2, fixedCellLayout(&g), 800, 480, null, &cell, &cell, null, true, false, Ground.opaqueRgb(bg_default)); + emitSurfaceCell(&g, null, &instances, &next, 0, 2, fixedCellLayout(&g), 800, 480, null, (&cell)[0..1], 0, null, &cell, null, true, false, Ground.opaqueRgb(bg_default)); try std.testing.expectEqual(@as(u32, 2), next); try std.testing.expectApproxEqAbs(@as(f32, 16.0 / 480.0 * 2), instances[1].y0 - instances[1].y1, 0.0001); } @@ -5747,12 +5757,14 @@ fn emitInstance( win_h: f32, track: ?pardes.layout.Track, role: pardes.FontRole, - cell: *const pardes.Cell, + line: []const pardes.Cell, + at: usize, + cursor: ?usize, old_layer: bool, is_cursor: bool, page: Ground, ) void { - const resolved = resolveCell(g, cell, role, is_cursor, page); + const resolved = resolveCell(g, line, at, cursor, role, is_cursor, page); const px0 = layout.x_off + @as(f32, @floatFromInt(col)) * layout.w; const visual_h: f32 = if (resolved.role == .tagline) @@ -5818,13 +5830,14 @@ fn emitInstance( test "block cursor alone overrides transparent cell background" { var g: Gui = undefined; + g.words = .{}; g.cell_w = 10; g.cell_h = 20; g.space_slot = .{ .u = 0, .v = 0 }; const cell: pardes.Cell = .{}; var instances: [2]CellInstance = undefined; for ([_]bool{ false, true }, 0..) |cursor, i| { - emitInstance(&g, &instances, @intCast(i), 0, 0, fixedCellLayout(&g), 800, 480, null, .body, &cell, false, cursor, Ground.opaqueRgb(bg_default)); + emitInstance(&g, &instances, @intCast(i), 0, 0, fixedCellLayout(&g), 800, 480, null, .body, (&cell)[0..1], 0, null, false, cursor, Ground.opaqueRgb(bg_default)); try std.testing.expectEqual(cursor, instances[i].effect & opaque_bg_bit != 0); } } @@ -5875,16 +5888,15 @@ fn firstCp(s: []const u8) u32 { } fn refitFont(g: *Gui, core: ?*pardes.Pardes) void { - g.scale = c.ui_font_scale_for_height(g.font, g.px); var cw: c_int = 10; var chh: c_int = 20; var asc: c_int = 16; - c.ui_font_cell_metrics(g.font, g.scale, &cw, &chh, &asc); + c.ui_font_cell_metrics(g.font, g.px, &cw, &chh, &asc); g.cell_w = @intCast(@max(cw, 1)); g.cell_h = @intCast(@max(chh, 1)); g.ascent = @intCast(@max(asc, 1)); const tagline = taglineRaster(g.font, g.px, g.cell_w, g.cell_h, g.tagline_percent); - g.tagline_scale = tagline.scale; + g.tagline_px = tagline.px; g.tagline_width = tagline.width; g.tagline_baseline = tagline.baseline; g.tagline_height = tagline.height; @@ -5899,10 +5911,11 @@ fn refitFont(g: *Gui, core: ?*pardes.Pardes) void { resetScroll(g); } +// The first cell of the cleared atlas stays blank: the space slot. fn resetGlyphAtlas(g: *Gui) void { g.glyphs.clearRetainingCapacity(); + g.words.clear(); @memset(g.atlas_stage, 0); - _ = c.ui_font_raster(g.font, g.scale, ' ', 0, g.atlas_stage.ptr, @intCast(atlas_w), @intCast(g.cell_w), @intCast(g.cell_h), g.ascent); g.space_slot = .{ .u = 0, .v = 0 }; g.pen_x = g.cell_w; g.pen_y = 0; @@ -5914,7 +5927,7 @@ fn syncTaglineFont(g: *Gui, core: *pardes.Pardes) void { if (percent == g.tagline_percent) return; g.tagline_percent = percent; const tagline = taglineRaster(g.font, g.px, g.cell_w, g.cell_h, percent); - g.tagline_scale = tagline.scale; + g.tagline_px = tagline.px; g.tagline_width = tagline.width; g.tagline_baseline = tagline.baseline; g.tagline_height = tagline.height; @@ -5923,14 +5936,294 @@ fn syncTaglineFont(g: *Gui, core: *pardes.Pardes) void { _ = updateCoreResize(core, geom.cols, geom.rows, g.cell_w, g.cell_h, g.tagline_width, g.tagline_height); } -fn ensureGlyph(g: *Gui, cp: u32, role: pardes.FontRole, decoration: GlyphDecoration) Slot { - return cachedGlyph(g, cp, role, decoration, false) orelse g.space_slot; +/// What text draws, so a frame does not work it out again. `cells` is the +/// atlas slot of a codepoint no ligature can touch (`shape_slot` for one that +/// is shaped with its word); `map` is the atlas slot of every cell of a word +/// holding one, found by the word's text. Bounded: past `max_cells` word cells +/// it starts over, and the next frames look up what they show again (the +/// glyphs stay in the atlas). +const Words = struct { + cells: std.AutoHashMapUnmanaged(CellKey, Slot) = .empty, + map: std.AutoHashMapUnmanaged(u64, Word) = .empty, + /// Every word's codepoints and slots, end to end; a Word indexes both. + text: std.ArrayListUnmanaged(u32) = .empty, + slots: std.ArrayListUnmanaged(Slot) = .empty, + shaped: std.ArrayListUnmanaged(c.UIShapedCell) = .empty, + /// The word the last cell was in, so the rest of it costs a compare. It + /// is positional, so every frame forgets it: the cells change under it. + memo: Memo = .{}, + + const max_cells = 1 << 17; + const CellKey = packed struct(u64) { cp: u21, role: pardes.FontRole, decoration: GlyphDecoration, _: u30 = 0 }; + const shape_slot: Slot = .{ .u = std.math.maxInt(u32), .v = std.math.maxInt(u32) }; + const Word = struct { start: u32, len: u32, decoration: GlyphDecoration }; + const Memo = struct { + line: ?[*]const pardes.Cell = null, + len: usize = 0, + start: usize = 0, + end: usize = 0, + cursor: ?usize = null, + slots: usize = 0, + }; + + fn clear(w: *Words) void { + w.cells.clearRetainingCapacity(); + w.map.clearRetainingCapacity(); + w.text.clearRetainingCapacity(); + w.slots.clearRetainingCapacity(); + w.memo = .{}; + } + + fn deinit(w: *Words, gpa: std.mem.Allocator) void { + w.cells.deinit(gpa); + w.map.deinit(gpa); + w.text.deinit(gpa); + w.slots.deinit(gpa); + w.shaped.deinit(gpa); + } +}; + +/// What decides where a word ends, for one cell. A concealed cell is a space. +const WordCell = struct { cp: u32, decoration: GlyphDecoration, role: pardes.FontRole }; + +fn wordCell(cell: *const pardes.Cell) WordCell { + return .{ + .cp = if (!cell.default and cell.style.invisible) ' ' else cellCodepoint(cell), + .decoration = GlyphDecoration.fromCell(cell), + .role = cellFontRole(cell), + }; +} + +/// Whether a word ends between `a`, cell `i`, and `b`, cell `i + 1`: at a +/// space, a decoration or role change, either side of the cursor (Ghostty's +/// rule: the cell being edited shows its own glyph, so a ligature under the +/// cursor comes apart), and inside f|i, f|l and s|t, whose typographic +/// ligatures do not belong on a grid (Ghostty again). Colours never end a +/// word: a ligature spans a syntax colour change or a selection edge, and each +/// cell tints its own slice. +fn wordBreak(a: WordCell, b: WordCell, i: usize, cursor: ?usize) bool { + if (a.cp == ' ' or b.cp == ' ') return true; + if (cursor) |at| if (at == i or at == i + 1) return true; + if (a.role != b.role or !std.meta.eql(a.decoration, b.decoration)) return true; + return (a.cp == 'f' and (b.cp == 'i' or b.cp == 'l')) or (a.cp == 's' and b.cp == 't'); +} + +/// The atlas slot `line[at]` draws: blank for a plain space (or concealed +/// text), its own glyph when no ligature could replace that glyph (every +/// cell, in a font without ligatures), else its slice of the word around it, +/// shaped once and cached by the word's text. The cells of a word being walked +/// cost a compare. Taglines are not shaped: they are drawn at two pitches +/// (tagline_width in a tag layer, a whole cell in the grid), and a strip would +/// not line up in one of them. +fn cellSlot(g: *Gui, line: []const pardes.Cell, at: usize, cursor: ?usize, role: pardes.FontRole) Slot { + const words = &g.words; + const memo = words.memo; + if (memo.line == line.ptr and memo.len == line.len and memo.cursor == cursor and at >= memo.start and at < memo.end and role == .body) + return words.slots.items[memo.slots + at - memo.start]; + var here = wordCell(&line[at]); + // An underlined or struck-out space is a glyph of its own: it draws its line. + if (here.cp == ' ' and !here.decoration.drawsBlank()) return g.space_slot; + const gpa = g.glyphs.allocator; + const cell_key: Words.CellKey = .{ .cp = @intCast(here.cp), .role = role, .decoration = here.decoration }; + const known = words.cells.getOrPut(gpa, cell_key) catch return g.space_slot; + if (!known.found_existing) { + const drawn = glyphForCodepoint(g, here.cp); + const font = if (drawn.face == 0) g.font else g.fallbacks[drawn.face - 1].?.face; + known.value_ptr.* = if (role == .body and c.ui_font_substitutes(font, drawn.glyph) != 0) + Words.shape_slot + else + cachedGlyph(g, .{ .face = drawn.face, .glyph = drawn.glyph, .role = role, .decoration = here.decoration }) orelse g.space_slot; + } + const plain = known.value_ptr.*; + if (!std.meta.eql(plain, Words.shape_slot)) return plain; + + if (words.text.items.len > Words.max_cells) words.clear(); + var start = at; + while (start > 0) { + const before = wordCell(&line[start - 1]); + if (wordBreak(before, here, start - 1, cursor)) break; + start -= 1; + here = before; + } + // The word's text goes on the end of `text`: a new word keeps it there, + // a known one gives it back. + const text_start = words.text.items.len; + var end = start; + while (true) { + words.text.append(gpa, here.cp) catch return g.space_slot; + end += 1; + if (end == line.len) break; + const next = wordCell(&line[end]); + if (wordBreak(here, next, end - 1, cursor)) break; + here = next; + } + const text = words.text.items[text_start..]; + const decoration = here.decoration; + const hash = std.hash.Wyhash.hash(@as(u5, @bitCast(decoration)), std.mem.sliceAsBytes(text)); + if (words.map.get(hash)) |word| { + if (word.len == text.len and std.meta.eql(word.decoration, decoration) and + std.mem.eql(u32, words.text.items[word.start..][0..word.len], text)) + { + words.text.shrinkRetainingCapacity(text_start); + words.memo = .{ .line = line.ptr, .len = line.len, .start = start, .end = end, .cursor = cursor, .slots = word.start }; + return words.slots.items[word.start + at - start]; + } + } + + // A new word (a hash collision takes the map entry over). Runs of one + // face are shaped in that face; fallback faces shape like the primary. + const n = text.len; + words.slots.ensureUnusedCapacity(gpa, n) catch { + words.text.shrinkRetainingCapacity(text_start); + return g.space_slot; + }; + words.shaped.resize(gpa, n) catch { + words.text.shrinkRetainingCapacity(text_start); + return g.space_slot; + }; + const shaped = words.shaped.items; + var run_start: usize = 0; + var face = glyphForCodepoint(g, text[0]).face; + while (run_start < n) { + var run_end = run_start + 1; + var next_face = face; + while (run_end < n) : (run_end += 1) { + next_face = glyphForCodepoint(g, text[run_end]).face; + if (next_face != face) break; + } + const run_font = if (face == 0) g.font else g.fallbacks[face - 1].?.face; + c.ui_font_shape(run_font, g.px, @intCast(g.cell_w), text[run_start..].ptr, @intCast(run_end - run_start), shaped[run_start..].ptr); + for (shaped[run_start..run_end]) |cell| { + const key: GlyphKey = .{ .face = face, .glyph = cell.glyph, .role = .body, .decoration = decoration, .lead = @intCast(cell.lead), .span = @intCast(cell.span) }; + const slot: Slot = if (cachedGlyph(g, key)) |strip| .{ .u = strip.u + g.cell_w * cell.slice, .v = strip.v } else g.space_slot; + words.slots.appendAssumeCapacity(slot); + } + run_start = run_end; + face = next_face; + } + words.map.put(gpa, hash, .{ .start = @intCast(text_start), .len = @intCast(n), .decoration = decoration }) catch {}; + words.memo = .{ .line = line.ptr, .len = line.len, .start = start, .end = end, .cursor = cursor, .slots = text_start }; + return words.slots.items[text_start + at - start]; +} + +/// A Gui that can shape and rasterize `font` at `px`, and nothing else. +fn textTestGui(font: *c.UIFont, px: f32) !Gui { + var g: Gui = undefined; + g.font = font; + g.fallback_count = 0; + g.px = px; + var cw: c_int = 0; + var ch: c_int = 0; + c.ui_font_cell_metrics(font, px, &cw, &ch, &g.ascent); + g.cell_w = @intCast(cw); + g.cell_h = @intCast(ch); + const tag = taglineRaster(font, px, g.cell_w, g.cell_h, 82); + g.tagline_px = tag.px; + g.tagline_width = tag.width; + g.tagline_height = tag.height; + g.tagline_baseline = tag.baseline; + g.atlas_stage = try std.testing.allocator.alloc(u8, atlas_w * atlas_h); + g.glyphs = std.AutoHashMap(GlyphKey, Slot).init(std.testing.allocator); + g.words = .{}; + resetGlyphAtlas(&g); + return g; +} + +fn textTestLine(comptime text: []const u8) [text.len]pardes.Cell { + var line: [text.len]pardes.Cell = @splat(.{ .default = false }); + for (&line, text) |*cell, byte| cell.text[0] = byte; + return line; } -fn cachedGlyph(g: *Gui, cp: u32, role: pardes.FontRole, decoration: GlyphDecoration, centered: bool) ?Slot { - const key: GlyphKey = .{ .codepoint = cp, .role = role, .decoration = decoration, .centered = centered }; - const slot_w = g.cell_w * @as(u32, if (centered) config.GUTTER else 1); +test "a ligature draws across its cells, one slice each, and comes apart under the cursor" { + const bytes = filesystem.readFile(std.testing.allocator, "assets/MapleMono-NF-Regular.ttf") catch return error.SkipZigTest; + defer std.testing.allocator.free(bytes); + const font = c.ui_font_new(bytes.ptr, @intCast(bytes.len)) orelse return error.FontInit; + defer c.ui_font_free(font); + var g = try textTestGui(font, 27); + defer std.testing.allocator.free(g.atlas_stage); + defer g.glyphs.deinit(); + defer g.words.deinit(std.testing.allocator); + + const line = textTestLine("a->b"); + var slots: [4]Slot = undefined; + for (&slots, 0..) |*slot, i| slot.* = cellSlot(&g, &line, i, null, .body); + // `->` is one glyph strip two cells wide: each cell samples its own half. + try std.testing.expectEqual(slots[1].v, slots[2].v); + try std.testing.expectEqual(slots[1].u + g.cell_w, slots[2].u); + var strips: usize = 0; + var it = g.glyphs.iterator(); + while (it.next()) |entry| if (entry.key_ptr.span == 2) { + strips += 1; + try std.testing.expectEqual(@as(u4, 1), entry.key_ptr.lead); + try std.testing.expectEqual(slots[1], entry.value_ptr.*); + }; + try std.testing.expectEqual(@as(usize, 1), strips); + // The arrow runs through the seam: both halves carry ink at it. + const seam = g.atlas_stage[@as(usize, slots[2].v) * atlas_w ..]; + var left_ink: usize = 0; + var right_ink: usize = 0; + for (0..g.cell_h) |y| { + left_ink += seam[y * atlas_w + slots[2].u - 1]; + right_ink += seam[y * atlas_w + slots[2].u]; + } + try std.testing.expect(left_ink > 0 and right_ink > 0); + // `a` and `b` are their plain glyphs. + try std.testing.expectEqual(g.glyphs.get(.{ .face = 0, .glyph = c.ui_font_glyph(font, 'a'), .role = .body }).?, slots[0]); + try std.testing.expectEqual(g.glyphs.get(.{ .face = 0, .glyph = c.ui_font_glyph(font, 'b'), .role = .body }).?, slots[3]); + + // A second line with the same word reuses the shaped slots. + const again = textTestLine("a->b"); + const text_len = g.words.text.items.len; + for (0..4) |i| try std.testing.expectEqual(slots[i], cellSlot(&g, &again, i, null, .body)); + try std.testing.expectEqual(text_len, g.words.text.items.len); + + // The cursor on either half shows plain `-` and `>`. + const plain_minus = cachedGlyph(&g, .{ .face = 0, .glyph = c.ui_font_glyph(font, '-'), .role = .body }).?; + const plain_greater = cachedGlyph(&g, .{ .face = 0, .glyph = c.ui_font_glyph(font, '>'), .role = .body }).?; + for ([_]usize{ 1, 2 }) |cursor| { + try std.testing.expectEqual(plain_minus, cellSlot(&g, &line, 1, cursor, .body)); + try std.testing.expectEqual(plain_greater, cellSlot(&g, &line, 2, cursor, .body)); + } + // A tagline is never shaped. + try std.testing.expectEqual(c.ui_font_glyph(font, '-'), (try glyphKeyAt(&g, cellSlot(&g, &line, 1, null, .tagline))).glyph); +} + +fn glyphKeyAt(g: *Gui, slot: Slot) !GlyphKey { + var it = g.glyphs.iterator(); + while (it.next()) |entry| if (std.meta.eql(entry.value_ptr.*, slot)) return entry.key_ptr.*; + return error.NoGlyph; +} + +test "a font without ligatures draws every cell as its own glyph, exactly as before shaping" { + const font = c.ui_font_new(font_ttf.ptr, @intCast(font_ttf.len)).?; + defer c.ui_font_free(font); + var g = try textTestGui(font, 18); + defer std.testing.allocator.free(g.atlas_stage); + defer g.glyphs.deinit(); + defer g.words.deinit(std.testing.allocator); + const text = "a->b != c => d <= e |> www == :: 0x1F"; + var line = textTestLine(text); + line[3].style.bold = true; // a style change inside a word + var expected: [64 * 64]u8 = undefined; + for (line, 0..) |cell, i| { + if (text[i] == ' ') continue; + const slot = cellSlot(&g, &line, i, null, .body); + const key = try glyphKeyAt(&g, slot); + try std.testing.expectEqual(c.ui_font_glyph(font, text[i]), key.glyph); + try std.testing.expectEqual(@as(u4, 1), key.span); + _ = c.ui_font_raster(font, 18, key.glyph, @intFromBool(cell.style.bold), &expected, 64, @intCast(g.cell_w), @intCast(g.cell_h), 0, @intCast(g.cell_w), g.ascent); + for (0..g.cell_h) |y| + try std.testing.expectEqualSlices(u8, expected[y * 64 ..][0..g.cell_w], g.atlas_stage[(slot.v + y) * atlas_w + slot.u ..][0..g.cell_w]); + } +} + +/// The atlas slot of `key`, rasterized on first use. A strip is `span` cells +/// wide (a grip glyph GUTTER cells, centered); a cell samples its slice of it. +/// Null when the atlas is full. +fn cachedGlyph(g: *Gui, key: GlyphKey) ?Slot { if (g.glyphs.get(key)) |s| return s; + const slot_w = g.cell_w * @as(u32, if (key.centered) config.GUTTER else key.span); if (g.pen_x + slot_w > atlas_w) { g.pen_x = 0; g.pen_y += g.cell_h; @@ -5938,18 +6231,20 @@ fn cachedGlyph(g: *Gui, cp: u32, role: pardes.FontRole, decoration: GlyphDecorat if (g.pen_y + g.cell_h > atlas_h) return null; // atlas full: fall back const s = Slot{ .u = g.pen_x, .v = g.pen_y }; const out = g.atlas_stage.ptr + @as(usize, s.v) * atlas_w + s.u; - const face = fontForCodepoint(g, cp); - const scale = if (role == .tagline) g.tagline_scale else g.scale; - const baseline = if (role == .tagline) g.tagline_baseline else g.ascent; - const raster_w = if (centered) slot_w else if (role == .tagline) g.tagline_width else g.cell_w; - const raster_h = if (role == .tagline) g.tagline_height else g.cell_h; - if (centered) { - _ = c.ui_font_raster_centered(face, scale, @intCast(cp), @intFromBool(decoration.bold), out, @intCast(atlas_w), @intCast(raster_w), @intCast(raster_h)); + const face = if (key.face == 0) g.font else g.fallbacks[key.face - 1].?.face; + const px = if (key.role == .tagline) g.tagline_px else g.px; + const baseline = if (key.role == .tagline) g.tagline_baseline else g.ascent; + const cell_w = if (key.role == .tagline) g.tagline_width else g.cell_w; + const raster_w = if (key.centered) slot_w else cell_w * key.span; + const raster_h = if (key.role == .tagline) g.tagline_height else g.cell_h; + const bold = @intFromBool(key.decoration.bold); + if (key.centered) { + _ = c.ui_font_raster_centered(face, px, key.glyph, bold, out, @intCast(atlas_w), @intCast(raster_w), @intCast(raster_h)); } else { - _ = c.ui_font_raster(face, scale, @intCast(cp), @intFromBool(decoration.bold), out, @intCast(atlas_w), @intCast(raster_w), @intCast(raster_h), baseline); + _ = c.ui_font_raster(face, px, key.glyph, bold, out, @intCast(atlas_w), @intCast(raster_w), @intCast(raster_h), @intCast(cell_w * key.lead), @intCast(cell_w), baseline); } - decorateLine(out, atlas_w, raster_w, raster_h, baseline, decoration); - if (centered) centerGlyphInk(out, raster_w, raster_h); + decorateLine(out, atlas_w, raster_w, raster_h, baseline, key.decoration); + if (key.centered) centerGlyphInk(out, raster_w, raster_h); g.glyphs.put(key, s) catch return null; g.pen_x += slot_w; g.atlas_dirty = true; @@ -5988,23 +6283,25 @@ test "pane indicator cached ink centers bearings styles and sizes" { defer std.testing.allocator.free(g.atlas_stage); g.glyphs = std.AutoHashMap(GlyphKey, Slot).init(std.testing.allocator); defer g.glyphs.deinit(); + g.words = .{}; for ([_]f32{ 13, 27, 40 }) |px| { - g.scale = c.ui_font_scale_for_height(font, px); + g.px = px; var cw: c_int = 0; var ch: c_int = 0; - c.ui_font_cell_metrics(font, g.scale, &cw, &ch, &g.ascent); + c.ui_font_cell_metrics(font, px, &cw, &ch, &g.ascent); g.cell_w = @intCast(cw); g.cell_h = @intCast(ch); for ([_]u8{ 40, 82, 100 }) |percent| { const tag = taglineRaster(font, px, g.cell_w, g.cell_h, percent); g.tagline_width = tag.width; g.tagline_height = tag.height; - g.tagline_scale = tag.scale; + g.tagline_px = tag.px; g.tagline_baseline = tag.baseline; resetGlyphAtlas(&g); try std.testing.expectEqual(@as(usize, 0), g.glyphs.count()); for ([_]u32{ '^', '$', 'j' }) |cp| for ([_]bool{ false, true }) |bold| { - const slot = cachedGlyph(&g, cp, .tagline, .{ .bold = bold }, true).?; + const key: GlyphKey = .{ .face = 0, .glyph = c.ui_font_glyph(font, @intCast(cp)), .role = .tagline, .decoration = .{ .bold = bold }, .centered = true }; + const slot = cachedGlyph(&g, key).?; const bounds = inkBounds(g.atlas_stage[@as(usize, slot.v) * atlas_w + slot.u ..], atlas_w, g.cell_w * config.GUTTER, tag.height).?; const center_x: isize = @intCast(bounds.min_x + bounds.max_x); const center_y: isize = @intCast(bounds.min_y + bounds.max_y); @@ -6012,7 +6309,7 @@ test "pane indicator cached ink centers bearings styles and sizes" { try std.testing.expect(@abs(center_y - @as(isize, @intCast(tag.height - 1))) <= 1); const count = g.glyphs.count(); const pen = g.pen_x; - try std.testing.expectEqualDeep(slot, cachedGlyph(&g, cp, .tagline, .{ .bold = bold }, true).?); + try std.testing.expectEqualDeep(slot, cachedGlyph(&g, key).?); try std.testing.expectEqual(count, g.glyphs.count()); try std.testing.expectEqual(pen, g.pen_x); }; @@ -6020,7 +6317,7 @@ test "pane indicator cached ink centers bearings styles and sizes" { } resetGlyphAtlas(&g); g.pen_y = atlas_h; - try std.testing.expectEqual(@as(?Slot, null), cachedGlyph(&g, '^', .tagline, .{}, true)); + try std.testing.expectEqual(@as(?Slot, null), cachedGlyph(&g, .{ .face = 0, .glyph = c.ui_font_glyph(font, '^'), .role = .tagline, .centered = true })); } test "pane indicator halves share dissolve changes and safe exhausted atlas" { @@ -6040,7 +6337,13 @@ test "pane indicator halves share dissolve changes and safe exhausted atlas" { layers[0].kind = .column; try std.testing.expect(paneGripCell(&layers, &cells, 6, 0, 0) == null); + const font = c.ui_font_new(font_ttf.ptr, @intCast(font_ttf.len)).?; + defer c.ui_font_free(font); var g: Gui = undefined; + g.font = font; + g.fallback_count = 0; + g.px = 20; + g.tagline_px = 16; g.cell_w = 10; g.cell_h = 20; g.tagline_width = 8; @@ -6050,11 +6353,13 @@ test "pane indicator halves share dissolve changes and safe exhausted atlas" { g.pen_y = atlas_h; g.glyphs = std.AutoHashMap(GlyphKey, Slot).init(std.testing.allocator); defer g.glyphs.deinit(); + g.words = .{}; + defer g.words.deinit(std.testing.allocator); for ([_]bool{ false, true }) |old| { var instances: [4]CellInstance = undefined; var next: u32 = 0; for (0..2) |col| { - emitSurfaceCell(&g, null, &instances, &next, @intCast(col), 0, fixedCellLayout(&g), 100, 100, null, &cells[col], &cells[2], .{ .cell = &cells[0], .offset = @intCast(col) }, old, false, Ground.opaqueRgb(bg_default)); + emitSurfaceCell(&g, null, &instances, &next, @intCast(col), 0, fixedCellLayout(&g), 100, 100, null, cells[0..6], col, null, &cells[2], .{ .cell = &cells[0], .offset = @intCast(col) }, old, false, Ground.opaqueRgb(bg_default)); try std.testing.expectEqual(@as(f32, 0), instances[col * 2 + 1].u0); try std.testing.expectEqual(old, instances[col * 2 + 1].effect & old_layer_bit != 0); } @@ -6472,8 +6777,9 @@ test "background opacity retains exact endpoints and percentage precision" { } /// PARDES_TEST_LATENCY trace for an external driver, CLOCK_MONOTONIC ns: -/// `R t` when stdin input is read, `F start fence` per captured frame (present -/// entry, and the GPU fence of that frame). Nothing is written without it. +/// `R t` when stdin input is read, `F start fence submit` per captured frame +/// (present entry, the GPU fence of that frame, and its submission: submit - +/// start is the frame's CPU cost). Nothing is written without it. var latency_fd: c_int = -1; var frame_started_ns: u64 = 0; @@ -6513,11 +6819,12 @@ fn captureFrame(g: *Gui, gpa: std.mem.Allocator, cmd: *c.SDL_GPUCommandBuffer, t c.SDL_DownloadFromGPUTexture(copy, &src, &dst); c.SDL_EndGPUCopyPass(copy); + const submit_ns = monoNs(); const fence = c.SDL_SubmitGPUCommandBufferAndAcquireFence(cmd) orelse return error.GpuSubmit; defer c.SDL_ReleaseGPUFence(g.device, fence); var fences = [_]*c.SDL_GPUFence{fence}; if (!c.SDL_WaitForGPUFences(g.device, true, &fences, 1)) return error.GpuSubmit; - latencyNote("F {d} {d}\n", .{ frame_started_ns, monoNs() }); + latencyNote("F {d} {d} {d}\n", .{ frame_started_ns, monoNs(), submit_ns }); const mapped = c.SDL_MapGPUTransferBuffer(g.device, xfer, false) orelse return error.GpuMap; defer c.SDL_UnmapGPUTransferBuffer(g.device, xfer); @@ -7260,6 +7567,7 @@ fn envU16(env: *std.process.Environ.Map, name: []const u8) ?u16 { test "compact body layer rendering fills recovered rows and clips the final glyph" { var g: Gui = undefined; + g.words = .{}; g.cell_w = 10; g.cell_h = 20; g.tagline_width = 6; @@ -7299,6 +7607,7 @@ test "compact body layer rendering fills recovered rows and clips the final glyp test "compact tag layers fill available width and clip at their physical edge" { var g: Gui = undefined; + g.words = .{}; g.cell_w = 10; g.cell_h = 20; g.tagline_width = 6; diff --git a/src/pardes.zig b/src/pardes.zig index ca2c34a4..f968511a 100644 --- a/src/pardes.zig +++ b/src/pardes.zig @@ -3702,7 +3702,7 @@ pub const CellStyle = struct { reverse: bool = false, invisible: bool = false, strikethrough: bool = false, - ul: enum { off, single, double, curly, dotted, dashed } = .off, + ul: enum(u3) { off, single, double, curly, dotted, dashed } = .off, font_role: FontRole = .body, }; -- cgit v1.3 From 39cdba439c1ae47dbc7c3243a9273aa011c6affa Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Thu, 24 Sep 2026 12:22:51 -0300 Subject: Allocate FreeType's and HarfBuzz's memory from the gui's Zig allocator FreeType and HarfBuzz allocated with libc malloc, out of sight of the Zig allocator the rest of the gui uses, so its Debug leak report and a test's std.testing.allocator never saw them. Now every allocation the font code makes goes through ui_malloc, ui_calloc, ui_realloc and ui_free, exported from gui.zig over `font_allocator`: - HarfBuzz is compiled with hb_malloc_impl and friends pointing at them. - Each UIFont gives its FreeType library its own memory manager (FT_New_Library with an FT_MemoryRec_ over the same functions, then FT_Add_Default_Modules and FT_Set_Default_Properties: exactly what FT_Init_FreeType does over its malloc manager), torn down with FT_Done_Library. - The shim's own UIFont and scratch arrays use them too. C's free and realloc pass no size, so a block starts with a 32-byte header (the caller's pointer stays 16-byte, max_align_t, aligned) holding its size and the allocator that made it, so a block goes back where it came from even after font_allocator is repointed. runNative points font_allocator at the gui's gpa. HarfBuzz makes a few process-wide objects on first use and never frees them (the default Unicode functions, the locale's language, hb-ft's font functions); ui_font_prime makes them from the default heap before that, so a Debug build's leak report stays about fonts. Tests do the same: the shaping tests, and a new test that creates, rasterizes and shapes fonts under std.testing.allocator, report any leak. Only the render thread calls into fonts, and every allocator used is thread-safe. It costs nothing measurable: against the previous change, 10 interleaved rounds with an A/A pair show every scenario as fast or faster with Adwaita Mono and Maple Mono alike, and first paint over 30 launches each matches main. Co-Authored-By: Claude Opus 5.5 (1M context) --- build.zig | 8 ++++- src/gui/font.c | 59 ++++++++++++++++++++++++++++-------- src/gui/font.h | 16 ++++++++++ src/gui/gui.zig | 93 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 4 files changed, 162 insertions(+), 14 deletions(-) (limited to 'src/gui') diff --git a/build.zig b/build.zig index 21df1555..c490cbac 100644 --- a/build.zig +++ b/build.zig @@ -644,7 +644,9 @@ pub fn build(b: *std.Build) void { gm.linkLibrary(freetype_dep.artifact("freetype")); // HarfBuzz from source, like FreeType: its FreeType integration // (HAVE_FREETYPE, hb-ft) links the freetype artifact above, so the two - // share one FreeType. The flags are the ones Ghostty builds it with. + // share one FreeType. The flags are the ones Ghostty builds it with, + // plus its allocator: gui.zig's ui_malloc and friends, over a Zig + // allocator, as FreeType's is. if (b.lazyDependency("harfbuzz", .{})) |upstream| { const harfbuzz = b.addLibrary(.{ .name = "harfbuzz", @@ -670,6 +672,10 @@ pub fn build(b: *std.Build) void { "-DHAVE_FT_SET_VAR_BLEND_COORDINATES=1", "-DHAVE_FT_DONE_MM_VAR=1", "-DHAVE_FT_GET_TRANSFORM=1", + "-Dhb_malloc_impl=ui_malloc", + "-Dhb_calloc_impl=ui_calloc", + "-Dhb_realloc_impl=ui_realloc", + "-Dhb_free_impl=ui_free", }, }); gm.linkLibrary(harfbuzz); diff --git a/src/gui/font.c b/src/gui/font.c index 5cb98e1a..aebe26e6 100644 --- a/src/gui/font.c +++ b/src/gui/font.c @@ -6,14 +6,17 @@ #include "font.h" #include #include +#include #include #include #include -#include #include struct UIFont { + // FreeType allocates through ui_malloc and friends: the library holds a + // pointer to this for its lifetime, which the UIFont outlives. + struct FT_MemoryRec_ memory; FT_Library library; FT_Face face; FT_F26Dot6 size; @@ -60,20 +63,42 @@ static FT_Int32 load_flags(void) { return FT_LOAD_DEFAULT | FT_LOAD_TARGET_LIGHT; } +static void *ft_alloc(FT_Memory memory, long size) { + (void)memory; + return ui_malloc((size_t)size); +} + +static void ft_free(FT_Memory memory, void *block) { + (void)memory; + ui_free(block); +} + +static void *ft_realloc(FT_Memory memory, long cur_size, long new_size, + void *block) { + (void)memory; + (void)cur_size; + return ui_realloc(block, (size_t)new_size); +} + UIFont *ui_font_new(const uint8_t *data, int32_t len) { if (!data || len <= 0) return NULL; - UIFont *f = (UIFont *)calloc(1, sizeof(UIFont)); + UIFont *f = (UIFont *)ui_calloc(1, sizeof(UIFont)); if (!f) return NULL; - if (FT_Init_FreeType(&f->library) != 0) { - free(f); + // FT_Init_FreeType is exactly FT_New_Library over FT_New_Memory's malloc + // manager, then the default modules and properties: the same, over ours. + f->memory = (struct FT_MemoryRec_){NULL, ft_alloc, ft_free, ft_realloc}; + if (FT_New_Library(&f->memory, &f->library) != 0) { + ui_free(f); return NULL; } + FT_Add_Default_Modules(f->library); + FT_Set_Default_Properties(f->library); if (FT_New_Memory_Face(f->library, data, (FT_Long)len, 0, &f->face) != 0) { - FT_Done_FreeType(f->library); - free(f); + FT_Done_Library(f->library); + ui_free(f); return NULL; } // Some symbol fonts do not expose a Unicode charmap. FreeType already @@ -136,10 +161,20 @@ void ui_font_free(UIFont *f) { if (f->face) FT_Done_Face(f->face); if (f->library) - FT_Done_FreeType(f->library); - free(f->own); - free(f->state); - free(f); + FT_Done_Library(f->library); + ui_free(f->own); + ui_free(f->state); + ui_free(f); +} + +void ui_font_prime(UIFont *f) { + if (!f) + return; + hb_font_destroy(hb_ft_font_create_referenced(f->face)); + hb_buffer_t *buffer = hb_buffer_create(); + hb_buffer_add_utf8(buffer, "a", 1, 0, 1); + hb_buffer_guess_segment_properties(buffer); + hb_buffer_destroy(buffer); } void ui_font_cell_metrics(UIFont *f, float px, int32_t *cell_w, int32_t *cell_h, @@ -325,11 +360,11 @@ void ui_font_shape(UIFont *f, float px, int32_t cell_w, const uint32_t *cps, if (!substitutable || cell_w <= 0 || !set_size(f, px)) return; if (n > f->scratch) { - uint32_t *own = (uint32_t *)realloc(f->own, (size_t)n * sizeof *own); + uint32_t *own = (uint32_t *)ui_realloc(f->own, (size_t)n * sizeof *own); if (!own) return; f->own = own; - uint8_t *state = (uint8_t *)realloc(f->state, (size_t)n); + uint8_t *state = (uint8_t *)ui_realloc(f->state, (size_t)n); if (!state) return; f->state = state; diff --git a/src/gui/font.h b/src/gui/font.h index b38f822a..db964fb0 100644 --- a/src/gui/font.h +++ b/src/gui/font.h @@ -4,6 +4,7 @@ // for the face lifetime. #ifndef UI_FONT_H #define UI_FONT_H +#include #include #ifdef __cplusplus @@ -12,6 +13,15 @@ extern "C" { typedef struct UIFont UIFont; +// Every allocation FreeType, HarfBuzz and this shim make: C's malloc, calloc, +// realloc and free, implemented by gui.zig over a Zig allocator. HarfBuzz is +// compiled to call them (hb_malloc_impl and friends); FreeType gets them as +// each library's memory manager. +void *ui_malloc(size_t size); +void *ui_calloc(size_t count, size_t size); +void *ui_realloc(void *block, size_t size); +void ui_free(void *block); + // Parse the first face in an in-memory font. `data` must stay alive for the // lifetime of the font. Returns NULL on failure. UIFont *ui_font_new(const uint8_t *data, int32_t len); @@ -76,6 +86,12 @@ int ui_font_raster_centered(UIFont *f, float px, uint32_t glyph, int bold, void ui_font_free(UIFont *f); +// HarfBuzz makes a few process-wide objects on first use and keeps them for +// the life of the process (the default Unicode functions, the locale's +// language, hb-ft's font functions). Making them here, with `f`'s face, lets +// the caller hand them an allocator that does not count them as leaks. +void ui_font_prime(UIFont *f); + #ifdef __cplusplus } #endif diff --git a/src/gui/gui.zig b/src/gui/gui.zig index 5bcb2867..a4cc7672 100644 --- a/src/gui/gui.zig +++ b/src/gui/gui.zig @@ -133,6 +133,85 @@ fn taglineRaster(font: *c.UIFont, body_px: f32, body_cell_w: u32, body_cell_h: u .height = @intCast(band_h), }; } +/// What FreeType and HarfBuzz allocate from, through ui_malloc and friends +/// below. runNative points it at the gui's gpa once HarfBuzz's process-wide +/// objects exist (ui_font_prime), so a Debug build's leak report is about +/// fonts; a test that counts what fonts leak points it at +/// std.testing.allocator the same way. Only the render thread calls into +/// fonts, and every allocator it is pointed at is thread-safe anyway. +var font_allocator: std.mem.Allocator = std.heap.smp_allocator; + +/// C's free and realloc pass no size, so a block starts with its size and the +/// allocator that made it: a block made before font_allocator was repointed +/// goes back where it came from. 32 bytes keep the caller's pointer 16-byte +/// (max_align_t) aligned. +const FontBlock = struct { size: usize, allocator: std.mem.Allocator }; +const font_block_header = 32; +comptime { + std.debug.assert(@sizeOf(FontBlock) <= font_block_header); +} + +export fn ui_malloc(size: usize) ?*anyopaque { + const total = std.math.add(usize, font_block_header, size) catch return null; + const bytes = font_allocator.alignedAlloc(u8, .@"16", total) catch return null; + @as(*FontBlock, @ptrCast(bytes.ptr)).* = .{ .size = size, .allocator = font_allocator }; + return bytes.ptr + font_block_header; +} + +export fn ui_calloc(count: usize, size: usize) ?*anyopaque { + const total = std.math.mul(usize, count, size) catch return null; + const block: [*]u8 = @ptrCast(ui_malloc(total) orelse return null); + @memset(block[0..total], 0); + return block; +} + +export fn ui_realloc(block: ?*anyopaque, size: usize) ?*anyopaque { + const old = block orelse return ui_malloc(size); + const base: [*]align(16) u8 = @alignCast(@as([*]u8, @ptrCast(old)) - font_block_header); + const header: *FontBlock = @ptrCast(base); + const total = std.math.add(usize, font_block_header, size) catch return null; + const bytes = header.allocator.realloc(base[0 .. font_block_header + header.size], total) catch return null; + @as(*FontBlock, @ptrCast(bytes.ptr)).size = size; + return bytes.ptr + font_block_header; +} + +export fn ui_free(block: ?*anyopaque) void { + const old = block orelse return; + const base: [*]align(16) u8 = @alignCast(@as([*]u8, @ptrCast(old)) - font_block_header); + const header: *FontBlock = @ptrCast(base); + header.allocator.free(base[0 .. font_block_header + header.size]); +} + +test "FreeType and HarfBuzz allocate from the gui allocator and give it all back" { + // HarfBuzz's process-wide objects come from the default heap, as in runNative. + const primer = c.ui_font_new(font_ttf.ptr, @intCast(font_ttf.len)).?; + c.ui_font_prime(primer); + c.ui_font_free(primer); + font_allocator = std.testing.allocator; + defer font_allocator = std.heap.smp_allocator; + + const font = c.ui_font_new(font_ttf.ptr, @intCast(font_ttf.len)).?; + defer c.ui_font_free(font); + var mask: [64 * 64]u8 = undefined; + try std.testing.expectEqual(@as(c_int, 1), c.ui_font_raster(font, 27, c.ui_font_glyph(font, 'g'), 1, &mask, 64, 32, 48, 0, 32, 30)); + try std.testing.expectEqual(@as(c_int, 0), c.ui_font_substitutes(font, c.ui_font_glyph(font, '-'))); + + // A font with ligatures runs the whole HarfBuzz pass. + const bytes = filesystem.readFile(std.testing.allocator, "assets/MapleMono-NF-Regular.ttf") catch return; + defer std.testing.allocator.free(bytes); + const maple = c.ui_font_new(bytes.ptr, @intCast(bytes.len)) orelse return error.FontInit; + defer c.ui_font_free(maple); + var cell_w: c_int = 0; + var cell_h: c_int = 0; + var ascent: c_int = 0; + c.ui_font_cell_metrics(maple, 27, &cell_w, &cell_h, &ascent); + const text = [_]u32{ 'a', '-', '>', 'b', '=', '=' }; + var shaped: [text.len]c.UIShapedCell = undefined; + c.ui_font_shape(maple, 27, cell_w, &text, text.len, &shaped); + try std.testing.expectEqual(@as(u8, 2), shaped[1].span); + try std.testing.expectEqual(@as(u8, 2), shaped[4].span); +} + const max_fallback_fonts = 1 + fonts.fallback_names.len; const LoadedFallback = struct { face: *c.UIFont, @@ -2181,10 +2260,16 @@ fn runNative(init: std.process.Init, opts_in: pardes.Options, attach: ?[]const u else c.SDL_GetGPUSwapchainTextureFormat(device, window); + font_allocator = gpa; const font = c.ui_font_new(font_ttf.ptr, @intCast(font_ttf.len)) orelse { log.err("ui_font_new failed", .{}); return error.FontInit; }; + // HarfBuzz's process-wide objects are made once and never freed: made + // from the default heap, they stay out of a Debug build's leak report. + font_allocator = std.heap.smp_allocator; + c.ui_font_prime(font); + font_allocator = gpa; const px: f32 = 27.0; var cw: c_int = 10; var chh: c_int = 20; @@ -6106,8 +6191,12 @@ fn cellSlot(g: *Gui, line: []const pardes.Cell, at: usize, cursor: ?usize, role: return words.slots.items[text_start + at - start]; } -/// A Gui that can shape and rasterize `font` at `px`, and nothing else. +/// A Gui that can shape and rasterize `font` at `px`, and nothing else. From +/// here on the fonts allocate from std.testing.allocator (the caller puts +/// font_allocator back), so the test counts what they leak. fn textTestGui(font: *c.UIFont, px: f32) !Gui { + c.ui_font_prime(font); + font_allocator = std.testing.allocator; var g: Gui = undefined; g.font = font; g.fallback_count = 0; @@ -6141,6 +6230,7 @@ test "a ligature draws across its cells, one slice each, and comes apart under t const font = c.ui_font_new(bytes.ptr, @intCast(bytes.len)) orelse return error.FontInit; defer c.ui_font_free(font); var g = try textTestGui(font, 27); + defer font_allocator = std.heap.smp_allocator; defer std.testing.allocator.free(g.atlas_stage); defer g.glyphs.deinit(); defer g.words.deinit(std.testing.allocator); @@ -6199,6 +6289,7 @@ test "a font without ligatures draws every cell as its own glyph, exactly as bef const font = c.ui_font_new(font_ttf.ptr, @intCast(font_ttf.len)).?; defer c.ui_font_free(font); var g = try textTestGui(font, 18); + defer font_allocator = std.heap.smp_allocator; defer std.testing.allocator.free(g.atlas_stage); defer g.glyphs.deinit(); defer g.words.deinit(std.testing.allocator); -- cgit v1.3 From a39fb20cb770c3adb911cec7d1f3d033669ed1bb Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Thu, 24 Sep 2026 09:45:50 -0300 Subject: Light a held column grip, and rail its landing beside the rule where the GUI shows it The column grip worked in the GUI but showed nothing anyone could see. Driving the real SDL window with pixel mouse events, press, drag and release all reach the core and reorder or resize the column; the feedback is what failed. The grip kept its muted color while held, and a reorder's insertion rail was drawn in the gutter cell at the destination edge. The GUI paints that cell as the column's scroll rail, and at the window's left edge, the common case of moving the right column first, the dashes were lost in it. From the leftmost column, a drag short of a neighbour's middle shows no rail, rightly, since nothing would move, but nothing said the grip was even held. A held grip now lights in column_box, the accent its muted color is mixed from, and the rail takes that color. The rail runs in the seam cell left of where the column's rule will land, where a border drag's rail runs, for a reorder and a left-edge move alike; at the window's left edge, which has no seam, it runs just past the scroll rail, leaving column 0's grip and pane boxes whole. A carried column's pointer aims at a place, not a word, so the column tags no longer light the word under it, and a release snaps the layout as a border drag's does rather than animating it. The preview and the release both ask layout.columnDrop where the column goes, so the rail stands where the release puts the edge, and the drag no longer carries its unused column index. The GUI test feed takes ESC]777;mouse;;