diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-12-03 11:59:00 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-03 11:59:00 +0800 |
commit | 0d885247b03439ee3aff4c0b9ec095a29bb21759 (patch) | |
tree | 8b3d8419bcfe2408ead3aaf1da73f05835292212 /test/functional/terminal | |
parent | 481a3158866638946c91fab28ae5bca97ff1e814 (diff) | |
parent | 64a14026d76ba1798d91e15a941fcb6af7cbc5ad (diff) | |
download | rneovim-0d885247b03439ee3aff4c0b9ec095a29bb21759.tar.gz rneovim-0d885247b03439ee3aff4c0b9ec095a29bb21759.tar.bz2 rneovim-0d885247b03439ee3aff4c0b9ec095a29bb21759.zip |
Merge pull request #26334 from echasnovski/default-colorscheme
feat(highlight): update default color scheme
Diffstat (limited to 'test/functional/terminal')
-rw-r--r-- | test/functional/terminal/api_spec.lua | 2 | ||||
-rw-r--r-- | test/functional/terminal/buffer_spec.lua | 6 | ||||
-rw-r--r-- | test/functional/terminal/cursor_spec.lua | 661 | ||||
-rw-r--r-- | test/functional/terminal/tui_spec.lua | 67 |
4 files changed, 388 insertions, 348 deletions
diff --git a/test/functional/terminal/api_spec.lua b/test/functional/terminal/api_spec.lua index 93641fc576..c278b2ad0e 100644 --- a/test/functional/terminal/api_spec.lua +++ b/test/functional/terminal/api_spec.lua @@ -12,7 +12,7 @@ describe('api', function() helpers.clear() os.remove(socket_name) screen = child_session.screen_setup(0, '["'..helpers.nvim_prog - ..'", "-u", "NONE", "-i", "NONE", "--cmd", "'..helpers.nvim_set..'"]') + ..'", "-u", "NONE", "-i", "NONE", "--cmd", "colorscheme vim", "--cmd", "'..helpers.nvim_set..'"]') end) after_each(function() os.remove(socket_name) diff --git a/test/functional/terminal/buffer_spec.lua b/test/functional/terminal/buffer_spec.lua index 6d8c214d87..423e7bdf21 100644 --- a/test/functional/terminal/buffer_spec.lua +++ b/test/functional/terminal/buffer_spec.lua @@ -446,8 +446,10 @@ end) describe('terminal input', function() it('sends various special keys with modifiers', function() clear() - local screen = thelpers.screen_setup(0, - string.format([=[["%s", "-u", "NONE", "-i", "NONE", "--cmd", "startinsert"]]=], nvim_prog)) + local screen = thelpers.screen_setup( + 0, + string.format([=[["%s", "-u", "NONE", "-i", "NONE", "--cmd", 'colorscheme vim', "--cmd", "startinsert"]]=], nvim_prog) + ) screen:expect{grid=[[ {1: } | {4:~ }| diff --git a/test/functional/terminal/cursor_spec.lua b/test/functional/terminal/cursor_spec.lua index 8285bcc26e..95081b7189 100644 --- a/test/functional/terminal/cursor_spec.lua +++ b/test/functional/terminal/cursor_spec.lua @@ -188,16 +188,22 @@ describe('buffer cursor position is correct in terminal without number column', ..[[", "-u", "NONE", "-i", "NONE", "-E", "--cmd", "let @r = ']]..str..[['", ]] -- <Left> and <Right> don't always work ..[["--cmd", "cnoremap <C-X> <Left>", "--cmd", "cnoremap <C-O> <Right>"]]..']', 70) + screen:set_default_attr_ids({ + [1] = {foreground = 253, background = 11}; + [3] = {bold = true}, + [16] = {background = 234, foreground = 253}; + [17] = {reverse = true, background = 234, foreground = 253}; + }) -- Also check for real cursor position, as it is used for stuff like input methods screen._handle_busy_start = function() end screen._handle_busy_stop = function() end screen:expect([[ - | - | - | - | - Entering Ex mode. Type "visual" to go to Normal mode. | - :{1:^ } | + {16: }| + {16: }| + {16: }| + {16: }| + {16:Entering Ex mode. Type "visual" to go to Normal mode. }| + {16::}{17:^ }{16: }| {3:-- TERMINAL --} | ]]) end @@ -212,23 +218,23 @@ describe('buffer cursor position is correct in terminal without number column', it('at the end', function() feed('<C-R>r') screen:expect([[ - | - | - | - | - Entering Ex mode. Type "visual" to go to Normal mode. | - :aaaaaaaa{1:^ } | + {16: }| + {16: }| + {16: }| + {16: }| + {16:Entering Ex mode. Type "visual" to go to Normal mode. }| + {16::aaaaaaaa}{17:^ }{16: }| {3:-- TERMINAL --} | ]]) eq({6, 9}, eval('nvim_win_get_cursor(0)')) feed([[<C-\><C-N>]]) screen:expect([[ - | - | - | - | - Entering Ex mode. Type "visual" to go to Normal mode. | - :aaaaaaa^a{2: } | + {16: }| + {16: }| + {16: }| + {16: }| + {16:Entering Ex mode. Type "visual" to go to Normal mode. }| + {16::aaaaaaa^a}{1: }{16: }| | ]]) eq({6, 8}, eval('nvim_win_get_cursor(0)')) @@ -237,23 +243,23 @@ describe('buffer cursor position is correct in terminal without number column', it('near the end', function() feed('<C-R>r<C-X><C-X>') screen:expect([[ - | - | - | - | - Entering Ex mode. Type "visual" to go to Normal mode. | - :aaaaaa{1:^a}a | + {16: }| + {16: }| + {16: }| + {16: }| + {16:Entering Ex mode. Type "visual" to go to Normal mode. }| + {16::aaaaaa}{17:^a}{16:a }| {3:-- TERMINAL --} | ]]) eq({6, 7}, eval('nvim_win_get_cursor(0)')) feed([[<C-\><C-N>]]) screen:expect([[ - | - | - | - | - Entering Ex mode. Type "visual" to go to Normal mode. | - :aaaaa^a{2:a}a | + {16: }| + {16: }| + {16: }| + {16: }| + {16:Entering Ex mode. Type "visual" to go to Normal mode. }| + {16::aaaaa^a}{1:a}{16:a }| | ]]) eq({6, 6}, eval('nvim_win_get_cursor(0)')) @@ -262,23 +268,23 @@ describe('buffer cursor position is correct in terminal without number column', it('near the start', function() feed('<C-R>r<C-B><C-O>') screen:expect([[ - | - | - | - | - Entering Ex mode. Type "visual" to go to Normal mode. | - :a{1:^a}aaaaaa | + {16: }| + {16: }| + {16: }| + {16: }| + {16:Entering Ex mode. Type "visual" to go to Normal mode. }| + {16::a}{17:^a}{16:aaaaaa }| {3:-- TERMINAL --} | ]]) eq({6, 2}, eval('nvim_win_get_cursor(0)')) feed([[<C-\><C-N>]]) screen:expect([[ - | - | - | - | - Entering Ex mode. Type "visual" to go to Normal mode. | - :^a{2:a}aaaaaa | + {16: }| + {16: }| + {16: }| + {16: }| + {16:Entering Ex mode. Type "visual" to go to Normal mode. }| + {16::^a}{1:a}{16:aaaaaa }| | ]]) eq({6, 1}, eval('nvim_win_get_cursor(0)')) @@ -293,23 +299,23 @@ describe('buffer cursor position is correct in terminal without number column', it('at the end', function() feed('<C-R>r') screen:expect([[ - | - | - | - | - Entering Ex mode. Type "visual" to go to Normal mode. | - :µµµµµµµµ{1:^ } | + {16: }| + {16: }| + {16: }| + {16: }| + {16:Entering Ex mode. Type "visual" to go to Normal mode. }| + {16::µµµµµµµµ}{17:^ }{16: }| {3:-- TERMINAL --} | ]]) eq({6, 17}, eval('nvim_win_get_cursor(0)')) feed([[<C-\><C-N>]]) screen:expect([[ - | - | - | - | - Entering Ex mode. Type "visual" to go to Normal mode. | - :µµµµµµµ^µ{2: } | + {16: }| + {16: }| + {16: }| + {16: }| + {16:Entering Ex mode. Type "visual" to go to Normal mode. }| + {16::µµµµµµµ^µ}{1: }{16: }| | ]]) eq({6, 15}, eval('nvim_win_get_cursor(0)')) @@ -318,23 +324,23 @@ describe('buffer cursor position is correct in terminal without number column', it('near the end', function() feed('<C-R>r<C-X><C-X>') screen:expect([[ - | - | - | - | - Entering Ex mode. Type "visual" to go to Normal mode. | - :µµµµµµ{1:^µ}µ | + {16: }| + {16: }| + {16: }| + {16: }| + {16:Entering Ex mode. Type "visual" to go to Normal mode. }| + {16::µµµµµµ}{17:^µ}{16:µ }| {3:-- TERMINAL --} | ]]) eq({6, 13}, eval('nvim_win_get_cursor(0)')) feed([[<C-\><C-N>]]) screen:expect([[ - | - | - | - | - Entering Ex mode. Type "visual" to go to Normal mode. | - :µµµµµ^µ{2:µ}µ | + {16: }| + {16: }| + {16: }| + {16: }| + {16:Entering Ex mode. Type "visual" to go to Normal mode. }| + {16::µµµµµ^µ}{1:µ}{16:µ }| | ]]) eq({6, 11}, eval('nvim_win_get_cursor(0)')) @@ -343,23 +349,23 @@ describe('buffer cursor position is correct in terminal without number column', it('near the start', function() feed('<C-R>r<C-B><C-O>') screen:expect([[ - | - | - | - | - Entering Ex mode. Type "visual" to go to Normal mode. | - :µ{1:^µ}µµµµµµ | + {16: }| + {16: }| + {16: }| + {16: }| + {16:Entering Ex mode. Type "visual" to go to Normal mode. }| + {16::µ}{17:^µ}{16:µµµµµµ }| {3:-- TERMINAL --} | ]]) eq({6, 3}, eval('nvim_win_get_cursor(0)')) feed([[<C-\><C-N>]]) screen:expect([[ - | - | - | - | - Entering Ex mode. Type "visual" to go to Normal mode. | - :^µ{2:µ}µµµµµµ | + {16: }| + {16: }| + {16: }| + {16: }| + {16:Entering Ex mode. Type "visual" to go to Normal mode. }| + {16::^µ}{1:µ}{16:µµµµµµ }| | ]]) eq({6, 1}, eval('nvim_win_get_cursor(0)')) @@ -376,23 +382,23 @@ describe('buffer cursor position is correct in terminal without number column', it('at the end', function() feed('<C-R>r') screen:expect([[ - | - | - | - | - Entering Ex mode. Type "visual" to go to Normal mode. | - :µ̳µ̳µ̳µ̳µ̳µ̳µ̳µ̳{1:^ } | + {16: }| + {16: }| + {16: }| + {16: }| + {16:Entering Ex mode. Type "visual" to go to Normal mode. }| + {16::µ̳µ̳µ̳µ̳µ̳µ̳µ̳µ̳}{17:^ }{16: }| {3:-- TERMINAL --} | ]]) eq({6, 33}, eval('nvim_win_get_cursor(0)')) feed([[<C-\><C-N>]]) screen:expect([[ - | - | - | - | - Entering Ex mode. Type "visual" to go to Normal mode. | - :µ̳µ̳µ̳µ̳µ̳µ̳µ̳^µ̳{2: } | + {16: }| + {16: }| + {16: }| + {16: }| + {16:Entering Ex mode. Type "visual" to go to Normal mode. }| + {16::µ̳µ̳µ̳µ̳µ̳µ̳µ̳^µ̳}{1: }{16: }| | ]]) eq({6, 29}, eval('nvim_win_get_cursor(0)')) @@ -401,23 +407,23 @@ describe('buffer cursor position is correct in terminal without number column', it('near the end', function() feed('<C-R>r<C-X><C-X>') screen:expect([[ - | - | - | - | - Entering Ex mode. Type "visual" to go to Normal mode. | - :µ̳µ̳µ̳µ̳µ̳µ̳{1:^µ̳}µ̳ | + {16: }| + {16: }| + {16: }| + {16: }| + {16:Entering Ex mode. Type "visual" to go to Normal mode. }| + {16::µ̳µ̳µ̳µ̳µ̳µ̳}{17:^µ̳}{16:µ̳ }| {3:-- TERMINAL --} | ]]) eq({6, 25}, eval('nvim_win_get_cursor(0)')) feed([[<C-\><C-N>]]) screen:expect([[ - | - | - | - | - Entering Ex mode. Type "visual" to go to Normal mode. | - :µ̳µ̳µ̳µ̳µ̳^µ̳{2:µ̳}µ̳ | + {16: }| + {16: }| + {16: }| + {16: }| + {16:Entering Ex mode. Type "visual" to go to Normal mode. }| + {16::µ̳µ̳µ̳µ̳µ̳^µ̳}{1:µ̳}{16:µ̳ }| | ]]) eq({6, 21}, eval('nvim_win_get_cursor(0)')) @@ -426,23 +432,23 @@ describe('buffer cursor position is correct in terminal without number column', it('near the start', function() feed('<C-R>r<C-B><C-O>') screen:expect([[ - | - | - | - | - Entering Ex mode. Type "visual" to go to Normal mode. | - :µ̳{1:^µ̳}µ̳µ̳µ̳µ̳µ̳µ̳ | + {16: }| + {16: }| + {16: }| + {16: }| + {16:Entering Ex mode. Type "visual" to go to Normal mode. }| + {16::µ̳}{17:^µ̳}{16:µ̳µ̳µ̳µ̳µ̳µ̳ }| {3:-- TERMINAL --} | ]]) eq({6, 5}, eval('nvim_win_get_cursor(0)')) feed([[<C-\><C-N>]]) screen:expect([[ - | - | - | - | - Entering Ex mode. Type "visual" to go to Normal mode. | - :^µ̳{2:µ̳}µ̳µ̳µ̳µ̳µ̳µ̳ | + {16: }| + {16: }| + {16: }| + {16: }| + {16:Entering Ex mode. Type "visual" to go to Normal mode. }| + {16::^µ̳}{1:µ̳}{16:µ̳µ̳µ̳µ̳µ̳µ̳ }| | ]]) eq({6, 1}, eval('nvim_win_get_cursor(0)')) @@ -459,23 +465,23 @@ describe('buffer cursor position is correct in terminal without number column', it('at the end', function() feed('<C-R>r') screen:expect([[ - | - | - | - | - Entering Ex mode. Type "visual" to go to Normal mode. | - :哦哦哦哦哦哦哦哦{1:^ } | + {16: }| + {16: }| + {16: }| + {16: }| + {16:Entering Ex mode. Type "visual" to go to Normal mode. }| + {16::哦哦哦哦哦哦哦哦}{17:^ }{16: }| {3:-- TERMINAL --} | ]]) eq({6, 25}, eval('nvim_win_get_cursor(0)')) feed([[<C-\><C-N>]]) screen:expect([[ - | - | - | - | - Entering Ex mode. Type "visual" to go to Normal mode. | - :哦哦哦哦哦哦哦^哦{2: } | + {16: }| + {16: }| + {16: }| + {16: }| + {16:Entering Ex mode. Type "visual" to go to Normal mode. }| + {16::哦哦哦哦哦哦哦^哦}{1: }{16: }| | ]]) eq({6, 22}, eval('nvim_win_get_cursor(0)')) @@ -484,23 +490,23 @@ describe('buffer cursor position is correct in terminal without number column', it('near the end', function() feed('<C-R>r<C-X><C-X>') screen:expect([[ - | - | - | - | - Entering Ex mode. Type "visual" to go to Normal mode. | - :哦哦哦哦哦哦{1:^哦}哦 | + {16: }| + {16: }| + {16: }| + {16: }| + {16:Entering Ex mode. Type "visual" to go to Normal mode. }| + {16::哦哦哦哦哦哦}{17:^哦}{16:哦 }| {3:-- TERMINAL --} | ]]) eq({6, 19}, eval('nvim_win_get_cursor(0)')) feed([[<C-\><C-N>]]) screen:expect([[ - | - | - | - | - Entering Ex mode. Type "visual" to go to Normal mode. | - :哦哦哦哦哦^哦{2:哦}哦 | + {16: }| + {16: }| + {16: }| + {16: }| + {16:Entering Ex mode. Type "visual" to go to Normal mode. }| + {16::哦哦哦哦哦^哦}{1:哦}{16:哦 }| | ]]) eq({6, 16}, eval('nvim_win_get_cursor(0)')) @@ -509,23 +515,23 @@ describe('buffer cursor position is correct in terminal without number column', it('near the start', function() feed('<C-R>r<C-B><C-O>') screen:expect([[ - | - | - | - | - Entering Ex mode. Type "visual" to go to Normal mode. | - :哦{1:^哦}哦哦哦哦哦哦 | + {16: }| + {16: }| + {16: }| + {16: }| + {16:Entering Ex mode. Type "visual" to go to Normal mode. }| + {16::哦}{17:^哦}{16:哦哦哦哦哦哦 }| {3:-- TERMINAL --} | ]]) eq({6, 4}, eval('nvim_win_get_cursor(0)')) feed([[<C-\><C-N>]]) screen:expect([[ - | - | - | - | - Entering Ex mode. Type "visual" to go to Normal mode. | - :^哦{2:哦}哦哦哦哦哦哦 | + {16: }| + {16: }| + {16: }| + {16: }| + {16:Entering Ex mode. Type "visual" to go to Normal mode. }| + {16::^哦}{1:哦}{16:哦哦哦哦哦哦 }| | ]]) eq({6, 1}, eval('nvim_win_get_cursor(0)')) @@ -536,24 +542,24 @@ describe('buffer cursor position is correct in terminal without number column', setup_ex_register('aaaaaaaa ') feed('<C-R>r') screen:expect([[ - | - | - | - | - Entering Ex mode. Type "visual" to go to Normal mode. | - :aaaaaaaa {1:^ } | + {16: }| + {16: }| + {16: }| + {16: }| + {16:Entering Ex mode. Type "visual" to go to Normal mode. }| + {16::aaaaaaaa }{17:^ }{16: }| {3:-- TERMINAL --} | ]]) matches('^:aaaaaaaa [ ]*$', eval('nvim_get_current_line()')) eq({6, 13}, eval('nvim_win_get_cursor(0)')) feed([[<C-\><C-N>]]) screen:expect([[ - | - | - | - | - Entering Ex mode. Type "visual" to go to Normal mode. | - :aaaaaaaa ^ {2: } | + {16: }| + {16: }| + {16: }| + {16: }| + {16:Entering Ex mode. Type "visual" to go to Normal mode. }| + {16::aaaaaaaa ^ }{1: }{16: }| | ]]) eq({6, 12}, eval('nvim_win_get_cursor(0)')) @@ -568,16 +574,23 @@ describe('buffer cursor position is correct in terminal with number column', fun ..[[", "-u", "NONE", "-i", "NONE", "-E", "--cmd", "let @r = ']]..str..[['", ]] -- <Left> and <Right> don't always work ..[["--cmd", "cnoremap <C-X> <Left>", "--cmd", "cnoremap <C-O> <Right>"]]..']', 70) + screen:set_default_attr_ids({ + [1] = {foreground = 253, background = 11}; + [3] = {bold = true}, + [7] = {foreground = 130}; + [16] = {background = 234, foreground = 253}; + [17] = {reverse = true, background = 234, foreground = 253}; + }) -- Also check for real cursor position, as it is used for stuff like input methods screen._handle_busy_start = function() end screen._handle_busy_stop = function() end screen:expect([[ - {7: 1 } | - {7: 2 } | - {7: 3 } | - {7: 4 } | - {7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | - {7: 6 }:{1:^ } | + {7: 1 }{16: }| + {7: 2 }{16: }| + {7: 3 }{16: }| + {7: 4 }{16: }| + {7: 5 }{16:Entering Ex mode. Type "visual" to go to Normal mode. }| + {7: 6 }{16::}{17:^ }{16: }| {3:-- TERMINAL --} | ]]) end @@ -595,23 +608,23 @@ describe('buffer cursor position is correct in terminal with number column', fun it('at the end', function() feed('<C-R>r') screen:expect([[ - {7: 1 } | - {7: 2 } | - {7: 3 } | - {7: 4 } | - {7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | - {7: 6 }:aaaaaaaa{1:^ } | + {7: 1 }{16: }| + {7: 2 }{16: }| + {7: 3 }{16: }| + {7: 4 }{16: }| + {7: 5 }{16:Entering Ex mode. Type "visual" to go to Normal mode. }| + {7: 6 }{16::aaaaaaaa}{17:^ }{16: }| {3:-- TERMINAL --} | ]]) eq({6, 9}, eval('nvim_win_get_cursor(0)')) feed([[<C-\><C-N>]]) screen:expect([[ - {7: 1 } | - {7: 2 } | - {7: 3 } | - {7: 4 } | - {7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | - {7: 6 }:aaaaaaa^a{2: } | + {7: 1 }{16: }| + {7: 2 }{16: }| + {7: 3 }{16: }| + {7: 4 }{16: }| + {7: 5 }{16:Entering Ex mode. Type "visual" to go to Normal mode. }| + {7: 6 }{16::aaaaaaa^a}{1: }{16: }| | ]]) eq({6, 8}, eval('nvim_win_get_cursor(0)')) @@ -620,23 +633,23 @@ describe('buffer cursor position is correct in terminal with number column', fun it('near the end', function() feed('<C-R>r<C-X><C-X>') screen:expect([[ - {7: 1 } | - {7: 2 } | - {7: 3 } | - {7: 4 } | - {7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | - {7: 6 }:aaaaaa{1:^a}a | + {7: 1 }{16: }| + {7: 2 }{16: }| + {7: 3 }{16: }| + {7: 4 }{16: }| + {7: 5 }{16:Entering Ex mode. Type "visual" to go to Normal mode. }| + {7: 6 }{16::aaaaaa}{17:^a}{16:a }| {3:-- TERMINAL --} | ]]) eq({6, 7}, eval('nvim_win_get_cursor(0)')) feed([[<C-\><C-N>]]) screen:expect([[ - {7: 1 } | - {7: 2 } | - {7: 3 } | - {7: 4 } | - {7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | - {7: 6 }:aaaaa^a{2:a}a | + {7: 1 }{16: }| + {7: 2 }{16: }| + {7: 3 }{16: }| + {7: 4 }{16: }| + {7: 5 }{16:Entering Ex mode. Type "visual" to go to Normal mode. }| + {7: 6 }{16::aaaaa^a}{1:a}{16:a }| | ]]) eq({6, 6}, eval('nvim_win_get_cursor(0)')) @@ -645,23 +658,23 @@ describe('buffer cursor position is correct in terminal with number column', fun it('near the start', function() feed('<C-R>r<C-B><C-O>') screen:expect([[ - {7: 1 } | - {7: 2 } | - {7: 3 } | - {7: 4 } | - {7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | - {7: 6 }:a{1:^a}aaaaaa | + {7: 1 }{16: }| + {7: 2 }{16: }| + {7: 3 }{16: }| + {7: 4 }{16: }| + {7: 5 }{16:Entering Ex mode. Type "visual" to go to Normal mode. }| + {7: 6 }{16::a}{17:^a}{16:aaaaaa }| {3:-- TERMINAL --} | ]]) eq({6, 2}, eval('nvim_win_get_cursor(0)')) feed([[<C-\><C-N>]]) screen:expect([[ - {7: 1 } | - {7: 2 } | - {7: 3 } | - {7: 4 } | - {7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | - {7: 6 }:^a{2:a}aaaaaa | + {7: 1 }{16: }| + {7: 2 }{16: }| + {7: 3 }{16: }| + {7: 4 }{16: }| + {7: 5 }{16:Entering Ex mode. Type "visual" to go to Normal mode. }| + {7: 6 }{16::^a}{1:a}{16:aaaaaa }| | ]]) eq({6, 1}, eval('nvim_win_get_cursor(0)')) @@ -676,23 +689,23 @@ describe('buffer cursor position is correct in terminal with number column', fun it('at the end', function() feed('<C-R>r') screen:expect([[ - {7: 1 } | - {7: 2 } | - {7: 3 } | - {7: 4 } | - {7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | - {7: 6 }:µµµµµµµµ{1:^ } | + {7: 1 }{16: }| + {7: 2 }{16: }| + {7: 3 }{16: }| + {7: 4 }{16: }| + {7: 5 }{16:Entering Ex mode. Type "visual" to go to Normal mode. }| + {7: 6 }{16::µµµµµµµµ}{17:^ }{16: }| {3:-- TERMINAL --} | ]]) eq({6, 17}, eval('nvim_win_get_cursor(0)')) feed([[<C-\><C-N>]]) screen:expect([[ - {7: 1 } | - {7: 2 } | - {7: 3 } | - {7: 4 } | - {7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | - {7: 6 }:µµµµµµµ^µ{2: } | + {7: 1 }{16: }| + {7: 2 }{16: }| + {7: 3 }{16: }| + {7: 4 }{16: }| + {7: 5 }{16:Entering Ex mode. Type "visual" to go to Normal mode. }| + {7: 6 }{16::µµµµµµµ^µ}{1: }{16: }| | ]]) eq({6, 15}, eval('nvim_win_get_cursor(0)')) @@ -701,23 +714,23 @@ describe('buffer cursor position is correct in terminal with number column', fun it('near the end', function() feed('<C-R>r<C-X><C-X>') screen:expect([[ - {7: 1 } | - {7: 2 } | - {7: 3 } | - {7: 4 } | - {7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | - {7: 6 }:µµµµµµ{1:^µ}µ | + {7: 1 }{16: }| + {7: 2 }{16: }| + {7: 3 }{16: }| + {7: 4 }{16: }| + {7: 5 }{16:Entering Ex mode. Type "visual" to go to Normal mode. }| + {7: 6 }{16::µµµµµµ}{17:^µ}{16:µ }| {3:-- TERMINAL --} | ]]) eq({6, 13}, eval('nvim_win_get_cursor(0)')) feed([[<C-\><C-N>]]) screen:expect([[ - {7: 1 } | - {7: 2 } | - {7: 3 } | - {7: 4 } | - {7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | - {7: 6 }:µµµµµ^µ{2:µ}µ | + {7: 1 }{16: }| + {7: 2 }{16: }| + {7: 3 }{16: }| + {7: 4 }{16: }| + {7: 5 }{16:Entering Ex mode. Type "visual" to go to Normal mode. }| + {7: 6 }{16::µµµµµ^µ}{1:µ}{16:µ }| | ]]) eq({6, 11}, eval('nvim_win_get_cursor(0)')) @@ -726,23 +739,23 @@ describe('buffer cursor position is correct in terminal with number column', fun it('near the start', function() feed('<C-R>r<C-B><C-O>') screen:expect([[ - {7: 1 } | - {7: 2 } | - {7: 3 } | - {7: 4 } | - {7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | - {7: 6 }:µ{1:^µ}µµµµµµ | + {7: 1 }{16: }| + {7: 2 }{16: }| + {7: 3 }{16: }| + {7: 4 }{16: }| + {7: 5 }{16:Entering Ex mode. Type "visual" to go to Normal mode. }| + {7: 6 }{16::µ}{17:^µ}{16:µµµµµµ }| {3:-- TERMINAL --} | ]]) eq({6, 3}, eval('nvim_win_get_cursor(0)')) feed([[<C-\><C-N>]]) screen:expect([[ - {7: 1 } | - {7: 2 } | - {7: 3 } | - {7: 4 } | - {7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | - {7: 6 }:^µ{2:µ}µµµµµµ | + {7: 1 }{16: }| + {7: 2 }{16: }| + {7: 3 }{16: }| + {7: 4 }{16: }| + {7: 5 }{16:Entering Ex mode. Type "visual" to go to Normal mode. }| + {7: 6 }{16::^µ}{1:µ}{16:µµµµµµ }| | ]]) eq({6, 1}, eval('nvim_win_get_cursor(0)')) @@ -759,23 +772,23 @@ describe('buffer cursor position is correct in terminal with number column', fun it('at the end', function() feed('<C-R>r') screen:expect([[ - {7: 1 } | - {7: 2 } | - {7: 3 } | - {7: 4 } | - {7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | - {7: 6 }:µ̳µ̳µ̳µ̳µ̳µ̳µ̳µ̳{1:^ } | + {7: 1 }{16: }| + {7: 2 }{16: }| + {7: 3 }{16: }| + {7: 4 }{16: }| + {7: 5 }{16:Entering Ex mode. Type "visual" to go to Normal mode. }| + {7: 6 }{16::µ̳µ̳µ̳µ̳µ̳µ̳µ̳µ̳}{17:^ }{16: }| {3:-- TERMINAL --} | ]]) eq({6, 33}, eval('nvim_win_get_cursor(0)')) feed([[<C-\><C-N>]]) screen:expect([[ - {7: 1 } | - {7: 2 } | - {7: 3 } | - {7: 4 } | - {7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | - {7: 6 }:µ̳µ̳µ̳µ̳µ̳µ̳µ̳^µ̳{2: } | + {7: 1 }{16: }| + {7: 2 }{16: }| + {7: 3 }{16: }| + {7: 4 }{16: }| + {7: 5 }{16:Entering Ex mode. Type "visual" to go to Normal mode. }| + {7: 6 }{16::µ̳µ̳µ̳µ̳µ̳µ̳µ̳^µ̳}{1: }{16: }| | ]]) eq({6, 29}, eval('nvim_win_get_cursor(0)')) @@ -784,23 +797,23 @@ describe('buffer cursor position is correct in terminal with number column', fun it('near the end', function() feed('<C-R>r<C-X><C-X>') screen:expect([[ - {7: 1 } | - {7: 2 } | - {7: 3 } | - {7: 4 } | - {7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | - {7: 6 }:µ̳µ̳µ̳µ̳µ̳µ̳{1:^µ̳}µ̳ | + {7: 1 }{16: }| + {7: 2 }{16: }| + {7: 3 }{16: }| + {7: 4 }{16: }| + {7: 5 }{16:Entering Ex mode. Type "visual" to go to Normal mode. }| + {7: 6 }{16::µ̳µ̳µ̳µ̳µ̳µ̳}{17:^µ̳}{16:µ̳ }| {3:-- TERMINAL --} | ]]) eq({6, 25}, eval('nvim_win_get_cursor(0)')) feed([[<C-\><C-N>]]) screen:expect([[ - {7: 1 } | - {7: 2 } | - {7: 3 } | - {7: 4 } | - {7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | - {7: 6 }:µ̳µ̳µ̳µ̳µ̳^µ̳{2:µ̳}µ̳ | + {7: 1 }{16: }| + {7: 2 }{16: }| + {7: 3 }{16: }| + {7: 4 }{16: }| + {7: 5 }{16:Entering Ex mode. Type "visual" to go to Normal mode. }| + {7: 6 }{16::µ̳µ̳µ̳µ̳µ̳^µ̳}{1:µ̳}{16:µ̳ }| | ]]) eq({6, 21}, eval('nvim_win_get_cursor(0)')) @@ -809,23 +822,23 @@ describe('buffer cursor position is correct in terminal with number column', fun it('near the start', function() feed('<C-R>r<C-B><C-O>') screen:expect([[ - {7: 1 } | - {7: 2 } | - {7: 3 } | - {7: 4 } | - {7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | - {7: 6 }:µ̳{1:^µ̳}µ̳µ̳µ̳µ̳µ̳µ̳ | + {7: 1 }{16: }| + {7: 2 }{16: }| + {7: 3 }{16: }| + {7: 4 }{16: }| + {7: 5 }{16:Entering Ex mode. Type "visual" to go to Normal mode. }| + {7: 6 }{16::µ̳}{17:^µ̳}{16:µ̳µ̳µ̳µ̳µ̳µ̳ }| {3:-- TERMINAL --} | ]]) eq({6, 5}, eval('nvim_win_get_cursor(0)')) feed([[<C-\><C-N>]]) screen:expect([[ - {7: 1 } | - {7: 2 } | - {7: 3 } | - {7: 4 } | - {7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | - {7: 6 }:^µ̳{2:µ̳}µ̳µ̳µ̳µ̳µ̳µ̳ | + {7: 1 }{16: }| + {7: 2 }{16: }| + {7: 3 }{16: }| + {7: 4 }{16: }| + {7: 5 }{16:Entering Ex mode. Type "visual" to go to Normal mode. }| + {7: 6 }{16::^µ̳}{1:µ̳}{16:µ̳µ̳µ̳µ̳µ̳µ̳ }| | ]]) eq({6, 1}, eval('nvim_win_get_cursor(0)')) @@ -842,23 +855,23 @@ describe('buffer cursor position is correct in terminal with number column', fun it('at the end', function() feed('<C-R>r') screen:expect([[ - {7: 1 } | - {7: 2 } | - {7: 3 } | - {7: 4 } | - {7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | - {7: 6 }:哦哦哦哦哦哦哦哦{1:^ } | + {7: 1 }{16: }| + {7: 2 }{16: }| + {7: 3 }{16: }| + {7: 4 }{16: }| + {7: 5 }{16:Entering Ex mode. Type "visual" to go to Normal mode. }| + {7: 6 }{16::哦哦哦哦哦哦哦哦}{17:^ }{16: }| {3:-- TERMINAL --} | ]]) eq({6, 25}, eval('nvim_win_get_cursor(0)')) feed([[<C-\><C-N>]]) screen:expect([[ - {7: 1 } | - {7: 2 } | - {7: 3 } | - {7: 4 } | - {7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | - {7: 6 }:哦哦哦哦哦哦哦^哦{2: } | + {7: 1 }{16: }| + {7: 2 }{16: }| + {7: 3 }{16: }| + {7: 4 }{16: }| + {7: 5 }{16:Entering Ex mode. Type "visual" to go to Normal mode. }| + {7: 6 }{16::哦哦哦哦哦哦哦^哦}{1: }{16: }| | ]]) eq({6, 22}, eval('nvim_win_get_cursor(0)')) @@ -867,23 +880,23 @@ describe('buffer cursor position is correct in terminal with number column', fun it('near the end', function() feed('<C-R>r<C-X><C-X>') screen:expect([[ - {7: 1 } | - {7: 2 } | - {7: 3 } | - {7: 4 } | - {7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | - {7: 6 }:哦哦哦哦哦哦{1:^哦}哦 | + {7: 1 }{16: }| + {7: 2 }{16: }| + {7: 3 }{16: }| + {7: 4 }{16: }| + {7: 5 }{16:Entering Ex mode. Type "visual" to go to Normal mode. }| + {7: 6 }{16::哦哦哦哦哦哦}{17:^哦}{16:哦 }| {3:-- TERMINAL --} | ]]) eq({6, 19}, eval('nvim_win_get_cursor(0)')) feed([[<C-\><C-N>]]) screen:expect([[ - {7: 1 } | - {7: 2 } | - {7: 3 } | - {7: 4 } | - {7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | - {7: 6 }:哦哦哦哦哦^哦{2:哦}哦 | + {7: 1 }{16: }| + {7: 2 }{16: }| + {7: 3 }{16: }| + {7: 4 }{16: }| + {7: 5 }{16:Entering Ex mode. Type "visual" to go to Normal mode. }| + {7: 6 }{16::哦哦哦哦哦^哦}{1:哦}{16:哦 }| | ]]) eq({6, 16}, eval('nvim_win_get_cursor(0)')) @@ -892,23 +905,23 @@ describe('buffer cursor position is correct in terminal with number column', fun it('near the start', function() feed('<C-R>r<C-B><C-O>') screen:expect([[ - {7: 1 } | - {7: 2 } | - {7: 3 } | - {7: 4 } | - {7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | - {7: 6 }:哦{1:^哦}哦哦哦哦哦哦 | + {7: 1 }{16: }| + {7: 2 }{16: }| + {7: 3 }{16: }| + {7: 4 }{16: }| + {7: 5 }{16:Entering Ex mode. Type "visual" to go to Normal mode. }| + {7: 6 }{16::哦}{17:^哦}{16:哦哦哦哦哦哦 }| {3:-- TERMINAL --} | ]]) eq({6, 4}, eval('nvim_win_get_cursor(0)')) feed([[<C-\><C-N>]]) screen:expect([[ - {7: 1 } | - {7: 2 } | - {7: 3 } | - {7: 4 } | - {7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | - {7: 6 }:^哦{2:哦}哦哦哦哦哦哦 | + {7: 1 }{16: }| + {7: 2 }{16: }| + {7: 3 }{16: }| + {7: 4 }{16: }| + {7: 5 }{16:Entering Ex mode. Type "visual" to go to Normal mode. }| + {7: 6 }{16::^哦}{1:哦}{16:哦哦哦哦哦哦 }| | ]]) eq({6, 1}, eval('nvim_win_get_cursor(0)')) @@ -919,24 +932,24 @@ describe('buffer cursor position is correct in terminal with number column', fun setup_ex_register('aaaaaaaa ') feed('<C-R>r') screen:expect([[ - {7: 1 } | - {7: 2 } | - {7: 3 } | - {7: 4 } | - {7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | - {7: 6 }:aaaaaaaa {1:^ } | + {7: 1 }{16: }| + {7: 2 }{16: }| + {7: 3 }{16: }| + {7: 4 }{16: }| + {7: 5 }{16:Entering Ex mode. Type "visual" to go to Normal mode. }| + {7: 6 }{16::aaaaaaaa }{17:^ }{16: }| {3:-- TERMINAL --} | ]]) matches('^:aaaaaaaa [ ]*$', eval('nvim_get_current_line()')) eq({6, 13}, eval('nvim_win_get_cursor(0)')) feed([[<C-\><C-N>]]) screen:expect([[ - {7: 1 } | - {7: 2 } | - {7: 3 } | - {7: 4 } | - {7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | - {7: 6 }:aaaaaaaa ^ {2: } | + {7: 1 }{16: }| + {7: 2 }{16: }| + {7: 3 }{16: }| + {7: 4 }{16: }| + {7: 5 }{16:Entering Ex mode. Type "visual" to go to Normal mode. }| + {7: 6 }{16::aaaaaaaa ^ }{1: }{16: }| | ]]) eq({6, 12}, eval('nvim_win_get_cursor(0)')) diff --git a/test/functional/terminal/tui_spec.lua b/test/functional/terminal/tui_spec.lua index 96ae0c4662..e0216a22a7 100644 --- a/test/functional/terminal/tui_spec.lua +++ b/test/functional/terminal/tui_spec.lua @@ -40,8 +40,12 @@ describe('TUI', function() clear() local child_server = new_pipename() screen = thelpers.screen_setup(0, - string.format([=[["%s", "--listen", "%s", "-u", "NONE", "-i", "NONE", "--cmd", "%s laststatus=2 background=dark"]]=], - nvim_prog, child_server, nvim_set)) + string.format( + [=[["%s", "--listen", "%s", "-u", "NONE", "-i", "NONE", "--cmd", "%s laststatus=2 background=dark", "--cmd", "colorscheme vim"]]=], + nvim_prog, + child_server, + nvim_set + )) screen:expect([[ {1: } | {4:~ }| @@ -1826,7 +1830,7 @@ describe('TUI', function() }) screen:attach() exec([[ - call termopen([v:progpath, '--clean', '--cmd', 'let start = reltime() | while v:true | if reltimefloat(reltime(start)) > 2 | break | endif | endwhile']) + call termopen([v:progpath, '--clean', '--cmd', 'colorscheme vim', '--cmd', 'let start = reltime() | while v:true | if reltimefloat(reltime(start)) > 2 | break | endif | endwhile']) sleep 500m vs new ]]) @@ -1852,7 +1856,7 @@ describe('TUI', function() write_file(script_file, [=[ local ffi = require('ffi') ffi.cdef([[int execl(const char *, const char *, ...);]]) - ffi.C.execl(vim.v.progpath, 'Xargv0nvim', '--clean') + ffi.C.execl(vim.v.progpath, 'Xargv0nvim', '--clean', '--cmd', 'colorscheme vim') ]=]) finally(function() os.remove(script_file) @@ -1870,12 +1874,12 @@ describe('TUI', function() ]]} feed_data(':put =v:argv + [v:progname]\n') screen:expect{grid=[[ - Xargv0nvim | - --embed | --clean | + --cmd | + colorscheme vim | {1:X}argv0nvim | - {5:[No Name] [+] 5,1 Bot}| - 4 more lines | + {5:[No Name] [+] 7,1 Bot}| + 6 more lines | {3:-- TERMINAL --} | ]]} end) @@ -1899,8 +1903,11 @@ describe('TUI', function() end) it('<C-h> #10134', function() - local screen = thelpers.screen_setup(0, '["'..nvim_prog - ..[[", "-u", "NONE", "-i", "NONE", "--cmd", "set noruler", "--cmd", ':nnoremap <C-h> :echomsg "\<C-h\>"<CR>']]..']') + local screen = thelpers.screen_setup( + 0, + '["'..nvim_prog..[[", "-u", "NONE", "-i", "NONE", "--cmd", "colorscheme vim", ]] + ..[["--cmd", "set noruler", "--cmd", ':nnoremap <C-h> :echomsg "\<C-h\>"<CR>']]..']' + ) screen:expect{grid=[[ {1: } | {4:~ }| @@ -1924,8 +1931,12 @@ describe('TUI', function() end) it('draws line with many trailing spaces correctly #24955', function() - local screen = thelpers.screen_setup(0, '["'..nvim_prog..[[", "-u", "NONE", "-i", "NONE"]] - ..[[, "--cmd", "call setline(1, ['1st line' .. repeat(' ', 153), '2nd line'])"]]..']', 80) + local screen = thelpers.screen_setup( + 0, + '["'..nvim_prog..[[", "-u", "NONE", "-i", "NONE", "--cmd", "colorscheme vim"]] + ..[[, "--cmd", "call setline(1, ['1st line' .. repeat(' ', 153), '2nd line'])"]]..']', + 80 + ) screen:expect{grid=[[ {1:1}st line | | @@ -1953,6 +1964,7 @@ describe('TUI UIEnter/UILeave', function() clear() local screen = thelpers.screen_setup(0, '["'..nvim_prog..'", "-u", "NONE", "-i", "NONE"' + ..[[, "--cmd", "colorscheme vim"]] ..[[, "--cmd", "set noswapfile noshowcmd noruler"]] ..[[, "--cmd", "let g:evs = []"]] ..[[, "--cmd", "autocmd UIEnter * :call add(g:evs, 'UIEnter')"]] @@ -1991,7 +2003,8 @@ describe('TUI FocusGained/FocusLost', function() local child_server = new_pipename() screen = thelpers.screen_setup(0, string.format( - [=[["%s", "--listen", "%s", "-u", "NONE", "-i", "NONE", "--cmd", "set noswapfile noshowcmd noruler"]]=], + '["%s", "--listen", "%s", "-u", "NONE", "-i", "NONE", "--cmd", "colorscheme vim", ' + ..'"--cmd", "set noswapfile noshowcmd noruler"]', nvim_prog, child_server)) screen:expect([[ {1: } | @@ -2198,14 +2211,16 @@ describe("TUI 't_Co' (terminal colors)", function() -- This is ugly because :term/termopen() forces TERM=xterm-256color. -- TODO: Revisit this after jobstart/termopen accept `env` dict. screen = thelpers.screen_setup(0, string.format( - [=[['sh', '-c', 'LANG=C TERM=%s %s %s -u NONE -i NONE --cmd "%s"']]=], + [=[['sh', '-c', 'LANG=C TERM=%s %s %s -u NONE -i NONE --cmd "colorscheme vim" --cmd "%s"']]=], term or "", (colorterm ~= nil and "COLORTERM="..colorterm or ""), nvim_prog, nvim_set)) local tline - if maxcolors == 8 or maxcolors == 16 then + if maxcolors == 8 then + tline = "{9:~ }" + elseif maxcolors == 16 then tline = "~ " else tline = "{4:~ }" @@ -2528,7 +2543,7 @@ describe("TUI", function() -- This is ugly because :term/termopen() forces TERM=xterm-256color. -- TODO: Revisit this after jobstart/termopen accept `env` dict. local cmd = string.format( - [=[['sh', '-c', 'LANG=C %s -u NONE -i NONE %s --cmd "%s"']]=], + [=[['sh', '-c', 'LANG=C %s -u NONE -i NONE %s --cmd "colorscheme vim" --cmd "%s"']]=], nvim_prog, extra_args or "", nvim_set) @@ -2591,7 +2606,7 @@ describe('TUI bg color', function() local function setup_bg_test() clear() screen = thelpers.screen_setup(0, '["'..nvim_prog - ..'", "-u", "NONE", "-i", "NONE", "--cmd", "set noswapfile", ' + ..'", "-u", "NONE", "-i", "NONE", "--cmd", "colorscheme vim", "--cmd", "set noswapfile", ' ..'"-c", "autocmd OptionSet background echo \\"did OptionSet, yay!\\""]') end @@ -2712,8 +2727,13 @@ describe("TUI as a client", function() set_session(server_super) local server_pipe = new_pipename() local screen_server = thelpers.screen_setup(0, - string.format([=[["%s", "--listen", "%s", "-u", "NONE", "-i", "NONE", "--cmd", "%s laststatus=2 background=dark"]]=], - nvim_prog, server_pipe, nvim_set)) + string.format( + '["%s", "--listen", "%s", "-u", "NONE", "-i", "NONE", "--cmd", "colorscheme vim", ' + ..'"--cmd", "%s laststatus=2 background=dark"]', + nvim_prog, + server_pipe, + nvim_set + )) feed_data("iHello, World") screen_server:expect{grid=[[ @@ -2839,8 +2859,13 @@ describe("TUI as a client", function() set_session(server_super) local server_pipe = new_pipename() local screen_server = thelpers.screen_setup(0, - string.format([=[["%s", "--listen", "%s", "-u", "NONE", "-i", "NONE", "--cmd", "%s laststatus=2 background=dark"]]=], - nvim_prog, server_pipe, nvim_set)) + string.format( + '["%s", "--listen", "%s", "-u", "NONE", "-i", "NONE", "--cmd", "colorscheme vim", ' + ..'"--cmd", "%s laststatus=2 background=dark"]', + nvim_prog, + server_pipe, + nvim_set + )) screen_server:expect{grid=[[ {1: } | {4:~ }| |