From b5ec285acb32959fc088bc76da984e70274e7b00 Mon Sep 17 00:00:00 2001 From: rvyhvn Date: Mon, 2 Feb 2026 02:00:01 +0800 Subject: [PATCH] fix(term): handle terminal size query failure gracefully Replaces the assertion on ioctl failure with a silent return. This prevents crashes in environments where the terminal size cannot be queried, such as stated here https://github.com/3rd/image.nvim/issues/210#issuecomment-3303048924). Making it fail silently so the plugin doesn't break the entire editor setup. --- lua/image/utils/term.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/image/utils/term.lua b/lua/image/utils/term.lua index 7e16d16..0ad42d5 100644 --- a/lua/image/utils/term.lua +++ b/lua/image/utils/term.lua @@ -31,7 +31,7 @@ local update_size = function() ---@type { row: number, col: number, xpixel: number, ypixel: number } local sz = ffi.new("winsize") - assert(ffi.C.ioctl(1, TIOCGWINSZ, sz) == 0, "Failed to get terminal size") + if ffi.C.ioctl(1, TIOCGWINSZ, sz) ~= 0 then return end cached_size = { screen_x = sz.xpixel,