From f930d53c58187381b2f0df6892546ac1c217c9db Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Thu, 5 Nov 2026 22:27:44 -0300 Subject: settings #1, Tagbottom goes, a pane's tag at its head the one value anyone used: layout.bodyTop and tagTop, mouse's seam and clampBorderRow, applyRowSplit, body_layer's copy and the tests' row arithmetic lose their other arm (reads deleted in Core.zig, layout.zig, mouse.zig, draw.zig, gui.zig, macos.zig, whose ABI slot 11 says 0 now, and ninep/events.zig, ninep/tree.zig, look.zig, Messages.zig), with the registry row, SPC t b, Help, /commands, the builtins JSON and the reference row; deleted: the snapshot scripts tagbottom, tagbottomshort and tagbottomimage with their goldens, the behaviour test "placement: under Tagbottom a look from a pane's text goes under its text too", the window scene 10-tagbottom with its gui-goldens line and the macOS parity check tags-bottom; tests that ran both ends of the tag run the head; a dump that kept the field loads without it; perf.zig's harness id moves in the two debug baselines (its reads of the field went); the window scenes after 10-tagbottom (12 to 15, 17) take new gui-goldens lines, the two Tagbottom writes gone from the scene and with them their words on the message row (the base window build running the same scenes gives the same frames); gates on tui: core-test 966/966, behaviour-test 243/243, unit-test 1484/1485, pane-test 171/172, snap all 105 scripts ok, process-test 0 of 37 failed; gui unit-test 1529/1530, gui-golden 0 of 1 failed Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- docs/typ/builtins-gui.json | 1 - docs/typ/builtins-tui.json | 1 - docs/typ/reference.typ | 2 +- src/CHANGELOG.md | 5 + src/Core.zig | 57 +++---- src/File.zig | 2 +- src/Layer.zig | 4 +- src/Messages.zig | 2 +- src/body_layer.zig | 7 +- src/config.zig | 5 +- src/draw.zig | 97 +++++------ src/gui/gui.zig | 10 +- src/layout.zig | 52 +++--- src/look.zig | 4 +- src/macos.zig | 8 +- src/mouse.zig | 34 ++-- src/ninep/events.zig | 2 +- src/ninep/tree.zig | 2 +- test/behaviour/mouse.zig | 45 +++-- test/behaviour/placement.zig | 23 --- test/behaviour/settings.zig | 2 +- test/behaviour/tags.zig | 172 +++++++++----------- test/column_drag.zig | 2 +- test/gui-goldens.txt | 11 +- test/macos-snapshots/rendering-parity.golden | 1 - test/macos-snapshots/rendering-parity.snap | 5 - test/mode.zig | 2 +- test/monkey9p.zig | 2 +- test/output.zig | 19 +-- test/panes.zig | 104 ++++++------ test/perf-baseline-gui-debug.json | 2 +- test/perf-baseline-tui-debug.json | 2 +- test/perf.zig | 4 +- test/process/window.zig | 3 - test/snapshots/tagbottom.golden | 235 --------------------------- test/snapshots/tagbottom.snap | 161 ------------------ test/snapshots/tagbottomimage.golden | 123 -------------- test/snapshots/tagbottomimage.snap | 53 ------ test/snapshots/tagbottomshort.golden | 43 ----- test/snapshots/tagbottomshort.snap | 48 ------ 40 files changed, 302 insertions(+), 1055 deletions(-) delete mode 100644 test/snapshots/tagbottom.golden delete mode 100644 test/snapshots/tagbottom.snap delete mode 100644 test/snapshots/tagbottomimage.golden delete mode 100644 test/snapshots/tagbottomimage.snap delete mode 100644 test/snapshots/tagbottomshort.golden delete mode 100644 test/snapshots/tagbottomshort.snap diff --git a/docs/typ/builtins-gui.json b/docs/typ/builtins-gui.json index d67fa728..de8a6058 100644 --- a/docs/typ/builtins-gui.json +++ b/docs/typ/builtins-gui.json @@ -102,7 +102,6 @@ {"name": "Symbols", "leader": "SPC l s", "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "List the file's symbols from the language server."}, {"name": "SyntaxBold", "leader": null, "also": [], "arg": true, "scope": "root", "setting": true, "choices": "on, off", "doc": "Keywords and the like are drawn bold, on or off."}, {"name": "Tab", "leader": null, "also": [], "arg": true, "scope": "root", "setting": true, "choices": null, "doc": "A tab's width in cells, 1 through 16, in every pane; bare, it says the width."}, - {"name": "Tagbottom", "leader": "SPC t b", "also": [], "arg": true, "scope": "root", "setting": true, "choices": "on, off", "doc": "Each pane's tag goes at its foot rather than its head, on or off."}, {"name": "TaglineSize", "leader": null, "also": [], "arg": true, "scope": "root", "setting": true, "choices": null, "doc": "Scale the tag font, a percentage."}, {"name": "Term", "leader": "SPC n t", "also": [], "arg": true, "scope": "pane", "setting": false, "choices": null, "doc": "A shell in the calling pane's directory, raw from the first frame."}, {"name": "TermImages", "leader": null, "also": [], "arg": true, "scope": "root", "setting": true, "choices": "real, petscii", "doc": "How a new terminal draws its program's kitty graphics: real, as pixels where it can, or petscii, as glyph art."}, diff --git a/docs/typ/builtins-tui.json b/docs/typ/builtins-tui.json index 151bb6a0..468b329c 100644 --- a/docs/typ/builtins-tui.json +++ b/docs/typ/builtins-tui.json @@ -96,7 +96,6 @@ {"name": "Symbols", "leader": "SPC l s", "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "List the file's symbols from the language server."}, {"name": "SyntaxBold", "leader": null, "also": [], "arg": true, "scope": "root", "setting": true, "choices": "on, off", "doc": "Keywords and the like are drawn bold, on or off."}, {"name": "Tab", "leader": null, "also": [], "arg": true, "scope": "root", "setting": true, "choices": null, "doc": "A tab's width in cells, 1 through 16, in every pane; bare, it says the width."}, - {"name": "Tagbottom", "leader": "SPC t b", "also": [], "arg": true, "scope": "root", "setting": true, "choices": "on, off", "doc": "Each pane's tag goes at its foot rather than its head, on or off."}, {"name": "Term", "leader": "SPC n t", "also": [], "arg": true, "scope": "pane", "setting": false, "choices": null, "doc": "A shell in the calling pane's directory, raw from the first frame."}, {"name": "TermImages", "leader": null, "also": [], "arg": true, "scope": "root", "setting": true, "choices": "real, petscii", "doc": "How a new terminal draws its program's kitty graphics: real, as pixels where it can, or petscii, as glyph art."}, {"name": "Theme", "leader": null, "also": [], "arg": true, "scope": "root", "setting": true, "choices": null, "doc": "Switch to the named theme."}, diff --git a/docs/typ/reference.typ b/docs/typ/reference.typ index b515e1b2..7cbbfc60 100644 --- a/docs/typ/reference.typ +++ b/docs/typ/reference.typ @@ -452,7 +452,7 @@ word clicked in a tag does. The same lines go in the startup file [#word("TreeContext")], [off: sticky declaration headers in a source pane (per pane, dumped)], [#word("TreeContextTagStyle")], [on: draw those headers in the tagline style], [#word("LocationsConfig") `...`], [the layout of #word("Grep"), search and language-server results (below)], - [#word("Wrap"), #word("Colors"), #word("Tagbottom"), #word("Debug")], [toggles], + [#word("Wrap"), #word("Colors"), #word("Debug")], [toggles], [#word("Font") `[:]`, #word("Fonts")], [SDL and macOS only; size 8-72 (pixels in SDL, points on macOS)], [#word("TaglineSize") `<1-100>`], [82: tagline face, percent; SDL and macOS], [#word("WindowOpacity") `<0-100>`], [100; SDL only: everything but text and the cursor], diff --git a/src/CHANGELOG.md b/src/CHANGELOG.md index 08b86064..ee968587 100644 --- a/src/CHANGELOG.md +++ b/src/CHANGELOG.md @@ -2,6 +2,11 @@ ## Unreleased +- Half the settings are gone, each one now the value it had by default, + its word refused as any unknown one is (an init file that still says it + gets a notice naming its line), and a dump that kept it loads as before: + - Tagbottom: a pane's tag is at its head (`SPC t b` with it). + - What pardes keeps on disk is in xitdb databases now (a pinned commit of github.com/xit-vcs/xitdb, pure Zig). The state file, `pardes.xitdb` in the DumpDir (`$XDG_DATA_HOME/pardes`, else `~/.local/share/pardes`), diff --git a/src/Core.zig b/src/Core.zig index eb3f0562..38493b93 100644 --- a/src/Core.zig +++ b/src/Core.zig @@ -3682,7 +3682,7 @@ test "raw terminal cursor obeys visibility without hiding modal and tag cursors" defer frame.deinit(); const visible = (try p.render(frame.allocator())).cursor orelse return error.MissingCursor; const rect = p.rects[0]; - const body_y = if (p.settings.tag_bottom) rect.y else rect.y + BOX_H; + const body_y = rect.y + BOX_H; try std.testing.expectEqual(rect.x + config.GUTTER + 3, visible.x); try std.testing.expectEqual(body_y, visible.y); @@ -3697,7 +3697,7 @@ test "raw terminal cursor obeys visibility without hiding modal and tag cursors" try std.testing.expectEqual(body_y, modal_cursor.y); tagline.enterTag(p, pane); const tag_cursor = (try p.render(frame.allocator())).cursor orelse return error.MissingCursor; - try std.testing.expectEqual(if (p.settings.tag_bottom) rect.y + rect.h - BOX_H else rect.y, tag_cursor.y); + try std.testing.expectEqual(rect.y, tag_cursor.y); pane.focus = .body; pane.body.mode = .tty; try std.testing.expect((try p.render(frame.allocator())).cursor == null); @@ -3716,34 +3716,31 @@ test "raw terminal cursor obeys visibility without hiding modal and tag cursors" test "raw terminal cursor follows its active row only while that row is visible" { const gpa = std.testing.allocator; - for ([_]bool{ false, true }) |tag_bottom| { - const p = try Pardes.init(gpa, .{ .tty_only = true, .cols = 40, .rows = 12 }); - defer p.deinit(); - while (p.nextEffect()) |_| {} - p.settings.tag_bottom = tag_bottom; - const pane = p.panes[0].?; - pane.body.mode = .tty; - for (0..60) |_| p.update(.{ .output = .{ .pane = 0, .bytes = "row\r\n" } }); - p.update(.{ .output = .{ .pane = 0, .bytes = "\x1b[3;4H" } }); - var frame = std.heap.ArenaAllocator.init(gpa); - defer frame.deinit(); - const live = (try p.render(frame.allocator())).cursor orelse return error.MissingCursor; - const rect = p.rects[0]; - const body_y = if (tag_bottom) rect.y else rect.y + BOX_H; - try std.testing.expectEqual(rect.x + config.GUTTER + 3, live.x); - try std.testing.expectEqual(body_y + 2, live.y); - - pardes.panes.terminal.scrollGrid(pane, -1); - const scrolled = (try p.render(frame.allocator())).cursor orelse return error.MissingCursor; - try std.testing.expectEqual(live.x, scrolled.x); - try std.testing.expectEqual(live.y + 1, scrolled.y); - pardes.panes.terminal.scrollGrid(pane, -@as(i32, pane.rows)); - try std.testing.expect((try p.render(frame.allocator())).cursor == null); - pardes.panes.terminal.followOutput(pane); - const returned = (try p.render(frame.allocator())).cursor orelse return error.MissingCursor; - try std.testing.expectEqual(live.x, returned.x); - try std.testing.expectEqual(live.y, returned.y); - } + const p = try Pardes.init(gpa, .{ .tty_only = true, .cols = 40, .rows = 12 }); + defer p.deinit(); + while (p.nextEffect()) |_| {} + const pane = p.panes[0].?; + pane.body.mode = .tty; + for (0..60) |_| p.update(.{ .output = .{ .pane = 0, .bytes = "row\r\n" } }); + p.update(.{ .output = .{ .pane = 0, .bytes = "\x1b[3;4H" } }); + var frame = std.heap.ArenaAllocator.init(gpa); + defer frame.deinit(); + const live = (try p.render(frame.allocator())).cursor orelse return error.MissingCursor; + const rect = p.rects[0]; + const body_y = rect.y + BOX_H; + try std.testing.expectEqual(rect.x + config.GUTTER + 3, live.x); + try std.testing.expectEqual(body_y + 2, live.y); + + pardes.panes.terminal.scrollGrid(pane, -1); + const scrolled = (try p.render(frame.allocator())).cursor orelse return error.MissingCursor; + try std.testing.expectEqual(live.x, scrolled.x); + try std.testing.expectEqual(live.y + 1, scrolled.y); + pardes.panes.terminal.scrollGrid(pane, -@as(i32, pane.rows)); + try std.testing.expect((try p.render(frame.allocator())).cursor == null); + pardes.panes.terminal.followOutput(pane); + const returned = (try p.render(frame.allocator())).cursor orelse return error.MissingCursor; + try std.testing.expectEqual(live.x, returned.x); + try std.testing.expectEqual(live.y, returned.y); } test "the bare tty startup opens a text pane under the shell, unfocused" { diff --git a/src/File.zig b/src/File.zig index 05d02673..5b3c6bb7 100644 --- a/src/File.zig +++ b/src/File.zig @@ -1933,7 +1933,7 @@ pub fn drawGutter(p: *Pardes, s: *Surface, pane: *Pane, r: pardes.Rect, tx: u16, const gcrow = if (pane.body.cur_pinned) pane.body.cur_row else @as(i32, gcur.y) + goff; const typing_body = pane.focus == .body and (pane.prompt == .none or pane.prompt == .del_side or pane.prompt == .repl_choice); const cur_line: i32 = if (active and typing_body) gcrow else std.math.minInt(i32); - // the body's first row, the way renderPane derives it (Tagbottom) + // the body's first row, the way renderPane derives it const body_y = p.bodyTop(pane, r); const context_bg = p.theme().tag_bg; for (0..@min(pane.context_rows, body_h)) |context_row| { diff --git a/src/Layer.zig b/src/Layer.zig index deca3466..aa346413 100644 --- a/src/Layer.zig +++ b/src/Layer.zig @@ -276,7 +276,7 @@ pub fn taglineBandOffset(row: u16, canvas_h: f32, cell_h: u32, tagline_h: u32) u const rows: u32 = @max(1, @as(u32, @intFromFloat(@floor(canvas_h / @as(f32, @floatFromInt(cell_h)))))); // 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). + // faces the window edge. if (@as(u32, row) + 1 >= rows) return spare; return spare / 2; } @@ -286,7 +286,7 @@ pub fn topbarPaneBorderPixels(cell_h: u32, tagline_h: u32) u32 { return @min(@as(u32, config.gui_topbar_pane_border_px), spare * 2); } -test "tagline bands center in their cells and Tagbottom faces the window edge" { +test "tagline bands center in their cells and the last row faces the window edge" { const cell_h: u32 = 20; const tagline_h: u32 = 16; const canvas_h: f32 = 200; diff --git a/src/Messages.zig b/src/Messages.zig index 8eb18f1d..66beb6bc 100644 --- a/src/Messages.zig +++ b/src/Messages.zig @@ -803,7 +803,7 @@ test "a builtin announces itself on the message row, and Verbose silences it" { if (layer.rows != 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); + try std.testing.expectEqual(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; diff --git a/src/body_layer.zig b/src/body_layer.zig index 2fc1454c..b8336b7b 100644 --- a/src/body_layer.zig +++ b/src/body_layer.zig @@ -188,9 +188,8 @@ pub fn joinBody(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane, var temporary: Surface = .{ .cols = r.w, .rows = @intCast(logical_rows + pane.tag_rows), .cells = temporary_cells }; const synthetic: Rect = .{ .x = 0, .y = 0, .w = r.w, .h = @intCast(logical_rows + pane.tag_rows) }; try renderBody(p, &temporary, arena, pane, synthetic, id, active, null); - const first_row: usize = if (p.settings.tag_bottom) 0 else pane.tag_rows; for (0..logical_rows) |row| { - const start = (row + first_row) * r.w + config.GUTTER; + const start = (row + pane.tag_rows) * r.w + config.GUTTER; @memcpy(layer.cells[row * width ..][0..width], temporary_cells[start..][0..width]); } layer.kind = .body; @@ -204,8 +203,8 @@ pub fn joinBody(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane, layer.setContextLines(pane.wrap_line[0..pane.context_rows]); layer.cursor = null; if (temporary.cursor) |cursor| { - if (cursor.x >= config.GUTTER and cursor.y >= first_row) - layer.cursor = .{ .x = cursor.x - config.GUTTER, .y = @intCast(cursor.y - first_row), .bar = cursor.bar }; + if (cursor.x >= config.GUTTER and cursor.y >= pane.tag_rows) + layer.cursor = .{ .x = cursor.x - config.GUTTER, .y = @intCast(cursor.y - pane.tag_rows), .bar = cursor.bar }; } // The grid: the layer's first rows, as many as the body has, each a // body row high; its caret where one of them has it. (pane.rows is the diff --git a/src/config.zig b/src/config.zig index 1c4e92a1..bea5dbbf 100644 --- a/src/config.zig +++ b/src/config.zig @@ -129,7 +129,6 @@ pub const leader_path = paths: { .Verbose = null, .TreeContextTagStyle = null, .Wrap = "tw", - .Tagbottom = "tb", .NextColor = "tn", .Themes = "tt", .Theme = null, @@ -690,7 +689,6 @@ pub const Runtime = struct { theme: usize = 0, colors: bool = true, wrap: bool = true, - tag_bottom: bool = false, tree_context_tag_style: bool = true, debug: bool = false, focus_tint: bool = true, @@ -861,7 +859,7 @@ 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, syntax_bold, pager_color, verbose, ligatures, cursor_blink, jump_trail, program_esc }; + pub const Toggle = enum { colors, wrap, tree_context_tag_style, debug, focus_tint, syntax_bold, pager_color, verbose, ligatures, cursor_blink, jump_trail, program_esc }; pub const Action = union(enum) { toggle: Toggle, @@ -920,7 +918,6 @@ pub const Runtime = struct { .{ .word = "Colors", .action = .{ .toggle = .colors }, .doc = "Syntax colours in text panes, on or off." }, .{ .word = "Wrap", .action = .{ .toggle = .wrap }, .doc = "Long lines wrap onto the next row, on or off." }, .{ .word = "TreeContextTagStyle", .action = .{ .toggle = .tree_context_tag_style }, .doc = "A pane's TreeContext rows draw in the tag's style, on or off." }, - .{ .word = "Tagbottom", .action = .{ .toggle = .tag_bottom }, .doc = "Each pane's tag goes at its foot rather than its head, on or off." }, .{ .word = "Debug", .action = .{ .toggle = .debug }, .doc = "A small box of frame statistics at the top right, on or off." }, .{ .word = "FocusTint", .action = .{ .toggle = .focus_tint }, .doc = "The focused pane's and column's tags are tinted, on or off." }, .{ .word = "SyntaxBold", .action = .{ .toggle = .syntax_bold }, .doc = "Keywords and the like are drawn bold, on or off." }, diff --git a/src/draw.zig b/src/draw.zig index ac13fc7d..ce5f86c1 100644 --- a/src/draw.zig +++ b/src/draw.zig @@ -1040,27 +1040,24 @@ test "a tag of three rows has its grip on the first, and band under it that stil pane.tag.own = try std.testing.allocator.dupe(u8, "Second\nthird\nfourth"); var arena: std.heap.ArenaAllocator = .init(std.testing.allocator); defer arena.deinit(); - for ([_]bool{ false, true }) |bottom| { - p.settings.tag_bottom = bottom; - p.sync(); - _ = arena.reset(.retain_capacity); - const s = try p.render(arena.allocator()); - const r = p.rects[0]; - const top = p.tagTop(pane, r); - try std.testing.expect(pane.tag_rows >= 3); - const chrome = p.chromeTheme(); - const band = if (p.settings.focus_tint) chrome.tag_active_bg else chrome.tag_bg; - for (0..config.GUTTER) |dx| { - const x = r.x + @as(u16, @intCast(dx)); - try std.testing.expectEqual(Color{ .rgb = chrome.box }, s.at(x, top).style.bg); - for (1..pane.tag_rows) |line| { - const cell = s.at(x, top + @as(u16, @intCast(line))); - try std.testing.expectEqual(Color{ .rgb = band }, cell.style.bg); - try std.testing.expectEqualStrings(" ", cell.grapheme()); - } + p.sync(); + _ = arena.reset(.retain_capacity); + const s = try p.render(arena.allocator()); + const r = p.rects[0]; + const top = p.tagTop(pane, r); + try std.testing.expect(pane.tag_rows >= 3); + const chrome = p.chromeTheme(); + const band = if (p.settings.focus_tint) chrome.tag_active_bg else chrome.tag_bg; + for (0..config.GUTTER) |dx| { + const x = r.x + @as(u16, @intCast(dx)); + try std.testing.expectEqual(Color{ .rgb = chrome.box }, s.at(x, top).style.bg); + for (1..pane.tag_rows) |line| { + const cell = s.at(x, top + @as(u16, @intCast(line))); + try std.testing.expectEqual(Color{ .rgb = band }, cell.style.bg); + try std.testing.expectEqualStrings(" ", cell.grapheme()); } - try std.testing.expectEqual(pane.tag_rows, s.region(.grip, 0).?.rect.h); } + try std.testing.expectEqual(pane.tag_rows, s.region(.grip, 0).?.rect.h); } test "place puts every part where the painters and layers put it, in every layout" { @@ -1074,7 +1071,6 @@ test "place puts every part where the painters and layers put it, in every layou var arena: std.heap.ArenaAllocator = .init(std.testing.allocator); defer arena.deinit(); for (0..16) |step| { - p.settings.tag_bottom = step & 1 != 0; if (step & 4 != 0) try std.testing.expect(p.executeBuiltinLine(p.active, "Msg a placed notice")); if (step == 8) try std.testing.expect(p.executeBuiltinLine(1, "Collapse")); if (step == 12) try std.testing.expect(p.executeBuiltinLine(1, "Collapse")); @@ -1214,7 +1210,7 @@ test "a monkey over notices, prompts, tags and tiny panes at a gui's metrics nev var arena: std.heap.ArenaAllocator = .init(std.testing.allocator); defer arena.deinit(); const words = [_][]const u8{ "error:", "\u{754c}", "x", "Shader /tmp/a.glsl:", "e\u{301}", "\t", std.mem.asBytes(&@as([20][5]u8, @splat("long-".*))), " " }; - const commands = [_][]const u8{ "New", "Newcol", "Collapse", "Tagbottom", "TreeContext", "Wrap", "Find", "Del", "FocusTint", "Debug" }; + const commands = [_][]const u8{ "New", "Newcol", "Collapse", "TreeContext", "Wrap", "Find", "Del", "Debug" }; var text: std.ArrayListUnmanaged(u8) = .empty; defer text.deinit(std.testing.allocator); for (0..steps) |_| { @@ -1318,38 +1314,35 @@ test "a body with context rows is painted once, and the grid's rows are what a p pane.file.?.scroll = 8; var arena: std.heap.ArenaAllocator = .init(std.testing.allocator); defer arena.deinit(); - for ([_]bool{ false, true }) |bottom| { - p.settings.tag_bottom = bottom; - // A selection and the cursor on body rows, painted in the one pass. - pane.body.cur_row = 12; - pane.body.cur_col = 3; - pane.body.vsel = .{ .active = true, .row = 10, .col = 2 }; - pane.body.mode = .normal; - p.sync(); - _ = arena.reset(.retain_capacity); - const s = try p.render(arena.allocator()); - const layer = &s.body_layers[0]; - try std.testing.expect(layer.context_rows > 0); - const body = s.region(.body, 0).?; - // The plain paint the grid used to take, of the same frame. - const cells = try arena.allocator().alloc(Cell, s.cells.len); - @memset(cells, .{}); - var plain: Surface = .{ .cols = s.cols, .rows = s.rows, .cells = cells }; - pane.view.layered = false; - try body_layer.renderBody(p, &plain, arena.allocator(), pane, p.rects[0], 0, true, null); - pane.view.layered = true; - for (0..body.rect.h) |row| { - const y = body.rect.y + row; - for (0..body.rect.w) |col| { - const x = body.rect.x + col; - const got = s.cells[y * s.cols + x]; - const want = plain.cells[y * s.cols + x]; - try std.testing.expect(got.visuallyEqual(&want)); - } + // A selection and the cursor on body rows, painted in the one pass. + pane.body.cur_row = 12; + pane.body.cur_col = 3; + pane.body.vsel = .{ .active = true, .row = 10, .col = 2 }; + pane.body.mode = .normal; + p.sync(); + _ = arena.reset(.retain_capacity); + const s = try p.render(arena.allocator()); + const layer = &s.body_layers[0]; + try std.testing.expect(layer.context_rows > 0); + const body = s.region(.body, 0).?; + // The plain paint the grid used to take, of the same frame. + const cells = try arena.allocator().alloc(Cell, s.cells.len); + @memset(cells, .{}); + var plain: Surface = .{ .cols = s.cols, .rows = s.rows, .cells = cells }; + pane.view.layered = false; + try body_layer.renderBody(p, &plain, arena.allocator(), pane, p.rects[0], 0, true, null); + pane.view.layered = true; + for (0..body.rect.h) |row| { + const y = body.rect.y + row; + for (0..body.rect.w) |col| { + const x = body.rect.x + col; + const got = s.cells[y * s.cols + x]; + const want = plain.cells[y * s.cols + x]; + try std.testing.expect(got.visuallyEqual(&want)); } - try std.testing.expectEqual(plain.cursor, s.cursor); - // The layer's own rows run past the grid's. - try std.testing.expect(layer.rows > body.rect.h); } + try std.testing.expectEqual(plain.cursor, s.cursor); + // The layer's own rows run past the grid's. + try std.testing.expect(layer.rows > body.rect.h); } diff --git a/src/gui/gui.zig b/src/gui/gui.zig index f9b757f8..7c042703 100644 --- a/src/gui/gui.zig +++ b/src/gui/gui.zig @@ -1018,7 +1018,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_y: u16 = 0, // that rect's first BODY row scroll_body_h: u16 = 0, // and its BODY rows, which a taller tag leaves fewer of scroll_held_px: f32 = 0, // its tree-sitter context band, which never moves scroll_col: u16 = 0, // where the wheel turned: crossed rows are delivered @@ -5801,7 +5801,6 @@ test "the layer cover is the per-cell layer scan, over a core's layouts and rand var cover: [97 * 31]Cover = undefined; var notices = false; for (0..32) |step| { - core.settings.tag_bottom = step & 1 != 0; if (step & 3 == 0) try std.testing.expect(core.executeBuiltinLine(2, "Collapse")); core.prefix = if (step & 4 != 0) .leader else .none; if (step & 8 != 0) { @@ -6141,8 +6140,7 @@ test "every pixel of a grip column is band, button or ring, and the button sits const pane = try core.setTestFile(std.mem.asBytes(&@as([60][5]u8, @splat("text\n".*)))); pane.tag.own = try gpa.dupe(u8, "second\nthird"); core.newScratchBelow(0); - for ([_]struct { w: u32, h: u32, tag: u32 }{ .{ .w = 10, .h = 20, .tag = 12 }, .{ .w = 17, .h = 35, .tag = 30 }, .{ .w = 9, .h = 19, .tag = 15 }, .{ .w = 12, .h = 24, .tag = 24 } }) |m| for ([_]bool{ false, true }) |bottom| for ([_]usize{ 0, 1 }) |focus| for ([_]bool{ false, true }) |dirty| { - core.settings.tag_bottom = bottom; + for ([_]struct { w: u32, h: u32, tag: u32 }{ .{ .w = 10, .h = 20, .tag = 12 }, .{ .w = 17, .h = 35, .tag = 30 }, .{ .w = 9, .h = 19, .tag = 15 }, .{ .w = 12, .h = 24, .tag = 24 } }) |m| for ([_]usize{ 0, 1 }) |focus| for ([_]bool{ false, true }) |dirty| { core.active = focus; pane.file.?.revision = pane.file.?.saved_revision + @intFromBool(dirty); core.sync(); @@ -6208,11 +6206,11 @@ test "every pixel of a grip column is band, button or ring, and the button sits // Under the first row there is no button: band and rules only. if (n / w_px >= m.h and n / w_px < h_px - 1 and !std.meta.eql(got, rgb(band)) and !std.meta.eql(got, rgb(chrome.border))) return error.TestButtonUnderFirstRow; - if (!known) std.debug.print("sliver {any} at {d},{d} of {d}x{d} (metrics {d}x{d}/{d}, bottom {}, focus {d}, dirty {}) page {any}\n", .{ got, n % w_px, n / w_px, w_px, h_px, m.w, m.h, m.tag, bottom, focus, dirty, s.chrome.page }); + if (!known) std.debug.print("sliver {any} at {d},{d} of {d}x{d} (metrics {d}x{d}/{d}, focus {d}, dirty {}) page {any}\n", .{ got, n % w_px, n / w_px, w_px, h_px, m.w, m.h, m.tag, focus, dirty, s.chrome.page }); try std.testing.expect(known); } // The rule under the tag runs unbroken across the grip column. - if (!bottom) for (pixels[(h_px - 1) * w_px ..][0..w_px]) |pixel| + for (pixels[(h_px - 1) * w_px ..][0..w_px]) |pixel| try std.testing.expectEqual(rgb(chrome.tag_rule orelse mixRgb(chrome.tag_bg, chrome.page orelse bg_default)), pixel.?); // The button's edges are the scrollbar's. const button = gripButton(&g, chrome, grip.rect.x, grip.rect.y, layout); diff --git a/src/layout.zig b/src/layout.zig index 10bed438..38841f59 100644 --- a/src/layout.zig +++ b/src/layout.zig @@ -407,7 +407,7 @@ pub fn applyRowSplit(p: *Pardes, cc: usize, k: usize, cur_y: u16) void { const ra = p.rects[p.cols[cc].panes[k]]; const rb = p.rects[p.cols[cc].panes[k + 1]]; const combined: f32 = @floatFromInt(ra.h + rb.h); - var nt: f32 = @floatFromInt(if (p.settings.tag_bottom) cur_y -| ra.y else (cur_y + 1) -| ra.y); + var nt: f32 = @floatFromInt((cur_y + 1) -| ra.y); // A terminal keeps its tag and two body rows (floorRows); a text pane // gives up all but its tag, as acme's do. const lo: f32 = @floatFromInt(@max(BOX_H, floorRows(p, p.cols[cc].panes[k]))); @@ -828,9 +828,7 @@ fn splitAt(p: *Pardes, c: usize, id: usize, y: u16) void { } /// A pane's top plus its tag's rows, as heights go: a split this far down -/// leaves the pane its tag and that much of its body, whichever end the tag -/// is on (Tagbottom's is at its foot, the height the same; behaviour test -/// "placement: under Tagbottom..."). +/// leaves the pane its tag and that much of its body. fn bodyFrom(p: *const Pardes, id: usize) u16 { return p.rects[id].y + p.panes[id].?.tag_rows; } @@ -1429,7 +1427,6 @@ test "collapse local transfers remain bounded through repeated tiny window resiz } for (0..180) |step| { p.screen_h = @intCast((step * 17) % 81); - p.settings.tag_bottom = step % 3 == 0; compute(p); toggleCollapse(p, step % 5); var used: u16 = 0; @@ -1484,7 +1481,7 @@ test "collapse single and all panes leave unused column space" { try std.testing.expectEqual(p.screen_h - 1, p.rects[1].y); } -test "collapse survives tiny resizes and TagBottom" { +test "collapse survives tiny resizes" { const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 80, .rows = 32 }); defer p.deinit(); _ = try p.newShell(1, ""); @@ -1492,22 +1489,17 @@ test "collapse survives tiny resizes and TagBottom" { insert(p, 0, 1, 1); insert(p, 0, 2, 2); p.panes[1].?.collapsed = true; - for ([_]bool{ false, true }) |bottom| { - p.settings.tag_bottom = bottom; - { - for (0..50) |height| { - p.screen_h = @intCast(height); - compute(p); - var used: u16 = 0; - for (p.cols[0].panes[0..p.cols[0].n]) |id| { - const rect = p.rects[id]; - try std.testing.expect(rect.h <= p.screen_h -| rect.y); - used += rect.h; - } - try std.testing.expect(used <= p.screen_h); - if (height >= 5) try std.testing.expectEqual(@as(u16, 1), p.rects[1].h); - } + for (0..50) |height| { + p.screen_h = @intCast(height); + compute(p); + var used: u16 = 0; + for (p.cols[0].panes[0..p.cols[0].n]) |id| { + const rect = p.rects[id]; + try std.testing.expect(rect.h <= p.screen_h -| rect.y); + used += rect.h; } + try std.testing.expect(used <= p.screen_h); + if (height >= 5) try std.testing.expectEqual(@as(u16, 1), p.rects[1].h); } p.screen_h = 32; compute(p); @@ -1525,8 +1517,7 @@ test "collapse can be expanded by dragging its boundary" { try std.testing.expect(!p.panes[0].?.collapsed); try std.testing.expectEqual(@as(u16, 6), p.rects[0].h); toggleCollapse(p, 1); - p.settings.tag_bottom = true; - applyRowSplit(p, 0, 0, p.rects[1].y - 5); + applyRowSplit(p, 0, 0, p.rects[1].y - 6); compute(p); try std.testing.expect(!p.panes[1].?.collapsed); try std.testing.expectEqual(@as(u16, 6), p.rects[1].h); @@ -1849,16 +1840,15 @@ pub fn wantedTagRows(p: *Pardes, id: usize) u16 { return @intCast(@max(BOX_H, @min(shown.rows(), MAX_TAG_ROWS))); } -/// 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, pane: *const Pane, r: Rect) u16 { - return if (p.settings.tag_bottom) r.y else r.y + pane.tag_rows; +/// The pane's first body row, under its tag. Notice bands do NOT move it +/// -- they are an overlay, drawn over the top rows rather than taking them. +pub fn bodyTop(_: *const Pardes, pane: *const Pane, r: Rect) u16 { + return r.y + pane.tag_rows; } -/// The tag's first row: the pane's top, or its last rows with Tagbottom. -pub fn tagTop(p: *const Pardes, pane: *const Pane, r: Rect) u16 { - return if (p.settings.tag_bottom) r.y + r.h -| pane.tag_rows else r.y; +/// The tag's first row: the pane's top. +pub fn tagTop(_: *const Pardes, _: *const Pane, r: Rect) u16 { + return r.y; } pub fn tagCapacity(p: *const Pardes, physical_width: u16) u16 { diff --git a/src/look.zig b/src/look.zig index 7df48c5a..ab1407ee 100644 --- a/src/look.zig +++ b/src/look.zig @@ -1924,7 +1924,7 @@ test "Look hover waits without mutating the pane and input cancels it" { _ = try p.render(frame.allocator()); const rect = p.rects[p.active]; const word_x = rect.x + config.GUTTER + config.PREFIX_W + 7; - const body_y = if (p.settings.tag_bottom) rect.y else rect.y + BOX_H; + const body_y = rect.y + BOX_H; const motion = Event{ .mouse = .{ .button = .none, .kind = .motion, .col = word_x, .row = body_y } }; const selections_before = pane.sel; @@ -1987,7 +1987,7 @@ test "Look hover waits without mutating the pane and input cancels it" { // first character must be paintable all the way at tag column zero — which // is TAG_TEXT_INSET, not GUTTER: the grip keeps the gutter and the gap // beside it separates the grip's hit area from the text. - const tag_y = if (p.settings.tag_bottom) rect.y + rect.h - BOX_H else rect.y; + const tag_y = rect.y; p.look_hover_preview = .{ .col = rect.x + TAG_TEXT_INSET, .row = tag_y, diff --git a/src/macos.zig b/src/macos.zig index 0d79f96b..13b8b332 100644 --- a/src/macos.zig +++ b/src/macos.zig @@ -1923,7 +1923,8 @@ export fn pardes_tag_layer_value(index: u32, field: u32) u32 { 8 => if (layer.cursor) |c| c.x else 65535, 9 => if (layer.cursor) |c| @intFromBool(c.bar) else 0, 10 => @as(u32, layer.bg[0]) << 16 | @as(u32, layer.bg[1]) << 8 | layer.bg[2], - 11 => @intFromBool(layer.kind == .pane and st.core.settings.tag_bottom), + // A tag at its pane's foot: there is no Tagbottom now. + 11 => 0, 12 => rgb: { const border = st.core.chromeTheme().border; break :rgb @as(u32, border[0]) << 16 | @as(u32, border[1]) << 8 | border[2]; @@ -2849,11 +2850,6 @@ test "mac tag layer ABI preserves logical capacity and physical grip" { try std.testing.expectEqual(@as(u32, 12), pardes_tag_layer_value(0, 0)); try std.testing.expectEqual(@as(u32, 0x123456), pardes_tag_layer_value(0, 10)); try std.testing.expectEqual(@as(u32, 0), pardes_tag_layer_value(0, 11)); - core.settings.tag_bottom = true; - try std.testing.expectEqual(@as(u32, 1), pardes_tag_layer_value(0, 11)); - core.surface.tag_layers[0].kind = .column; - try std.testing.expectEqual(@as(u32, 0), pardes_tag_layer_value(0, 11)); - core.surface.tag_layers[0].kind = .pane; const border = core.chromeTheme().border; const border_rgb = @as(u32, border[0]) << 16 | @as(u32, border[1]) << 8 | border[2]; try std.testing.expectEqual(border_rgb, pardes_tag_layer_value(0, 12)); diff --git a/src/mouse.zig b/src/mouse.zig index 02f966bd..7905735c 100644 --- a/src/mouse.zig +++ b/src/mouse.zig @@ -154,16 +154,15 @@ fn clampBorderCol(lx: u16, lw: u16, rw: u16, mcol: u16) u16 { return if (lo <= hi) std.math.clamp(mcol, lo, hi) else mcol; } -fn clampBorderRow(ay: u16, ah: u16, bh: u16, mrow: u16, tag_bottom: bool) u16 { - const d: u16 = if (tag_bottom) 1 else 0; - const lo = ay + BOX_H - 1 + d; - const hi = (ay +| ah +| bh -| (BOX_H + 1)) +| d; +fn clampBorderRow(ay: u16, ah: u16, bh: u16, mrow: u16) u16 { + const lo = ay + BOX_H - 1; + const hi = ay +| ah +| bh -| (BOX_H + 1); return if (lo <= hi) std.math.clamp(mrow, lo, hi) else mrow; } fn seamRowOf(p: *const Pardes, c: usize, k: usize) u16 { const r = p.rects[p.cols[c].panes[k]]; - return if (p.settings.tag_bottom) r.y +| r.h else r.y + r.h -| 1; + return r.y + r.h -| 1; } fn cornerFixture(gpa: std.mem.Allocator) !*Pardes { @@ -747,7 +746,7 @@ pub fn handleMouse(p: *Pardes, event: Mouse) void { // window by its button. if (m.rule_above and mrow > 0) for (0..p.ncol) |cc| { if (mcol < p.col_x[cc] or mcol >= p.col_x[cc] + p.col_w[cc]) continue; - const seam = if (p.settings.tag_bottom) mrow else mrow - 1; + const seam = mrow - 1; if (seamIdxAt(p, cc, seam)) |k| { p.drag = .{ .border_h = .{ .col = cc, .top_idx = k, .cur_y = seam } }; return; @@ -903,7 +902,7 @@ pub fn dragUpdate(p: *Pardes, mcol: u16, mrow: u16, body_hit: ?Mouse.BodyHit) vo if (d.corner) |k| if (k.idx + 1 < p.cols[k.col].n) { const a = p.rects[p.cols[k.col].panes[k.idx]]; const b = p.rects[p.cols[k.col].panes[k.idx + 1]]; - d.cur_y = clampBorderRow(a.y, a.h, b.h, mrow, p.settings.tag_bottom); + d.cur_y = clampBorderRow(a.y, a.h, b.h, mrow); } else { d.cur_y = mrow; }; @@ -915,8 +914,7 @@ pub fn dragUpdate(p: *Pardes, mcol: u16, mrow: u16, body_hit: ?Mouse.BodyHit) vo const a = p.rects[p.cols[cc].panes[k]]; const b = p.rects[p.cols[cc].panes[k + 1]]; // Held by the rule over the lower pane: the seam is the row above. - const seam = if (p.settings.tag_bottom) mrow else mrow -| 1; - d.cur_y = clampBorderRow(a.y, a.h, b.h, seam, p.settings.tag_bottom); + d.cur_y = clampBorderRow(a.y, a.h, b.h, mrow -| 1); } else d.cur_y = mrow; }, .column_move => |*d| d.cur_x = mcol, @@ -1545,29 +1543,25 @@ test "a corner drag's two axes clamp independently" { // each axis alone, at both walls try std.testing.expectEqual(@as(u16, config.MINW), clampBorderCol(lx, lw, rw, 0)); try std.testing.expectEqual(@as(u16, 100 - config.MINW), clampBorderCol(lx, lw, rw, 999)); - try std.testing.expectEqual(row_lo, clampBorderRow(ay, ah, bh, 0, false)); - try std.testing.expectEqual(row_hi, clampBorderRow(ay, ah, bh, 999, false)); + try std.testing.expectEqual(row_lo, clampBorderRow(ay, ah, bh, 0)); + try std.testing.expectEqual(row_hi, clampBorderRow(ay, ah, bh, 999)); // THE corner property: drag off the right edge while staying mid-height — // x sits at its wall, y still tracks the mouse row exactly try std.testing.expectEqual(@as(u16, 100 - config.MINW), clampBorderCol(lx, lw, rw, 999)); - try std.testing.expectEqual(@as(u16, 12), clampBorderRow(ay, ah, bh, 12, false)); + try std.testing.expectEqual(@as(u16, 12), clampBorderRow(ay, ah, bh, 12)); // and the mirror: pinned at the bottom, x still free - try std.testing.expectEqual(row_hi, clampBorderRow(ay, ah, bh, 999, false)); + try std.testing.expectEqual(row_hi, clampBorderRow(ay, ah, bh, 999)); try std.testing.expectEqual(@as(u16, 40), clampBorderCol(lx, lw, rw, 40)); // both pinned at once is just both walls, not a stuck gesture try std.testing.expectEqual(@as(u16, config.MINW), clampBorderCol(lx, lw, rw, 0)); - try std.testing.expectEqual(row_hi, clampBorderRow(ay, ah, bh, 999, false)); - - try std.testing.expectEqual(row_lo + 1, clampBorderRow(ay, ah, bh, 0, true)); - try std.testing.expectEqual(row_hi + 1, clampBorderRow(ay, ah, bh, 999, true)); - try std.testing.expectEqual(@as(u16, 12), clampBorderRow(ay, ah, bh, 12, true)); + try std.testing.expectEqual(row_hi, clampBorderRow(ay, ah, bh, 999)); // degenerate pairs pass through untouched, each on its own terms: a pane // pair with no room stays draggable even when the column pair has room try std.testing.expectEqual(@as(u16, 7), clampBorderCol(0, 5, 5, 7)); try std.testing.expectEqual(@as(u16, 40), clampBorderCol(lx, lw, rw, 40)); - try std.testing.expectEqual(@as(u16, 9), clampBorderRow(TOPBAR_H, 1, 0, 9, false)); + try std.testing.expectEqual(@as(u16, 9), clampBorderRow(TOPBAR_H, 1, 0, 9)); } test "a v-handle press at the RIGHT column's seam drags both boundaries" { @@ -1668,7 +1662,7 @@ test "a RIGHT-column corner's two axes clamp independently" { try std.testing.expectEqual(handle, p.drag.border_v.cur_x); const a = p.rects[p.cols[1].panes[0]]; const b = p.rects[p.cols[1].panes[1]]; - try std.testing.expectEqual(clampBorderRow(a.y, a.h, b.h, 999, p.settings.tag_bottom), p.drag.border_v.cur_y); + try std.testing.expectEqual(clampBorderRow(a.y, a.h, b.h, 999), p.drag.border_v.cur_y); p.update(.{ .mouse = .{ .button = .left, .kind = .release, .col = handle, .row = 999 } }); } diff --git a/src/ninep/events.zig b/src/ninep/events.zig index e0a67ad4..a4094e57 100644 --- a/src/ninep/events.zig +++ b/src/ninep/events.zig @@ -1374,7 +1374,7 @@ test "a click in the body reports the offsets of the word it takes, so the recor _ = try p.render(frame.allocator()); const rect = p.rects[id]; const x0 = rect.x + config.GUTTER + config.PREFIX_W; - const y0 = if (p.settings.tag_bottom) rect.y else rect.y + p.panes[id].?.tag_rows; + const y0 = rect.y + p.panes[id].?.tag_rows; const tab: u16 = config.tab_now; const Click = struct { x: u16, y: u16, look: []const u8, exec: []const u8, scroll: i32 = 0 }; // Where the wrapped line's `qty` landed, as drawn. diff --git a/src/ninep/tree.zig b/src/ninep/tree.zig index a00a8947..1b6c242e 100644 --- a/src/ninep/tree.zig +++ b/src/ninep/tree.zig @@ -1434,7 +1434,7 @@ test "filesystem inspection preserves pending and displayed Look hover" { .button = .none, .kind = .motion, .col = rect.x + config.GUTTER + config.PREFIX_W + 7, - .row = if (p.settings.tag_bottom) rect.y else rect.y + pardes.BOX_H, + .row = rect.y + pardes.BOX_H, } }); try testing.expect(p.look_hover_wait != null); const body = Node.of(serialOf(p), .body); diff --git a/test/behaviour/mouse.zig b/test/behaviour/mouse.zig index a0ac7a23..e64e3ef9 100644 --- a/test/behaviour/mouse.zig +++ b/test/behaviour/mouse.zig @@ -53,30 +53,27 @@ test "mouse: everything a B1 chord does while B1 is down is one undo step" { test "mouse: a click past a line's or the file's end puts the caret where insertion types" { for ([_]bool{ false, true }) |already_insert| { - for ([_]bool{ false, true }) |bottom_tag| { - for ([_]struct { text: []const u8, click_row: usize, dot: u32, col: usize, row: usize, result: []const u8 }{ - .{ .text = "abc\nxy", .click_row = 0, .dot = 3, .col = 3, .row = 0, .result = "abcZ\nxy" }, - .{ .text = "abc\nxy", .click_row = 5, .dot = 6, .col = 2, .row = 1, .result = "abc\nxyZ" }, - .{ .text = "abc\n", .click_row = 5, .dot = 4, .col = 0, .row = 1, .result = "abc\nZ" }, - .{ .text = "", .click_row = 5, .dot = 0, .col = 0, .row = 0, .result = "Z" }, - }) |case| { - var s = try Session.initFile(std.testing.allocator, case.text); - defer s.deinit(); - const n = try s.focused(); - if (bottom_tag) try s.write("/ctl", "Tagbottom on\n"); - if (already_insert) try s.keys("i"); - // The first line's number, then a blank, then its text. - const x, const y = try s.where("1 "); - try mouse(&s, "m {d} {d} 1\nm {d} {d} 0\n", .{ x + 2 + 15, y + case.click_row, x + 2 + 15, y + case.click_row }); - try std.testing.expectEqual(.{ case.dot, case.dot }, try s.range(s.at("/pane/{d}/dot", .{n}))); - // The caret is drawn where it is, and insertion draws it there too. - try std.testing.expectEqual(.{ x + 2 + case.col, y + case.row }, (try s.cursor()).?); - if (!already_insert) try s.keys("i"); - try std.testing.expect(std.mem.endsWith(u8, try s.read(s.at("/pane/{d}/ctl", .{n})), " mode:insert ")); - try std.testing.expectEqual(.{ x + 2 + case.col, y + case.row }, (try s.cursor()).?); - try s.keys("Z"); - try s.expect(s.at("/pane/{d}/body", .{n}), case.result); - } + for ([_]struct { text: []const u8, click_row: usize, dot: u32, col: usize, row: usize, result: []const u8 }{ + .{ .text = "abc\nxy", .click_row = 0, .dot = 3, .col = 3, .row = 0, .result = "abcZ\nxy" }, + .{ .text = "abc\nxy", .click_row = 5, .dot = 6, .col = 2, .row = 1, .result = "abc\nxyZ" }, + .{ .text = "abc\n", .click_row = 5, .dot = 4, .col = 0, .row = 1, .result = "abc\nZ" }, + .{ .text = "", .click_row = 5, .dot = 0, .col = 0, .row = 0, .result = "Z" }, + }) |case| { + var s = try Session.initFile(std.testing.allocator, case.text); + defer s.deinit(); + const n = try s.focused(); + if (already_insert) try s.keys("i"); + // The first line's number, then a blank, then its text. + const x, const y = try s.where("1 "); + try mouse(&s, "m {d} {d} 1\nm {d} {d} 0\n", .{ x + 2 + 15, y + case.click_row, x + 2 + 15, y + case.click_row }); + try std.testing.expectEqual(.{ case.dot, case.dot }, try s.range(s.at("/pane/{d}/dot", .{n}))); + // The caret is drawn where it is, and insertion draws it there too. + try std.testing.expectEqual(.{ x + 2 + case.col, y + case.row }, (try s.cursor()).?); + if (!already_insert) try s.keys("i"); + try std.testing.expect(std.mem.endsWith(u8, try s.read(s.at("/pane/{d}/ctl", .{n})), " mode:insert ")); + try std.testing.expectEqual(.{ x + 2 + case.col, y + case.row }, (try s.cursor()).?); + try s.keys("Z"); + try s.expect(s.at("/pane/{d}/body", .{n}), case.result); } } } diff --git a/test/behaviour/placement.zig b/test/behaviour/placement.zig index f6823feb..73d69883 100644 --- a/test/behaviour/placement.zig +++ b/test/behaviour/placement.zig @@ -108,29 +108,6 @@ test "placement: a look from a pane's text goes under its text when it has many try std.testing.expectEqual(was[big][0] + was[big][1], now[big + 1][0] + now[big + 1][1]); } -test "placement: under Tagbottom a look from a pane's text goes under its text too, every line of it still in sight above its tag" { - var tmp = std.testing.tmpDir(.{}); - defer tmp.cleanup(); - try tmp.dir.writeFile(std.testing.io, .{ .sub_path = "second.txt", .data = "second\n" }); - var dir: [4096]u8 = undefined; - const at = dir[0..try tmp.dir.realPath(std.testing.io, &dir)]; - var s = try Session.initFile(std.testing.allocator, "alpha\nbeta\ngamma\n"); - defer s.deinit(); - s.detach(); - try s.write("/ctl", "size 200 60\n"); - try s.write("/ctl", "Tagbottom on\n"); - const top = try s.focused(); - try s.write(s.at("/pane/{d}/look", .{top}), s.at("{s}/second.txt\n", .{at})); - // The first pane keeps its three lines with its tag under them, at its - // foot: the split leaves it its tag and its text whichever end the tag - // is on (makenewwindow, util.c:482-486). The new pane starts below. - const alpha = (try s.where("alpha"))[1]; - try std.testing.expectEqual(alpha + 1, (try s.where("beta"))[1]); - try std.testing.expectEqual(alpha + 2, (try s.where("gamma"))[1]); - try std.testing.expectEqual(alpha + 3, try tagRow(&s, "/test.txt")); - try std.testing.expectEqual(alpha + 4, (try s.where("second"))[1]); -} - test "placement: a look from the middle of a column splits only the pane it came from, short ones round it kept short, through a Newcol too" { var tmp = std.testing.tmpDir(.{}); defer tmp.cleanup(); diff --git a/test/behaviour/settings.zig b/test/behaviour/settings.zig index d87e8191..80573e2f 100644 --- a/test/behaviour/settings.zig +++ b/test/behaviour/settings.zig @@ -274,7 +274,7 @@ test "settings: every on/off setting the root ctl reads flips when its word is w // A floor, so a ctl that lists none fails: a bare session's on/off // words, Colors to PagerColor, are ten. try std.testing.expect(flipped >= 10); - for ([_][]const u8{ "Colors off", "Wrap off", "Tagbottom on", "Debug on" }) |want| + for ([_][]const u8{ "Colors off", "Wrap off", "Debug on" }) |want| try std.testing.expectEqualStrings(want, try setting(&s, want[0..std.mem.indexOfScalar(u8, want, ' ').?])); try s.write("/ctl", "Theme acme\n"); try s.write("/ctl", "Shell /bin/sh\n"); diff --git a/test/behaviour/tags.zig b/test/behaviour/tags.zig index 71faed3a..4477e73e 100644 --- a/test/behaviour/tags.zig +++ b/test/behaviour/tags.zig @@ -149,76 +149,67 @@ test "tags: a renamed path moves the tag's cursor with the text after it and a s } test "tags: window keys move between panes from a tag and each tag keeps its cursor" { - for ([_]bool{ false, true }) |bottom| { - var s = try Session.initFile(std.testing.allocator, "body\n"); - defer s.deinit(); - if (bottom) try s.write("/ctl", "Tagbottom on\n"); - const first = try s.focused(); - const second = try s.newPane(); - try s.write(s.at("/pane/{d}/name", .{second}), "/second.txt"); - try s.write("/focus", s.at("{d}", .{first})); - try s.keys(":" ++ home ++ "ll" ++ window ++ "j\n"); - try std.testing.expectEqual(second, try s.focused()); - try s.keys(":" ++ home ++ "llll" ++ window ++ "k\n"); - try std.testing.expectEqual(first, try s.focused()); - try s.keys(":"); - try std.testing.expectEqual(@as(usize, 2), try tagCol(&s, "/test.txt")); - try s.keys(window ++ "j\n:"); - try std.testing.expectEqual(@as(usize, 4), try tagCol(&s, "/second.txt")); - } + var s = try Session.initFile(std.testing.allocator, "body\n"); + defer s.deinit(); + const first = try s.focused(); + const second = try s.newPane(); + try s.write(s.at("/pane/{d}/name", .{second}), "/second.txt"); + try s.write("/focus", s.at("{d}", .{first})); + try s.keys(":" ++ home ++ "ll" ++ window ++ "j\n"); + try std.testing.expectEqual(second, try s.focused()); + try s.keys(":" ++ home ++ "llll" ++ window ++ "k\n"); + try std.testing.expectEqual(first, try s.focused()); + try s.keys(":"); + try std.testing.expectEqual(@as(usize, 2), try tagCol(&s, "/test.txt")); + try s.keys(window ++ "j\n:"); + try std.testing.expectEqual(@as(usize, 4), try tagCol(&s, "/second.txt")); } test "tags: a tag's normal mode is the body's: motions stay in the tag and insert types into it" { - for ([_]bool{ false, true }) |bottom| { - var s = try Session.initFile(std.testing.allocator, "body\n"); - defer s.deinit(); - if (bottom) try s.write("/ctl", "Tagbottom on\n"); - const first = try s.focused(); - try s.write("/ctl", "Newcol\n"); - const right_pane = try s.newPane(); - try s.write("/focus", s.at("{d}", .{first})); - try s.keys(":" ++ home ++ "l"); - try std.testing.expectEqual(@as(usize, 1), try tagCol(&s, "/test.txt")); - try s.keys("hkj"); - try std.testing.expectEqual(@as(usize, 0), try tagCol(&s, "/test.txt")); - try std.testing.expectEqual(first, try s.focused()); - try s.keys(window ++ "l\n"); - try std.testing.expectEqual(right_pane, try s.focused()); - try s.keys(window ++ "h\n"); - try std.testing.expectEqual(first, try s.focused()); - try s.keys(":i\u{F018}hjklHJKL:"); - try std.testing.expectEqualStrings("/test.txt Save Term Collapse DelhjklHJKL:", try tag(&s, first)); - try std.testing.expect(std.mem.endsWith(u8, try s.read(s.at("/pane/{d}/ctl", .{first})), " mode:normal ")); - try s.expect(s.at("/pane/{d}/body", .{first}), "body\n"); - try std.testing.expectEqual(first, try s.focused()); - } + var s = try Session.initFile(std.testing.allocator, "body\n"); + defer s.deinit(); + const first = try s.focused(); + try s.write("/ctl", "Newcol\n"); + const right_pane = try s.newPane(); + try s.write("/focus", s.at("{d}", .{first})); + try s.keys(":" ++ home ++ "l"); + try std.testing.expectEqual(@as(usize, 1), try tagCol(&s, "/test.txt")); + try s.keys("hkj"); + try std.testing.expectEqual(@as(usize, 0), try tagCol(&s, "/test.txt")); + try std.testing.expectEqual(first, try s.focused()); + try s.keys(window ++ "l\n"); + try std.testing.expectEqual(right_pane, try s.focused()); + try s.keys(window ++ "h\n"); + try std.testing.expectEqual(first, try s.focused()); + try s.keys(":i\u{F018}hjklHJKL:"); + try std.testing.expectEqualStrings("/test.txt Save Term Collapse DelhjklHJKL:", try tag(&s, first)); + try std.testing.expect(std.mem.endsWith(u8, try s.read(s.at("/pane/{d}/ctl", .{first})), " mode:normal ")); + try s.expect(s.at("/pane/{d}/body", .{first}), "body\n"); + try std.testing.expectEqual(first, try s.focused()); } test "tags: a tag with a newline in it is as tall as its lines, and each line is typed into and pointed at" { - for ([_]bool{ false, true }) |bottom| { - var s = try Session.initFile(std.testing.allocator, "body\n"); - defer s.deinit(); - const n = try s.focused(); - if (bottom) try s.write("/ctl", "Tagbottom on\n"); - // Insert mode in a tag is a body's: Enter is a new line. - try s.keys(":A\nSecond"); - try std.testing.expectEqualStrings("/test.txt Save Term Collapse Del\nSecond", try tag(&s, n)); - const x, const y = try s.where("/test.txt"); - try std.testing.expectEqual(.{ x, y + 1 }, try s.where("Second")); - // The caret is on the second line, after what was typed. - try std.testing.expectEqual(.{ x + 6, y + 1 }, (try s.cursor()).?); - // The body starts under (or over) the whole tag. - const by = (try s.where("1 body"))[1]; - try std.testing.expect(if (bottom) by < y else by == y + 2); - // A click on the second line puts the tag's cursor on it. - try s.keys("\x1b:"); - try s.write("/mousein", s.at("m {d} {d} 1\nm {d} {d} 0\n", .{ x + 2, y + 1, x + 2, y + 1 })); - try std.testing.expectEqual(.{ x + 2, y + 1 }, (try s.cursor()).?); - // A clicked tag is in normal mode: `i` types where it was clicked. - try s.keys("iX"); - try std.testing.expectEqualStrings("/test.txt Save Term Collapse Del\nSeXcond", try tag(&s, n)); - try s.expect(s.at("/pane/{d}/body", .{n}), "body\n"); - } + var s = try Session.initFile(std.testing.allocator, "body\n"); + defer s.deinit(); + const n = try s.focused(); + // Insert mode in a tag is a body's: Enter is a new line. + try s.keys(":A\nSecond"); + try std.testing.expectEqualStrings("/test.txt Save Term Collapse Del\nSecond", try tag(&s, n)); + const x, const y = try s.where("/test.txt"); + try std.testing.expectEqual(.{ x, y + 1 }, try s.where("Second")); + // The caret is on the second line, after what was typed. + try std.testing.expectEqual(.{ x + 6, y + 1 }, (try s.cursor()).?); + // The body starts under the whole tag. + const by = (try s.where("1 body"))[1]; + try std.testing.expect(by == y + 2); + // A click on the second line puts the tag's cursor on it. + try s.keys("\x1b:"); + try s.write("/mousein", s.at("m {d} {d} 1\nm {d} {d} 0\n", .{ x + 2, y + 1, x + 2, y + 1 })); + try std.testing.expectEqual(.{ x + 2, y + 1 }, (try s.cursor()).?); + // A clicked tag is in normal mode: `i` types where it was clicked. + try s.keys("iX"); + try std.testing.expectEqualStrings("/test.txt Save Term Collapse Del\nSeXcond", try tag(&s, n)); + try s.expect(s.at("/pane/{d}/body", .{n}), "body\n"); } test "tags: a tag with more lines than rows scrolls to keep its caret in view" { @@ -469,33 +460,30 @@ test "tags: truncating a tag clears its own text, u in the tag undoes it, and > try std.testing.expectEqualStrings("/test.txt Make\nMore\n Tail\n", try tag(&s, n)); } -test "tags: a pane tag's file name is tinted, its directory, dirty marker and words not, the tag at the top or the bottom" { - for ([_]bool{ false, true }) |bottom| { - var s = try Session.initFile(std.testing.allocator, "body\n"); - defer s.deinit(); - const n = try s.focused(); - try s.write("/ctl", "FocusTint off\n"); - if (bottom) try s.write("/ctl", "Tagbottom\n"); - try s.write(s.at("/pane/{d}/name", .{n}), "/project/界file.zig\n"); - try s.write(s.at("/pane/{d}/dirty", .{n}), "1"); - const x0, const y = try s.where("/project/"); - const screen = try s.screen(); - const styles = try s.styles(); - const cols = try std.unicode.utf8CountCodepoints(screen[0..std.mem.indexOfScalar(u8, screen, '\n').?]); - var rows = std.mem.splitScalar(u8, screen, '\n'); - for (0..y) |_| _ = rows.next(); - var cells = (try std.unicode.Utf8View.init(rows.next().?)).iterator(); - var x: usize = 0; - var tinted: ?[]const u8 = null; - var ink: ?[]const u8 = null; - while (cells.nextCodepointSlice()) |cell| : (x += 1) { - if (x < x0 or std.mem.eql(u8, cell, " ")) continue; - // `界file.zig`: the wide glyph's two cells, then eight. - const in_name = x >= x0 + "/project/".len and x < x0 + "/project/".len + 10; - const want = if (in_name) &tinted else &ink; - if (want.* == null) want.* = styles[y * cols + x]; - try std.testing.expectEqualStrings(want.*.?, styles[y * cols + x]); - } - try std.testing.expect(!std.mem.eql(u8, tinted.?, ink.?)); +test "tags: a pane tag's file name is tinted, its directory, dirty marker and words not" { + var s = try Session.initFile(std.testing.allocator, "body\n"); + defer s.deinit(); + const n = try s.focused(); + try s.write("/ctl", "FocusTint off\n"); + try s.write(s.at("/pane/{d}/name", .{n}), "/project/界file.zig\n"); + try s.write(s.at("/pane/{d}/dirty", .{n}), "1"); + const x0, const y = try s.where("/project/"); + const screen = try s.screen(); + const styles = try s.styles(); + const cols = try std.unicode.utf8CountCodepoints(screen[0..std.mem.indexOfScalar(u8, screen, '\n').?]); + var rows = std.mem.splitScalar(u8, screen, '\n'); + for (0..y) |_| _ = rows.next(); + var cells = (try std.unicode.Utf8View.init(rows.next().?)).iterator(); + var x: usize = 0; + var tinted: ?[]const u8 = null; + var ink: ?[]const u8 = null; + while (cells.nextCodepointSlice()) |cell| : (x += 1) { + if (x < x0 or std.mem.eql(u8, cell, " ")) continue; + // `界file.zig`: the wide glyph's two cells, then eight. + const in_name = x >= x0 + "/project/".len and x < x0 + "/project/".len + 10; + const want = if (in_name) &tinted else &ink; + if (want.* == null) want.* = styles[y * cols + x]; + try std.testing.expectEqualStrings(want.*.?, styles[y * cols + x]); } + try std.testing.expect(!std.mem.eql(u8, tinted.?, ink.?)); } diff --git a/test/column_drag.zig b/test/column_drag.zig index 7f5b6e94..8c71ba74 100644 --- a/test/column_drag.zig +++ b/test/column_drag.zig @@ -143,7 +143,7 @@ test "column grip is separate from compact text and the resize seam" { if (pane_layer.rows > 0 and pane_layer.kind == .pane and pane_layer.id == pane_id) try std.testing.expectEqual((try tagLayer(p, column)).viewport.x, pane_layer.viewport.x); } - const pane_tag_y = if (p.settings.tag_bottom) rect.y + rect.h - pardes.BOX_H else rect.y; + const pane_tag_y = rect.y; for (0..config.GUTTER) |offset| { const x = rect.x + @as(u16, @intCast(offset)); try std.testing.expectEqual(surface.at(x, pane_tag_y).style.font_role, surface.at(x, pardes.TOPBAR_H).style.font_role); diff --git a/test/gui-goldens.txt b/test/gui-goldens.txt index 02fccf40..e9882515 100644 --- a/test/gui-goldens.txt +++ b/test/gui-goldens.txt @@ -7,10 +7,9 @@ 07-prompt-notice 4b1511f42b1cc06d3fe8b07e44a296a6c3fb2a37788cf0e9b5b1c7837a00993b 08-wide-glyph-edges c200d9fd0254af6b39a6387a074b1e29efeb3bd4114b373f83650a8bae8900ad 09-collapsed-focus-tint 4ac6f25f742ad68ea00a5033fd6c6c785b3426a0045499f046f99db9310c5721 -10-tagbottom 224d369c583348a9bcdcc4d2ef66529a79da18bfff82ab401af8970f03fafabb -12-multiline-tag 09fe9f8841a14fe3379aa2d87d82fc817f9c011444261d635cec235a32e9a866 -13-image 318720734099917fe92694dfb52f9304e61efb53ff76118621762498b9b114c1 -14-theme-ink 5ce5d040782d7b019da22109867e07ae212ea175b4527b7d2c1c5bcfca055793 -15-theme-acme-light d81855e3204cbb698731cfd72519b7e3454c6b0ac734c01228004c8ee60f8683 +12-multiline-tag 02af5e9e367063f3e15e13bfe69c4fbce2ebf000ca392bd814c348cb7a773e7c +13-image 5b50a99f020ab5d61b5b481cda9e77496f1c03700df5d957f5280ec873e9cfa3 +14-theme-ink 41932127a60a7347c08f84e32bba064c862aa06fa46e2ca9e117a1e37177f534 +15-theme-acme-light 7a0336e9c8429ac0d0fb04e6357e2ee20a69cf57b1c484680222912aeb1877f2 16-debug 8c0d51dddb4badb908a3975952b3a960bc1f1132ffa94e874be7172d36d997d4 -17-terminal bdd828d94de59aba7ce9e35e80d7b4b9081ec663b0a2489e4076279d9b03e0a4 +17-terminal 9acf2cfaefd7e48a3c32a03254307293297c0e5ab9829475f8a94b96decbc35d diff --git a/test/macos-snapshots/rendering-parity.golden b/test/macos-snapshots/rendering-parity.golden index cbb56ab2..fc0d8acd 100644 --- a/test/macos-snapshots/rendering-parity.golden +++ b/test/macos-snapshots/rendering-parity.golden @@ -1,5 +1,4 @@ == backgrounds tags-100 uniform -== backgrounds tags-bottom uniform == backgrounds tags-71 uniform == backgrounds tags-0 uniform == backgrounds invalid-stays-0 uniform diff --git a/test/macos-snapshots/rendering-parity.snap b/test/macos-snapshots/rendering-parity.snap index cdd940c8..332f3155 100644 --- a/test/macos-snapshots/rendering-parity.snap +++ b/test/macos-snapshots/rendering-parity.snap @@ -5,11 +5,6 @@ command Theme forge command TaglineSize 70 stable 700 20000 check-backgrounds tags-100 -command Tagbottom -stable 700 20000 -check-backgrounds tags-bottom -command Tagbottom -stable 700 20000 command WindowOpacity 71 stable 700 20000 check-backgrounds tags-71 diff --git a/test/mode.zig b/test/mode.zig index 42e61c79..6141d898 100644 --- a/test/mode.zig +++ b/test/mode.zig @@ -14,7 +14,7 @@ fn clickModeTag(p: *Pardes) !void { const text = try pardes.tagline.tagText(p, p.scratch.allocator(), pane); const col = std.mem.indexOf(u8, text, "Mode") orelse return error.MissingModeTag; const rect = p.rects[0]; - const row = if (p.settings.tag_bottom) rect.y + rect.h - pardes.BOX_H else rect.y; + const row = rect.y; for ([_]pardes.Mouse.Kind{ .press, .release }) |kind| p.update(.{ .mouse = .{ .button = .left, .kind = kind, .col = rect.x + pardes.TAG_TEXT_INSET + @as(u16, @intCast(col)), .row = row } }); try std.testing.expect(pane.focus == .tag); diff --git a/test/monkey9p.zig b/test/monkey9p.zig index f33c58f8..b3f53093 100644 --- a/test/monkey9p.zig +++ b/test/monkey9p.zig @@ -74,7 +74,7 @@ const builtins = [_][]const u8{ "Look", "Exec", "Kill", "Dump", "Msg", "NextColor", "Themes", "DumpThemes", "TreeContext", "PdfFit", "PdfTint", "PdfSections", "Petscii", "Palette", "Ascii", "Save", "New", "Newcol", "Del", "Filter", "Mode", "Togglettymode", "Edit", "Undo", "Redo", "Collapse", "Delcol", "DelAbove", "DelBelow", "Term", "Repl", "Joincol", "Config", "LocationsConfig", "Messages", "Mini", "Find", "Grep", "Left", - "Down", "Up", "Right", "Back", "Forward", "Last", "Recent", "Jumplist", "Colors", "Wrap", "Tagbottom", "Debug", "FocusTint", + "Down", "Up", "Right", "Back", "Forward", "Last", "Recent", "Jumplist", "Colors", "Wrap", "Debug", "FocusTint", "Verbose", "SyntaxBold", "InactiveDim", "DumpDir", "Theme", "Get", "Put", "Undo", "Redo", "Zerox", "Snarf", "Paste", "Cut", "Sort", "Font", "Local", }; diff --git a/test/output.zig b/test/output.zig index 31027cfc..70518de8 100644 --- a/test/output.zig +++ b/test/output.zig @@ -38,18 +38,15 @@ test "search tint survives wrapping and theme changes while selections remain au pane.file.?.output = .{ .from = .search }; var frame = std.heap.ArenaAllocator.init(std.testing.allocator); defer frame.deinit(); - for ([_]bool{ false, true }) |bottom| { - p.settings.tag_bottom = bottom; - for ([_]bool{ true, false, true }) |colors| { - p.settings.colors = colors; - const surface = try p.render(frame.allocator()); - var marked: usize = 0; - for (surface.cells) |cell| { - if (std.meta.eql(cell.style.bg, pardes.Color{ .rgb = p.theme().search_bg.? })) marked += 1; - } - try std.testing.expectEqual(@as(usize, if (colors) 3 else 0), marked); - _ = frame.reset(.retain_capacity); + for ([_]bool{ true, false, true }) |colors| { + p.settings.colors = colors; + const surface = try p.render(frame.allocator()); + var marked: usize = 0; + for (surface.cells) |cell| { + if (std.meta.eql(cell.style.bg, pardes.Color{ .rgb = p.theme().search_bg.? })) marked += 1; } + try std.testing.expectEqual(@as(usize, if (colors) 3 else 0), marked); + _ = frame.reset(.retain_capacity); } // The body changes immediately even when dark chrome is still fading. try std.testing.expect(p.executeBuiltinLine(0, "Theme daybreak")); diff --git a/test/panes.zig b/test/panes.zig index c1c2ef9b..45302b6f 100644 --- a/test/panes.zig +++ b/test/panes.zig @@ -32,45 +32,42 @@ const TagLayerTests = struct { } test "compact tag layers render and edit Unicode text beyond body column capacity" { - for ([_]bool{ false, true }) |bottom| { - const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 40, .rows = 16 }); - defer p.deinit(); - const pane = try p.setTestFile("body\n"); - p.settings.tag_bottom = bottom; - p.row_metrics = .{ .body_w = 10, .body_h = 20, .tagline_w = 5, .tagline_h = 10 }; - p.gpa.free(pane.file.?.path); - pane.file.?.path = try p.gpa.dupe(u8, "/x"); - try setTag(pane, " " ++ &@as([38]u8, @splat('a')) ++ "\t界 END"); - var frame = std.heap.ArenaAllocator.init(p.gpa); - defer frame.deinit(); - _ = try p.render(frame.allocator()); - const layer = try findLayer(p, .pane, 0); - const text = try pardes.tagline.tagText(p, frame.allocator(), pane); - const at = std.mem.indexOf(u8, text, "END").?; - const col = panes.File.displayWidth(text[0..at]); - try std.testing.expect(col > p.rects[0].w); - try std.testing.expect(col + 3 < layer.cols); - try std.testing.expectEqualStrings("E", layer.cells[col].grapheme()); - try std.testing.expectEqual(@as(u16, 0), pane.tag_scroll); - const x = @as(f32, @floatFromInt(layer.viewport.x)) * 10 + (@as(f32, @floatFromInt(col)) + 0.5) * 5; - var stale = mouse(layer, x, .press); - stale.tag_hit.?.serial +%= 1; - p.update(.{ .mouse = stale }); - try std.testing.expect(pane.focus == .body); - p.update(.{ .mouse = mouse(layer, x, .press) }); - p.update(.{ .mouse = mouse(layer, x, .release) }); - try std.testing.expect(pane.focus == .tag); - try std.testing.expectEqual(at, @as(usize, @intCast(pane.tag.cur_col))); - // A clicked tag is in normal mode: `i` types where it was clicked. - p.update(.{ .key = .{ .cp = 'i', .text = "i" } }); - p.update(.{ .key = .{ .cp = 'X', .text = "X" } }); - _ = try p.render(frame.allocator()); - const edited = try pardes.tagline.tagText(p, frame.allocator(), pane); - try std.testing.expect(std.mem.endsWith(u8, edited, "界 XEND")); - try std.testing.expectEqual(@as(u16, 0), pane.tag_scroll); - try std.testing.expectEqualStrings("body\n", pane.file.?.content); - p.update(.{ .key = .{ .cp = Key.escape } }); - } + const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 40, .rows = 16 }); + defer p.deinit(); + const pane = try p.setTestFile("body\n"); + p.row_metrics = .{ .body_w = 10, .body_h = 20, .tagline_w = 5, .tagline_h = 10 }; + p.gpa.free(pane.file.?.path); + pane.file.?.path = try p.gpa.dupe(u8, "/x"); + try setTag(pane, " " ++ &@as([38]u8, @splat('a')) ++ "\t界 END"); + var frame = std.heap.ArenaAllocator.init(p.gpa); + defer frame.deinit(); + _ = try p.render(frame.allocator()); + const layer = try findLayer(p, .pane, 0); + const text = try pardes.tagline.tagText(p, frame.allocator(), pane); + const at = std.mem.indexOf(u8, text, "END").?; + const col = panes.File.displayWidth(text[0..at]); + try std.testing.expect(col > p.rects[0].w); + try std.testing.expect(col + 3 < layer.cols); + try std.testing.expectEqualStrings("E", layer.cells[col].grapheme()); + try std.testing.expectEqual(@as(u16, 0), pane.tag_scroll); + const x = @as(f32, @floatFromInt(layer.viewport.x)) * 10 + (@as(f32, @floatFromInt(col)) + 0.5) * 5; + var stale = mouse(layer, x, .press); + stale.tag_hit.?.serial +%= 1; + p.update(.{ .mouse = stale }); + try std.testing.expect(pane.focus == .body); + p.update(.{ .mouse = mouse(layer, x, .press) }); + p.update(.{ .mouse = mouse(layer, x, .release) }); + try std.testing.expect(pane.focus == .tag); + try std.testing.expectEqual(at, @as(usize, @intCast(pane.tag.cur_col))); + // A clicked tag is in normal mode: `i` types where it was clicked. + p.update(.{ .key = .{ .cp = 'i', .text = "i" } }); + p.update(.{ .key = .{ .cp = 'X', .text = "X" } }); + _ = try p.render(frame.allocator()); + const edited = try pardes.tagline.tagText(p, frame.allocator(), pane); + try std.testing.expect(std.mem.endsWith(u8, edited, "界 XEND")); + try std.testing.expectEqual(@as(u16, 0), pane.tag_scroll); + try std.testing.expectEqualStrings("body\n", pane.file.?.content); + p.update(.{ .key = .{ .cp = Key.escape } }); } test "compact tag pointer keeps physical grips and adjacent header ownership" { @@ -838,22 +835,19 @@ const TagNameTintTests = struct { // A file pane's is test/behaviour/tags.zig's; a search pane's needs // results put in through fillResults. test "tag filename tint of a search pane excludes its directory and command" { - for ([_]bool{ false, true }) |bottom| { - const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 100, .rows = 24 }); - defer p.deinit(); - p.locations_config.layout = .@"inline"; - const pane = try p.setTestFile("body\n"); - p.gpa.free(pane.file.?.path); - pane.file.?.path = try p.gpa.dupe(u8, "/project/界file.zig"); - pane.file.?.revision += 1; - configure(p); - defer p.custom_theme = null; - p.settings.tag_bottom = bottom; - try panes.Output.fillResults(p, 0, "/project", .search, "tint", try p.gpa.dupe(u8, "no matches\n"), null); - const id = pane.search_pane.?; - p.update(.tick); - try std.testing.expect((try check(p, id, p.panes[id].?.file.?.path)) > 0); - } + const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 100, .rows = 24 }); + defer p.deinit(); + p.locations_config.layout = .@"inline"; + const pane = try p.setTestFile("body\n"); + p.gpa.free(pane.file.?.path); + pane.file.?.path = try p.gpa.dupe(u8, "/project/界file.zig"); + pane.file.?.revision += 1; + configure(p); + defer p.custom_theme = null; + try panes.Output.fillResults(p, 0, "/project", .search, "tint", try p.gpa.dupe(u8, "no matches\n"), null); + const id = pane.search_pane.?; + p.update(.tick); + try std.testing.expect((try check(p, id, p.panes[id].?.file.?.path)) > 0); } test "tag filename tint follows wrapped Unicode drafted names and yields to selection" { diff --git a/test/perf-baseline-gui-debug.json b/test/perf-baseline-gui-debug.json index ae800a39..e7f577bf 100644 --- a/test/perf-baseline-gui-debug.json +++ b/test/perf-baseline-gui-debug.json @@ -1 +1 @@ -{"harness":"de81ad6bc9756a40","build":{"compiler":"0.17.0","target":"x86_64-linux.5.10...7.2-gnu.2.38","cpu":"x86_64","driver_optimize":"fast","core_optimize":"debug","c_optimize":"fast","terminal_optimize":"safe","platform":"gui","grammars":"full","mupdf":true,"jpx":true,"tracy":false,"terminal_simd":true,"prebuilt_shaders":false},"cols":120,"rows":40,"reps":10,"only":"medium","fixtures":[{"name":"small","lines":1000,"cols":60,"bytes":62694},{"name":"medium","lines":50000,"cols":60,"bytes":3201944},{"name":"large","lines":300000,"cols":60,"bytes":19464444},{"name":"longline","lines":400,"cols":8000,"bytes":3200400}],"cells":[{"op":"open","fixture":"medium","min_us":2290,"med_us":2523,"p90_us":2642,"max_us":2642},{"op":"render","fixture":"medium","min_us":96,"med_us":97,"p90_us":99,"max_us":99},{"op":"key-down","fixture":"medium","min_us":104,"med_us":106,"p90_us":113,"max_us":113},{"op":"key-right","fixture":"medium","min_us":105,"med_us":107,"p90_us":111,"max_us":112},{"op":"page-down","fixture":"medium","min_us":104,"med_us":107,"p90_us":121,"max_us":125},{"op":"wheel","fixture":"medium","min_us":101,"med_us":104,"p90_us":105,"max_us":106},{"op":"edit-char","fixture":"medium","min_us":1023,"med_us":1293,"p90_us":1447,"max_us":1467},{"op":"edit-twin","fixture":"medium","min_us":1089,"med_us":1340,"p90_us":1418,"max_us":1441},{"op":"body-2m","fixture":"medium","min_us":5061,"med_us":8829,"p90_us":11118,"max_us":11667},{"op":"body-appends","fixture":"medium","min_us":149285,"med_us":210882,"p90_us":266047,"max_us":279235},{"op":"deep-sel","fixture":"medium","min_us":87,"med_us":90,"p90_us":96,"max_us":96}]} +{"harness":"1a1e0068d88dc7a7","build":{"compiler":"0.17.0","target":"x86_64-linux.5.10...7.2-gnu.2.38","cpu":"x86_64","driver_optimize":"fast","core_optimize":"debug","c_optimize":"fast","terminal_optimize":"safe","platform":"gui","grammars":"full","mupdf":true,"jpx":true,"tracy":false,"terminal_simd":true,"prebuilt_shaders":false},"cols":120,"rows":40,"reps":10,"only":"medium","fixtures":[{"name":"small","lines":1000,"cols":60,"bytes":62694},{"name":"medium","lines":50000,"cols":60,"bytes":3201944},{"name":"large","lines":300000,"cols":60,"bytes":19464444},{"name":"longline","lines":400,"cols":8000,"bytes":3200400}],"cells":[{"op":"open","fixture":"medium","min_us":2290,"med_us":2523,"p90_us":2642,"max_us":2642},{"op":"render","fixture":"medium","min_us":96,"med_us":97,"p90_us":99,"max_us":99},{"op":"key-down","fixture":"medium","min_us":104,"med_us":106,"p90_us":113,"max_us":113},{"op":"key-right","fixture":"medium","min_us":105,"med_us":107,"p90_us":111,"max_us":112},{"op":"page-down","fixture":"medium","min_us":104,"med_us":107,"p90_us":121,"max_us":125},{"op":"wheel","fixture":"medium","min_us":101,"med_us":104,"p90_us":105,"max_us":106},{"op":"edit-char","fixture":"medium","min_us":1023,"med_us":1293,"p90_us":1447,"max_us":1467},{"op":"edit-twin","fixture":"medium","min_us":1089,"med_us":1340,"p90_us":1418,"max_us":1441},{"op":"body-2m","fixture":"medium","min_us":5061,"med_us":8829,"p90_us":11118,"max_us":11667},{"op":"body-appends","fixture":"medium","min_us":149285,"med_us":210882,"p90_us":266047,"max_us":279235},{"op":"deep-sel","fixture":"medium","min_us":87,"med_us":90,"p90_us":96,"max_us":96}]} diff --git a/test/perf-baseline-tui-debug.json b/test/perf-baseline-tui-debug.json index b6c766e1..464ec4d9 100644 --- a/test/perf-baseline-tui-debug.json +++ b/test/perf-baseline-tui-debug.json @@ -1 +1 @@ -{"harness":"de81ad6bc9756a40","build":{"compiler":"0.17.0","target":"x86_64-linux.5.10...7.2-gnu.2.38","cpu":"x86_64","driver_optimize":"fast","core_optimize":"debug","c_optimize":"fast","terminal_optimize":"safe","platform":"tui","grammars":"full","mupdf":true,"jpx":true,"tracy":false,"terminal_simd":true,"prebuilt_shaders":false},"cols":120,"rows":40,"reps":10,"only":"medium","fixtures":[{"name":"small","lines":1000,"cols":60,"bytes":62694},{"name":"medium","lines":50000,"cols":60,"bytes":3201944},{"name":"large","lines":300000,"cols":60,"bytes":19464444},{"name":"longline","lines":400,"cols":8000,"bytes":3200400}],"cells":[{"op":"open","fixture":"medium","min_us":1820,"med_us":2128,"p90_us":2500,"max_us":3046},{"op":"render","fixture":"medium","min_us":90,"med_us":96,"p90_us":98,"max_us":101},{"op":"key-down","fixture":"medium","min_us":101,"med_us":103,"p90_us":105,"max_us":114},{"op":"key-right","fixture":"medium","min_us":101,"med_us":103,"p90_us":106,"max_us":112},{"op":"page-down","fixture":"medium","min_us":97,"med_us":102,"p90_us":103,"max_us":105},{"op":"wheel","fixture":"medium","min_us":97,"med_us":102,"p90_us":112,"max_us":160},{"op":"edit-char","fixture":"medium","min_us":838,"med_us":899,"p90_us":1129,"max_us":1167},{"op":"edit-twin","fixture":"medium","min_us":869,"med_us":1099,"p90_us":1321,"max_us":1393},{"op":"body-2m","fixture":"medium","min_us":4820,"med_us":8314,"p90_us":11931,"max_us":12182},{"op":"body-appends","fixture":"medium","min_us":125039,"med_us":170714,"p90_us":213376,"max_us":232728},{"op":"deep-sel","fixture":"medium","min_us":90,"med_us":92,"p90_us":96,"max_us":101}]} +{"harness":"1a1e0068d88dc7a7","build":{"compiler":"0.17.0","target":"x86_64-linux.5.10...7.2-gnu.2.38","cpu":"x86_64","driver_optimize":"fast","core_optimize":"debug","c_optimize":"fast","terminal_optimize":"safe","platform":"tui","grammars":"full","mupdf":true,"jpx":true,"tracy":false,"terminal_simd":true,"prebuilt_shaders":false},"cols":120,"rows":40,"reps":10,"only":"medium","fixtures":[{"name":"small","lines":1000,"cols":60,"bytes":62694},{"name":"medium","lines":50000,"cols":60,"bytes":3201944},{"name":"large","lines":300000,"cols":60,"bytes":19464444},{"name":"longline","lines":400,"cols":8000,"bytes":3200400}],"cells":[{"op":"open","fixture":"medium","min_us":1820,"med_us":2128,"p90_us":2500,"max_us":3046},{"op":"render","fixture":"medium","min_us":90,"med_us":96,"p90_us":98,"max_us":101},{"op":"key-down","fixture":"medium","min_us":101,"med_us":103,"p90_us":105,"max_us":114},{"op":"key-right","fixture":"medium","min_us":101,"med_us":103,"p90_us":106,"max_us":112},{"op":"page-down","fixture":"medium","min_us":97,"med_us":102,"p90_us":103,"max_us":105},{"op":"wheel","fixture":"medium","min_us":97,"med_us":102,"p90_us":112,"max_us":160},{"op":"edit-char","fixture":"medium","min_us":838,"med_us":899,"p90_us":1129,"max_us":1167},{"op":"edit-twin","fixture":"medium","min_us":869,"med_us":1099,"p90_us":1321,"max_us":1393},{"op":"body-2m","fixture":"medium","min_us":4820,"med_us":8314,"p90_us":11931,"max_us":12182},{"op":"body-appends","fixture":"medium","min_us":125039,"med_us":170714,"p90_us":213376,"max_us":232728},{"op":"deep-sel","fixture":"medium","min_us":90,"med_us":92,"p90_us":96,"max_us":101}]} diff --git a/test/perf.zig b/test/perf.zig index 0aa4cf91..236716ae 100644 --- a/test/perf.zig +++ b/test/perf.zig @@ -591,7 +591,7 @@ fn measure(op: Op, fx: Fixture, path: []const u8, expected_bytes: usize, reps: u const before = .{ .row = pane.body.cur_row, .col = pane.body.cur_col, .scroll = pane.scroll(), .len = pane.file.?.content.len }; const rect = core.rects[id]; const wheel_col = rect.x + pardes.config.GUTTER; - const wheel_row = if (core.settings.tag_bottom) rect.y else rect.y + pardes.BOX_H; + const wheel_row = rect.y + pardes.BOX_H; const t0 = nowNs(); switch (op) { .open => unreachable, @@ -770,7 +770,7 @@ fn checkTerminalTail(core: *pardes.Pardes, surface: *pardes.Surface, batch: usiz const pane = core.panes[0] orelse return error.MissingTerminal; const rect = core.rects[0]; const x = rect.x + pardes.config.GUTTER; - const y = (if (core.settings.tag_bottom) rect.y else rect.y + pardes.BOX_H) + pardes.panes.terminal.gridCursor(pane).y; + const y = rect.y + pardes.BOX_H + pardes.panes.terminal.gridCursor(pane).y; var expected_buffer: [32]u8 = undefined; const expected = try std.fmt.bufPrint(&expected_buffer, "TURN {d:0>10} READY", .{batch}); for (expected, 0..) |byte, col| { diff --git a/test/process/window.zig b/test/process/window.zig index 3d197c09..b7397fec 100644 --- a/test/process/window.zig +++ b/test/process/window.zig @@ -297,9 +297,6 @@ fn goldens(gpa: std.mem.Allocator, exe: [:0]const u8) !void { try f.write(f.at("/pane/{d}/ctl", .{notes_pane}), "Collapse\n"); try shot(&d, a, &results, keep, "09-collapsed-focus-tint", "latest.ppm"); try f.write(f.at("/pane/{d}/ctl", .{notes_pane}), "Collapse\n"); - try f.write("/ctl", "Tagbottom\n"); - try shot(&d, a, &results, keep, "10-tagbottom", "latest.ppm"); - try f.write("/ctl", "Tagbottom\n"); try f.write(f.at("/pane/{d}/tag", .{first}), " Second\nthird line of the tag"); try shot(&d, a, &results, keep, "12-multiline-tag", "latest.ppm"); try f.write(f.at("/pane/{d}/look", .{first}), root ++ "/ramp.ppm\n"); diff --git a/test/snapshots/tagbottom.golden b/test/snapshots/tagbottom.golden deleted file mode 100644 index 8cae6a7d..00000000 --- a/test/snapshots/tagbottom.golden +++ /dev/null @@ -1,235 +0,0 @@ -== snap boot grid=100x31 cursor=7,3 -| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Term Find Grep Joincol Delcol -| /tmp/pardes-snap/tagbottom/cwd/top.txt Save Term Collapse Del -| 1 aaa -| 2 bbb -| 3 ccc -| 4 ddd -| 5 eee -| 6 fff -| 7 ggg -| 8 hhh -| 9 iii -| 10 jjj -| 11 kkk -| 12 lll -| 13 mmm -| 14 nnn -| 15 ooo -| 16 ppp -| 17 qqq -| 18 rrr -| 19 sss -| 20 ttt -| 21 uuu -| 22 vvv -| 23 www -| 24 xxx -| 25 yyy -| 26 zzz -== snap on grid=100x31 cursor=7,2 -|2: 1 aaa -|3: 2 bbb -|4: 3 ccc -|5: 4 ddd -|6: 5 eee -|7: 6 fff -|8: 7 ggg -|9: 8 hhh -|10: 9 iii -|11: 10 jjj -|12: 11 kkk -|13: 12 lll -|14: 13 mmm -|15: 14 nnn -|16: 15 ooo -|17: 16 ppp -|18: 17 qqq -|19: 18 rrr -|20: 19 sss -|21: 20 ttt -|22: 21 uuu -|23: 22 vvv -|24: 23 www -|25: 24 xxx -|26: 25 yyy -|27: 26 zzz -|28: -|30: /tmp/pardes-snap/tagbottom/cwd/top.txt Save Term Collapse Del -== snap off grid=100x31 cursor=7,3 -|2: /tmp/pardes-snap/tagbottom/cwd/top.txt Save Term Collapse Del -|3: 1 aaa -|4: 2 bbb -|5: 3 ccc -|6: 4 ddd -|7: 5 eee -|8: 6 fff -|9: 7 ggg -|10: 8 hhh -|11: 9 iii -|12: 10 jjj -|13: 11 kkk -|14: 12 lll -|15: 13 mmm -|16: 14 nnn -|17: 15 ooo -|18: 16 ppp -|19: 17 qqq -|20: 18 rrr -|21: 19 sss -|22: 20 ttt -|23: 21 uuu -|24: 22 vvv -|25: 23 www -|26: 24 xxx -|27: 25 yyy -|28: 26 zzz -|30: -== snap tag-typed grid=100x31 cursor=74,30 -|2: 1 aaa -|3: 2 bbb -|4: 3 ccc -|5: 4 ddd -|6: 5 eee -|7: 6 fff -|8: 7 ggg -|9: 8 hhh -|10: 9 iii -|11: 10 jjj -|12: 11 kkk -|13: 12 lll -|14: 13 mmm -|15: 14 nnn -|16: 15 ooo -|17: 16 ppp -|18: 17 qqq -|19: 18 rrr -|20: 19 sss -|21: 20 ttt -|22: 21 uuu -|23: 22 vvv -|24: 23 www -|25: 24 xxx -|26: 25 yyy -|27: 26 zzz -|28: -|30: /tmp/pardes-snap/tagbottom/cwd/top.txt Save Term Collapse Del bottom.txt -== snap look-bottom-tag grid=100x31 cursor=7,16 -|15: /tmp/pardes-snap/tagbottom/cwd/top.txt Save Term Collapse Del bottom.txt -|16: 1 ZZONE -|17: 2 ZZTWO -|18: -|19: -|20: -|21: -|22: -|23: -|24: -|25: -|26: -|27: -|30: /tmp/pardes-snap/tagbottom/cwd/bottom.txt Save Term Collapse Del -== snap body-cursor grid=100x31 cursor=9,6 -== snap seam-noop grid=100x31 cursor=12,16 -== snap seam-dragged grid=100x31 cursor=12,12 -|11: /tmp/pardes-snap/tagbottom/cwd/top.txt Save Term Collapse Del bottom.txt -|12: 1 ZZONE -|13: 2 ZZTWO -|14: -|15: -|16: -|17: -== snap gutter-click grid=100x31 cursor=9,5 -|2: 2 bbb -|3: 3 ccc -|4: 4 ddd -|5: 5 eee -|6: 6 fff -|7: 7 ggg -|8: 8 hhh -|9: 9 iii -|10: 10 jjj -== snap search-prompt grid=100x31 cursor=5,21 -|20: /tmp/pardes-snap/tagbottom/cwd/bottom.txt Save Term Collapse Del -|21: /ZZ -|22: bottom.txt:1:1 ZZONE -|23: bottom.txt:2:1 ZZTWO -|30: ^ +Search 1/2 Del -== snap leader grid=100x31 cursor=9,13 -|12: 1 ZZONE SPC -|20: -|21: -|22: -|23: -|30: /tmp/pardes-snap/tagbottom/cwd/bottom.txt Save Term Collapse Del -== snap cut-down grid=100x31 cursor=7,5 -|2: 1 aaa -|3: 2 bbb -|4: 3 ccc -|5: 4 jj -|6: 5 kkk -|7: 6 lll -|8: 7 mmm -|9: 8 nnn -|10: 9 ooo -|11: */tmp/pardes-snap/tagbottom/cwd/top.txt Save Term Collapse Del bottom.txt -|12: 1 ZZONE -== file cut-buffer -aaa -bbb -ccc -jj -kkk -lll -mmm -nnn -ooo -ppp -qqq -rrr -sss -ttt -uuu -vvv -www -xxx -yyy -zzz -== end file -== snap del-bottom-tag grid=100x31 cursor=7,5 -|11: 10 ppp -|12: 11 qqq -|13: 12 rrr -|14: 13 sss -|15: 14 ttt -|16: 15 uuu -|17: 16 vvv -|18: 17 www -|19: 18 xxx -|20: 19 yyy -|21: 20 zzz -|30: /tmp/pardes-snap/tagbottom/cwd/top.txt Save Term Collapse Del bottom.txt -== snap off-again grid=100x31 cursor=7,6 -|2: /tmp/pardes-snap/tagbottom/cwd/top.txt Save Term Collapse Del bottom.txt -|3: 1 aaa -|4: 2 bbb -|5: 3 ccc -|6: 4 jj -|7: 5 kkk -|8: 6 lll -|9: 7 mmm -|10: 8 nnn -|11: 9 ooo -|12: 10 ppp -|13: 11 qqq -|14: 12 rrr -|15: 13 sss -|16: 14 ttt -|17: 15 uuu -|18: 16 vvv -|19: 17 www -|20: 18 xxx -|21: 19 yyy -|22: 20 zzz -|30: diff --git a/test/snapshots/tagbottom.snap b/test/snapshots/tagbottom.snap deleted file mode 100644 index 7ce0ae5a..00000000 --- a/test/snapshots/tagbottom.snap +++ /dev/null @@ -1,161 +0,0 @@ -# Tagbottom: every pane's tagline on its LAST row instead of its first, and the -# transient message row (prompts, messages, the SPC indicator) stepping up to -# the row just above it. One global bool, so the whole screen flips at once. -# -# The two things worth pinning here are not pixels. The first is that a click -# still lands where it looks like it lands: the Sel coordinate space is -# UNCHANGED (row 0 is the tag, the body starts at BOX_H) and the mouse maps a -# screen row into it, so a look or an execute on a bottom tagline acts on the -# word under the pointer instead of silently sweeping whatever body row shares -# that number. Every mouse assertion below is therefore a CONSEQUENCE — a pane -# appearing, a pane going away, a view scrolling by a counted number of rows — -# and not a picture of a highlight. The tagline-execute pair is what caught the -# bug this script exists for: before the tag row got its own arm in the -# execute/look press, both ran a blank body row and a golden recorded the -# no-op as if it had passed. -# The second is that turning it back off restores the top-tagline layout -# 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 -stable 700 20000 -snap boot -# SPC t b. The tag leaves row 1 for row 29, the body slides up one row, and -# the cursor goes with it (7,2 -> 7,1) because it is on the same file line. -key space t b -stable 700 15000 -snap on -# ...and straight back. This grid must equal `boot`'s, to the cell. -key space t b -stable 700 15000 -snap off -key space t b -stable 700 15000 -# CLICK the bottom tagline (col 50 of row 30, the pane's last row) and type -# into it. A clicked tag is insert mode, so the text lands as text, and the -# 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. -# 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 -key i -send \x20bottom.txt -stable 600 8000 -stable 400 5000 -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 @bottom.txt 31 -release right @bottom.txt 31 -wait 10000 ZZONE -stable 700 15000 -snap look-bottom-tag -# a body click in the UPPER pane: the cursor lands on the row under the -# pointer, counted from the pane's first row rather than from a tag that is no -# longer there. Row 6 is grid row 5, the fifth body row, file line 5. -press left 10 7 -release left 10 7 -stable 400 8000 -snap body-cursor -# No row of text is a resize handle: a click on the lower pane's FIRST row -# (grid 16, click row 17), where the seam used to be, is a click in its text, -# and both sizes stay. -press left 40 17 -release left 40 17 -motion 40 25 -stable 500 8000 -snap seam-noop -# A terminal has no rule between panes, so the grip resizes them, as acme's -# button moves a window: the lower pane's, on its tag at the bottom, dragged up -# to row 13. The upper pane keeps 10 rows, the lower grows to 19. Both -# taglines follow their own pane's bottom. -press left 1 31 -drag left 1 13 -release left 1 13 -motion 40 25 -stable 500 8000 -snap seam-dragged -# Scroll the upper pane's body down four rows and back up one, so the gutter -# click below has a scrolled view to count from. Not captured: the wheel arm of -# handleMouse is `hovered` plus scrollBy and contains no tag_bottom at all, and -# the body rendering under it is already pinned by `boot`, `on` and -# `body-cursor`. View ends at line 4. -wheel down 40 4 -wheel down 40 4 -wheel down 40 4 -wheel down 40 4 -wheel up 1 4 -stable 400 8000 -# a left click in the gutter scrolls UP to the clicked row, and the row it -# counts from is the BODY's first, not r.y + BOX_H. Row 4 is grid row 3, the -# third body row: two rows up, to line 2. Counted from the wrong end it would -# be one row up, to line 3. -press left 1 5 -release left 1 5 -stable 400 8000 -snap gutter-click -# `/` in the lower pane's body arms the search input. The prompt is CUT off the -# tagline and drawn on the message row with the cursor — and with Tagbottom the -# two are adjacent: the tail keeps its builtins on row 29 while `/ZZ` and the -# cursor sit on row 28, the last body row. The tagline under it stays whole — -# the prompt must not have eaten the row it was cut from. -press left 10 15 -release left 10 15 -stable 400 5000 -key / -send ZZ -stable 600 8000 -stable 400 5000 -snap search-prompt -key esc -settle 100 -stable 400 5000 -# the SPC leader indicator lives on that same message row, right-aligned -key space -stable 400 5000 -snap leader -key esc -settle 100 -stable 400 5000 -# THE INVERSION. Sweeping DOWN past the last body row is the ordinary "select -# to the end" gesture, and with the tag drawn BELOW the body it lands on the -# tagline — Sel row 0. Unclamped that drives the selection's far end to the TOP -# of Sel space: the highlight jumps ABOVE the anchor and a 1-2 Cut deletes lines -# nobody swept. Anchored on grid row 3 (file line 4) and dragged onto the upper -# pane's tag row, the sweep must cover lines 4..10 downward, not 2..4 upward. -press left 8 5 -drag left 8 12 -stable 400 5000 -# ...and the proof is the BUFFER, not the highlight: 1-2 Cut the sweep, save, -# and read the file back. aaa/bbb/ccc survive and kkk..zzz survive; unclamped -# this file lost bbb/ccc/ddd instead and kept eee onward. -press middle 8 12 -release middle 8 12 -release left 8 12 -stable 400 5000 -snap cut-down -key space f s -stable 700 15000 -snapfile cut-buffer /tmp/pardes-snap/tagbottom/cwd/top.txt -# EXECUTE `Del` on the lower pane's bottom tagline: the pane goes away and the -# upper one takes the whole column back. The middle button's half of the same -# tag mapping the look used above. -press middle @Del 31 -release middle @Del 31 -stable 700 15000 -snap del-bottom-tag -# and off again, one pane, its tagline back on row 1 with the body under it -key space t b -stable 700 15000 -snap off-again diff --git a/test/snapshots/tagbottomimage.golden b/test/snapshots/tagbottomimage.golden deleted file mode 100644 index aa94e8c4..00000000 --- a/test/snapshots/tagbottomimage.golden +++ /dev/null @@ -1,123 +0,0 @@ -== snap img-top grid=150x31 cursor=11,8 -| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Term Find Grep Joincol Delcol -| /tmp/pardes-snap/tagbottomimage/cwd Term+bash Save Mode Filter Collapse Del -| ls -| pic.ppm -| -| img petscii:on palette:commodore ascii:on /tmp/pardes-snap/tagbottomimage/cwd/pic.ppm Term Collapse Del -| 4*🬹~F~N🬰|G🬏▚Y~KF🬴s>T&zZ/🬻iTY=`S~╳bkZR37v🬦🬵d4QHZ8X▛▟ -| ^🬪🬛$}DrydNU&wsz=`*r🬒🬓🬳🬟*Y🬴G6🬧f🬮/>t🬧u🬲1Rg1t🬝🬻█ -| ▖#_{🬗X@🬢&$s'C%*=w@🬆▀wq%🬡d┼a┼m─>🬭🬜A▀A🬲H]p🬝🬹 -| %?WX🬕f🬩*TA8n╱┼E▘🬭Y#qo~XVE▐(╳▀H4^[mj🬗=🬒🬕▟█ -| ]Z🬷eb~Oyl3=SL▙a🬱🬉~MPMz}FMu<🬝▚>3&▖🬷WS🬝~█ -| EF-🬑y🬔!r🬙🬐╳O🬩▐%Qj─4za/?/\a🬜"🬖🬈🬛🬟A🬙🬝▄ -| 🬃N@xzOnczIK=t0@🬖j5🬮🬧65▟{🬮🬉🬄🬩zQ9/🬝🬻 -| ╲${&%@"#ctt▀Cr5F;🬐ARM╱uej╳75🬹9▛🬻 -| h^🬜"🬈🬨▜╲|W🬊🬦k6^🬰🬶rZ─▄\z9🬎🬉4^🬎🬻 -| 🬆f│Q_V🬗wGx🬱=5▛5*&V🬟🬄ZrXGz2🬝🬻█ -| !🬷W🬐(🬭]7x_>▗er🬯~▚di🬬4jY:🬝▟ -| gU~🬧3▙bjr\C#kKMpffAjps🬝🬻 -| *🬯G"🬣▟d🬮▀zJ🬪EHV▟╳9}y▛▄ -| ``))~RyJ🬴jA~w=hLpX🬝🬻█ -| 4x▀J"TG7=y-QZ🬙╲~▛🬻 -| 🬯/+╳f9ZG🬕+{QN_🬝🬹 -| E<'─🬫pS!"n4&🬝~ -| m$dx"!2🬳&{🬝🬻 -| *8f🬩▙Jb🬒🬝🬻█ -| m🬩7CiN🬎🬹 -| pG╲L🬝🬻 -| 🬡L🬝▄ -| 🬝~ -== snap img-bottom grid=150x31 cursor=11,8 -|2: ls -|3: pic.ppm -|4: -|5: /tmp/pardes-snap/tagbottomimage/cwd Term+bash Save Mode Filter Collapse Del -|6: Tagbottom -|7: {DbgY🬲s▜M^#▐FUJ[zNq=🬝g/y╱?V@🬱🬙▌UK╱🬍("🬕KJ8hSo🬝🬻 -|8: tX🬆s>🬌`🬵