aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-07-23 08:23:07 +0800
committerGitHub <noreply@github.com>2023-07-23 08:23:07 +0800
commitcdb758ef447e1f934966fab42d5db0bf929de89c (patch)
treef3aa6598daf93c95294217e4216c199b3916689c
parenta8cfdf43bc6226e32679ec59769ea3e48ca26193 (diff)
downloadrneovim-cdb758ef447e1f934966fab42d5db0bf929de89c.tar.gz
rneovim-cdb758ef447e1f934966fab42d5db0bf929de89c.tar.bz2
rneovim-cdb758ef447e1f934966fab42d5db0bf929de89c.zip
test: check real cursor position in Terminal mode (#24436)
-rw-r--r--test/functional/terminal/cursor_spec.lua66
1 files changed, 36 insertions, 30 deletions
diff --git a/test/functional/terminal/cursor_spec.lua b/test/functional/terminal/cursor_spec.lua
index 98ac03211a..47bc02373c 100644
--- a/test/functional/terminal/cursor_spec.lua
+++ b/test/functional/terminal/cursor_spec.lua
@@ -187,13 +187,16 @@ 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)
+ -- 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: } |
+ :{1:^ } |
{3:-- TERMINAL --} |
]])
end
@@ -213,7 +216,7 @@ describe('buffer cursor position is correct in terminal without number column',
|
|
Entering Ex mode. Type "visual" to go to Normal mode. |
- :aaaaaaaa{1: } |
+ :aaaaaaaa{1:^ } |
{3:-- TERMINAL --} |
]])
eq({6, 9}, eval('nvim_win_get_cursor(0)'))
@@ -238,7 +241,7 @@ describe('buffer cursor position is correct in terminal without number column',
|
|
Entering Ex mode. Type "visual" to go to Normal mode. |
- :aaaaaa{1:a}a |
+ :aaaaaa{1:^a}a |
{3:-- TERMINAL --} |
]])
eq({6, 7}, eval('nvim_win_get_cursor(0)'))
@@ -263,7 +266,7 @@ describe('buffer cursor position is correct in terminal without number column',
|
|
Entering Ex mode. Type "visual" to go to Normal mode. |
- :a{1:a}aaaaaa |
+ :a{1:^a}aaaaaa |
{3:-- TERMINAL --} |
]])
eq({6, 2}, eval('nvim_win_get_cursor(0)'))
@@ -294,7 +297,7 @@ describe('buffer cursor position is correct in terminal without number column',
|
|
Entering Ex mode. Type "visual" to go to Normal mode. |
- :µµµµµµµµ{1: } |
+ :µµµµµµµµ{1:^ } |
{3:-- TERMINAL --} |
]])
eq({6, 17}, eval('nvim_win_get_cursor(0)'))
@@ -319,7 +322,7 @@ describe('buffer cursor position is correct in terminal without number column',
|
|
Entering Ex mode. Type "visual" to go to Normal mode. |
- :µµµµµµ{1:µ}µ |
+ :µµµµµµ{1:^µ}µ |
{3:-- TERMINAL --} |
]])
eq({6, 13}, eval('nvim_win_get_cursor(0)'))
@@ -344,7 +347,7 @@ describe('buffer cursor position is correct in terminal without number column',
|
|
Entering Ex mode. Type "visual" to go to Normal mode. |
- :µ{1:µ}µµµµµµ |
+ :µ{1:^µ}µµµµµµ |
{3:-- TERMINAL --} |
]])
eq({6, 3}, eval('nvim_win_get_cursor(0)'))
@@ -377,7 +380,7 @@ describe('buffer cursor position is correct in terminal without number column',
|
|
Entering Ex mode. Type "visual" to go to Normal mode. |
- :µ̳µ̳µ̳µ̳µ̳µ̳µ̳µ̳{1: } |
+ :µ̳µ̳µ̳µ̳µ̳µ̳µ̳µ̳{1:^ } |
{3:-- TERMINAL --} |
]])
eq({6, 33}, eval('nvim_win_get_cursor(0)'))
@@ -402,7 +405,7 @@ describe('buffer cursor position is correct in terminal without number column',
|
|
Entering Ex mode. Type "visual" to go to Normal mode. |
- :µ̳µ̳µ̳µ̳µ̳µ̳{1:µ̳}µ̳ |
+ :µ̳µ̳µ̳µ̳µ̳µ̳{1:^µ̳}µ̳ |
{3:-- TERMINAL --} |
]])
eq({6, 25}, eval('nvim_win_get_cursor(0)'))
@@ -427,7 +430,7 @@ describe('buffer cursor position is correct in terminal without number column',
|
|
Entering Ex mode. Type "visual" to go to Normal mode. |
- :µ̳{1:µ̳}µ̳µ̳µ̳µ̳µ̳µ̳ |
+ :µ̳{1:^µ̳}µ̳µ̳µ̳µ̳µ̳µ̳ |
{3:-- TERMINAL --} |
]])
eq({6, 5}, eval('nvim_win_get_cursor(0)'))
@@ -446,7 +449,7 @@ describe('buffer cursor position is correct in terminal without number column',
end)
describe('in a line with double-cell multibyte characters and no trailing spaces,', function()
- skip(is_os('win'), "Encoding problem?")
+ if skip(is_os('win'), "Encoding problem?") then return end
before_each(function()
setup_ex_register('哦哦哦哦哦哦哦哦')
@@ -460,7 +463,7 @@ describe('buffer cursor position is correct in terminal without number column',
|
|
Entering Ex mode. Type "visual" to go to Normal mode. |
- :哦哦哦哦哦哦哦哦{1: } |
+ :哦哦哦哦哦哦哦哦{1:^ } |
{3:-- TERMINAL --} |
]])
eq({6, 25}, eval('nvim_win_get_cursor(0)'))
@@ -485,7 +488,7 @@ describe('buffer cursor position is correct in terminal without number column',
|
|
Entering Ex mode. Type "visual" to go to Normal mode. |
- :哦哦哦哦哦哦{1:哦}哦 |
+ :哦哦哦哦哦哦{1:^哦}哦 |
{3:-- TERMINAL --} |
]])
eq({6, 19}, eval('nvim_win_get_cursor(0)'))
@@ -510,7 +513,7 @@ describe('buffer cursor position is correct in terminal without number column',
|
|
Entering Ex mode. Type "visual" to go to Normal mode. |
- :哦{1:哦}哦哦哦哦哦哦 |
+ :哦{1:^哦}哦哦哦哦哦哦 |
{3:-- TERMINAL --} |
]])
eq({6, 4}, eval('nvim_win_get_cursor(0)'))
@@ -537,7 +540,7 @@ describe('buffer cursor position is correct in terminal without number column',
|
|
Entering Ex mode. Type "visual" to go to Normal mode. |
- :aaaaaaaa {1: } |
+ :aaaaaaaa {1:^ } |
{3:-- TERMINAL --} |
]])
matches('^:aaaaaaaa [ ]*$', eval('nvim_get_current_line()'))
@@ -564,13 +567,16 @@ 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)
+ -- 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: 6 }:{1:^ } |
{3:-- TERMINAL --} |
]])
end
@@ -593,7 +599,7 @@ describe('buffer cursor position is correct in terminal with number column', fun
{7: 3 } |
{7: 4 } |
{7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. |
- {7: 6 }:aaaaaaaa{1: } |
+ {7: 6 }:aaaaaaaa{1:^ } |
{3:-- TERMINAL --} |
]])
eq({6, 9}, eval('nvim_win_get_cursor(0)'))
@@ -618,7 +624,7 @@ describe('buffer cursor position is correct in terminal with number column', fun
{7: 3 } |
{7: 4 } |
{7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. |
- {7: 6 }:aaaaaa{1:a}a |
+ {7: 6 }:aaaaaa{1:^a}a |
{3:-- TERMINAL --} |
]])
eq({6, 7}, eval('nvim_win_get_cursor(0)'))
@@ -643,7 +649,7 @@ describe('buffer cursor position is correct in terminal with number column', fun
{7: 3 } |
{7: 4 } |
{7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. |
- {7: 6 }:a{1:a}aaaaaa |
+ {7: 6 }:a{1:^a}aaaaaa |
{3:-- TERMINAL --} |
]])
eq({6, 2}, eval('nvim_win_get_cursor(0)'))
@@ -674,7 +680,7 @@ describe('buffer cursor position is correct in terminal with number column', fun
{7: 3 } |
{7: 4 } |
{7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. |
- {7: 6 }:µµµµµµµµ{1: } |
+ {7: 6 }:µµµµµµµµ{1:^ } |
{3:-- TERMINAL --} |
]])
eq({6, 17}, eval('nvim_win_get_cursor(0)'))
@@ -699,7 +705,7 @@ describe('buffer cursor position is correct in terminal with number column', fun
{7: 3 } |
{7: 4 } |
{7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. |
- {7: 6 }:µµµµµµ{1:µ}µ |
+ {7: 6 }:µµµµµµ{1:^µ}µ |
{3:-- TERMINAL --} |
]])
eq({6, 13}, eval('nvim_win_get_cursor(0)'))
@@ -724,7 +730,7 @@ describe('buffer cursor position is correct in terminal with number column', fun
{7: 3 } |
{7: 4 } |
{7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. |
- {7: 6 }:µ{1:µ}µµµµµµ |
+ {7: 6 }:µ{1:^µ}µµµµµµ |
{3:-- TERMINAL --} |
]])
eq({6, 3}, eval('nvim_win_get_cursor(0)'))
@@ -757,7 +763,7 @@ describe('buffer cursor position is correct in terminal with number column', fun
{7: 3 } |
{7: 4 } |
{7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. |
- {7: 6 }:µ̳µ̳µ̳µ̳µ̳µ̳µ̳µ̳{1: } |
+ {7: 6 }:µ̳µ̳µ̳µ̳µ̳µ̳µ̳µ̳{1:^ } |
{3:-- TERMINAL --} |
]])
eq({6, 33}, eval('nvim_win_get_cursor(0)'))
@@ -782,7 +788,7 @@ describe('buffer cursor position is correct in terminal with number column', fun
{7: 3 } |
{7: 4 } |
{7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. |
- {7: 6 }:µ̳µ̳µ̳µ̳µ̳µ̳{1:µ̳}µ̳ |
+ {7: 6 }:µ̳µ̳µ̳µ̳µ̳µ̳{1:^µ̳}µ̳ |
{3:-- TERMINAL --} |
]])
eq({6, 25}, eval('nvim_win_get_cursor(0)'))
@@ -807,7 +813,7 @@ describe('buffer cursor position is correct in terminal with number column', fun
{7: 3 } |
{7: 4 } |
{7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. |
- {7: 6 }:µ̳{1:µ̳}µ̳µ̳µ̳µ̳µ̳µ̳ |
+ {7: 6 }:µ̳{1:^µ̳}µ̳µ̳µ̳µ̳µ̳µ̳ |
{3:-- TERMINAL --} |
]])
eq({6, 5}, eval('nvim_win_get_cursor(0)'))
@@ -826,7 +832,7 @@ describe('buffer cursor position is correct in terminal with number column', fun
end)
describe('in a line with double-cell multibyte characters and no trailing spaces,', function()
- skip(is_os('win'), "Encoding problem?")
+ if skip(is_os('win'), "Encoding problem?") then return end
before_each(function()
setup_ex_register('哦哦哦哦哦哦哦哦')
@@ -840,7 +846,7 @@ describe('buffer cursor position is correct in terminal with number column', fun
{7: 3 } |
{7: 4 } |
{7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. |
- {7: 6 }:哦哦哦哦哦哦哦哦{1: } |
+ {7: 6 }:哦哦哦哦哦哦哦哦{1:^ } |
{3:-- TERMINAL --} |
]])
eq({6, 25}, eval('nvim_win_get_cursor(0)'))
@@ -865,7 +871,7 @@ describe('buffer cursor position is correct in terminal with number column', fun
{7: 3 } |
{7: 4 } |
{7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. |
- {7: 6 }:哦哦哦哦哦哦{1:哦}哦 |
+ {7: 6 }:哦哦哦哦哦哦{1:^哦}哦 |
{3:-- TERMINAL --} |
]])
eq({6, 19}, eval('nvim_win_get_cursor(0)'))
@@ -890,7 +896,7 @@ describe('buffer cursor position is correct in terminal with number column', fun
{7: 3 } |
{7: 4 } |
{7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. |
- {7: 6 }:哦{1:哦}哦哦哦哦哦哦 |
+ {7: 6 }:哦{1:^哦}哦哦哦哦哦哦 |
{3:-- TERMINAL --} |
]])
eq({6, 4}, eval('nvim_win_get_cursor(0)'))
@@ -917,7 +923,7 @@ describe('buffer cursor position is correct in terminal with number column', fun
{7: 3 } |
{7: 4 } |
{7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. |
- {7: 6 }:aaaaaaaa {1: } |
+ {7: 6 }:aaaaaaaa {1:^ } |
{3:-- TERMINAL --} |
]])
matches('^:aaaaaaaa [ ]*$', eval('nvim_get_current_line()'))