rename Range.from_txtobj => from_motion
Some checks failed
NeoVim tests / plenary-tests (push) Failing after 7s

This commit is contained in:
2025-04-11 21:37:28 -06:00
parent 0ee6caa7ba
commit 87930bf3af
7 changed files with 33 additions and 33 deletions

View File

@@ -139,7 +139,7 @@ function M.setup()
local from_c = vim.fn.nr2char(from_cn)
local from = surrounds[from_c] or { left = from_c, right = from_c }
local function get_fresh_arange()
local arange = Range.from_txtobj('a' .. from_c, { user_defined = true })
local arange = Range.from_motion('a' .. from_c, { user_defined = true })
if arange == nil then return end
if from_c == 'q' then
from.left = arange.start:char()
@@ -166,7 +166,7 @@ function M.setup()
if from_c == 't' then
-- For tags, we want to replace the inner text, not the tag:
local irange = Range.from_txtobj('i' .. from_c, { user_defined = true })
local irange = Range.from_motion('i' .. from_c, { user_defined = true })
if arange == nil or irange == nil then return end
local lrange = Range.new(arange.start, irange.start:must_next(-1))
@@ -204,8 +204,8 @@ function M.setup()
CACHED_DELETE_FROM = txt_obj
local buf = Buffer.current()
local irange = Range.from_txtobj('i' .. txt_obj)
local arange = Range.from_txtobj('a' .. txt_obj)
local irange = Range.from_motion('i' .. txt_obj)
local arange = Range.from_motion('a' .. txt_obj)
if arange == nil or irange == nil then return end
local starting_cursor_pos = arange.start:clone()
@@ -217,8 +217,8 @@ function M.setup()
-- Dedenting moves the cursor, so we need to set the cursor to a consistent starting spot:
arange.start:save_to_pos '.'
-- Dedenting also changed the inner text, so re-acquire it:
arange = Range.from_txtobj('a' .. txt_obj)
irange = Range.from_txtobj('i' .. txt_obj)
arange = Range.from_motion('a' .. txt_obj)
irange = Range.from_motion('i' .. txt_obj)
if arange == nil or irange == nil then return end -- should never be true
arange:replace(irange:lines())
-- `arange:replace(..)` updates its own `stop` position, so we will use

View File

@@ -23,7 +23,7 @@ function M.setup()
---Selects the next quote object (searches forward)
--- @param q string
local function define_quote_obj(q)
local function select_around() return Range.from_txtobj('a' .. q) end
local function select_around() return Range.from_motion('a' .. q) end
txtobj.define('a' .. q, function() return select_around() end)
txtobj.define('i' .. q, function()
@@ -48,7 +48,7 @@ function M.setup()
if not curr then return end
-- Reset visual selection to current context:
curr:save_to_pos '.'
return Range.from_txtobj('a' .. q)
return Range.from_motion('a' .. q)
end
txtobj.define('al' .. q, function() return select_around() end)