diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-05 22:27:44 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-05 23:58:31 -0300 |
| commit | f930d53c58187381b2f0df6892546ac1c217c9db (patch) | |
| tree | 5ca1eea4698b3c14178d2b1ae5d0251c0b884543 /src/mouse.zig | |
| parent | 71e5a0f4a8685b385fac762995d45575b638179f (diff) | |
| download | pardes-f930d53c58187381b2f0df6892546ac1c217c9db.tar.gz pardes-f930d53c58187381b2f0df6892546ac1c217c9db.zip | |
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 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/mouse.zig')
| -rw-r--r-- | src/mouse.zig | 34 |
1 files changed, 14 insertions, 20 deletions
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 } }); } |
