aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar 0xACE <0xACE@users.noreply.github.com>2020-05-05 14:32:42 +0200
committerGravatar GitHub <noreply@github.com>2020-05-05 18:02:42 +0530
commit65da1c19413008eedcd228bb9cbda416ca269aae (patch)
treea2e998c8a253236466a9a526feebeb740fb0c750
parentc9f0e279afbd28506b7104831826917b2d5cdc19 (diff)
downloadnnn-65da1c19413008eedcd228bb9cbda416ca269aae.tar.gz
Double click only works on same item (#555)
This patch disables accidental triggering of double clicking when you are just single clicking on multiple objects fast.
-rw-r--r--src/nnn.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/nnn.c b/src/nnn.c
index 789e80d..13d9815 100644
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -5190,6 +5190,7 @@ static bool browse(char *ipath, const char *session)
#ifndef NOMOUSE
MEVENT event;
struct timespec mousetimings[2] = {{.tv_sec = 0, .tv_nsec = 0}, {.tv_sec = 0, .tv_nsec = 0} };
+ int mousedent[2] = {-1, -1};
bool currentmouse = 1;
bool rightclicksel = 0;
#endif
@@ -5423,13 +5424,16 @@ nochange:
CLOCK_REALTIME,
#endif
&mousetimings[currentmouse]);
+ mousedent[currentmouse] = cur;
- /*Single click just selects, double click also opens */
- if (((_ABSSUB(mousetimings[0].tv_sec, mousetimings[1].tv_sec) << 30)
- + (mousetimings[0].tv_nsec - mousetimings[1].tv_nsec))
- > DOUBLECLICK_INTERVAL_NS)
+ /* Single click just selects, double click falls through to SEL_GOIN */
+ if ((mousedent[0] != mousedent[1]) ||
+ (((_ABSSUB(mousetimings[0].tv_sec, mousetimings[1].tv_sec) << 30)
+ + (_ABSSUB(mousetimings[0].tv_nsec, mousetimings[1].tv_nsec)))
+ > DOUBLECLICK_INTERVAL_NS))
break;
mousetimings[currentmouse].tv_sec = 0;
+ mousedent[currentmouse] = -1;
} else {
if (cfg.filtermode || filterset())
presel = FILTER;