Skip to content

Commit a296eaa

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

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

lua/nvim-treesitter-textobjects/shared.lua

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -231,11 +231,17 @@ 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 range1 Range4
235-
---@param range2 Range4
234+
---@param outer Range4
235+
---@param inner Range4
236236
---@return boolean
237-
local function contains(range1, range2)
238-
return is_in_range(range1, range2[1], range2[2]) and is_in_range(range1, range2[3], range2[4])
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
239245
end
240246

241247
---@param range Range6

0 commit comments

Comments
 (0)