mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
Merge pull request #16841 from zeertzjq/vim-8.1.2073
vim-patch:8.1.2073: when editing a buffer 'colorcolumn' may not work
This commit is contained in:
commit
f6485e9446
@ -1497,6 +1497,11 @@ void set_curbuf(buf_T *buf, int action)
|
||||
*/
|
||||
void enter_buffer(buf_T *buf)
|
||||
{
|
||||
// Get the buffer in the current window.
|
||||
curwin->w_buffer = buf;
|
||||
curbuf = buf;
|
||||
curbuf->b_nwindows++;
|
||||
|
||||
// Copy buffer and window local option values. Not for a help buffer.
|
||||
buf_copy_options(buf, BCO_ENTER | BCO_NOHELP);
|
||||
if (!buf->b_help) {
|
||||
@ -1507,11 +1512,6 @@ void enter_buffer(buf_T *buf)
|
||||
}
|
||||
foldUpdateAll(curwin); // update folds (later).
|
||||
|
||||
// Get the buffer in the current window.
|
||||
curwin->w_buffer = buf;
|
||||
curbuf = buf;
|
||||
curbuf->b_nwindows++;
|
||||
|
||||
if (curwin->w_p_diff) {
|
||||
diff_buf_add(curbuf);
|
||||
}
|
||||
|
@ -1984,10 +1984,9 @@ static void didset_options(void)
|
||||
(void)did_set_spell_option(true);
|
||||
// set cedit_key
|
||||
(void)check_cedit();
|
||||
briopt_check(curwin);
|
||||
// initialize the table for 'breakat'.
|
||||
fill_breakat_flags();
|
||||
fill_culopt_flags(NULL, curwin);
|
||||
didset_window_options(curwin);
|
||||
}
|
||||
|
||||
// More side effects of setting options.
|
||||
@ -6174,6 +6173,7 @@ void win_copy_options(win_T *wp_from, win_T *wp_to)
|
||||
{
|
||||
copy_winopt(&wp_from->w_onebuf_opt, &wp_to->w_onebuf_opt);
|
||||
copy_winopt(&wp_from->w_allbuf_opt, &wp_to->w_allbuf_opt);
|
||||
didset_window_options(wp_to);
|
||||
}
|
||||
|
||||
/// Copy the options from one winopt_T to another.
|
||||
|
@ -597,6 +597,31 @@ func Test_cursorline_with_visualmode()
|
||||
call delete('Xtest_cursorline_with_visualmode')
|
||||
endfunc
|
||||
|
||||
func Test_colorcolumn()
|
||||
CheckScreendump
|
||||
|
||||
" check that setting 'colorcolumn' when entering a buffer works
|
||||
let lines =<< trim END
|
||||
split
|
||||
edit X
|
||||
call setline(1, ["1111111111","22222222222","3333333333"])
|
||||
set nomodified
|
||||
set colorcolumn=3,9
|
||||
set number cursorline cursorlineopt=number
|
||||
wincmd w
|
||||
buf X
|
||||
END
|
||||
call writefile(lines, 'Xtest_colorcolumn')
|
||||
let buf = RunVimInTerminal('-S Xtest_colorcolumn', {'rows': 10})
|
||||
call term_sendkeys(buf, ":\<CR>")
|
||||
call term_wait(buf)
|
||||
call VerifyScreenDump(buf, 'Test_colorcolumn_1', {})
|
||||
|
||||
" clean up
|
||||
call StopVimInTerminal(buf)
|
||||
call delete('Xtest_colorcolumn')
|
||||
endfunc
|
||||
|
||||
func Test_colorcolumn_bri()
|
||||
CheckScreendump
|
||||
|
||||
|
@ -1482,8 +1482,6 @@ static void win_init(win_T *newp, win_T *oldp, int flags)
|
||||
copyFoldingState(oldp, newp);
|
||||
|
||||
win_init_some(newp, oldp);
|
||||
|
||||
didset_window_options(newp);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -2,7 +2,7 @@ local helpers = require('test.functional.helpers')(after_each)
|
||||
local Screen = require('test.functional.ui.screen')
|
||||
local os = require('os')
|
||||
local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
|
||||
local command = helpers.command
|
||||
local command, exec = helpers.command, helpers.exec
|
||||
local eval, exc_exec = helpers.eval, helpers.exc_exec
|
||||
local feed_command, eq = helpers.feed_command, helpers.eq
|
||||
local curbufmeths = helpers.curbufmeths
|
||||
@ -1172,6 +1172,105 @@ describe('CursorLine highlight', function()
|
||||
end)
|
||||
end)
|
||||
|
||||
describe('ColorColumn highlight', function()
|
||||
local screen
|
||||
|
||||
before_each(function()
|
||||
clear()
|
||||
screen = Screen.new(40, 15)
|
||||
Screen:set_default_attr_ids({
|
||||
[1] = {background = Screen.colors.LightRed}, -- ColorColumn
|
||||
[2] = {background = Screen.colors.Grey90}, -- CursorLine
|
||||
[3] = {foreground = Screen.colors.Brown}, -- LineNr
|
||||
[4] = {foreground = Screen.colors.Brown, bold = true}, -- CursorLineNr
|
||||
[5] = {foreground = Screen.colors.Blue, bold = true}, -- NonText
|
||||
-- NonText and ColorColumn
|
||||
[6] = {foreground = Screen.colors.Blue, background = Screen.colors.LightRed, bold = true},
|
||||
[7] = {reverse = true, bold = true}, -- StatusLine
|
||||
[8] = {reverse = true}, -- StatusLineNC
|
||||
})
|
||||
screen:attach()
|
||||
end)
|
||||
|
||||
it('when entering a buffer vim-patch:8.1.2073', function()
|
||||
exec([[
|
||||
set nohidden
|
||||
split
|
||||
edit X
|
||||
call setline(1, ["1111111111","22222222222","3333333333"])
|
||||
set nomodified
|
||||
set colorcolumn=3,9
|
||||
set number cursorline cursorlineopt=number
|
||||
wincmd w
|
||||
buf X
|
||||
]])
|
||||
screen:expect([[
|
||||
{4: 1 }11{1:1}11111{1:1}1 |
|
||||
{3: 2 }22{1:2}22222{1:2}22 |
|
||||
{3: 3 }33{1:3}33333{1:3}3 |
|
||||
{5:~ }|
|
||||
{5:~ }|
|
||||
{5:~ }|
|
||||
{8:X }|
|
||||
{4: 1 }^11{1:1}11111{1:1}1 |
|
||||
{3: 2 }22{1:2}22222{1:2}22 |
|
||||
{3: 3 }33{1:3}33333{1:3}3 |
|
||||
{5:~ }|
|
||||
{5:~ }|
|
||||
{5:~ }|
|
||||
{7:X }|
|
||||
|
|
||||
]])
|
||||
end)
|
||||
|
||||
it("in 'breakindent' vim-patch:8.2.1689", function()
|
||||
exec([[
|
||||
call setline(1, 'The quick brown fox jumped over the lazy dogs')
|
||||
set co=40 linebreak bri briopt=shift:2 cc=40,41,43
|
||||
]])
|
||||
screen:expect([[
|
||||
^The quick brown fox jumped over the {1: }|
|
||||
{1: } {1:l}azy dogs |
|
||||
{5:~ }|
|
||||
{5:~ }|
|
||||
{5:~ }|
|
||||
{5:~ }|
|
||||
{5:~ }|
|
||||
{5:~ }|
|
||||
{5:~ }|
|
||||
{5:~ }|
|
||||
{5:~ }|
|
||||
{5:~ }|
|
||||
{5:~ }|
|
||||
{5:~ }|
|
||||
|
|
||||
]])
|
||||
end)
|
||||
|
||||
it("in 'showbreak' vim-patch:8.2.1689", function()
|
||||
exec([[
|
||||
call setline(1, 'The quick brown fox jumped over the lazy dogs')
|
||||
set co=40 showbreak=+++>\\ cc=40,41,43
|
||||
]])
|
||||
screen:expect([[
|
||||
^The quick brown fox jumped over the laz{1:y}|
|
||||
{6:+}{5:+}{6:+}{5:>\} dogs |
|
||||
{5:~ }|
|
||||
{5:~ }|
|
||||
{5:~ }|
|
||||
{5:~ }|
|
||||
{5:~ }|
|
||||
{5:~ }|
|
||||
{5:~ }|
|
||||
{5:~ }|
|
||||
{5:~ }|
|
||||
{5:~ }|
|
||||
{5:~ }|
|
||||
{5:~ }|
|
||||
|
|
||||
]])
|
||||
end)
|
||||
end)
|
||||
|
||||
describe("MsgSeparator highlight and msgsep fillchar", function()
|
||||
local screen
|
||||
|
Loading…
Reference in New Issue
Block a user