]> Sergey Matveev's repositories - nnn.git/commitdiff
Revert "Paging is achieved through shell command now"
authorArun Prakash Jana <engineerarun@gmail.com>
Sun, 15 Jan 2023 18:45:54 +0000 (00:15 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Sun, 15 Jan 2023 18:45:54 +0000 (00:15 +0530)
This reverts commit 243301603edb1bfc31087ee20fa6cf90bad8ff64.

nnn.1
plugins/README.md
src/nnn.c

diff --git a/nnn.1 b/nnn.1
index 983089c30ad1c3a0c45f1d06bc0d61232d346b62..7b736a25f82c787095e58fc78542af93cd6738f8 100644 (file)
--- a/nnn.1
+++ b/nnn.1
@@ -448,6 +448,7 @@ separated by \fI;\fR:
        add \fB|\fR (pipe) after \fB!\fR
        Note: This option is incompatible with \fB&\fR (terminal output is masked
        for GUI programs) and ignores \fB*\fR (output is already paged for user).
+       \fI$nnn\fR must be the last argument in this case as well.
 
         export NNN_PLUG='m:-!|mediainfo $nnn;t:-!|tree -ps;l:-!|ls -lah --group-directories-first'
 
index e0e0ddf5c591278a3ed1d96773a7d2484596819b..ca5af90bdd5d786125dc718e501e94abf763df0a 100644 (file)
@@ -180,6 +180,7 @@ export NNN_PLUG='m:-!|mediainfo $nnn;t:-!|tree -ps;l:-!|ls -lah --group-director
 ```
 
 This option is incompatible with `&` (terminal output is masked for GUI programs) and ignores `*` (output is already paged for user).
+`$nnn` must be the last argument in this case as well.
 
 Notes:
 
index 1c7dfe4c7095b399540fd3b1b58032198928ebcc..c70392bb47e998a65ecfcba41a4ae1541343c9bb 100644 (file)
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -5192,23 +5192,27 @@ static void setexports(void)
 
 static void run_cmd_as_plugin(const char *file, char *runfile, uchar_t flags)
 {
-       size_t len = xstrsncpy(g_buf, file, PATH_MAX) - 1;
+       size_t len;
+
+       xstrsncpy(g_buf, file, PATH_MAX);
 
+       len = xstrlen(g_buf);
        if (len > 1 && g_buf[len - 1] == '*') {
                flags &= ~F_CONFIRM; /* Skip user confirmation */
                g_buf[len - 1] = '\0'; /* Get rid of trailing no confirmation symbol */
                --len;
        }
 
-       if (flags & F_PAGE)
-               get_output(g_buf, NULL, NULL, -1, TRUE);
-       else if (flags & F_NOTRACE) {
+       if ((flags & F_PAGE) || (flags & F_NOTRACE)) {
                if (is_suffix(g_buf, " $nnn"))
                        g_buf[len - 5] = '\0';
                else
                        runfile = NULL;
 
-               spawn(g_buf, runfile, NULL, NULL, flags);
+               if (flags & F_PAGE)
+                       get_output(g_buf, runfile, NULL, -1, TRUE);
+               else // F_NOTRACE
+                       spawn(g_buf, runfile, NULL, NULL, flags);
        } else
                spawn(utils[UTIL_SH_EXEC], g_buf, NULL, NULL, flags);
 }