mirror of
https://github.com/jarun/nnn.git
synced 2025-01-22 08:46:38 +00:00
Fix #1098: clear selmode on last deselect
This commit is contained in:
parent
1269dd2695
commit
facdc5fdeb
24
src/nnn.c
24
src/nnn.c
|
@ -1498,6 +1498,14 @@ static void startselection(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void clearselection(void)
|
||||||
|
{
|
||||||
|
nselected = 0;
|
||||||
|
selbufpos = 0;
|
||||||
|
g_state.selmode = 0;
|
||||||
|
writesel(NULL, 0);
|
||||||
|
}
|
||||||
|
|
||||||
static size_t appendslash(char *path)
|
static size_t appendslash(char *path)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -1533,10 +1541,9 @@ static void invertselbuf(char *path, bool toggle)
|
||||||
if (len > 1)
|
if (len > 1)
|
||||||
--len;
|
--len;
|
||||||
path[len] = '\0';
|
path[len] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
nselected ? writesel(pselbuf, selbufpos - 1) : writesel(NULL, 0);
|
nselected ? writesel(pselbuf, selbufpos - 1) : clearselection();
|
||||||
} else
|
|
||||||
writesel(NULL, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void addtoselbuf(char *path, int startid, int endid)
|
static void addtoselbuf(char *path, int startid, int endid)
|
||||||
|
@ -1626,14 +1633,6 @@ static void endselection(void)
|
||||||
writesel(pselbuf, selbufpos - 1);
|
writesel(pselbuf, selbufpos - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void clearselection(void)
|
|
||||||
{
|
|
||||||
nselected = 0;
|
|
||||||
selbufpos = 0;
|
|
||||||
g_state.selmode = 0;
|
|
||||||
writesel(NULL, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Returns: 1 - success, 0 - none selected, -1 - other failure */
|
/* Returns: 1 - success, 0 - none selected, -1 - other failure */
|
||||||
static int editselection(void)
|
static int editselection(void)
|
||||||
{
|
{
|
||||||
|
@ -6858,9 +6857,6 @@ nochange:
|
||||||
if (cfg.x11)
|
if (cfg.x11)
|
||||||
plugscript(utils[UTIL_CBCP], F_NOWAIT | F_NOTRACE);
|
plugscript(utils[UTIL_CBCP], F_NOWAIT | F_NOTRACE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!nselected)
|
|
||||||
unlink(selpath);
|
|
||||||
#ifndef NOMOUSE
|
#ifndef NOMOUSE
|
||||||
if (rightclicksel)
|
if (rightclicksel)
|
||||||
rightclicksel = 0;
|
rightclicksel = 0;
|
||||||
|
|
Loading…
Reference in a new issue