aboutsummaryrefslogtreecommitdiff
path: root/test/functional/editor/mode_insert_spec.lua
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/editor/mode_insert_spec.lua')
-rw-r--r--test/functional/editor/mode_insert_spec.lua113
1 files changed, 100 insertions, 13 deletions
diff --git a/test/functional/editor/mode_insert_spec.lua b/test/functional/editor/mode_insert_spec.lua
index fb3dda4bf4..87d5c46134 100644
--- a/test/functional/editor/mode_insert_spec.lua
+++ b/test/functional/editor/mode_insert_spec.lua
@@ -180,12 +180,6 @@ describe('insert-mode', function()
it('multi-char mapping updates screen properly #25626', function()
local screen = Screen.new(60, 6)
- screen:set_default_attr_ids({
- [0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
- [1] = { bold = true, reverse = true }, -- StatusLine
- [2] = { reverse = true }, -- StatusLineNC
- [3] = { bold = true }, -- ModeMsg
- })
screen:attach()
command('vnew')
insert('foo\nfoo\nfoo')
@@ -197,10 +191,10 @@ describe('insert-mode', function()
grid = [[
foo │ |
foo │β^jβ |
- foo │{0:~ }|
- {0:~ }│{0:~ }|
- {2:[No Name] [+] }{1:[No Name] [+] }|
- {3:-- INSERT --} |
+ foo │{1:~ }|
+ {1:~ }│{1:~ }|
+ {2:[No Name] [+] }{3:[No Name] [+] }|
+ {5:-- INSERT --} |
]],
}
feed('k')
@@ -208,9 +202,9 @@ describe('insert-mode', function()
grid = [[
foo │ |
foo │^βββ |
- foo │{0:~ }|
- {0:~ }│{0:~ }|
- {2:[No Name] [+] }{1:[No Name] [+] }|
+ foo │{1:~ }|
+ {1:~ }│{1:~ }|
+ {2:[No Name] [+] }{3:[No Name] [+] }|
|
]],
}
@@ -357,4 +351,97 @@ describe('insert-mode', function()
eq(2, api.nvim_win_get_cursor(0)[1])
end)
end)
+
+ it('backspace after replacing multibyte chars', function()
+ local screen = Screen.new(30, 3)
+ screen:attach()
+ api.nvim_buf_set_lines(0, 0, -1, true, { 'test ȧ̟̜̝̅̚m̆̉̐̐̇̈ å' })
+ feed('^Rabcdefghi')
+ screen:expect([[
+ abcdefghi^ |
+ {1:~ }|
+ {5:-- REPLACE --} |
+ ]])
+
+ feed('<bs>')
+ screen:expect([[
+ abcdefgh^å |
+ {1:~ }|
+ {5:-- REPLACE --} |
+ ]])
+
+ feed('<bs>')
+ screen:expect([[
+ abcdefg^ å |
+ {1:~ }|
+ {5:-- REPLACE --} |
+ ]])
+
+ feed('<bs>')
+ screen:expect([[
+ abcdef^m̆̉̐̐̇̈ å |
+ {1:~ }|
+ {5:-- REPLACE --} |
+ ]])
+
+ feed('<bs>')
+ screen:expect([[
+ abcde^ȧ̟̜̝̅̚m̆̉̐̐̇̈ å |
+ {1:~ }|
+ {5:-- REPLACE --} |
+ ]])
+
+ feed('<bs>')
+ screen:expect([[
+ abcd^ ȧ̟̜̝̅̚m̆̉̐̐̇̈ å |
+ {1:~ }|
+ {5:-- REPLACE --} |
+ ]])
+
+ feed('<esc>')
+
+ api.nvim_buf_set_lines(0, 0, -1, true, { 'wow 🧑‍🌾🏳️‍⚧️x' })
+ feed('^Rabcd')
+
+ screen:expect([[
+ abcd^🧑‍🌾🏳️‍⚧️x |
+ {1:~ }|
+ {5:-- REPLACE --} |
+ ]])
+
+ feed('e')
+ screen:expect([[
+ abcde^🏳️‍⚧️x |
+ {1:~ }|
+ {5:-- REPLACE --} |
+ ]])
+
+ feed('f')
+ screen:expect([[
+ abcdef^x |
+ {1:~ }|
+ {5:-- REPLACE --} |
+ ]])
+
+ feed('<bs>')
+ screen:expect([[
+ abcde^🏳️‍⚧️x |
+ {1:~ }|
+ {5:-- REPLACE --} |
+ ]])
+
+ feed('<bs>')
+ screen:expect([[
+ abcd^🧑‍🌾🏳️‍⚧️x |
+ {1:~ }|
+ {5:-- REPLACE --} |
+ ]])
+
+ feed('<bs>')
+ screen:expect([[
+ abc^ 🧑‍🌾🏳️‍⚧️x |
+ {1:~ }|
+ {5:-- REPLACE --} |
+ ]])
+ end)
end)