aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-06-11 11:29:39 +0800
committerGitHub <noreply@github.com>2023-06-11 11:29:39 +0800
commit2237b384e4027af7c977a4be01d792fcb790819c (patch)
treea7bbd4a8e4909d2eb5338173d65230810b3c51f0 /test
parent302d3cfb96d7f0c856262e1a4252d058e3300c8b (diff)
downloadrneovim-2237b384e4027af7c977a4be01d792fcb790819c.tar.gz
rneovim-2237b384e4027af7c977a4be01d792fcb790819c.tar.bz2
rneovim-2237b384e4027af7c977a4be01d792fcb790819c.zip
vim-patch:9.0.1626: Visual area not shown when using 'showbreak' (#23978)
Problem: Visual area not shown when using 'showbreak' and start of line is not visible. (Jaehwang Jung) Solution: Adjust "fromcol" for the space taken by 'showbreak'. (closes vim/vim#12514) https://github.com/vim/vim/commit/f578ca2c8f36b61ac3301fe8b59a8473c964cdc2 Co-authored-by: Bram Moolenaar <Bram@vim.org>
Diffstat (limited to 'test')
-rw-r--r--test/functional/legacy/highlight_spec.lua (renamed from test/functional/legacy/051_highlight_spec.lua)34
-rw-r--r--test/old/testdir/test_highlight.vim23
2 files changed, 51 insertions, 6 deletions
diff --git a/test/functional/legacy/051_highlight_spec.lua b/test/functional/legacy/highlight_spec.lua
index d3f2897493..0a130f1607 100644
--- a/test/functional/legacy/051_highlight_spec.lua
+++ b/test/functional/legacy/highlight_spec.lua
@@ -1,5 +1,3 @@
--- Tests for ":highlight".
-
local Screen = require('test.functional.ui.screen')
local helpers = require('test.functional.helpers')(after_each)
local clear, feed = helpers.clear, helpers.feed
@@ -8,10 +6,11 @@ local eq = helpers.eq
local poke_eventloop = helpers.poke_eventloop
local exc_exec = helpers.exc_exec
local feed_command = helpers.feed_command
+local exec = helpers.exec
-describe(':highlight', function()
- setup(clear)
+before_each(clear)
+describe(':highlight', function()
it('is working', function()
local screen = Screen.new(35, 10)
screen:attach()
@@ -94,3 +93,30 @@ describe(':highlight', function()
Group3 xxx cleared]])
end)
end)
+
+describe('Visual selection highlight', function()
+ -- oldtest: Test_visual_sbr()
+ it("when 'showbreak' is set", function()
+ local screen = Screen.new(60, 6)
+ 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([[
+ set showbreak=>
+ call setline(1, 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.')
+ exe "normal! z1\<CR>"
+ ]])
+ feed('v$')
+ screen:expect([[
+ {0:>}{1:n, no sea takimata sanctus est Lorem ipsum dolor sit amet.}^ |
+ |
+ |
+ |
+ |
+ {2:-- VISUAL --} |
+ ]])
+ end)
+end)
diff --git a/test/old/testdir/test_highlight.vim b/test/old/testdir/test_highlight.vim
index 8a102f2e65..8ed03732c2 100644
--- a/test/old/testdir/test_highlight.vim
+++ b/test/old/testdir/test_highlight.vim
@@ -698,7 +698,7 @@ func Test_colorcolumn_sbr()
let lines =<< trim END
call setline(1, 'The quick brown fox jumped over the lazy dogs')
END
- call writefile(lines, 'Xtest_colorcolumn_srb')
+ call writefile(lines, 'Xtest_colorcolumn_srb', 'D')
let buf = RunVimInTerminal('-S Xtest_colorcolumn_srb', {'rows': 10,'columns': 40})
call term_sendkeys(buf, ":set co=40 showbreak=+++>\\ cc=40,41,43\<CR>")
call TermWait(buf)
@@ -706,7 +706,26 @@ func Test_colorcolumn_sbr()
" clean up
call StopVimInTerminal(buf)
- call delete('Xtest_colorcolumn_srb')
+endfunc
+
+func Test_visual_sbr()
+ CheckScreendump
+
+ " check Visual highlight when 'showbreak' is set
+ let lines =<< trim END
+ set showbreak=>
+ call setline(1, 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.')
+ exe "normal! z1\<CR>"
+ END
+ call writefile(lines, 'Xtest_visual_sbr', 'D')
+ let buf = RunVimInTerminal('-S Xtest_visual_sbr', {'rows': 6,'columns': 60})
+
+ call term_sendkeys(buf, "v$")
+ call VerifyScreenDump(buf, 'Test_visual_sbr_1', {})
+
+ " clean up
+ call term_sendkeys(buf, "\<Esc>")
+ call StopVimInTerminal(buf)
endfunc
" This test must come before the Test_cursorline test, as it appears this