end
end
function Text.populate_link_offsets(State, line_index)
local line = State.lines[line_index]
if line.mode ~= 'text' then return end
local line_cache = State.line_cache[line_index]
if line_cache.link_offsets then
return
end
line_cache.link_offsets = {}
local pos = 1
-- try to wrap at word boundaries
local s, e = 1, 0
while s <= #line.data do
s, e = line.data:find('%w+', s)
if s == nil then break end
local word = line.data:sub(s, e)
if file_exists(word) then
--? print('filename:', s, e, word)
table.insert(line_cache.link_offsets, {s, e, word})
end
s = e + 1