2024-04-20 08:44:13 -07:00
|
|
|
local t = require('test.testutil')
|
|
|
|
local n = require('test.functional.testnvim')()
|
2015-02-24 12:23:50 -07:00
|
|
|
local Screen = require('test.functional.ui.screen')
|
2024-04-20 08:44:13 -07:00
|
|
|
|
|
|
|
local clear, feed, command = n.clear, n.feed, n.command
|
2024-04-08 02:03:20 -07:00
|
|
|
local eq = t.eq
|
2024-04-20 08:44:13 -07:00
|
|
|
local insert = n.insert
|
|
|
|
local poke_eventloop = n.poke_eventloop
|
|
|
|
local exec = n.exec
|
2015-02-24 12:23:50 -07:00
|
|
|
|
|
|
|
describe('Screen', function()
|
2016-11-16 16:33:45 -07:00
|
|
|
local screen
|
2015-02-24 12:23:50 -07:00
|
|
|
|
2016-11-16 16:33:45 -07:00
|
|
|
before_each(function()
|
2015-02-24 12:23:50 -07:00
|
|
|
clear()
|
|
|
|
screen = Screen.new(nil, 10)
|
2016-08-09 05:22:54 -07:00
|
|
|
screen:set_default_attr_ids({
|
|
|
|
[0] = { bold = true, foreground = Screen.colors.Blue },
|
2019-01-12 04:18:00 -07:00
|
|
|
[1] = { foreground = Screen.colors.LightGrey, background = Screen.colors.DarkGray },
|
|
|
|
[2] = { bold = true, reverse = true },
|
|
|
|
[3] = { reverse = true },
|
|
|
|
[4] = { bold = true },
|
|
|
|
[5] = { background = Screen.colors.Yellow },
|
2024-02-14 16:49:39 -07:00
|
|
|
[6] = { foreground = Screen.colors.Black, background = Screen.colors.LightGrey },
|
2016-08-09 05:22:54 -07:00
|
|
|
})
|
2015-02-24 12:23:50 -07:00
|
|
|
end)
|
2016-11-16 16:33:45 -07:00
|
|
|
|
2015-02-24 12:23:50 -07:00
|
|
|
describe('match and conceal', function()
|
|
|
|
before_each(function()
|
2017-04-08 14:12:26 -07:00
|
|
|
command('let &conceallevel=1')
|
2015-02-24 12:23:50 -07:00
|
|
|
end)
|
|
|
|
|
|
|
|
describe('multiple', function()
|
|
|
|
before_each(function()
|
|
|
|
insert([[
|
|
|
|
&&
|
|
|
|
&&
|
|
|
|
&&
|
|
|
|
&&
|
|
|
|
&&
|
|
|
|
&&
|
|
|
|
]])
|
2017-04-08 14:12:26 -07:00
|
|
|
command("syn match dAmpersand '[&][&]' conceal cchar=∧")
|
2015-02-24 12:23:50 -07:00
|
|
|
end)
|
|
|
|
|
|
|
|
it('double characters.', function()
|
|
|
|
screen:expect([[
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:∧} |*6
|
2015-02-24 12:23:50 -07:00
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*2
|
2017-04-08 17:23:16 -07:00
|
|
|
|
|
2015-02-24 12:23:50 -07:00
|
|
|
]])
|
|
|
|
end)
|
|
|
|
|
2016-11-16 16:33:45 -07:00
|
|
|
it('double characters and move the cursor one line up.', function()
|
2015-02-24 12:23:50 -07:00
|
|
|
feed('k')
|
|
|
|
screen:expect([[
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:∧} |*5
|
2015-02-24 12:23:50 -07:00
|
|
|
^&& |
|
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*2
|
2017-04-08 17:23:16 -07:00
|
|
|
|
|
2015-02-24 12:23:50 -07:00
|
|
|
]])
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('double characters and move the cursor to the beginning of the file.', function()
|
|
|
|
feed('gg')
|
|
|
|
screen:expect([[
|
|
|
|
^&& |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:∧} |*5
|
2015-02-24 12:23:50 -07:00
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*2
|
2017-04-08 17:23:16 -07:00
|
|
|
|
|
2015-02-24 12:23:50 -07:00
|
|
|
]])
|
|
|
|
end)
|
|
|
|
|
2016-11-16 16:33:45 -07:00
|
|
|
it('double characters and move the cursor to the second line in the file.', function()
|
2015-02-24 12:23:50 -07:00
|
|
|
feed('ggj')
|
|
|
|
screen:expect([[
|
|
|
|
{1:∧} |
|
|
|
|
^&& |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:∧} |*4
|
2015-02-24 12:23:50 -07:00
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*2
|
2017-04-08 17:23:16 -07:00
|
|
|
|
|
2015-02-24 12:23:50 -07:00
|
|
|
]])
|
|
|
|
end)
|
|
|
|
|
2016-11-16 16:33:45 -07:00
|
|
|
it(
|
|
|
|
'double characters and then move the cursor to the beginning of the file and back to the end of the file.',
|
|
|
|
function()
|
2015-02-24 12:23:50 -07:00
|
|
|
feed('ggG')
|
|
|
|
screen:expect([[
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:∧} |*6
|
2015-02-24 12:23:50 -07:00
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*2
|
2017-04-08 17:23:16 -07:00
|
|
|
|
|
2015-02-24 12:23:50 -07:00
|
|
|
]])
|
|
|
|
end
|
|
|
|
)
|
2016-11-16 16:33:45 -07:00
|
|
|
end) -- multiple
|
|
|
|
|
2015-02-24 12:23:50 -07:00
|
|
|
it('keyword instances in initially in the document.', function()
|
|
|
|
feed('2ilambda<cr><ESC>')
|
2017-04-08 14:12:26 -07:00
|
|
|
command('let &conceallevel=1')
|
|
|
|
command('syn keyword kLambda lambda conceal cchar=λ')
|
2015-02-24 12:23:50 -07:00
|
|
|
screen:expect([[
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:λ} |*2
|
2015-02-24 12:23:50 -07:00
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*6
|
2017-04-08 17:23:16 -07:00
|
|
|
|
|
2015-02-24 12:23:50 -07:00
|
|
|
]])
|
|
|
|
end) -- Keyword
|
|
|
|
|
|
|
|
describe('regions in the document', function()
|
2016-11-16 16:33:45 -07:00
|
|
|
before_each(function()
|
2015-02-24 12:23:50 -07:00
|
|
|
feed('2')
|
|
|
|
insert('<r> a region of text </r>\n')
|
2017-04-08 14:12:26 -07:00
|
|
|
command('let &conceallevel=1')
|
2015-02-24 12:23:50 -07:00
|
|
|
end)
|
2016-11-16 16:33:45 -07:00
|
|
|
|
|
|
|
it('initially and conceal it.', function()
|
2017-04-08 14:12:26 -07:00
|
|
|
command("syn region rText start='<r>' end='</r>' conceal cchar=R")
|
2015-02-24 12:23:50 -07:00
|
|
|
screen:expect([[
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:R} |*2
|
2015-02-24 12:23:50 -07:00
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*6
|
2015-02-24 12:23:50 -07:00
|
|
|
|
|
|
|
|
]])
|
|
|
|
end)
|
|
|
|
|
2015-06-20 13:16:10 -07:00
|
|
|
it('initially and conceal its start tag and end tag.', function()
|
|
|
|
-- concealends has a known bug (todo.txt) where the first match won't
|
|
|
|
-- be replaced with cchar.
|
2017-04-08 14:12:26 -07:00
|
|
|
command("syn region rText matchgroup=rMatch start='<r>' end='</r>' concealends cchar=-")
|
2015-02-24 12:23:50 -07:00
|
|
|
screen:expect([[
|
2023-12-09 05:42:00 -07:00
|
|
|
{1: } a region of text {1:-} |*2
|
2015-02-24 12:23:50 -07:00
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*6
|
2015-02-24 12:23:50 -07:00
|
|
|
|
|
|
|
|
]])
|
|
|
|
end)
|
2016-11-16 16:33:45 -07:00
|
|
|
|
2015-02-24 12:23:50 -07:00
|
|
|
it("that are nested and conceal the nested region's start and end tags.", function()
|
2017-04-08 14:12:26 -07:00
|
|
|
command(
|
|
|
|
"syn region rText contains=rText matchgroup=rMatch start='<r>' end='</r>' concealends cchar=-"
|
|
|
|
)
|
2015-02-24 12:23:50 -07:00
|
|
|
insert('<r> A region with <r> a nested <r> nested region.</r> </r> </r>\n')
|
|
|
|
screen:expect([[
|
2023-12-09 05:42:00 -07:00
|
|
|
{1: } a region of text {1:-} |*2
|
2015-06-20 13:16:10 -07:00
|
|
|
{1: } A region with {1: } a nested {1: } nested region.{1:-} |
|
2015-02-24 12:23:50 -07:00
|
|
|
{1:-} {1:-} |
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*4
|
2015-02-24 12:23:50 -07:00
|
|
|
|
|
|
|
|
]])
|
|
|
|
end)
|
|
|
|
end) -- regions in the document
|
|
|
|
|
|
|
|
describe('a region of text', function()
|
2016-11-16 16:33:45 -07:00
|
|
|
before_each(function()
|
2017-04-08 14:12:26 -07:00
|
|
|
command('syntax conceal on')
|
2015-02-24 12:23:50 -07:00
|
|
|
feed('2')
|
|
|
|
insert('<r> a region of text </r>\n')
|
2017-04-08 14:12:26 -07:00
|
|
|
command("syn region rText start='<r>' end='</r>' cchar=-")
|
2015-02-24 12:23:50 -07:00
|
|
|
end)
|
|
|
|
|
|
|
|
it('and turn on implicit concealing', function()
|
|
|
|
screen:expect([[
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:-} |*2
|
2015-02-24 12:23:50 -07:00
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*6
|
2017-04-08 17:23:16 -07:00
|
|
|
|
|
2015-02-24 12:23:50 -07:00
|
|
|
]])
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('and then turn on, then off, and then back on implicit concealing.', function()
|
2017-04-08 14:12:26 -07:00
|
|
|
command('syntax conceal off')
|
2015-02-24 12:23:50 -07:00
|
|
|
feed('2')
|
|
|
|
insert('<i> italian text </i>\n')
|
2017-04-08 14:12:26 -07:00
|
|
|
command("syn region iText start='<i>' end='</i>' cchar=*")
|
2015-02-24 12:23:50 -07:00
|
|
|
screen:expect([[
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:-} |*2
|
|
|
|
<i> italian text </i> |*2
|
2015-02-24 12:23:50 -07:00
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*4
|
2017-04-08 17:23:16 -07:00
|
|
|
|
|
2015-02-24 12:23:50 -07:00
|
|
|
]])
|
2017-04-08 14:12:26 -07:00
|
|
|
command('syntax conceal on')
|
|
|
|
command("syn region iText start='<i>' end='</i>' cchar=*")
|
2015-02-24 12:23:50 -07:00
|
|
|
screen:expect([[
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:-} |*2
|
|
|
|
{1:*} |*2
|
2015-02-24 12:23:50 -07:00
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*4
|
2017-04-08 17:23:16 -07:00
|
|
|
|
|
2015-02-24 12:23:50 -07:00
|
|
|
]])
|
|
|
|
end)
|
|
|
|
end) -- a region of text (implicit concealing)
|
2022-04-01 05:12:20 -07:00
|
|
|
|
2024-11-19 17:24:58 -07:00
|
|
|
it('cursor position when entering Insert mode with cocu=ni #13916', function()
|
2022-04-01 05:12:20 -07:00
|
|
|
insert([[foobarfoobarfoobar]])
|
|
|
|
-- move to end of line
|
|
|
|
feed('$')
|
|
|
|
command('set concealcursor=ni')
|
|
|
|
command('syn match Foo /foobar/ conceal cchar=&')
|
|
|
|
screen:expect([[
|
|
|
|
{1:&&&}^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*8
|
2022-04-01 05:12:20 -07:00
|
|
|
|
|
|
|
|
]])
|
|
|
|
feed('i')
|
|
|
|
-- cursor should stay in place, not jump to column 16
|
|
|
|
screen:expect([[
|
|
|
|
{1:&&&}^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*8
|
2022-04-01 05:12:20 -07:00
|
|
|
{4:-- INSERT --} |
|
|
|
|
]])
|
|
|
|
end)
|
2024-11-19 17:24:58 -07:00
|
|
|
|
|
|
|
it('cursor position when scrolling in Normal mode with cocu=n #31271', function()
|
|
|
|
insert(('foo\n'):rep(9) .. 'foofoobarfoofoo' .. ('\nfoo'):rep(9))
|
|
|
|
command('set concealcursor=n')
|
|
|
|
command('syn match Foo /bar/ conceal cchar=&')
|
|
|
|
feed('gg5<C-E>10gg$')
|
|
|
|
screen:expect([[
|
|
|
|
foo |*4
|
|
|
|
foofoo{1:&}foofo^o |
|
|
|
|
foo |*4
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
feed('zz')
|
|
|
|
screen:expect_unchanged()
|
|
|
|
feed('zt')
|
|
|
|
screen:expect([[
|
|
|
|
foofoo{1:&}foofo^o |
|
|
|
|
foo |*8
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
feed('zt')
|
|
|
|
screen:expect_unchanged()
|
|
|
|
feed('zb')
|
|
|
|
screen:expect([[
|
|
|
|
foo |*8
|
|
|
|
foofoo{1:&}foofo^o |
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
feed('zb')
|
|
|
|
screen:expect_unchanged()
|
|
|
|
end)
|
2015-02-24 12:23:50 -07:00
|
|
|
end) -- match and conceal
|
|
|
|
|
2016-11-16 16:33:45 -07:00
|
|
|
describe('let the conceal level be', function()
|
2015-02-24 12:23:50 -07:00
|
|
|
before_each(function()
|
2016-11-16 16:33:45 -07:00
|
|
|
insert('// No Conceal\n')
|
|
|
|
insert('"Conceal without a cchar"\n')
|
|
|
|
insert('+ With cchar\n\n')
|
2017-04-08 14:12:26 -07:00
|
|
|
command("syn match noConceal '^//.*$'")
|
|
|
|
command('syn match concealNoCchar \'".\\{-}"$\' conceal')
|
|
|
|
command("syn match concealWCchar '^+.\\{-}$' conceal cchar=C")
|
2015-02-24 12:23:50 -07:00
|
|
|
end)
|
2016-11-16 16:33:45 -07:00
|
|
|
|
|
|
|
it('0. No concealing.', function()
|
2017-04-08 14:12:26 -07:00
|
|
|
command('let &conceallevel=0')
|
2015-02-24 12:23:50 -07:00
|
|
|
screen:expect([[
|
|
|
|
// No Conceal |
|
|
|
|
"Conceal without a cchar" |
|
|
|
|
+ With cchar |
|
|
|
|
|
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*4
|
2017-04-08 17:23:16 -07:00
|
|
|
|
|
2015-02-24 12:23:50 -07:00
|
|
|
]])
|
|
|
|
end)
|
2016-11-16 16:33:45 -07:00
|
|
|
|
2015-02-24 12:23:50 -07:00
|
|
|
it('1. Conceal using cchar or reference listchars.', function()
|
2017-04-08 14:12:26 -07:00
|
|
|
command('let &conceallevel=1')
|
2015-02-24 12:23:50 -07:00
|
|
|
screen:expect([[
|
|
|
|
// No Conceal |
|
2015-06-20 13:16:10 -07:00
|
|
|
{1: } |
|
2015-02-24 12:23:50 -07:00
|
|
|
{1:C} |
|
|
|
|
|
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*4
|
2017-04-08 17:23:16 -07:00
|
|
|
|
|
2015-02-24 12:23:50 -07:00
|
|
|
]])
|
|
|
|
end)
|
2016-11-16 16:33:45 -07:00
|
|
|
|
2015-02-24 12:23:50 -07:00
|
|
|
it('2. Hidden unless cchar is set.', function()
|
2017-04-08 14:12:26 -07:00
|
|
|
command('let &conceallevel=2')
|
2015-02-24 12:23:50 -07:00
|
|
|
screen:expect([[
|
|
|
|
// No Conceal |
|
|
|
|
|
|
|
|
|
{1:C} |
|
|
|
|
|
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*4
|
2017-04-08 17:23:16 -07:00
|
|
|
|
|
2015-02-24 12:23:50 -07:00
|
|
|
]])
|
|
|
|
end)
|
2016-11-16 16:33:45 -07:00
|
|
|
|
|
|
|
it('3. Hide all concealed text.', function()
|
2017-04-08 14:12:26 -07:00
|
|
|
command('let &conceallevel=3')
|
2015-02-24 12:23:50 -07:00
|
|
|
screen:expect([[
|
|
|
|
// No Conceal |
|
2023-12-09 05:42:00 -07:00
|
|
|
|*3
|
2015-02-24 12:23:50 -07:00
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*4
|
2017-04-08 17:23:16 -07:00
|
|
|
|
|
2015-02-24 12:23:50 -07:00
|
|
|
]])
|
|
|
|
end)
|
|
|
|
end) -- conceallevel
|
2019-01-12 04:18:00 -07:00
|
|
|
|
|
|
|
describe('cursor movement', function()
|
|
|
|
before_each(function()
|
|
|
|
command('syn keyword concealy barf conceal cchar=b')
|
|
|
|
command('set cole=2')
|
|
|
|
feed('5Ofoo barf bar barf eggs<esc>')
|
|
|
|
screen:expect([[
|
2023-12-09 05:42:00 -07:00
|
|
|
foo {1:b} bar {1:b} eggs |*4
|
2019-01-12 04:18:00 -07:00
|
|
|
foo barf bar barf egg^s |
|
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*3
|
2019-01-12 04:18:00 -07:00
|
|
|
|
|
|
|
|
]])
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('between windows', function()
|
2019-03-09 15:12:33 -07:00
|
|
|
feed('k')
|
2019-01-12 04:18:00 -07:00
|
|
|
command('split')
|
|
|
|
screen:expect([[
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo barf bar barf egg^s |
|
2019-03-09 15:12:33 -07:00
|
|
|
foo {1:b} bar {1:b} eggs |
|
2019-01-12 04:18:00 -07:00
|
|
|
|
|
|
|
|
{2:[No Name] [+] }|
|
2023-12-09 05:42:00 -07:00
|
|
|
foo {1:b} bar {1:b} eggs |*3
|
2019-01-12 04:18:00 -07:00
|
|
|
{3:[No Name] [+] }|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
feed('<c-w>w')
|
|
|
|
|
|
|
|
screen:expect([[
|
2023-12-09 05:42:00 -07:00
|
|
|
foo {1:b} bar {1:b} eggs |*3
|
2019-01-12 04:18:00 -07:00
|
|
|
|
|
|
|
|
{3:[No Name] [+] }|
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo barf bar barf egg^s |
|
2019-03-09 15:12:33 -07:00
|
|
|
foo {1:b} bar {1:b} eggs |
|
2019-01-12 04:18:00 -07:00
|
|
|
{2:[No Name] [+] }|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('in insert mode', function()
|
|
|
|
feed('i')
|
|
|
|
screen:expect([[
|
2023-12-09 05:42:00 -07:00
|
|
|
foo {1:b} bar {1:b} eggs |*4
|
2019-01-12 04:18:00 -07:00
|
|
|
foo barf bar barf egg^s |
|
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*3
|
2019-01-12 04:18:00 -07:00
|
|
|
{4:-- INSERT --} |
|
|
|
|
]])
|
|
|
|
|
|
|
|
feed('<up>')
|
|
|
|
screen:expect([[
|
2023-12-09 05:42:00 -07:00
|
|
|
foo {1:b} bar {1:b} eggs |*3
|
2019-01-12 04:18:00 -07:00
|
|
|
foo barf bar barf egg^s |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*3
|
2019-01-12 04:18:00 -07:00
|
|
|
{4:-- INSERT --} |
|
|
|
|
]])
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('between modes cocu=iv', function()
|
|
|
|
command('set cocu=iv')
|
|
|
|
feed('gg')
|
|
|
|
screen:expect([[
|
|
|
|
^foo barf bar barf eggs |
|
2023-12-09 05:42:00 -07:00
|
|
|
foo {1:b} bar {1:b} eggs |*4
|
2019-01-12 04:18:00 -07:00
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*3
|
2019-01-12 04:18:00 -07:00
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
|
|
|
feed('i')
|
|
|
|
screen:expect([[
|
|
|
|
^foo {1:b} bar {1:b} eggs |
|
2023-12-09 05:42:00 -07:00
|
|
|
foo {1:b} bar {1:b} eggs |*4
|
2019-01-12 04:18:00 -07:00
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*3
|
2019-01-12 04:18:00 -07:00
|
|
|
{4:-- INSERT --} |
|
|
|
|
]])
|
|
|
|
|
|
|
|
feed('<esc>')
|
|
|
|
screen:expect([[
|
|
|
|
^foo barf bar barf eggs |
|
2023-12-09 05:42:00 -07:00
|
|
|
foo {1:b} bar {1:b} eggs |*4
|
2019-01-12 04:18:00 -07:00
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*3
|
2019-01-12 04:18:00 -07:00
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
|
|
|
feed('v')
|
|
|
|
screen:expect([[
|
|
|
|
^foo {1:b} bar {1:b} eggs |
|
2023-12-09 05:42:00 -07:00
|
|
|
foo {1:b} bar {1:b} eggs |*4
|
2019-01-12 04:18:00 -07:00
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*3
|
2019-01-12 04:18:00 -07:00
|
|
|
{4:-- VISUAL --} |
|
|
|
|
]])
|
|
|
|
|
|
|
|
feed('<esc>')
|
|
|
|
screen:expect([[
|
|
|
|
^foo barf bar barf eggs |
|
2023-12-09 05:42:00 -07:00
|
|
|
foo {1:b} bar {1:b} eggs |*4
|
2019-01-12 04:18:00 -07:00
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*3
|
2019-01-12 04:18:00 -07:00
|
|
|
|
|
|
|
|
]])
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('between modes cocu=n', function()
|
|
|
|
command('set cocu=n')
|
|
|
|
feed('gg')
|
|
|
|
screen:expect([[
|
|
|
|
^foo {1:b} bar {1:b} eggs |
|
2023-12-09 05:42:00 -07:00
|
|
|
foo {1:b} bar {1:b} eggs |*4
|
2019-01-12 04:18:00 -07:00
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*3
|
2019-01-12 04:18:00 -07:00
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
|
|
|
feed('i')
|
|
|
|
screen:expect([[
|
|
|
|
^foo barf bar barf eggs |
|
2023-12-09 05:42:00 -07:00
|
|
|
foo {1:b} bar {1:b} eggs |*4
|
2019-01-12 04:18:00 -07:00
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*3
|
2019-01-12 04:18:00 -07:00
|
|
|
{4:-- INSERT --} |
|
|
|
|
]])
|
|
|
|
|
|
|
|
feed('<esc>')
|
|
|
|
screen:expect([[
|
|
|
|
^foo {1:b} bar {1:b} eggs |
|
2023-12-09 05:42:00 -07:00
|
|
|
foo {1:b} bar {1:b} eggs |*4
|
2019-01-12 04:18:00 -07:00
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*3
|
2019-01-12 04:18:00 -07:00
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
|
|
|
feed('v')
|
|
|
|
screen:expect([[
|
|
|
|
^foo barf bar barf eggs |
|
2023-12-09 05:42:00 -07:00
|
|
|
foo {1:b} bar {1:b} eggs |*4
|
2019-01-12 04:18:00 -07:00
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*3
|
2019-01-12 04:18:00 -07:00
|
|
|
{4:-- VISUAL --} |
|
|
|
|
]])
|
|
|
|
|
|
|
|
feed('<esc>')
|
|
|
|
screen:expect([[
|
|
|
|
^foo {1:b} bar {1:b} eggs |
|
2023-12-09 05:42:00 -07:00
|
|
|
foo {1:b} bar {1:b} eggs |*4
|
2019-01-12 04:18:00 -07:00
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*3
|
2019-01-12 04:18:00 -07:00
|
|
|
|
|
|
|
|
]])
|
2024-03-16 18:44:10 -07:00
|
|
|
|
|
|
|
feed('r')
|
|
|
|
screen:expect_unchanged()
|
|
|
|
|
|
|
|
feed('m')
|
|
|
|
screen:expect([[
|
|
|
|
^moo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs |*4
|
|
|
|
|
|
|
|
|
{0:~ }|*3
|
|
|
|
|
|
|
|
|
]])
|
2019-01-12 04:18:00 -07:00
|
|
|
end)
|
|
|
|
|
|
|
|
it('and open line', function()
|
|
|
|
feed('o')
|
|
|
|
screen:expect([[
|
2023-12-09 05:42:00 -07:00
|
|
|
foo {1:b} bar {1:b} eggs |*5
|
2019-01-12 04:18:00 -07:00
|
|
|
^ |
|
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*2
|
2019-01-12 04:18:00 -07:00
|
|
|
{4:-- INSERT --} |
|
|
|
|
]])
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('and open line cocu=i', function()
|
|
|
|
command('set cocu=i')
|
|
|
|
feed('o')
|
|
|
|
screen:expect([[
|
2023-12-09 05:42:00 -07:00
|
|
|
foo {1:b} bar {1:b} eggs |*5
|
2019-01-12 04:18:00 -07:00
|
|
|
^ |
|
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*2
|
2019-01-12 04:18:00 -07:00
|
|
|
{4:-- INSERT --} |
|
|
|
|
]])
|
|
|
|
end)
|
|
|
|
|
|
|
|
describe('with incsearch', function()
|
|
|
|
before_each(function()
|
|
|
|
command('set incsearch hlsearch')
|
|
|
|
feed('2GA x<esc>3GA xy<esc>gg')
|
|
|
|
screen:expect([[
|
|
|
|
^foo barf bar barf eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs x |
|
|
|
|
foo {1:b} bar {1:b} eggs xy |
|
2023-12-09 05:42:00 -07:00
|
|
|
foo {1:b} bar {1:b} eggs |*2
|
2019-01-12 04:18:00 -07:00
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*3
|
2019-01-12 04:18:00 -07:00
|
|
|
|
|
|
|
|
]])
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('cocu=', function()
|
|
|
|
feed('/')
|
|
|
|
screen:expect([[
|
|
|
|
foo barf bar barf eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs x |
|
|
|
|
foo {1:b} bar {1:b} eggs xy |
|
2023-12-09 05:42:00 -07:00
|
|
|
foo {1:b} bar {1:b} eggs |*2
|
2019-01-12 04:18:00 -07:00
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*3
|
2019-01-12 04:18:00 -07:00
|
|
|
/^ |
|
|
|
|
]])
|
|
|
|
|
|
|
|
feed('x')
|
|
|
|
screen:expect([[
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo barf bar barf eggs {3:x} |
|
|
|
|
foo {1:b} bar {1:b} eggs {5:x}y |
|
2023-12-09 05:42:00 -07:00
|
|
|
foo {1:b} bar {1:b} eggs |*2
|
2019-01-12 04:18:00 -07:00
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*3
|
2019-01-12 04:18:00 -07:00
|
|
|
/x^ |
|
|
|
|
]])
|
|
|
|
|
|
|
|
feed('y')
|
|
|
|
screen:expect([[
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs x |
|
|
|
|
foo barf bar barf eggs {3:xy} |
|
2023-12-09 05:42:00 -07:00
|
|
|
foo {1:b} bar {1:b} eggs |*2
|
2019-01-12 04:18:00 -07:00
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*3
|
2019-01-12 04:18:00 -07:00
|
|
|
/xy^ |
|
|
|
|
]])
|
|
|
|
|
|
|
|
feed('<c-w>')
|
|
|
|
screen:expect([[
|
|
|
|
foo barf bar barf eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs x |
|
|
|
|
foo {1:b} bar {1:b} eggs xy |
|
2023-12-09 05:42:00 -07:00
|
|
|
foo {1:b} bar {1:b} eggs |*2
|
2019-01-12 04:18:00 -07:00
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*3
|
2019-01-12 04:18:00 -07:00
|
|
|
/^ |
|
|
|
|
]])
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('cocu=c', function()
|
|
|
|
command('set cocu=c')
|
|
|
|
|
|
|
|
feed('/')
|
|
|
|
-- NB: we don't do this redraw. Probably best to still skip it,
|
|
|
|
-- to avoid annoying distraction from the cmdline
|
|
|
|
screen:expect([[
|
|
|
|
foo barf bar barf eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs x |
|
|
|
|
foo {1:b} bar {1:b} eggs xy |
|
2023-12-09 05:42:00 -07:00
|
|
|
foo {1:b} bar {1:b} eggs |*2
|
2019-01-12 04:18:00 -07:00
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*3
|
2019-01-12 04:18:00 -07:00
|
|
|
/^ |
|
|
|
|
]])
|
|
|
|
|
|
|
|
feed('x')
|
|
|
|
screen:expect([[
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs {3:x} |
|
|
|
|
foo {1:b} bar {1:b} eggs {5:x}y |
|
2023-12-09 05:42:00 -07:00
|
|
|
foo {1:b} bar {1:b} eggs |*2
|
2019-01-12 04:18:00 -07:00
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*3
|
2019-01-12 04:18:00 -07:00
|
|
|
/x^ |
|
|
|
|
]])
|
|
|
|
|
|
|
|
feed('y')
|
|
|
|
screen:expect([[
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs x |
|
|
|
|
foo {1:b} bar {1:b} eggs {3:xy} |
|
2023-12-09 05:42:00 -07:00
|
|
|
foo {1:b} bar {1:b} eggs |*2
|
2019-01-12 04:18:00 -07:00
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*3
|
2019-01-12 04:18:00 -07:00
|
|
|
/xy^ |
|
|
|
|
]])
|
|
|
|
|
|
|
|
feed('<c-w>')
|
|
|
|
screen:expect([[
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs x |
|
|
|
|
foo {1:b} bar {1:b} eggs xy |
|
2023-12-09 05:42:00 -07:00
|
|
|
foo {1:b} bar {1:b} eggs |*2
|
2019-01-12 04:18:00 -07:00
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*3
|
2019-01-12 04:18:00 -07:00
|
|
|
/^ |
|
|
|
|
]])
|
|
|
|
|
|
|
|
feed('<esc>')
|
|
|
|
screen:expect([[
|
|
|
|
^foo barf bar barf eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs x |
|
|
|
|
foo {1:b} bar {1:b} eggs xy |
|
2023-12-09 05:42:00 -07:00
|
|
|
foo {1:b} bar {1:b} eggs |*2
|
2019-01-12 04:18:00 -07:00
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*3
|
2019-01-12 04:18:00 -07:00
|
|
|
|
|
|
|
|
]])
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('cocu=n', function()
|
|
|
|
command('set cocu=n')
|
|
|
|
screen:expect([[
|
|
|
|
^foo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs x |
|
|
|
|
foo {1:b} bar {1:b} eggs xy |
|
2023-12-09 05:42:00 -07:00
|
|
|
foo {1:b} bar {1:b} eggs |*2
|
2019-01-12 04:18:00 -07:00
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*3
|
2019-01-12 04:18:00 -07:00
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
|
|
|
feed('/')
|
|
|
|
-- NB: we don't do this redraw. Probably best to still skip it,
|
|
|
|
-- to avoid annoying distraction from the cmdline
|
|
|
|
screen:expect([[
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs x |
|
|
|
|
foo {1:b} bar {1:b} eggs xy |
|
2023-12-09 05:42:00 -07:00
|
|
|
foo {1:b} bar {1:b} eggs |*2
|
2019-01-12 04:18:00 -07:00
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*3
|
2019-01-12 04:18:00 -07:00
|
|
|
/^ |
|
|
|
|
]])
|
|
|
|
|
|
|
|
feed('x')
|
|
|
|
screen:expect([[
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo barf bar barf eggs {3:x} |
|
|
|
|
foo {1:b} bar {1:b} eggs {5:x}y |
|
2023-12-09 05:42:00 -07:00
|
|
|
foo {1:b} bar {1:b} eggs |*2
|
2019-01-12 04:18:00 -07:00
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*3
|
2019-01-12 04:18:00 -07:00
|
|
|
/x^ |
|
|
|
|
]])
|
|
|
|
|
|
|
|
feed('<c-w>')
|
|
|
|
screen:expect([[
|
|
|
|
foo barf bar barf eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs x |
|
|
|
|
foo {1:b} bar {1:b} eggs xy |
|
2023-12-09 05:42:00 -07:00
|
|
|
foo {1:b} bar {1:b} eggs |*2
|
2019-01-12 04:18:00 -07:00
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*3
|
2019-01-12 04:18:00 -07:00
|
|
|
/^ |
|
|
|
|
]])
|
|
|
|
|
|
|
|
feed('<esc>')
|
|
|
|
screen:expect([[
|
|
|
|
^foo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs x |
|
|
|
|
foo {1:b} bar {1:b} eggs xy |
|
2023-12-09 05:42:00 -07:00
|
|
|
foo {1:b} bar {1:b} eggs |*2
|
2019-01-12 04:18:00 -07:00
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*3
|
2019-01-12 04:18:00 -07:00
|
|
|
|
|
|
|
|
]])
|
|
|
|
end)
|
|
|
|
end)
|
2019-10-01 18:51:46 -07:00
|
|
|
|
|
|
|
it('redraws properly with concealcursor in visual mode', function()
|
|
|
|
command('set concealcursor=v conceallevel=2')
|
|
|
|
|
|
|
|
feed('10Ofoo barf bar barf eggs<esc>')
|
|
|
|
feed(':3<cr>o a<Esc>ggV')
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
|
|
|
^f{6:oo }{1:b}{6: bar }{1:b}{6: eggs} |
|
2023-12-09 05:42:00 -07:00
|
|
|
foo {1:b} bar {1:b} eggs |*2
|
2019-10-01 18:51:46 -07:00
|
|
|
a |
|
2023-12-09 05:42:00 -07:00
|
|
|
foo {1:b} bar {1:b} eggs |*5
|
2019-10-01 18:51:46 -07:00
|
|
|
{4:-- VISUAL LINE --} |
|
|
|
|
]],
|
|
|
|
}
|
|
|
|
feed(string.rep('j', 15))
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2023-12-09 05:42:00 -07:00
|
|
|
{6:foo }{1:b}{6: bar }{1:b}{6: eggs} |*8
|
2019-10-01 18:51:46 -07:00
|
|
|
^f{6:oo }{1:b}{6: bar }{1:b}{6: eggs} |
|
|
|
|
{4:-- VISUAL LINE --} |
|
|
|
|
]],
|
|
|
|
}
|
|
|
|
feed(string.rep('k', 15))
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
|
|
|
^f{6:oo }{1:b}{6: bar }{1:b}{6: eggs} |
|
2023-12-09 05:42:00 -07:00
|
|
|
foo {1:b} bar {1:b} eggs |*2
|
2019-10-01 18:51:46 -07:00
|
|
|
a |
|
2023-12-09 05:42:00 -07:00
|
|
|
foo {1:b} bar {1:b} eggs |*5
|
2019-10-01 18:51:46 -07:00
|
|
|
{4:-- VISUAL LINE --} |
|
|
|
|
]],
|
|
|
|
}
|
|
|
|
end)
|
2019-01-12 04:18:00 -07:00
|
|
|
end)
|
2019-09-26 00:15:21 -07:00
|
|
|
|
|
|
|
it('redraws not too much with conceallevel=1', function()
|
|
|
|
command('set conceallevel=1')
|
|
|
|
command('set redrawdebug+=nodelta')
|
|
|
|
|
|
|
|
insert([[
|
|
|
|
aaa
|
|
|
|
bbb
|
|
|
|
ccc
|
|
|
|
]])
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
|
|
|
aaa |
|
|
|
|
bbb |
|
|
|
|
ccc |
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*5
|
2019-09-26 00:15:21 -07:00
|
|
|
|
|
|
|
|
]],
|
|
|
|
}
|
|
|
|
|
|
|
|
-- XXX: hack to get notifications, and check only a single line is
|
|
|
|
-- updated. Could use next_msg() also.
|
|
|
|
local orig_handle_grid_line = screen._handle_grid_line
|
|
|
|
local grid_lines = {}
|
|
|
|
function screen._handle_grid_line(self, grid, row, col, items)
|
|
|
|
table.insert(grid_lines, { row, col, items })
|
|
|
|
orig_handle_grid_line(self, grid, row, col, items)
|
|
|
|
end
|
|
|
|
feed('k')
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
|
|
|
aaa |
|
|
|
|
bbb |
|
|
|
|
^ccc |
|
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*5
|
2019-09-26 00:15:21 -07:00
|
|
|
|
|
|
|
|
]],
|
|
|
|
}
|
2022-08-17 06:40:21 -07:00
|
|
|
eq({ { 2, 0, { { 'c', 0, 3 }, { ' ', 0, 50 } } }, { 3, 0, { { ' ', 0, 53 } } } }, grid_lines)
|
2022-03-27 15:45:15 -07:00
|
|
|
end)
|
|
|
|
|
|
|
|
it('K_EVENT should not cause extra redraws with concealcursor #13196', function()
|
|
|
|
command('set conceallevel=1')
|
|
|
|
command('set concealcursor=nv')
|
|
|
|
command('set redrawdebug+=nodelta')
|
|
|
|
|
|
|
|
insert([[
|
|
|
|
aaa
|
|
|
|
bbb
|
|
|
|
ccc
|
|
|
|
]])
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
|
|
|
aaa |
|
|
|
|
bbb |
|
|
|
|
ccc |
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*5
|
2022-03-27 15:45:15 -07:00
|
|
|
|
|
|
|
|
]],
|
|
|
|
}
|
|
|
|
|
|
|
|
-- XXX: hack to get notifications, and check only a single line is
|
|
|
|
-- updated. Could use next_msg() also.
|
|
|
|
local orig_handle_grid_line = screen._handle_grid_line
|
|
|
|
local grid_lines = {}
|
|
|
|
function screen._handle_grid_line(self, grid, row, col, items)
|
|
|
|
table.insert(grid_lines, { row, col, items })
|
|
|
|
orig_handle_grid_line(self, grid, row, col, items)
|
|
|
|
end
|
|
|
|
feed('k')
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
|
|
|
aaa |
|
|
|
|
bbb |
|
|
|
|
^ccc |
|
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*5
|
2022-03-27 15:45:15 -07:00
|
|
|
|
|
|
|
|
]],
|
|
|
|
}
|
2022-08-17 06:40:21 -07:00
|
|
|
eq({ { 2, 0, { { 'c', 0, 3 }, { ' ', 0, 50 } } } }, grid_lines)
|
|
|
|
grid_lines = {}
|
2022-03-27 15:45:15 -07:00
|
|
|
poke_eventloop() -- causes K_EVENT key
|
|
|
|
screen:expect_unchanged()
|
2022-08-17 06:40:21 -07:00
|
|
|
eq({}, grid_lines) -- no redraw was done
|
2019-09-26 00:15:21 -07:00
|
|
|
end)
|
2021-09-06 15:18:33 -07:00
|
|
|
|
2022-12-08 19:37:53 -07:00
|
|
|
describe('concealed line has the correct cursor column', function()
|
|
|
|
-- oldtest: Test_cursor_column_in_concealed_line_after_window_scroll()
|
|
|
|
it('after window scroll', function()
|
2021-09-06 15:18:33 -07:00
|
|
|
insert([[
|
2022-12-08 19:37:53 -07:00
|
|
|
3split
|
|
|
|
let m = matchadd('Conceal', '=')
|
|
|
|
setl conceallevel=2 concealcursor=nc
|
|
|
|
normal gg
|
|
|
|
"==expr==]])
|
|
|
|
feed('gg')
|
|
|
|
command('file Xcolesearch')
|
|
|
|
command('set nomodified')
|
2021-09-06 15:18:33 -07:00
|
|
|
|
2022-12-08 19:37:53 -07:00
|
|
|
command('so')
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
|
|
|
^3split |
|
|
|
|
let m matchadd('Conceal', '') |
|
|
|
|
setl conceallevel2 concealcursornc |
|
|
|
|
{2:Xcolesearch }|
|
|
|
|
3split |
|
|
|
|
let m = matchadd('Conceal', '=') |
|
|
|
|
setl conceallevel=2 concealcursor=nc |
|
|
|
|
normal gg |
|
|
|
|
{3:Xcolesearch }|
|
|
|
|
|
|
|
|
|
]],
|
|
|
|
}
|
2021-09-06 15:18:33 -07:00
|
|
|
|
|
|
|
-- Jump to something that is beyond the bottom of the window,
|
|
|
|
-- so there's a scroll down.
|
|
|
|
feed('/expr<CR>')
|
|
|
|
|
|
|
|
-- Are the concealed parts of the current line really hidden?
|
|
|
|
-- Is the window's cursor column properly updated for hidden
|
|
|
|
-- parts of the current line?
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
|
|
|
setl conceallevel2 concealcursornc |
|
|
|
|
normal gg |
|
|
|
|
"{5:^expr} |
|
|
|
|
{2:Xcolesearch }|
|
2022-12-08 19:37:53 -07:00
|
|
|
3split |
|
|
|
|
let m = matchadd('Conceal', '=') |
|
|
|
|
setl conceallevel=2 concealcursor=nc |
|
2021-09-06 15:18:33 -07:00
|
|
|
normal gg |
|
|
|
|
{3:Xcolesearch }|
|
|
|
|
/expr |
|
|
|
|
]],
|
|
|
|
}
|
|
|
|
end)
|
2022-12-08 19:37:53 -07:00
|
|
|
|
|
|
|
-- oldtest: Test_cursor_column_in_concealed_line_after_leftcol_change()
|
|
|
|
it('after leftcol change', function()
|
|
|
|
exec([[
|
|
|
|
0put = 'ab' .. repeat('-', &columns) .. 'c'
|
|
|
|
call matchadd('Conceal', '-')
|
|
|
|
set nowrap ss=0 cole=3 cocu=n
|
|
|
|
]])
|
|
|
|
|
|
|
|
-- Go to the end of the line (3 columns beyond the end of the screen).
|
|
|
|
-- Horizontal scroll would center the cursor in the screen line, but conceal
|
|
|
|
-- makes it go to screen column 1.
|
|
|
|
feed('$')
|
|
|
|
|
|
|
|
-- Are the concealed parts of the current line really hidden?
|
|
|
|
-- Is the window's cursor column properly updated for conceal?
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
|
|
|
^c |
|
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*7
|
2022-12-08 19:37:53 -07:00
|
|
|
|
|
|
|
|
]],
|
|
|
|
}
|
|
|
|
end)
|
2021-09-06 15:18:33 -07:00
|
|
|
end)
|
2015-02-24 12:23:50 -07:00
|
|
|
end)
|