From 806b33f8f256eb01213c20b5226686dbbb7785fa Mon Sep 17 00:00:00 2001 From: Tim Culverhouse Date: Wed, 20 Mar 2024 10:53:25 -0500 Subject: [PATCH] mouse: handle switch case '0' for left_click_count A state of '0' if a valid state for the mouse click. I'm unsure *how* we get a 0 within this branch but I was able to reliably trigger it while clicking and dragging. We handle the state explicitly because the `else` prong is `unreachable`. We only handle triple clicks, and in another function we reset to 3 if the count goes above that. Add an assert to confirm this is the case. --- src/Surface.zig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Surface.zig b/src/Surface.zig index a93d3c088..d916894c2 100644 --- a/src/Surface.zig +++ b/src/Surface.zig @@ -2580,8 +2580,10 @@ pub fn cursorPosCallback( // Convert to points const screen_point = pos_vp.toScreen(&self.io.terminal.screen); + assert(self.mouse.left_click_count <= 3); // Handle dragging depending on click count switch (self.mouse.left_click_count) { + 0 => {}, // 0 is a valid state but we don't do anything 1 => self.dragLeftClickSingle(screen_point, pos.x), 2 => self.dragLeftClickDouble(screen_point), 3 => self.dragLeftClickTriple(screen_point),