aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/_editor.lua
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2024-05-28 03:07:13 -0700
committerGitHub <noreply@github.com>2024-05-28 03:07:13 -0700
commit90a4b1a59cf0c204cb39ec7789ab8783626e449d (patch)
tree9210f143983c176a2387cc763fa7c9ab98e61abe /runtime/lua/vim/_editor.lua
parent5b6477be45c54ebac4dce6bda51028542167fd1f (diff)
downloadrneovim-90a4b1a59cf0c204cb39ec7789ab8783626e449d.tar.gz
rneovim-90a4b1a59cf0c204cb39ec7789ab8783626e449d.tar.bz2
rneovim-90a4b1a59cf0c204cb39ec7789ab8783626e449d.zip
refactor: deprecate vim.region() #28416
Problem: `vim.region()` is redundant with `getregionpos()`. Solution: Deprecate `vim.region()`.
Diffstat (limited to 'runtime/lua/vim/_editor.lua')
-rw-r--r--runtime/lua/vim/_editor.lua3
1 files changed, 3 insertions, 0 deletions
diff --git a/runtime/lua/vim/_editor.lua b/runtime/lua/vim/_editor.lua
index 5e9be509c8..9f952db4fc 100644
--- a/runtime/lua/vim/_editor.lua
+++ b/runtime/lua/vim/_editor.lua
@@ -494,6 +494,7 @@ do
vim.t = make_dict_accessor('t')
end
+--- @deprecated
--- Gets a dict of line segment ("chunk") positions for the region from `pos1` to `pos2`.
---
--- Input and output positions are byte positions, (0,0)-indexed. "End of line" column
@@ -507,6 +508,8 @@ end
---@return table region Dict of the form `{linenr = {startcol,endcol}}`. `endcol` is exclusive, and
---whole lines are returned as `{startcol,endcol} = {0,-1}`.
function vim.region(bufnr, pos1, pos2, regtype, inclusive)
+ vim.deprecate('vim.region', 'vim.fn.getregionpos()', '0.13')
+
if not vim.api.nvim_buf_is_loaded(bufnr) then
vim.fn.bufload(bufnr)
end