From c5e09df466a40023fd4cdf0980c79ca071ea8792 Mon Sep 17 00:00:00 2001 From: huwwa Date: Sun, 14 Jun 2026 00:13:54 +0300 Subject: [PATCH] fix target window selection logic for next-error --- modes/shell.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/modes/shell.c b/modes/shell.c index 6ca2882..d65e7a0 100644 --- a/modes/shell.c +++ b/modes/shell.c @@ -4099,14 +4099,15 @@ static void do_next_error(EditState *s, int arg, int dir) edit_close(&e); } - /* find a window showing the error source buffer, - split a new one if none is found */ - if ((e = eb_find_window(b, NULL)) == NULL && qs->shell_command_other_window) { - e = shell_target_window(s, b); - - /* if there is only one window whoing the error source buffer + /* find a window showing the error source + buffer, split a new one if none is found */ + e = eb_find_window(b, NULL); + if (qs->shell_command_other_window) { + if (e == NULL) + e = shell_target_window(s, b); + /* if there is only one window showing the error source buffer then find or split a new window to find the file in */ - if (e == s && (s = get_next_window(s, WF_MINIBUF | WF_HIDDEN, 0)) == NULL) + if (e == s && !(s = get_next_window(s, WF_MINIBUF | WF_HIDDEN, 0))) s = shell_target_window(e, b); }