Fix #1098: clear selmode on last deselect

This commit is contained in:
Arun Prakash Jana 2021-07-06 23:25:49 +05:30
parent 1269dd2695
commit facdc5fdeb
No known key found for this signature in database
GPG Key ID: A75979F35C080412
1 changed files with 10 additions and 14 deletions

View File

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