aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/window.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-03-11 12:05:01 +0800
committerGitHub <noreply@github.com>2024-03-11 12:05:01 +0800
commit3814750d3789b5c5690e8fa68066bd864a4f0a8e (patch)
tree8958b54539e3b4df3b8e6eebf6f11c7fbecc1662 /src/nvim/window.c
parenta09ddd7ce55037edc9747a682810fba6a26bc201 (diff)
parent3b3511c4d9f1855d4240da0d844ce7875176c607 (diff)
downloadrneovim-3814750d3789b5c5690e8fa68066bd864a4f0a8e.tar.gz
rneovim-3814750d3789b5c5690e8fa68066bd864a4f0a8e.tar.bz2
rneovim-3814750d3789b5c5690e8fa68066bd864a4f0a8e.zip
Merge pull request #27738 from ColinKennedy/vim-9.1.0147
vim-patch:9.1.{0147,0149,0150,0152,0156},58f1e5c0893a: 'winfixbuf'
Diffstat (limited to 'src/nvim/window.c')
-rw-r--r--src/nvim/window.c31
1 files changed, 30 insertions, 1 deletions
diff --git a/src/nvim/window.c b/src/nvim/window.c
index ff40a9adef..521699f2f0 100644
--- a/src/nvim/window.c
+++ b/src/nvim/window.c
@@ -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) {
+ emsg(_(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) {
+ emsg(_(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;