]> Sergey Matveev's repositories - nnn.git/commitdiff
Revert searching for a leading space
authorKlzXS <klzx@klzx.cf>
Fri, 22 Oct 2021 18:27:12 +0000 (20:27 +0200)
committerKlzXS <klzx@klzx.cf>
Fri, 22 Oct 2021 18:28:33 +0000 (20:28 +0200)
%j and %J will be replaced by a file path. File paths should be quoted to ensure proper interpretation by the shell

src/nnn.c

index c66ced4a2449061c6b2677adcf10f8f8a5df149a..8d8cd40434d74949f3f66e0e01eea3c1d5cc42be 100644 (file)
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -5379,9 +5379,8 @@ static bool prompt_run(void)
 
                cnt_j = 0;
                next = cmdline;
-               while ((next = strstr(next, " %j"))) {
+               while ((next = strstr(next, "%j"))) {
                        ++cnt_j;
-                       ++next; // skip the space we don't need it
 
                        // replace %j with {} for xargs later
                        next[0] = '{';
@@ -5392,9 +5391,8 @@ static bool prompt_run(void)
 
                cnt_J = 0;
                next = cmdline;
-               while (!cnt_j && (next = strstr(next, " %J"))) {
+               while (!cnt_j && (next = strstr(next, "%J"))) {
                        ++cnt_J;
-                       ++next; // skip the space we don't need it
 
                        tmplen = xstrsncpy(tmpcmd, cmdline, next - cmdline + 1) - 1;
                        tmplen += xstrsncpy(tmpcmd + tmplen, "${0} ${@}", sizeof("${0} ${@}"));