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.
This commit is contained in:
Tim Culverhouse
2024-03-20 10:53:25 -05:00
parent 5dc7384d57
commit 806b33f8f2

View File

@ -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),