mirror of
https://github.com/neovim/neovim.git
synced 2025-11-03 09:14:24 +00:00
Use get_line_byte_from_position in jump_to_location
This commit is contained in:
@@ -474,9 +474,7 @@ function M.jump_to_location(location)
|
|||||||
api.nvim_buf_set_option(0, 'buflisted', true)
|
api.nvim_buf_set_option(0, 'buflisted', true)
|
||||||
local range = location.range or location.targetSelectionRange
|
local range = location.range or location.targetSelectionRange
|
||||||
local row = range.start.line
|
local row = range.start.line
|
||||||
local col = range.start.character
|
local col = get_line_byte_from_position(0, range.start)
|
||||||
local line = api.nvim_buf_get_lines(0, row, row+1, true)[1]
|
|
||||||
col = vim.str_byteindex(line, col)
|
|
||||||
api.nvim_win_set_cursor(0, {row + 1, col})
|
api.nvim_win_set_cursor(0, {row + 1, col})
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user