fix(api): consider multibyte characters in get_screen_cursor (cmdline) (#1352)
* fix(api): consider multibyte characters in get_screen_cursor (cmdline) * style: format with stylua * test: tell luacheck that it is intended unreachable code
This commit is contained in:
@@ -4,8 +4,8 @@ local feedkeys = require('cmp.utils.feedkeys')
|
||||
local api = require('cmp.utils.api')
|
||||
|
||||
describe('api', function()
|
||||
before_each(spec.before)
|
||||
describe('get_cursor', function()
|
||||
before_each(spec.before)
|
||||
it('insert-mode', function()
|
||||
local cursor
|
||||
feedkeys.call(keymap.t('i\t1234567890'), 'nx', function()
|
||||
@@ -24,8 +24,26 @@ describe('api', function()
|
||||
end)
|
||||
end)
|
||||
|
||||
describe('get_screen_cursor', function()
|
||||
it('insert-mode', function()
|
||||
local screen_cursor
|
||||
feedkeys.call(keymap.t('iあいうえお'), 'nx', function()
|
||||
screen_cursor = api.get_screen_cursor()
|
||||
end)
|
||||
assert.are.equal(10, screen_cursor[2])
|
||||
end)
|
||||
it('cmdline-mode', function()
|
||||
local screen_cursor
|
||||
keymap.set_map(0, 'c', '<Plug>(cmp-spec-spy)', function()
|
||||
screen_cursor = api.get_screen_cursor()
|
||||
end, { expr = true, noremap = true })
|
||||
feedkeys.call(keymap.t(':あいうえお'), 'n')
|
||||
feedkeys.call(keymap.t('<Plug>(cmp-spec-spy)'), 'x')
|
||||
assert.are.equal(10, screen_cursor[2])
|
||||
end)
|
||||
end)
|
||||
|
||||
describe('get_cursor_before_line', function()
|
||||
before_each(spec.before)
|
||||
it('insert-mode', function()
|
||||
local cursor_before_line
|
||||
feedkeys.call(keymap.t('i\t1234567890<Left><Left>'), 'nx', function()
|
||||
|
||||
Reference in New Issue
Block a user