diff options
| author | Junegunn Choi <junegunn.c@gmail.com> | 2023-01-03 01:21:40 +0900 |
|---|---|---|
| committer | Junegunn Choi <junegunn.c@gmail.com> | 2023-01-03 01:21:40 +0900 |
| commit | a893fc0ca2d5c205c394e8f149b48e8f2007d181 (patch) | |
| tree | 5d8511b25b420397f25eb678c002c962ab450e99 /src/tui/light.go | |
| parent | 3761dc0433edc32ea890ac57c383ea2dfda32b1b (diff) | |
| download | fzf-a893fc0ca2d5c205c394e8f149b48e8f2007d181.tar.gz | |
Clicks with different x coordinates shouldn't be seen as a double-click
Diffstat (limited to 'src/tui/light.go')
| -rw-r--r-- | src/tui/light.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/tui/light.go b/src/tui/light.go index 7745efd9..ec5cf334 100644 --- a/src/tui/light.go +++ b/src/tui/light.go @@ -72,7 +72,7 @@ type LightRenderer struct { forceBlack bool clearOnExit bool prevDownTime time.Time - clickY []int + clicks [][2]int ttyin *os.File buffer []byte origState *term.State @@ -580,15 +580,15 @@ func (r *LightRenderer) mouseSequence(sz *int) Event { if down && !drag { now := time.Now() if !left { // Right double click is not allowed - r.clickY = []int{} + r.clicks = [][2]int{} } else if now.Sub(r.prevDownTime) < doubleClickDuration { - r.clickY = append(r.clickY, y) + r.clicks = append(r.clicks, [2]int{x, y}) } else { - r.clickY = []int{y} + r.clicks = [][2]int{{x, y}} } r.prevDownTime = now } else { - if len(r.clickY) > 1 && r.clickY[0] == r.clickY[1] && + if len(r.clicks) > 1 && r.clicks[0][0] == r.clicks[1][0] && r.clicks[0][1] == r.clicks[1][1] && time.Since(r.prevDownTime) < doubleClickDuration { double = true } |
