fix(help): :help can focus unfocusable/hide window #34442

Problem:
:help/:helpgrep/:lhelpgrep can focus unfocusable/hide window

Solution:
Ignore unfocusable/hidden window when reusing help buffer.
This commit is contained in:
phanium
2025-06-29 22:44:17 +08:00
committed by GitHub
parent 63a7b92e58
commit 1c52e90cd5
3 changed files with 23 additions and 2 deletions

View File

@@ -141,7 +141,7 @@ void ex_help(exarg_T *eap)
} else {
wp = NULL;
FOR_ALL_WINDOWS_IN_TAB(wp2, curtab) {
if (bt_help(wp2->w_buffer)) {
if (bt_help(wp2->w_buffer) && !wp2->w_config.hide && wp2->w_config.focusable) {
wp = wp2;
break;
}

View File

@@ -2671,7 +2671,7 @@ static win_T *qf_find_help_win(void)
FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
{
FOR_ALL_WINDOWS_IN_TAB(wp, curtab) {
if (bt_help(wp->w_buffer)) {
if (bt_help(wp->w_buffer) && !wp->w_config.hide && wp->w_config.focusable) {
return wp;
}
}