From dfa5bd4d413504a6afff414962c4de70ab093af0 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 29 Sep 2026 22:21:56 -0300 Subject: A middle or right sweep over a column's or the workspace's tag runs or looks for what it swept, as a pane tag's does Both headers acted on the press: a middle or right press ran, or looked for, the word under it (or the header's selection when it was on that) at once, so a drag had nothing left to do. A sweep of `echo SWEPT` in a column tag ran a bare `echo`. They have done so since the headers were drawn apart from the panes; it is no regression, and the -l/Restore allocator fix (ompukopz) does not touch it. Now a press on a header holds a HeaderSweep (the column by its serial, or the workspace), which the drag extends, held to the header's row and text as a pane tag's sweep is. It is painted in its button's tint meanwhile, and the release runs what it swept in that header's context; a release that has not moved runs the word or selection a click always did. The other of middle and right cancels it (acme 2-3/3-2); the select button is inert, as a header's command already takes the held selection as its argument. Running on the release, a builtin from a header is announced as one from a pane tag is: the press used to set the announcement and the release clear it at once. find, restore, theme, topbarexec, ttyhelp, tutor and windowops re-recorded for that badge alone. headersweep.snap sweeps the column and workspace tags with the middle button and a word part with the right one, and cancels a sweep; headersweep-restored.snap sweeps both after Dump and Restore. Co-Authored-By: Claude Opus 5.5 --- src/draw.zig | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'src/draw.zig') diff --git a/src/draw.zig b/src/draw.zig index ad24153f..0ea0b35e 100644 --- a/src/draw.zig +++ b/src/draw.zig @@ -1109,8 +1109,9 @@ fn renderHeaderLayer(p: *Pardes, arena: std.mem.Allocator, layer: *pardes.Layer, // The word under the pointer, a Look or Exec target: on a header even // while it is edited, on a notice, and on the grid's copy of either // (joined from this); not on a column a carried column's pointer is - // aiming at a place over. - const hovered = p.pointer_inside and !(kind == .column and p.drag == .column_move); + // aiming at a place over; nor under a held middle or right sweep, + // which paints what it sweeps instead. + const hovered = p.pointer_inside and !(kind == .column and p.drag == .column_move) and p.header_sweep == null; if (hovered) { const tag_hit = p.pointer_tag_hit; const col: ?usize = if (tag_hit) |pointer| @@ -1141,6 +1142,27 @@ fn renderHeaderLayer(p: *Pardes, arena: std.mem.Allocator, layer: *pardes.Layer, const asking = if (p.panes[p.active]) |active| active.prompt != .none else false; if (!asking and t.cur_row == line + p.header_top and caret < columns) layer.cursor = .{ .x = @intCast(caret), .y = line, .bar = t.mode == .insert }; } + // A middle or right sweep held over this header, tinted by its + // button as a pane tag's is. + if (p.header_sweep) |sweep| if (sweep.column(p)) |column| { + const mine = switch (kind) { + .workspace => column == null, + .column => column == id, + .pane, .notice, .body => false, + }; + const swept = sweep.span(text.len); + const start = modal.lineStartOffset(text, index + top); + const end = start + shown.len; + if (mine and swept.lo < swept.hi and swept.hi > start and swept.lo < end) { + const button = @intFromEnum(sweep.button); + var col = panes.File.rawDisplayCol(shown, @max(swept.lo, start) - start) -| scroll; + const stop = panes.File.rawDisplayCol(shown, @min(swept.hi, end) - start) -| scroll; + while (col < stop and col < columns) : (col += 1) { + surface.at(@intCast(col), 0).style.bg = .{ .rgb = body_layer.buttonTints(p.theme())[button] }; + surface.at(@intCast(col), 0).style.fg = .{ .rgb = body_layer.buttonInks(p.theme())[button] }; + } + } + } else |_| {}; } } -- cgit v1.3