mirror of
https://github.com/jarun/nnn.git
synced 2024-11-28 05:41:31 +00:00
Fix #996: select all on 'A' with empty selection
This commit is contained in:
parent
e4c3f7d739
commit
466d138cc7
13
src/nnn.c
13
src/nnn.c
|
@ -1476,11 +1476,7 @@ static void invertselbuf(char *path, bool toggle)
|
|||
{
|
||||
selbufpos = lastappendpos;
|
||||
|
||||
if (!nselected) {
|
||||
writesel(NULL, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (toggle || nselected) {
|
||||
size_t len = appendslash(path);
|
||||
|
||||
for (int i = 0; i < ndents; ++i) {
|
||||
|
@ -1490,14 +1486,17 @@ static void invertselbuf(char *path, bool toggle)
|
|||
}
|
||||
|
||||
if (pdents[i].flags & FILE_SELECTED)
|
||||
appendfpath(path, len + xstrsncpy(path + len, pdents[i].name, PATH_MAX - len));
|
||||
appendfpath(path,
|
||||
len + xstrsncpy(path + len, pdents[i].name, PATH_MAX - len));
|
||||
}
|
||||
|
||||
if (len > 1)
|
||||
--len;
|
||||
path[len] = '\0';
|
||||
|
||||
writesel(pselbuf, selbufpos - 1); /* Truncate NULL from end */
|
||||
nselected ? writesel(pselbuf, selbufpos - 1) : writesel(NULL, 0);
|
||||
} else
|
||||
writesel(NULL, 0);
|
||||
}
|
||||
|
||||
static void addtoselbuf(char *path, int startid, int endid)
|
||||
|
|
Loading…
Reference in a new issue