aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ui/cmdline_spec.lua
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2023-11-29 21:52:58 +0000
committerJosh Rahm <joshuarahm@gmail.com>2023-11-29 21:52:58 +0000
commit931bffbda3668ddc609fc1da8f9eb576b170aa52 (patch)
treed8c1843a95da5ea0bb4acc09f7e37843d9995c86 /test/functional/ui/cmdline_spec.lua
parent142d9041391780ac15b89886a54015fdc5c73995 (diff)
parent4a8bf24ac690004aedf5540fa440e788459e5e34 (diff)
downloadrneovim-931bffbda3668ddc609fc1da8f9eb576b170aa52.tar.gz
rneovim-931bffbda3668ddc609fc1da8f9eb576b170aa52.tar.bz2
rneovim-931bffbda3668ddc609fc1da8f9eb576b170aa52.zip
Merge remote-tracking branch 'upstream/master' into userreguserreg
Diffstat (limited to 'test/functional/ui/cmdline_spec.lua')
-rw-r--r--test/functional/ui/cmdline_spec.lua181
1 files changed, 172 insertions, 9 deletions
diff --git a/test/functional/ui/cmdline_spec.lua b/test/functional/ui/cmdline_spec.lua
index 1c9ac7f7ba..188b9ee87b 100644
--- a/test/functional/ui/cmdline_spec.lua
+++ b/test/functional/ui/cmdline_spec.lua
@@ -24,6 +24,7 @@ local function new_screen(opt)
[7] = {bold = true, foreground = Screen.colors.Brown},
[8] = {background = Screen.colors.LightGrey},
[9] = {bold = true},
+ [10] = {background = Screen.colors.Yellow1};
})
return screen
end
@@ -316,7 +317,7 @@ local function test_cmdline(linegrid)
screen:expect{grid=[[
|
{2:[No Name] }|
- {1::}make^ |
+ {1::}mak^e |
{3:[Command Line] }|
|
]]}
@@ -326,7 +327,7 @@ local function test_cmdline(linegrid)
screen:expect{grid=[[
|
{2:[No Name] }|
- {1::}make^ |
+ {1::}mak^e |
{3:[Command Line] }|
|
]], cmdline={nil, {
@@ -339,7 +340,7 @@ local function test_cmdline(linegrid)
screen:expect{grid=[[
|
{2:[No Name] }|
- {1::}make^ |
+ {1::}mak^e |
{3:[Command Line] }|
|
]], cmdline={nil, {
@@ -352,7 +353,7 @@ local function test_cmdline(linegrid)
screen:expect{grid=[[
|
{2:[No Name] }|
- {1::}make^ |
+ {1::}mak^e |
{3:[Command Line] }|
|
]]}
@@ -771,6 +772,84 @@ describe('cmdline redraw', function()
:^abc |
]])
end)
+
+ it('with rightleftcmd', function()
+ command('set rightleft rightleftcmd=search shortmess+=s')
+ meths.buf_set_lines(0, 0, -1, true, {"let's rock!"})
+ screen:expect{grid=[[
+ !kcor s'te^l|
+ {1: ~}|
+ {1: ~}|
+ {1: ~}|
+ |
+ ]]}
+
+ feed '/'
+ screen:expect{grid=[[
+ !kcor s'tel|
+ {1: ~}|
+ {1: ~}|
+ {1: ~}|
+ ^ /|
+ ]]}
+
+ feed "let's"
+ -- note: cursor looks off but looks alright in real use
+ -- when rendered as a block so it touches the end of the text
+ screen:expect{grid=[[
+ !kcor {2:s'tel}|
+ {1: ~}|
+ {1: ~}|
+ {1: ~}|
+ ^ s'tel/|
+ ]]}
+
+ -- cursor movement
+ feed "<space>"
+ screen:expect{grid=[[
+ !kcor{2: s'tel}|
+ {1: ~}|
+ {1: ~}|
+ {1: ~}|
+ ^ s'tel/|
+ ]]}
+
+ feed "rock"
+ screen:expect{grid=[[
+ !{2:kcor s'tel}|
+ {1: ~}|
+ {1: ~}|
+ {1: ~}|
+ ^ kcor s'tel/|
+ ]]}
+
+ feed "<right>"
+ screen:expect{grid=[[
+ !{2:kcor s'tel}|
+ {1: ~}|
+ {1: ~}|
+ {1: ~}|
+ ^kcor s'tel/|
+ ]]}
+
+ feed "<left>"
+ screen:expect{grid=[[
+ !{2:kcor s'tel}|
+ {1: ~}|
+ {1: ~}|
+ {1: ~}|
+ ^ kcor s'tel/|
+ ]]}
+
+ feed "<cr>"
+ screen:expect{grid=[[
+ !{10:kcor s'te^l}|
+ {1: ~}|
+ {1: ~}|
+ {1: ~}|
+ kcor s'tel/ |
+ ]]}
+ end)
end)
describe('statusline is redrawn on entering cmdline', function()
@@ -944,15 +1023,64 @@ describe('statusline is redrawn on entering cmdline', function()
end)
end)
+it('tabline is not redrawn in Ex mode #24122', function()
+ clear()
+ local screen = Screen.new(60, 5)
+ screen:set_default_attr_ids({
+ [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
+ [1] = {bold = true, reverse = true}, -- MsgSeparator
+ [2] = {reverse = true}, -- TabLineFill
+ })
+ screen:attach()
+
+ exec([[
+ set showtabline=2
+ set tabline=%!MyTabLine()
+
+ function! MyTabLine()
+
+ return "foo"
+ endfunction
+ ]])
+
+ feed('gQ')
+ screen:expect{grid=[[
+ {2:foo }|
+ |
+ {1: }|
+ Entering Ex mode. Type "visual" to go to Normal mode. |
+ :^ |
+ ]]}
+
+ feed('echo 1<CR>')
+ screen:expect{grid=[[
+ {1: }|
+ Entering Ex mode. Type "visual" to go to Normal mode. |
+ :echo 1 |
+ 1 |
+ :^ |
+ ]]}
+end)
+
describe("cmdline height", function()
+ before_each(clear)
+
it("does not crash resized screen #14263", function()
- clear()
local screen = Screen.new(25, 10)
screen:attach()
command('set cmdheight=9999')
screen:try_resize(25, 5)
assert_alive()
end)
+
+ it('unchanged when restoring window sizes with global statusline', function()
+ command('set cmdheight=2 laststatus=2')
+ feed('q:')
+ command('set cmdheight=1 laststatus=3 | quit')
+ -- Available lines changed, so closing cmdwin should skip restoring window sizes, leaving the
+ -- cmdheight unchanged.
+ eq(1, eval('&cmdheight'))
+ end)
end)
describe('cmdheight=0', function()
@@ -972,6 +1100,26 @@ describe('cmdheight=0', function()
screen:attach()
end)
+ it("with redrawdebug=invalid resize -1", function()
+ command("set redrawdebug=invalid cmdheight=0 noruler laststatus=0")
+ screen:expect{grid=[[
+ ^ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ]]}
+ feed(":resize -1<CR>")
+ screen:expect{grid=[[
+ ^ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ |
+ ]]}
+ assert_alive()
+ end)
+
it("with cmdheight=1 noruler laststatus=2", function()
command("set cmdheight=1 noruler laststatus=2")
screen:expect{grid=[[
@@ -1226,6 +1374,7 @@ describe('cmdheight=0', function()
it('with multigrid', function()
clear{args={'--cmd', 'set cmdheight=0'}}
screen:attach{ext_multigrid=true}
+ meths.buf_set_lines(0, 0, -1, true, {'p'})
screen:expect{grid=[[
## grid 1
[2:-------------------------]|
@@ -1234,14 +1383,14 @@ describe('cmdheight=0', function()
[2:-------------------------]|
[2:-------------------------]|
## grid 2
- ^ |
+ ^p |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
## grid 3
]], win_viewport={
- [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
}}
feed '/p'
@@ -1253,7 +1402,7 @@ describe('cmdheight=0', function()
[2:-------------------------]|
[3:-------------------------]|
## grid 2
- |
+ {6:p} |
{1:~ }|
{1:~ }|
{1:~ }|
@@ -1261,7 +1410,7 @@ describe('cmdheight=0', function()
## grid 3
/p^ |
]], win_viewport={
- [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
}}
end)
@@ -1378,7 +1527,21 @@ describe('cmdheight=0', function()
|
]])
command('set cmdheight=0')
+ screen:expect{grid=[[
+ ^ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {2:[No Name] }|
+ ]]}
command('resize -1')
+ screen:expect{grid=[[
+ ^ |
+ {1:~ }|
+ {1:~ }|
+ {2:[No Name] }|
+ |
+ ]]}
command('resize +1')
screen:expect([[
^ |