vim-patch:9.1.0147: Cannot keep a buffer focused in a window

Problem:  Cannot keep a buffer focused in a window
          (Amit Levy)
Solution: Add the 'winfixbuf' window-local option
          (Colin Kennedy)

fixes:  vim/vim#6445
closes: vim/vim#13903

2157035637

N/A patch:
vim-patch:58f1e5c0893a
This commit is contained in:
Colin Kennedy
2023-12-25 20:41:09 -08:00
committed by zeertzjq
parent a09ddd7ce5
commit 141182d6c6
27 changed files with 3414 additions and 23 deletions

View File

@ -133,6 +133,35 @@ static void log_frame_layout(frame_T *frame)
}
#endif
/// Check if the current window is allowed to move to a different buffer.
///
/// @return If the window has 'winfixbuf', or this function will return false.
bool check_can_set_curbuf_disabled(void)
{
if (curwin->w_p_wfb) {
semsg("%s", e_winfixbuf_cannot_go_to_buffer);
return false;
}
return true;
}
/// Check if the current window is allowed to move to a different buffer.
///
/// @param forceit If true, do not error. If false and 'winfixbuf' is enabled, error.
///
/// @return If the window has 'winfixbuf', then forceit must be true
/// or this function will return false.
bool check_can_set_curbuf_forceit(int forceit)
{
if (!forceit && curwin->w_p_wfb) {
semsg("%s", e_winfixbuf_cannot_go_to_buffer);
return false;
}
return true;
}
/// @return the current window, unless in the cmdline window and "prevwin" is
/// set, then return "prevwin".
win_T *prevwin_curwin(void)
@ -597,7 +626,7 @@ wingotofile:
ptr = xmemdupz(ptr, len);
find_pattern_in_path(ptr, 0, len, true, Prenum == 0,
type, Prenum1, ACTION_SPLIT, 1, MAXLNUM);
type, Prenum1, ACTION_SPLIT, 1, MAXLNUM, false);
xfree(ptr);
curwin->w_set_curswant = true;
break;