fix: display virtual column number in location component (#835)

This commit is contained in:
Andrey Mishakin 2022-09-11 21:32:09 +03:00 committed by GitHub
parent 5d133a1ef2
commit 2061fcbf3b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -2,7 +2,7 @@
-- MIT license, see LICENSE for more details.
local function location()
local line = vim.fn.line('.')
local col = vim.fn.col('.')
local col = vim.fn.virtcol('.')
return string.format('%3d:%-2d', line, col)
end

View File

@ -405,6 +405,12 @@ describe('Location component', function()
assert_component('location', opts, ' 10:1 ')
vim.api.nvim_win_set_cursor(0, {5, 0})
assert_component('location', opts, ' 5:1 ')
-- test column number
vim.cmd('normal! oTest')
assert_component('location', opts, ' 6:4 ')
-- test column number in line containing cyrillic symbols
vim.cmd('normal! oТест')
assert_component('location', opts, ' 7:4 ')
vim.cmd('bdelete!')
end)
end)