mirror of
https://github.com/jarun/nnn.git
synced 2024-11-24 11:51:27 +00:00
Sync file paths correctly for clipboard copy
This commit is contained in:
parent
e723666256
commit
5a46b8fb25
32
src/nnn.c
32
src/nnn.c
|
@ -4864,27 +4864,35 @@ nochange:
|
||||||
if (rangesel)
|
if (rangesel)
|
||||||
rangesel = FALSE;
|
rangesel = FALSE;
|
||||||
|
|
||||||
/* Write the path to selection file to avoid flush */
|
/* Toggle selection status */
|
||||||
if (!(dents[cur].flags & FILE_SELECTED)) {
|
dents[cur].flags ^= FILE_SELECTED;
|
||||||
|
|
||||||
|
if (dents[cur].flags & FILE_SELECTED) {
|
||||||
|
++nselected;
|
||||||
utmp = selbufpos;
|
utmp = selbufpos;
|
||||||
selbufpos = lastappendpos;
|
selbufpos = lastappendpos;
|
||||||
appendfpath(newpath, mkpath(path, dents[cur].name, newpath));
|
appendfpath(newpath, mkpath(path, dents[cur].name, newpath));
|
||||||
writesel(pselbuf, selbufpos - 1); /* Truncate NULL from end */
|
writesel(pselbuf, selbufpos - 1); /* Truncate NULL from end */
|
||||||
if (cfg.x11)
|
|
||||||
plugscript(utils[UTIL_CBCP], newpath, F_NOWAIT | F_NOTRACE);
|
|
||||||
lastappendpos = selbufpos;
|
lastappendpos = selbufpos;
|
||||||
selbufpos = utmp;
|
selbufpos = utmp;
|
||||||
}
|
} else {
|
||||||
|
--nselected;
|
||||||
/* Toggle selection status */
|
if (nselected) {
|
||||||
dents[cur].flags ^= FILE_SELECTED;
|
utmp = selbufpos;
|
||||||
(dents[cur].flags & FILE_SELECTED) ? ++nselected : --nselected;
|
updateselbuf(path, newpath);
|
||||||
|
writesel(pselbuf, selbufpos - 1); /* Truncate NULL from end */
|
||||||
if (!nselected) {
|
lastappendpos = selbufpos;
|
||||||
|
selbufpos = utmp;
|
||||||
|
} else
|
||||||
writesel(NULL, 0);
|
writesel(NULL, 0);
|
||||||
unlink(g_selpath);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (cfg.x11)
|
||||||
|
plugscript(utils[UTIL_CBCP], newpath, F_NOWAIT | F_NOTRACE);
|
||||||
|
|
||||||
|
if (!nselected)
|
||||||
|
unlink(g_selpath);
|
||||||
|
|
||||||
/* move cursor to the next entry if this is not the last entry */
|
/* move cursor to the next entry if this is not the last entry */
|
||||||
if (!cfg.picker && cur != ndents - 1)
|
if (!cfg.picker && cur != ndents - 1)
|
||||||
move_cursor((cur + 1) % ndents, 0);
|
move_cursor((cur + 1) % ndents, 0);
|
||||||
|
|
Loading…
Reference in a new issue