summaryrefslogtreecommitdiff
path: root/src/mouse.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-05 20:47:45 -0300
committerGabriel Schneider <[email protected]>2026-11-05 22:07:55 -0300
commit80d47cd246f37356fd2e705495936f6546613e29 (patch)
treec9b8025faa82717c9cc51d98dd4ce774dc0fad13 /src/mouse.zig
parent4c3dbce20f11204f6d4bfb715239beae74259e7f (diff)
downloadpardes-80d47cd246f37356fd2e705495936f6546613e29.tar.gz
pardes-80d47cd246f37356fd2e705495936f6546613e29.zip
fields #39, a header's focus is one optional union: header_focus and header_column, of which (false, some column) never happened, are the session's header: ?Header, workspace or column, and p.headerColumn() the column whose tag has the keyboard (null for none or the workspace's); tagline.enterHeader and exitHeader set it in one write each, layout.reorderColumn moves the focused column's index in place, and the reads in 17 files say p.header != null where they said header_focus; views.zig's per-view fields name header; a dump written before this change loads it as the default once: an Upgrade or Restore from it comes back with the keyboard on a pane, not a header, and the wire's semantics change; gates on tui: core-test 960/960, behaviour-test 238/238, pane-test 171/172 (1 skipped), snap all 108 scripts ok; gui unit-test 1518/1519 (1 skipped)
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/mouse.zig')
-rw-r--r--src/mouse.zig8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/mouse.zig b/src/mouse.zig
index 56a1b378..02f966bd 100644
--- a/src/mouse.zig
+++ b/src/mouse.zig
@@ -100,7 +100,7 @@ pub const HeaderSweep = struct {
fn headerPoint(p: *Pardes, column: ?usize, mcol: u16, mrow: u16, clamp: bool) ?struct { t: *panes.Text, text: []const u8, line: u16, at: usize } {
const t = if (column) |c| &p.col_tags[c] else &p.global_tag;
const x = if (column) |c| p.col_x[c] + TAG_TEXT_INSET else TAG_TEXT_INSET;
- const focused = p.header_focus and p.header_column == column;
+ const focused = p.header != null and p.headerColumn() == column;
const text = edit.flatSurface(p, t) catch return null;
const base = if (column != null) p.topBarHeight() else 0;
const rows = if (column != null) layout.columnBarHeight(p) else p.topBarHeight();
@@ -128,7 +128,7 @@ fn headerSweepRun(p: *Pardes, sweep: HeaderSweep) void {
const start = modal.lineStartOffset(text, line);
const bar = modal.lineSlice(text, line);
const at = swept.lo - start;
- const focused = p.header_focus and p.header_column == column;
+ const focused = p.header != null and p.headerColumn() == column;
const on = if (focused) tagline.headerSelection(t, text, line) else null;
const under = if (tagline.wordBoundsAtCol(bar, at)) |b| bar[b.lo..b.hi] else "";
break :click if (on) |sp| (if (at >= sp.lo and at < sp.hi) bar[sp.lo..sp.hi] else under) else under;
@@ -609,7 +609,7 @@ pub fn handleMouse(p: *Pardes, event: Mouse) void {
}
// Held to the focused header's rows and text; the anchor stays
// where the press put it.
- const point = headerPoint(p, p.header_column, mcol, mrow, true) orelse return;
+ const point = headerPoint(p, p.headerColumn(), mcol, mrow, true) orelse return;
const t = point.t;
t.cur_row = point.line;
t.cur_col = @intCast(point.at - modal.lineStartOffset(point.text, point.line));
@@ -643,7 +643,7 @@ pub fn handleMouse(p: *Pardes, event: Mouse) void {
const t = point.t;
const at = point.at - modal.lineStartOffset(point.text, point.line);
// A clicked header starts in normal mode, as a clicked tag does.
- if (!(p.header_focus and p.header_column == column)) tagline.enterHeader(p, column);
+ if (!(p.header != null and p.headerColumn() == column)) tagline.enterHeader(p, column);
t.mode = .normal;
t.cur_row = point.line;
t.cur_col = @intCast(at);