diff options
Diffstat (limited to 'src/mouse.zig')
| -rw-r--r-- | src/mouse.zig | 8 |
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); |
