params.range=M.get_selected_range()-- workaround for neovim 0.6.1 bug (https://github.com/mickael-menu/zk-nvim/issues/19)
returnparams
end
---Gets the text in the given range of the current buffer.
---Needed until https://github.com/neovim/neovim/pull/13896 is merged.
--
---@param range table contains {start} and {end} tables with {line} and {character} values
---@param range table contains {start} and {end} tables with {line} (0-indexed, end inclusive) and {character} (0-indexed, end exclusive) values
---@return string? text in range
functionM.get_text_in_range(range)
localA=range["start"]
@ -68,27 +69,28 @@ function M.get_text_in_range(range)
returntable.concat(lines,"\n")
end
---Gets the most recently selected text of the current buffer.
---Gets the most recently selected range of the current buffer.
---That is the text between the '<,'> marks.
---Note that these marks are only updated *after* leaving the visual mode.
--
---@return string? selected text
functionM.get_selected_text()
---@return table selected range, contains {start} and {end} tables with {line} (0-indexed, end inclusive) and {character} (0-indexed, end exclusive) values
functionM.get_selected_range()
-- code adjusted from `vim.lsp.util.make_given_range_params`
-- we don't want to use character encoding offsets here