2016-04-23 16:53:11 -07:00
|
|
|
local helpers = require('test.functional.helpers')(after_each)
|
2015-02-24 12:23:50 -07:00
|
|
|
local Screen = require('test.functional.ui.screen')
|
2017-04-08 14:12:26 -07:00
|
|
|
local clear, feed, command = helpers.clear, helpers.feed, helpers.command
|
2015-02-24 12:23:50 -07:00
|
|
|
local insert = helpers.insert
|
|
|
|
|
|
|
|
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)
|
|
|
|
screen:attach()
|
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},
|
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
|
|
|
after_each(function()
|
|
|
|
screen:detach()
|
2016-11-16 16:33:45 -07:00
|
|
|
end)
|
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([[
|
|
|
|
{1:∧} |
|
|
|
|
{1:∧} |
|
|
|
|
{1:∧} |
|
|
|
|
{1:∧} |
|
|
|
|
{1:∧} |
|
|
|
|
{1:∧} |
|
|
|
|
^ |
|
2016-08-09 05:22:54 -07:00
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
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([[
|
|
|
|
{1:∧} |
|
|
|
|
{1:∧} |
|
|
|
|
{1:∧} |
|
|
|
|
{1:∧} |
|
|
|
|
{1:∧} |
|
|
|
|
^&& |
|
|
|
|
|
|
2016-08-09 05:22:54 -07:00
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
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([[
|
|
|
|
^&& |
|
|
|
|
{1:∧} |
|
|
|
|
{1:∧} |
|
|
|
|
{1:∧} |
|
|
|
|
{1:∧} |
|
|
|
|
{1:∧} |
|
|
|
|
|
|
2016-08-09 05:22:54 -07:00
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
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:∧} |
|
|
|
|
^&& |
|
|
|
|
{1:∧} |
|
|
|
|
{1:∧} |
|
|
|
|
{1:∧} |
|
|
|
|
{1:∧} |
|
|
|
|
|
|
2016-08-09 05:22:54 -07:00
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
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([[
|
|
|
|
{1:∧} |
|
|
|
|
{1:∧} |
|
|
|
|
{1:∧} |
|
|
|
|
{1:∧} |
|
|
|
|
{1:∧} |
|
|
|
|
{1:∧} |
|
|
|
|
^ |
|
2016-08-09 05:22:54 -07:00
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
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([[
|
|
|
|
{1:λ} |
|
|
|
|
{1:λ} |
|
|
|
|
^ |
|
2016-08-09 05:22:54 -07:00
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
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([[
|
|
|
|
{1:R} |
|
|
|
|
{1:R} |
|
|
|
|
^ |
|
2016-08-09 05:22:54 -07:00
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
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([[
|
2015-06-20 13:16:10 -07:00
|
|
|
{1: } a region of text {1:-} |
|
|
|
|
{1: } a region of text {1:-} |
|
2015-02-24 12:23:50 -07:00
|
|
|
^ |
|
2016-08-09 05:22:54 -07:00
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
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([[
|
2015-06-20 13:16:10 -07:00
|
|
|
{1: } a region of text {1:-} |
|
|
|
|
{1: } a region of text {1:-} |
|
|
|
|
{1: } A region with {1: } a nested {1: } nested region.{1:-} |
|
2015-02-24 12:23:50 -07:00
|
|
|
{1:-} {1:-} |
|
|
|
|
^ |
|
2016-08-09 05:22:54 -07:00
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
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([[
|
|
|
|
{1:-} |
|
|
|
|
{1:-} |
|
|
|
|
^ |
|
2016-08-09 05:22:54 -07:00
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
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([[
|
|
|
|
{1:-} |
|
|
|
|
{1:-} |
|
|
|
|
<i> italian text </i> |
|
|
|
|
<i> italian text </i> |
|
|
|
|
^ |
|
2016-08-09 05:22:54 -07:00
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
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([[
|
|
|
|
{1:-} |
|
|
|
|
{1:-} |
|
|
|
|
{1:*} |
|
|
|
|
{1:*} |
|
|
|
|
^ |
|
2016-08-09 05:22:54 -07:00
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
2017-04-08 17:23:16 -07:00
|
|
|
|
|
2015-02-24 12:23:50 -07:00
|
|
|
]])
|
|
|
|
end)
|
|
|
|
end) -- a region of text (implicit concealing)
|
|
|
|
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 |
|
|
|
|
|
|
|
|
|
^ |
|
2016-08-09 05:22:54 -07:00
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
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} |
|
|
|
|
|
|
|
|
|
^ |
|
2016-08-09 05:22:54 -07:00
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
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} |
|
|
|
|
|
|
|
|
|
^ |
|
2016-08-09 05:22:54 -07:00
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
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 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
^ |
|
2016-08-09 05:22:54 -07:00
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
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([[
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo barf bar barf egg^s |
|
|
|
|
|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('between windows', function()
|
|
|
|
command("split")
|
|
|
|
screen:expect([[
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo barf bar barf egg^s |
|
|
|
|
|
|
|
|
|
{2:[No Name] [+] }|
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
|
|
|
|
|
{3:[No Name] [+] }|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
feed('<c-w>w')
|
|
|
|
|
|
|
|
screen:expect([[
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
|
|
|
|
|
{3:[No Name] [+] }|
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo barf bar barf egg^s |
|
|
|
|
|
|
|
|
|
{2:[No Name] [+] }|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('in insert mode', function()
|
|
|
|
feed('i')
|
|
|
|
screen:expect([[
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo barf bar barf egg^s |
|
|
|
|
|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{4:-- INSERT --} |
|
|
|
|
]])
|
|
|
|
|
|
|
|
feed('<up>')
|
|
|
|
screen:expect([[
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo barf bar barf egg^s |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{4:-- INSERT --} |
|
|
|
|
]])
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('between modes cocu=iv', function()
|
|
|
|
command('set cocu=iv')
|
|
|
|
feed('gg')
|
|
|
|
screen:expect([[
|
|
|
|
^foo barf bar barf eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
|
|
|
feed('i')
|
|
|
|
screen:expect([[
|
|
|
|
^foo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{4:-- INSERT --} |
|
|
|
|
]])
|
|
|
|
|
|
|
|
feed('<esc>')
|
|
|
|
screen:expect([[
|
|
|
|
^foo barf bar barf eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
|
|
|
feed('v')
|
|
|
|
screen:expect([[
|
|
|
|
^foo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{4:-- VISUAL --} |
|
|
|
|
]])
|
|
|
|
|
|
|
|
feed('<esc>')
|
|
|
|
screen:expect([[
|
|
|
|
^foo barf bar barf eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('between modes cocu=n', function()
|
|
|
|
command('set cocu=n')
|
|
|
|
feed('gg')
|
|
|
|
screen:expect([[
|
|
|
|
^foo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
|
|
|
feed('i')
|
|
|
|
screen:expect([[
|
|
|
|
^foo barf bar barf eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{4:-- INSERT --} |
|
|
|
|
]])
|
|
|
|
|
|
|
|
feed('<esc>')
|
|
|
|
screen:expect([[
|
|
|
|
^foo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
|
|
|
|
|
|
|
feed('v')
|
|
|
|
screen:expect([[
|
|
|
|
^foo barf bar barf eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{4:-- VISUAL --} |
|
|
|
|
]])
|
|
|
|
|
|
|
|
feed('<esc>')
|
|
|
|
screen:expect([[
|
|
|
|
^foo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('and open line', function()
|
|
|
|
feed('o')
|
|
|
|
screen:expect([[
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
^ |
|
|
|
|
|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{4:-- INSERT --} |
|
|
|
|
]])
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('and open line cocu=i', function()
|
|
|
|
command('set cocu=i')
|
|
|
|
feed('o')
|
|
|
|
screen:expect([[
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
^ |
|
|
|
|
|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{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 |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
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 |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
/^ |
|
|
|
|
]])
|
|
|
|
|
|
|
|
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 |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
/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} |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
/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 |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
/^ |
|
|
|
|
]])
|
|
|
|
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 |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
/^ |
|
|
|
|
]])
|
|
|
|
|
|
|
|
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 |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
/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} |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
/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 |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
/^ |
|
|
|
|
]])
|
|
|
|
|
|
|
|
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 |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
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 |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
|
|
|
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 |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
/^ |
|
|
|
|
]])
|
|
|
|
|
|
|
|
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 |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
/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 |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
/^ |
|
|
|
|
]])
|
|
|
|
|
|
|
|
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 |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
foo {1:b} bar {1:b} eggs |
|
|
|
|
|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
end)
|
|
|
|
end)
|
|
|
|
end)
|
2015-02-24 12:23:50 -07:00
|
|
|
end)
|