aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Arun Prakash Jana <engineerarun@gmail.com>2019-03-10 07:24:09 +0530
committerGravatar Arun Prakash Jana <engineerarun@gmail.com>2019-03-10 07:30:18 +0530
commitc609885763b45b7849f8157db58f010aff184b26 (patch)
treeca4dc21fca09575959f28f5a6b7c23def9e30f0f
parent4289f13c404cd339f82f80c1be1913efcbe2563b (diff)
downloadnnn-c609885763b45b7849f8157db58f010aff184b26.tar.gz
Special handling for editor
-rw-r--r--src/nnn.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/nnn.c b/src/nnn.c
index 790e66f..ec39df6 100644
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -197,6 +197,7 @@ disabledbg()
#define F_NOWAIT 0x02 /* don't wait for child process (e.g. file manager) */
#define F_NOTRACE 0x04 /* suppress stdout and strerr (no traces) */
#define F_SIGINT 0x08 /* restore default SIGINT handler */
+#define F_EDITOR 0x10 /* spawn the editor */
#define F_NORMAL 0x80 /* spawn child process in non-curses regular CLI mode */
/* CRC8 macros */
@@ -1022,9 +1023,11 @@ static void spawn(const char *file, const char *arg1, const char *arg2, const ch
DPRINTF_D(pid);
if (flag & F_NORMAL) {
refresh();
- exitcurses();
- fflush(stdout);
- initcurses();
+ if (flag & F_EDITOR) {
+ exitcurses();
+ fflush(stdout);
+ initcurses();
+ }
}
}
}
@@ -1068,7 +1071,7 @@ static bool quote_run_sh_cmd(const char *cmd, const char *arg, const char *path)
}
DPRINTF_S(g_buf);
- spawn("sh", "-c", g_buf, path, F_NORMAL);
+ spawn("sh", "-c", g_buf, path, F_NORMAL | F_EDITOR);
return TRUE;
}