mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-16 10:20:11 -04:00
fix: is_in_node_range now includes end line and col
This fixes no indents at the end of python files Refs #1136
This commit is contained in:
parent
1e4c846d01
commit
5a721fef56
1 changed files with 1 additions and 13 deletions
|
|
@ -227,19 +227,7 @@ end
|
||||||
-- @param col A column (0-based)
|
-- @param col A column (0-based)
|
||||||
function M.is_in_node_range(node, line, col)
|
function M.is_in_node_range(node, line, col)
|
||||||
local start_line, start_col, end_line, end_col = node:range()
|
local start_line, start_col, end_line, end_col = node:range()
|
||||||
if line >= start_line and line <= end_line then
|
return line >= start_line and line <= end_line and col >= start_col and col <= end_col
|
||||||
if line == start_line and line == end_line then
|
|
||||||
return col >= start_col and col < end_col
|
|
||||||
elseif line == start_line then
|
|
||||||
return col >= start_col
|
|
||||||
elseif line == end_line then
|
|
||||||
return col < end_col
|
|
||||||
else
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
else
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.get_node_range(node_or_range)
|
function M.get_node_range(node_or_range)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue