summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-04 23:31:13 -0300
committerGabriel Schneider <[email protected]>2026-11-05 01:00:59 -0300
commit463f319643848b9361eef140497b5a166e3945e3 (patch)
treecbaf6a8bbc4192d2c0a6c2b9252c799c11ac0537 /src
parent43739b4eb99f2b68ec2368e6ec69491b2d9ab0b4 (diff)
downloadpardes-463f319643848b9361eef140497b5a166e3945e3.tar.gz
pardes-463f319643848b9361eef140497b5a166e3945e3.zip
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 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src')
-rw-r--r--src/pardes.zig36
1 files 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 => {