aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/buffer.c
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2017-11-13 19:55:20 +0100
committerBjörn Linse <bjorn.linse@gmail.com>2018-06-21 22:41:15 +0200
commit8917e0c3010f93d6238bda21c4807c6c5921eb4a (patch)
treecac3120a95f3e49f6bcbc882c462c6e3f29905cd /src/nvim/buffer.c
parent7ae7da8fb9ab2e23ffc19000798ae27a2dee4e87 (diff)
downloadrneovim-8917e0c3010f93d6238bda21c4807c6c5921eb4a.tar.gz
rneovim-8917e0c3010f93d6238bda21c4807c6c5921eb4a.tar.bz2
rneovim-8917e0c3010f93d6238bda21c4807c6c5921eb4a.zip
buffer: fix copying setl options for buffer currently displayed in another window
vim-patch:8.0.1836: buffer-local window options may not be recent Problem: Buffer-local window options may not be recent if the buffer is still open in another window. Solution: Copy the options from the window instead of the outdated window options. (Bjorn Linse, closes vim/vim#2336) https://github.com/vim/vim/commit/25782a7ff4755daf16c2e1cb5e5f826b13b672ce
Diffstat (limited to 'src/nvim/buffer.c')
-rw-r--r--src/nvim/buffer.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c
index eb781b1be0..b1f44277c7 100644
--- a/src/nvim/buffer.c
+++ b/src/nvim/buffer.c
@@ -2381,8 +2381,15 @@ void get_winopts(buf_T *buf)
clear_winopt(&curwin->w_onebuf_opt);
clearFolding(curwin);
- wip = find_wininfo(buf, TRUE);
- if (wip != NULL && wip->wi_optset) {
+ wip = find_wininfo(buf, true);
+ if (wip != NULL && wip->wi_win != curwin && wip->wi_win != NULL
+ && wip->wi_win->w_buffer == buf) {
+ win_T *wp = wip->wi_win;
+ copy_winopt(&wp->w_onebuf_opt, &curwin->w_onebuf_opt);
+ curwin->w_fold_manual = wp->w_fold_manual;
+ curwin->w_foldinvalid = true;
+ cloneFoldGrowArray(&wp->w_folds, &curwin->w_folds);
+ } else if (wip != NULL && wip->wi_optset) {
copy_winopt(&wip->wi_opt, &curwin->w_onebuf_opt);
curwin->w_fold_manual = wip->wi_fold_manual;
curwin->w_foldinvalid = true;