From 95f01124b30bd8ed7aa1a85658836890bcc4c228 Mon Sep 17 00:00:00 2001 From: Jakob Kaivo Date: Tue, 19 Apr 2022 20:59:44 -0400 Subject: reenable v command --- more.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/more.c b/more.c index aae4ad4..b9508ac 100644 --- a/more.c +++ b/more.c @@ -132,6 +132,7 @@ static int more_open(struct more_file *mf) static void more_close(struct more_file *mf) { + /* TODO: maybe save these ? */ if (mf->backing != mf->f) { fclose(mf->backing); } @@ -285,7 +286,7 @@ static void more_help(void) remove(path); } -static struct more_file more_invoke_editor(struct more_file *mf) +static void more_invoke_editor(struct more_file *mf) { extern char **environ; char *editor = getenv("EDITOR"); @@ -308,28 +309,21 @@ static struct more_file more_invoke_editor(struct more_file *mf) argv[2] = NULL; } - struct more_file ret = *mf; - def_prog_mode(); reset_shell_mode(); pid_t pid; if (posix_spawnp(&pid, editor, NULL, NULL, argv, environ) == 0) { - char *path = strdup(mf->path); size_t line = mf->topline; more_close(mf); - waitpid(pid, NULL, 0); - - //ret = more_open(path); - ret.topline = line; - free(path); + more_open(mf); + mf->topline = line; } else { - wprintw(more_status, "%s %s: %s\n", editor, mf->path, strerror(errno)); + wprintw(more_status, "%s %s: %s\n", editor, mf->path, + strerror(errno)); } reset_prog_mode(); - - return ret; } static struct more_file more_examine(struct more_file *mf) -- cgit v1.2.1