Fix range jumps
This commit is contained in:
parent
9737ef7f6b
commit
655663cb6f
@ -34,18 +34,26 @@ local function find_closest()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function find_at_cursor(start_cursor)
|
local function find_at_cursor(start_cursor, parent_range)
|
||||||
local pairing = Pairing.from_brace(start_cursor:get_value())
|
local pairing = Pairing.from_brace(start_cursor:get_value())
|
||||||
if pairing then
|
if pairing then
|
||||||
local cursor_current = Cursor:get_current()
|
local cursor_current = Cursor:get_current()
|
||||||
start_cursor:set_current()
|
start_cursor:set_current()
|
||||||
|
|
||||||
local stop_cursor = pairing:find_closest(true)
|
local stop_cursor = pairing:find_closest(true)
|
||||||
cursor_current:set_current()
|
cursor_current:set_current()
|
||||||
if stop_cursor then
|
|
||||||
local range = Range.new(start_cursor, stop_cursor, pairing)
|
if not stop_cursor then
|
||||||
range:parse()
|
return
|
||||||
return range
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if parent_range and not parent_range:contains(stop_cursor) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local range = Range.new(start_cursor, stop_cursor, pairing)
|
||||||
|
range:parse()
|
||||||
|
return range
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -86,7 +94,7 @@ function Range:parse()
|
|||||||
if cursor:is_string() or cursor:is_comment() then
|
if cursor:is_string() or cursor:is_comment() then
|
||||||
append_param_value(Param.new_cursor_cell(cursor))
|
append_param_value(Param.new_cursor_cell(cursor))
|
||||||
else
|
else
|
||||||
local range = find_at_cursor(cursor)
|
local range = find_at_cursor(cursor, self)
|
||||||
if range then
|
if range then
|
||||||
append_param_value(Param.new_range_cell(range))
|
append_param_value(Param.new_range_cell(range))
|
||||||
cursor = range.stop_cursor
|
cursor = range.stop_cursor
|
||||||
|
Loading…
x
Reference in New Issue
Block a user