]> Sergey Matveev's repositories - nnn.git/commitdiff
Merge pull request #1571 from KlzXS/plugin_simplification
authorArun <engineerarun@gmail.com>
Sat, 28 Jan 2023 02:53:24 +0000 (08:23 +0530)
committerGitHub <noreply@github.com>
Sat, 28 Jan 2023 02:53:24 +0000 (08:23 +0530)
Simplify the command as plugin codepath

1  2 
src/nnn.c

diff --cc src/nnn.c
index 9818c347774b7d4cc973fb1b835dbac9d5be82d6,24e6d72d4bda69b17411658c0d27fb0be08c896c..6be52e3fe78c8bc10601bb4a2248be8b713c73cc
+++ b/src/nnn.c
@@@ -5188,17 -5172,19 +5188,19 @@@ static void run_cmd_as_plugin(const cha
                --len;
        }
  
-       if ((flags & F_PAGE) || (flags & F_NOTRACE)) {
-               if (is_suffix(g_buf, " $nnn"))
-                       g_buf[len - 5] = '\0';
-               else
-                       runfile = NULL;
+       /* This is to catch the old way of doing things so we don't break users' configs */
+       if ((flags & (F_PAGE | F_NOTRACE)) && is_suffix(g_buf, " $nnn")) {
+               g_buf[len - 5] = '\0';
  
                if (flags & F_PAGE)
 -                      get_output(g_buf, runfile, NULL, -1, TRUE, TRUE);
 +                      get_output(g_buf, runfile, NULL, -1, TRUE);
                else // F_NOTRACE
                        spawn(g_buf, runfile, NULL, NULL, flags);
-       } else
+       }
+       if (flags & F_PAGE)
+               get_output(utils[UTIL_SH_EXEC], g_buf, NULL, -1, TRUE);
+       else
                spawn(utils[UTIL_SH_EXEC], g_buf, NULL, NULL, flags);
  }