From 8879f80552d4ab9d468bd8fb83fe9e04dbcc395c Mon Sep 17 00:00:00 2001 From: eph Date: Fri, 9 Jan 2026 04:35:51 +0800 Subject: [PATCH] fix(api): limit help description width to avoid string.format error Lua's string.format has a maximum width limit of 99 characters for format specifiers. When position='current' is set, the output window can be very wide, causing the calculated max_desc_length to exceed this limit and trigger an 'invalid conversion specification' error. Fix by capping max_desc_length at 90 characters to stay safely under the 99-character limit. --- lua/opencode/api.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/opencode/api.lua b/lua/opencode/api.lua index 6285e58c..c366df73 100644 --- a/lua/opencode/api.lua +++ b/lua/opencode/api.lua @@ -496,7 +496,7 @@ function M.help() return end - local max_desc_length = vim.api.nvim_win_get_width(state.windows.output_win) - 30 + local max_desc_length = math.min(90, vim.api.nvim_win_get_width(state.windows.output_win) - 30) local sorted_commands = vim.tbl_keys(M.commands) table.sort(sorted_commands)