From 0c91f6fcf354a121469bbcfa299e8588c61e909b Mon Sep 17 00:00:00 2001 From: Baptiste Bourdet Date: Tue, 7 Apr 2026 13:30:36 +0200 Subject: [PATCH] feat(zellij): implement dump() with --ansi flag for scrollback support Zellij added --ansi support to dump-screen, enabling ANSI escape sequences in the output. Re-enable the dump() method using stdout output instead of a temp file. Co-authored-by: Baptiste Bourdet --- lua/sidekick/cli/session/zellij.lua | 35 ++++++++++------------------- 1 file changed, 12 insertions(+), 23 deletions(-) diff --git a/lua/sidekick/cli/session/zellij.lua b/lua/sidekick/cli/session/zellij.lua index 61c36ee4..478f0d35 100644 --- a/lua/sidekick/cli/session/zellij.lua +++ b/lua/sidekick/cli/session/zellij.lua @@ -110,28 +110,17 @@ function M.sessions() return ret end --- function M:dump() --- do --- -- sigh, another broken zellij feature --- -- dump-screen doesn't include ansi escape sequences --- -- just the raw text --- return --- end --- local tmp = Config.state("zellij-dump.txt") --- local ok = Util.exec({ "zellij", "-s", self.mux_session, "action", "dump-screen", "-f", tmp }, { --- notify = true, --- }) --- if not ok then --- return --- end --- local f = io.open(tmp, "r") --- if not f then --- return --- end --- vim.fn.delete(tmp) --- local content = f:read("*a") --- f:close() --- return content --- end +function M:dump() + if self.mux_session == nil then + return + end + local ok, ret = Util.exec({ "zellij", "-s", self.mux_session, "action", "dump-screen", "-f", "--ansi" }, { + notify = true, + }) + if not ok or ret == "" then + return + end + return ret +end return M