Commit: dbd4ab62ef66d78cbffae4326fbd6e10d75022be
Parent: 1e02db24a2ad7a2d5b1a4969a6e10ea4c08e545e
Author: Randy Palamar
Date: Sat, 6 May 2023 14:42:07 -0600
vis: add util:message_clear() and use it when building latex
Diffstat:
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/.config/vis/build.lua b/.config/vis/build.lua
@@ -31,7 +31,10 @@ local function build_files(win)
-- build pdf
local err, ostr = vis:pipe(f, {start = 0, finish = 0}, cmd)
if err ~= 0 then
- if ostr then vis:message(ostr) end
+ if ostr then
+ util:message_clear(vis)
+ vis:message(ostr)
+ end
return false
end
diff --git a/.config/vis/util.lua b/.config/vis/util.lua
@@ -1,7 +1,15 @@
-util = {}
+local util = {}
+
function util:splitext(file)
if file == nil then return nil, nil end
local i = file:reverse():find('%.')
if i == nil then return file, nil end
return file:sub(0, -(i + 1)), file:sub(-i)
end
+
+function util:message_clear(vis)
+ vis:message("") -- hack: focus the message window
+ vis.win.file:delete(0, vis.win.file.size)
+end
+
+return util