diff options
| -rw-r--r-- | more.c | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -95,7 +95,7 @@ static struct more_file more_invoke_editor(struct more_file *mf) } char line[64]; - snprintf(line, sizeof(line), "%zd", mf->topline); + snprintf(line, sizeof(line), "%zd", mf->topline + 1); char *argv[] = { editor, "-c", line, mf->path, NULL }; char *base = editor; @@ -116,11 +116,18 @@ static struct more_file more_invoke_editor(struct more_file *mf) 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); + } else { + wprintw(more_status, "%s %s: %s\n", editor, mf->path, strerror(errno)); } + reset_prog_mode(); return ret; @@ -314,7 +321,7 @@ static int more(const char *path) break; case 'v': - more_invoke_editor(&mf); + mf = more_invoke_editor(&mf); break; case '=': |
