From 463f319643848b9361eef140497b5a166e3945e3 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Wed, 4 Nov 2026 23:31:13 -0300 Subject: update: what a Look's hover outlives (a tick, a batch of rows, a move with no button, a change to another pane) is one predicate, and cancelling it is written once, where six switch arms each wrote it Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- src/pardes.zig | 36 +++++++++++++----------------------- 1 file changed, 13 insertions(+), 23 deletions(-) diff --git a/src/pardes.zig b/src/pardes.zig index d63c7beb..f1a804fc 100644 --- a/src/pardes.zig +++ b/src/pardes.zig @@ -5677,29 +5677,19 @@ pub const Pardes = struct { for (p.panes) |slot| if (slot) |pane| { pane.msg_announcement = false; }; - switch (ev) { - // A batch of rows coming in is no gesture: a Look's hover stays. - .tick, .search => {}, - .mouse => |m| if (!(m.button == .none and m.kind == .motion)) { - p.raw_hover_intent = false; - look.cancelLookHover(p); - }, - .output => |o| if (look.lookHoverPane(p) == o.pane) { - p.raw_hover_intent = false; - look.cancelLookHover(p); - }, - .file_changed => |changed| if (look.lookHoverPane(p) == changed.pane) { - p.raw_hover_intent = false; - look.cancelLookHover(p); - }, - .pdf_scroll => |scroll| if (look.lookHoverPane(p) == scroll.pane) { - p.raw_hover_intent = false; - look.cancelLookHover(p); - }, - else => { - p.raw_hover_intent = false; - look.cancelLookHover(p); - }, + // A Look's hover outlives a tick, a batch of rows coming in (no + // gesture), a move with no button, and a change to another pane. + const hover_stays = switch (ev) { + .tick, .search => true, + .mouse => |m| m.button == .none and m.kind == .motion, + .output => |o| look.lookHoverPane(p) != o.pane, + .file_changed => |changed| look.lookHoverPane(p) != changed.pane, + .pdf_scroll => |scroll| look.lookHoverPane(p) != scroll.pane, + else => false, + }; + if (!hover_stays) { + p.raw_hover_intent = false; + look.cancelLookHover(p); } switch (ev) { .key, .mouse => { -- cgit v1.3