From 22d7dd2aec9053028cc033e4c68335a81f845e06 Mon Sep 17 00:00:00 2001 From: Rishikesh Vaishnav Date: Fri, 10 Dec 2021 06:17:50 -0800 Subject: fix(lsp): create lsp requests with position offsets considering client encoding (#16382) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: black-desk Co-authored-by: Mathias Fußenegger --- runtime/lua/vim/lsp.lua | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'runtime/lua/vim/lsp.lua') diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua index 95bc4635b0..72a84dcc53 100644 --- a/runtime/lua/vim/lsp.lua +++ b/runtime/lua/vim/lsp.lua @@ -1493,11 +1493,7 @@ local function adjust_start_col(lnum, line, items, encoding) end end if min_start_char then - if encoding == 'utf-8' then - return min_start_char - else - return vim.str_byteindex(line, min_start_char, encoding == 'utf-16') - end + return util._str_byteindex_enc(line, min_start_char, encoding) else return nil end -- cgit