Skip to content

Commit fdd9475

Browse files
committed
fix @parameter.inner scoping issues
Fixes #832
1 parent 0d7c800 commit fdd9475

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

lua/nvim-treesitter-textobjects/shared.lua

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,19 @@ local function is_in_range(range, row, col)
231231
return is_in_rows and is_after_start_col_if_needed and is_before_end_col_if_needed
232232
end
233233

234+
---@param outer Range4
235+
---@param inner Range4
236+
---@return boolean
237+
local function contains(outer, inner)
238+
local start_row_o, start_col_o, end_row_o, end_col_o = unpack(outer)
239+
local start_row_i, start_col_i, end_row_i, end_col_i = unpack(inner)
240+
241+
return start_row_o <= start_row_i
242+
and start_col_o <= start_col_i
243+
and end_row_o >= end_row_i
244+
and end_col_o >= end_col_i
245+
end
246+
234247
---@param range1 Range4
235248
---@param range2 Range4
236249
---@return boolean

0 commit comments

Comments
 (0)