Skip to content

Conversation

bfredl
Copy link
Member

@bfredl bfredl commented Nov 13, 2017

In this sequence of commands the buffer-local value of window option winhl is copied

e /tmp/xx
split
e /tmp/yy
setl winhl=Normal:ErrorMsg
b /tmp/xx
wincmd w
b /tmp/yy

but NOT in this sequence

e /tmp/xx
split
e /tmp/yy
setl winhl=Normal:ErrorMsg
wincmd w
b /tmp/yy

This seem counter to the intended behavior stated at

* If the buffer wasn't used in this window before, use the values from
. At least the discrepancy seems quite jarring.

As discussed with @leonerd on IRC/Gitter, this will make filetype autocmds that setl window options behave more reasonably.

@bfredl bfredl changed the title [WIP] fix copying setl options for buffer currently displayed in another buffer [WIP] fix copying setl options for buffer currently displayed in another window Nov 13, 2017
@bfredl
Copy link
Member Author

bfredl commented Nov 13, 2017

I get same discrepancy with vim, tested with setl number instead of setl winhl.

@brammool is this a bug, or intentional behavior?

@brammool
Copy link
Contributor

So, when wi_optset is false, you use the options from the window directly.
That makes sense, more like what a user would expect.
Can you please make a pull request for Vim (with a test would be nice)?

@marvim marvim added the WIP label Nov 13, 2017
@bfredl
Copy link
Member Author

bfredl commented Nov 13, 2017

I will make a PR with tests, maybe tomorrow.

@justinmk justinmk added the has:vim-patch issue is fixed in vim and patch needs to be ported label Nov 13, 2017
@justinmk
Copy link
Member

Vim merged this in vim/vim@25782a7

@bfredl
Copy link
Member Author

bfredl commented Jun 21, 2018

@justinmk Ok if I just take the new-style test? Or should I port it to lua?

@justinmk
Copy link
Member

@bfredl don't need to port it.

@bfredl bfredl force-pushed the setl_bufwin branch 2 times, most recently from e20e600 to 90147d2 Compare June 21, 2018 08:50
…other 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)
vim/vim@25782a7
@bfredl
Copy link
Member Author

bfredl commented Jun 22, 2018

failures unrelated.

@bfredl bfredl merged commit bf2460e into neovim:master Jun 22, 2018
@justinmk justinmk removed the WIP label Jun 22, 2018
@justinmk justinmk changed the title [WIP] fix copying setl options for buffer currently displayed in another window fix copying setl options for buffer currently displayed in another window Jun 22, 2018
@justinmk justinmk added the bug-vim wrong behavior inherited from vim label Jun 22, 2018
@janlazo janlazo mentioned this pull request Jun 22, 2018
justinmk added a commit that referenced this pull request Jul 18, 2018
FEATURES:
07499a8 #8709 man.vim: C highlighting for EXAMPLES section
07f82ad #8699 TUI: urxvt: also send xterm focus-reporting seqs
40911e4 #8616 API: emit nvim_buf_lines_event from :terminal
c46997a #8546 fillchars: Add "eob" flag

FIXES:
74d19f6 #8576 startup: avoid blank stdin buffer if other files were opened
4874214 #8737 Only waitpid() for processes that we care about
cd6e7e8 #8743 Check all child processes for exit in SIGCHLD handler
c230ef2 #8746 channel.c: Prevent channel_destroy_early() from freeing uninitialized rpc stuff
0ed8b12 #8681 transstr_buf: fix length comparison
d241f27 #8708 TUI: Fix standout mode
9afed40 #8698 man.vim: fix for mandoc
e889640 #8682 provider/node: npm --loglevel silent
1cbc830 #8613 API: nvim_win_set_cursor: set curswant
bf6048e #8628 checkhealth: Python: fix VIRTUAL_ENV check
3cc3506 #8528 checkhealth: node.js: also search yarn

CHANGES:
b751449 #8619 defaults: shortmess+=F
1248178 #8578 highlight: high-priority CursorLine if fg is set.
01570f1 #8726 terminal: handle &confirm and :confirm on unloading
56065bb #8721 screen: truncate showmode messages
bf2460e #7551 buffer: fix copying :setlocal options
c1c14fa #8520 Ex mode: always "improved" (gQ)
050f397 #7992 options: remove 'maxcombine` option (always 6)

INTERNAL:
463da84 #7992 screen: use UTF-8 representation
coditva pushed a commit to coditva/neovim that referenced this pull request Jul 28, 2018
FEATURES:
07499a8 neovim#8709 man.vim: C highlighting for EXAMPLES section
07f82ad neovim#8699 TUI: urxvt: also send xterm focus-reporting seqs
40911e4 neovim#8616 API: emit nvim_buf_lines_event from :terminal
c46997a neovim#8546 fillchars: Add "eob" flag

FIXES:
74d19f6 neovim#8576 startup: avoid blank stdin buffer if other files were opened
4874214 neovim#8737 Only waitpid() for processes that we care about
cd6e7e8 neovim#8743 Check all child processes for exit in SIGCHLD handler
c230ef2 neovim#8746 channel.c: Prevent channel_destroy_early() from freeing uninitialized rpc stuff
0ed8b12 neovim#8681 transstr_buf: fix length comparison
d241f27 neovim#8708 TUI: Fix standout mode
9afed40 neovim#8698 man.vim: fix for mandoc
e889640 neovim#8682 provider/node: npm --loglevel silent
1cbc830 neovim#8613 API: nvim_win_set_cursor: set curswant
bf6048e neovim#8628 checkhealth: Python: fix VIRTUAL_ENV check
3cc3506 neovim#8528 checkhealth: node.js: also search yarn

CHANGES:
b751449 neovim#8619 defaults: shortmess+=F
1248178 neovim#8578 highlight: high-priority CursorLine if fg is set.
01570f1 neovim#8726 terminal: handle &confirm and :confirm on unloading
56065bb neovim#8721 screen: truncate showmode messages
bf2460e neovim#7551 buffer: fix copying :setlocal options
c1c14fa neovim#8520 Ex mode: always "improved" (gQ)
050f397 neovim#7992 options: remove 'maxcombine` option (always 6)

INTERNAL:
463da84 neovim#7992 screen: use UTF-8 representation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-vim wrong behavior inherited from vim has:vim-patch issue is fixed in vim and patch needs to be ported
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants