mirror of
https://github.com/jarun/nnn.git
synced 2025-01-05 23:54:17 +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)
|
||||
{
|
||||
|
||||
|
@ -1533,10 +1541,9 @@ static void invertselbuf(char *path, bool toggle)
|
|||
if (len > 1)
|
||||
--len;
|
||||
path[len] = '\0';
|
||||
}
|
||||
|
||||
nselected ? writesel(pselbuf, selbufpos - 1) : writesel(NULL, 0);
|
||||
} else
|
||||
writesel(NULL, 0);
|
||||
nselected ? writesel(pselbuf, selbufpos - 1) : clearselection();
|
||||
}
|
||||
|
||||
static void addtoselbuf(char *path, int startid, int endid)
|
||||
|
@ -1626,14 +1633,6 @@ static void endselection(void)
|
|||
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 */
|
||||
static int editselection(void)
|
||||
{
|
||||
|
@ -6858,9 +6857,6 @@ nochange:
|
|||
if (cfg.x11)
|
||||
plugscript(utils[UTIL_CBCP], F_NOWAIT | F_NOTRACE);
|
||||
#endif
|
||||
|
||||
if (!nselected)
|
||||
unlink(selpath);
|
||||
#ifndef NOMOUSE
|
||||
if (rightclicksel)
|
||||
rightclicksel = 0;
|
||||
|
|
Loading…
Reference in a new issue