1
0
Fork 0
mirror of https://github.com/jarun/nnn.git synced 2025-04-02 11:36:33 +00:00

Double click only works on same item ()

This patch disables accidental triggering of double clicking when you
are just single clicking on multiple objects fast.
This commit is contained in:
0xACE 2020-05-05 14:32:42 +02:00 committed by GitHub
parent c9f0e279af
commit 65da1c1941
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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;