diff options
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/doc/api.txt | 15 | ||||
-rw-r--r-- | runtime/lua/vim/lsp/util.lua | 8 |
2 files changed, 19 insertions, 4 deletions
diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt index c72381fd06..1e287281cf 100644 --- a/runtime/doc/api.txt +++ b/runtime/doc/api.txt @@ -2518,6 +2518,21 @@ nvim_win_get_width({window}) *nvim_win_get_width()* Return: ~ Width as a count of columns +nvim_win_hide({window}) *nvim_win_hide()* + Closes the window and hide the buffer it contains (like + |:hide| with a |window-ID|). + + Like |:hide| the buffer becomes hidden unless another window + is editing it, or 'bufhidden' is `unload` , `delete` or `wipe` + as opposed to |:close| or |nvim_win_close|, which will close + the buffer. + + Attributes: ~ + not allowed when |textlock| is active + + Parameters: ~ + {window} Window handle, or 0 for current window + nvim_win_is_valid({window}) *nvim_win_is_valid()* Checks if a window is valid diff --git a/runtime/lua/vim/lsp/util.lua b/runtime/lua/vim/lsp/util.lua index 942c6761c4..412be68396 100644 --- a/runtime/lua/vim/lsp/util.lua +++ b/runtime/lua/vim/lsp/util.lua @@ -373,13 +373,13 @@ function M.compute_diff(old_lines, new_lines, start_line_idx, end_line_idx) adj_end_char = #old_lines[#old_lines + end_line + 1] + end_char + 1 end - start_char = vim.str_utfindex(old_lines[start_line], start_char - 1) - adj_end_char = vim.str_utfindex(old_lines[#old_lines + end_line + 1], adj_end_char) + local _, utf16_start_char = vim.str_utfindex(old_lines[start_line], start_char - 1) + local _, utf16_end_char = vim.str_utfindex(old_lines[#old_lines + end_line + 1], adj_end_char) local result = { range = { - start = { line = start_line - 1, character = start_char}, - ["end"] = { line = adj_end_line, character = adj_end_char} + start = { line = start_line - 1, character = utf16_start_char}, + ["end"] = { line = adj_end_line, character = utf16_end_char} }, text = text, rangeLength = length + 1, |