nnn.c | 23 +++-------------------- diff --git a/nnn.c b/nnn.c index bcba125199dc21939ee4f8305e10ad38801a0eee..0e630818578ccc5cf47e91d18aa5d25c57e417ef 100644 --- a/nnn.c +++ b/nnn.c @@ -2520,7 +2520,7 @@ * open text in EDITOR */ if (editor) { if (getmime(dents[cur].name)) { - spawn(editor, newpath, NULL, NULL, F_NORMAL); + spawn(editor, newpath, NULL, path, F_NORMAL); continue; } @@ -2531,7 +2531,7 @@ if (get_output(g_buf, MAX_CMD_LEN, "file", "-bi", newpath, 0) == NULL) continue; if (strstr(g_buf, "text/") == g_buf) { - spawn(editor, newpath, NULL, NULL, F_NORMAL); + spawn(editor, newpath, NULL, path, F_NORMAL); continue; } } @@ -3150,24 +3150,7 @@ printmsg("vidir missing"); goto nochange; } - /* Save the program start dir */ - tmp = getcwd(newpath, PATH_MAX); - if (tmp == NULL) { - printwarn(); - goto nochange; - } - - /* Switch to current path for readline(3) */ - if (chdir(path) == -1) { - printwarn(); - goto nochange; - } - - spawn(utils[VIDIR], ".", NULL, NULL, F_NORMAL); - - /* Change back to program start dir */ - if (chdir(newpath) == -1) - printwarn(); + spawn(utils[VIDIR], ".", NULL, path, F_NORMAL); /* Save current */ if (ndents > 0)