mirror of
https://github.com/jarun/nnn.git
synced 2024-12-01 02:49:44 +00:00
checkpatch fix: refactor file path copy
This commit is contained in:
parent
2ae1cca96a
commit
5402e1201c
38
src/nnn.c
38
src/nnn.c
|
@ -3528,6 +3528,22 @@ nochange:
|
||||||
printmsg("selection on");
|
printmsg("selection on");
|
||||||
DPRINTF_S("selection on");
|
DPRINTF_S("selection on");
|
||||||
goto nochange;
|
goto nochange;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ncp) { /* Handle range selection */
|
||||||
|
#ifndef DIR_LIMITED_COPY
|
||||||
|
if (g_crc != crc8fast((uchar *)dents,
|
||||||
|
ndents * sizeof(struct entry))) {
|
||||||
|
cfg.copymode = 0;
|
||||||
|
printmsg("dir/content changed");
|
||||||
|
goto nochange;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
if (cur < copystartid) {
|
||||||
|
copyendid = copystartid;
|
||||||
|
copystartid = cur;
|
||||||
|
} else
|
||||||
|
copyendid = cur;
|
||||||
} // fallthrough
|
} // fallthrough
|
||||||
case SEL_COPYALL:
|
case SEL_COPYALL:
|
||||||
if (sel == SEL_COPYALL) {
|
if (sel == SEL_COPYALL) {
|
||||||
|
@ -3538,29 +3554,12 @@ nochange:
|
||||||
|
|
||||||
cfg.copymode = 0;
|
cfg.copymode = 0;
|
||||||
copybufpos = 0;
|
copybufpos = 0;
|
||||||
ncp = 0;
|
ncp = 0; /* Override single/multi path selection */
|
||||||
copystartid = 0;
|
copystartid = 0;
|
||||||
copyendid = ndents - 1;
|
copyendid = ndents - 1;
|
||||||
}
|
}
|
||||||
if (!ncp) { /* Handle range selection */
|
|
||||||
#ifndef DIR_LIMITED_COPY
|
|
||||||
if ((sel != SEL_COPYALL) && g_crc != crc8fast((uchar *)dents,
|
|
||||||
ndents * sizeof(struct entry))) {
|
|
||||||
cfg.copymode = 0;
|
|
||||||
printmsg("dir/content changed");
|
|
||||||
DPRINTF_S("dir/content changed");
|
|
||||||
goto nochange;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if (sel != SEL_COPYALL) {
|
|
||||||
if (cur < copystartid) {
|
|
||||||
copyendid = copystartid;
|
|
||||||
copystartid = cur;
|
|
||||||
} else
|
|
||||||
copyendid = cur;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (copystartid < copyendid || sel == SEL_COPYALL) {
|
if ((!ncp && copystartid < copyendid) || sel == SEL_COPYALL) {
|
||||||
for (r = copystartid; r <= copyendid; ++r)
|
for (r = copystartid; r <= copyendid; ++r)
|
||||||
if (!appendfpath(newpath, mkpath(path,
|
if (!appendfpath(newpath, mkpath(path,
|
||||||
dents[r].name, newpath)))
|
dents[r].name, newpath)))
|
||||||
|
@ -3569,7 +3568,6 @@ nochange:
|
||||||
mvprintw(LINES - 1, 0, "%d files selected\n",
|
mvprintw(LINES - 1, 0, "%d files selected\n",
|
||||||
copyendid - copystartid + 1);
|
copyendid - copystartid + 1);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (copybufpos) { /* File path(s) written to the buffer */
|
if (copybufpos) { /* File path(s) written to the buffer */
|
||||||
writecp(pcopybuf, copybufpos - 1); /* Truncate NULL from end */
|
writecp(pcopybuf, copybufpos - 1); /* Truncate NULL from end */
|
||||||
|
|
Loading…
Reference in a new issue