mirror of
https://github.com/neovim/neovim.git
synced 2025-12-05 22:22:44 +00:00
vim-patch:9.1.0084: Visual hl wrong when it ends before multibyte 'showbreak' (#27404)
Problem: Visual hl wrong when it ends before multibyte 'showbreak'.
(lacygoil)
Solution: Use vcol_sbr instead of adding n_extra.
(zeertzjq)
fixes: vim/vim#11272
closes: vim/vim#13996
df23d7f4bd
Bug doesn't apply to Nvim.
This commit is contained in:
@@ -1,12 +1,14 @@
|
|||||||
-- Test for linebreak and list option in utf-8 mode
|
-- Test for linebreak and list option in utf-8 mode
|
||||||
|
|
||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
|
local Screen = require('test.functional.ui.screen')
|
||||||
local source = helpers.source
|
local source = helpers.source
|
||||||
local feed = helpers.feed
|
local feed = helpers.feed
|
||||||
|
local exec = helpers.exec
|
||||||
local clear, expect = helpers.clear, helpers.expect
|
local clear, expect = helpers.clear, helpers.expect
|
||||||
|
|
||||||
describe('linebreak', function()
|
describe('linebreak', function()
|
||||||
setup(clear)
|
before_each(clear)
|
||||||
|
|
||||||
-- luacheck: ignore 621 (Indentation)
|
-- luacheck: ignore 621 (Indentation)
|
||||||
-- luacheck: ignore 613 (Trailing whitespaces in a string)
|
-- luacheck: ignore 613 (Trailing whitespaces in a string)
|
||||||
@@ -208,4 +210,29 @@ describe('linebreak', function()
|
|||||||
a b c¶
|
a b c¶
|
||||||
Screen attributes are the same!]])
|
Screen attributes are the same!]])
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
-- oldtest: Test_visual_ends_before_showbreak()
|
||||||
|
it("Visual area is correct when it ends before multibyte 'showbreak'", function()
|
||||||
|
local screen = Screen.new(60, 8)
|
||||||
|
screen:set_default_attr_ids({
|
||||||
|
[0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
|
||||||
|
[1] = { background = Screen.colors.LightGrey }, -- Visual
|
||||||
|
[2] = { bold = true }, -- ModeMsg
|
||||||
|
})
|
||||||
|
screen:attach()
|
||||||
|
exec([[
|
||||||
|
let &wrap = v:true
|
||||||
|
let &linebreak = v:true
|
||||||
|
let &showbreak = '↪ '
|
||||||
|
eval ['xxxxx ' .. 'y'->repeat(&columns - 6) .. ' zzzz']->setline(1)
|
||||||
|
normal! wvel
|
||||||
|
]])
|
||||||
|
screen:expect([[
|
||||||
|
xxxxx |
|
||||||
|
{0:↪ }{1:yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy}^ {1: }|
|
||||||
|
{0:↪ }zzzz |
|
||||||
|
{0:~ }|*4
|
||||||
|
{2:-- VISUAL --} |
|
||||||
|
]])
|
||||||
|
end)
|
||||||
end)
|
end)
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ CheckFeature conceal
|
|||||||
CheckFeature signs
|
CheckFeature signs
|
||||||
|
|
||||||
source view_util.vim
|
source view_util.vim
|
||||||
|
source screendump.vim
|
||||||
|
|
||||||
func s:screen_lines(lnum, width) abort
|
func s:screen_lines(lnum, width) abort
|
||||||
return ScreenLines(a:lnum, a:width)
|
return ScreenLines(a:lnum, a:width)
|
||||||
@@ -358,4 +359,24 @@ func Test_unprintable_char_on_wrap_column()
|
|||||||
call s:close_windows()
|
call s:close_windows()
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
" Test that Visual selection is drawn correctly when 'linebreak' is set and
|
||||||
|
" selection ends before multibyte 'showbreak'.
|
||||||
|
func Test_visual_ends_before_showbreak()
|
||||||
|
CheckScreendump
|
||||||
|
|
||||||
|
let lines =<< trim END
|
||||||
|
vim9script
|
||||||
|
&wrap = true
|
||||||
|
&linebreak = true
|
||||||
|
&showbreak = '↪ '
|
||||||
|
['xxxxx ' .. 'y'->repeat(&columns - 6) .. ' zzzz']->setline(1)
|
||||||
|
normal! wvel
|
||||||
|
END
|
||||||
|
call writefile(lines, 'XvisualEndsBeforeShowbreak', 'D')
|
||||||
|
let buf = RunVimInTerminal('-S XvisualEndsBeforeShowbreak', #{rows: 6})
|
||||||
|
call VerifyScreenDump(buf, 'Test_visual_ends_before_showbreak', {})
|
||||||
|
|
||||||
|
call StopVimInTerminal(buf)
|
||||||
|
endfunc
|
||||||
|
|
||||||
" vim: shiftwidth=2 sts=2 expandtab
|
" vim: shiftwidth=2 sts=2 expandtab
|
||||||
|
|||||||
Reference in New Issue
Block a user