More debug stuff
This commit is contained in:
parent
726577ee00
commit
fb58f7ad42
@ -14,7 +14,7 @@ function ParamCursorCell:hit_test(cursor)
|
|||||||
if self.cursor == cursor then
|
if self.cursor == cursor then
|
||||||
return {{
|
return {{
|
||||||
type = 'cursor_cell',
|
type = 'cursor_cell',
|
||||||
value = self.cursor:get_value(),
|
char = self.cursor:get_value(),
|
||||||
}}
|
}}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -111,9 +111,9 @@ function Param:hit_test(cursor)
|
|||||||
local trace = cell:hit_test(cursor)
|
local trace = cell:hit_test(cursor)
|
||||||
if trace then
|
if trace then
|
||||||
table.insert(trace, 1, {
|
table.insert(trace, 1, {
|
||||||
index = i,
|
type = 'param',
|
||||||
length = #self.cells,
|
cell_count = #self.cells,
|
||||||
type = 'param_cell',
|
cell_index = i,
|
||||||
})
|
})
|
||||||
|
|
||||||
return trace
|
return trace
|
||||||
@ -123,11 +123,11 @@ end
|
|||||||
|
|
||||||
function Param:hit_search(trace, depth)
|
function Param:hit_search(trace, depth)
|
||||||
local frame = trace[depth]
|
local frame = trace[depth]
|
||||||
assert(frame.index <= #self.cells)
|
assert(frame.type == 'param')
|
||||||
assert(frame.length == #self.cells)
|
assert(frame.cell_count == #self.cells)
|
||||||
assert(frame.type == 'param_cell')
|
assert(frame.cell_index <= #self.cells)
|
||||||
|
|
||||||
return self.cells[frame.index]:hit_search(trace, depth + 1)
|
return self.cells[frame.cell_index]:hit_search(trace, depth + 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
function Param:write(builder, wrapped)
|
function Param:write(builder, wrapped)
|
||||||
|
@ -105,40 +105,37 @@ end
|
|||||||
|
|
||||||
function Range:hit_test(cursor)
|
function Range:hit_test(cursor)
|
||||||
if self:contains(cursor) then
|
if self:contains(cursor) then
|
||||||
|
local frame = {
|
||||||
|
type = 'range',
|
||||||
|
pairing = self.pairing.open .. self.pairing.close,
|
||||||
|
param_count = #self.params,
|
||||||
|
param_index = 0,
|
||||||
|
}
|
||||||
|
|
||||||
for i, param in pairs(self.params) do
|
for i, param in pairs(self.params) do
|
||||||
local trace = param:hit_test(cursor)
|
local trace = param:hit_test(cursor)
|
||||||
if trace then
|
if trace then
|
||||||
table.insert(trace, 1, {
|
frame.param_index = i
|
||||||
index = i,
|
table.insert(trace, 1, frame)
|
||||||
length = #self.params,
|
|
||||||
type = 'range_param',
|
|
||||||
value = self.pairing.open,
|
|
||||||
})
|
|
||||||
|
|
||||||
return trace
|
return trace
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return {
|
return {frame}
|
||||||
index = 0,
|
|
||||||
length = #self.params,
|
|
||||||
type = 'range_padding',
|
|
||||||
value = self.pairing.open,
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function Range:hit_search(trace, depth)
|
function Range:hit_search(trace, depth)
|
||||||
local frame = trace[depth]
|
local frame = trace[depth]
|
||||||
assert(frame.index <= #self.params)
|
assert(frame.type == 'range')
|
||||||
assert(frame.length == #self.params)
|
assert(frame.pairing == self.pairing.open .. self.pairing.close)
|
||||||
assert(frame.type == 'range_param')
|
assert(frame.param_count == #self.params)
|
||||||
assert(frame.value == self.pairing.open)
|
assert(frame.param_index <= #self.params)
|
||||||
|
|
||||||
if frame.index == 0 then
|
if frame.param_index == 0 then
|
||||||
return self.start_cursor
|
return self.start_cursor
|
||||||
else
|
else
|
||||||
return self.params[frame.index]:hit_search(trace, depth + 1)
|
return self.params[frame.param_index]:hit_search(trace, depth + 1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user