Commit: 7207535e4e6a0aadcd02d63e922e3d1d007048d1
Parent: 4c84d673fb875d80c79d3adf37a687d40dd2aa86
Author: Randy Palamar
Date: Wed, 29 May 2024 07:45:20 -0600
vis: have generate_line_indices return an empty table
This is how the calling code wants it to behave. Returning nil is
bad because taking the length of nil is an error.
Diffstat:
3 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/.config/vis/build.lua b/.config/vis/build.lua
@@ -73,7 +73,7 @@ local function build_files(win)
local build_c = function (f)
local _, ostr, estr = vis:pipe('./build.sh')
if estr then
- filepairs = gf.generate_line_indices(estr)
+ local filepairs = gf.generate_line_indices(estr)
if #filepairs then
local forward, backward = gf.generate_iterators(filepairs)
vis:map(vis.modes.NORMAL, "gn", forward)
diff --git a/.config/vis/goto-ref.lua b/.config/vis/goto-ref.lua
@@ -37,7 +37,7 @@ M.generate_line_indices = function(data)
found, _, file, line = s:find('^([^:]+):([%d]+):')
if found then table.insert(ret, {file, line}) end
end
- return #ret > 0 and ret or nil
+ return ret
end
return M
diff --git a/.config/vis/visrc.lua b/.config/vis/visrc.lua
@@ -65,6 +65,7 @@ end)
vis:command_register("ag", function(argv)
local filepairs = {}
+ util.message_clear(vis)
for _, arg in ipairs(argv) do
local _, out = vis:pipe("ag -Q " .. arg)
if out then