From 44aa8fef20214af9fd106d225d56f61bc4fed061 Mon Sep 17 00:00:00 2001 From: Thomas Koutcher Date: Tue, 2 Apr 2024 21:30:26 +0200 Subject: [PATCH 1/2] Fix keybind with +[cmd] not triggering view refreshing Fixes #1323 --- src/display.c | 11 ++++------- src/view.c | 1 - 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/display.c b/src/display.c index eb252674a..53c4d7443 100644 --- a/src/display.c +++ b/src/display.c @@ -73,16 +73,13 @@ open_external_viewer(const char *argv[], const char *dir, bool silent, bool conf bool ok; if (echo) { + struct io io; char buf[SIZEOF_STR] = ""; - io_run_buf(argv, buf, sizeof(buf), dir, false); - if (*buf) { + ok = io_exec(&io, IO_RD, dir, NULL, argv, IO_RD_WITH_STDERR) && io_read_buf(&io, buf, sizeof(buf), true); + if (*buf) report("%s", buf); - return true; - } else { - report("No output"); - return false; - } + } else if (silent || is_script_executing()) { ok = io_run_bg(argv, dir); diff --git a/src/view.c b/src/view.c index 6e419fae0..2112fe088 100644 --- a/src/view.c +++ b/src/view.c @@ -853,7 +853,6 @@ load_view(struct view *view, struct view *prev, enum open_flags flags) /* Do not clear the position if it is the first view. */ if (view->prev && !(flags & (OPEN_RELOAD | OPEN_REFRESH))) clear_position(&view->prev_pos); - report_clear(); } else if (view_is_displayed(view)) { redraw_view(view); report_clear(); From 1b31e053eb17938592bce98b3955b976629e3100 Mon Sep 17 00:00:00 2001 From: Thomas Koutcher Date: Thu, 4 Apr 2024 19:05:18 +0200 Subject: [PATCH 2/2] fixup! Fix keybind with +[cmd] not triggering view refreshing --- src/view.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/view.c b/src/view.c index 2112fe088..3944e5f3e 100644 --- a/src/view.c +++ b/src/view.c @@ -851,8 +851,10 @@ load_view(struct view *view, struct view *prev, enum open_flags flags) * the screen. */ werase(view->win); /* Do not clear the position if it is the first view. */ - if (view->prev && !(flags & (OPEN_RELOAD | OPEN_REFRESH))) + if (view->prev && !(flags & (OPEN_RELOAD | OPEN_REFRESH))) { clear_position(&view->prev_pos); + report_clear(); + } } else if (view_is_displayed(view)) { redraw_view(view); report_clear();