From 55b0dd49938cbd5dcc2febd40ebc967a2ae7858f Mon Sep 17 00:00:00 2001 From: eph Date: Wed, 14 Jan 2026 21:21:13 +0800 Subject: [PATCH 1/2] fix(provider): trigger terminal redraw to fix empty columns on right side --- lua/opencode/provider/terminal.lua | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/lua/opencode/provider/terminal.lua b/lua/opencode/provider/terminal.lua index 240a54b1..dbb65fd3 100644 --- a/lua/opencode/provider/terminal.lua +++ b/lua/opencode/provider/terminal.lua @@ -48,7 +48,20 @@ function Terminal:start() self.bufnr = vim.api.nvim_create_buf(true, false) self.winid = vim.api.nvim_open_win(self.bufnr, true, self.opts) - -- FIX: There's a few empty columns on the right side of the terminal until it's redrawn, at least for me. + + local auid + auid = vim.api.nvim_create_autocmd("TermRequest", { + buffer = self.bufnr, + callback = function(ev) + if ev.data.cursor[1] > 1 then + -- Trigger terminal buffer redrawing. + vim.api.nvim_del_autocmd(auid) + vim.api.nvim_set_current_win(self.winid) + vim.cmd([[startinsert | call feedkeys("\\\p", "n")]]) + end + end, + }) + vim.fn.jobstart(self.cmd, { term = true, on_exit = function() From df0a3578f3986429f25358b29afe08c2855df4cd Mon Sep 17 00:00:00 2001 From: Nick van Dyke Date: Wed, 14 Jan 2026 09:23:11 -0700 Subject: [PATCH 2/2] comment --- lua/opencode/provider/terminal.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lua/opencode/provider/terminal.lua b/lua/opencode/provider/terminal.lua index dbb65fd3..dab7acdd 100644 --- a/lua/opencode/provider/terminal.lua +++ b/lua/opencode/provider/terminal.lua @@ -49,12 +49,13 @@ function Terminal:start() self.bufnr = vim.api.nvim_create_buf(true, false) self.winid = vim.api.nvim_open_win(self.bufnr, true, self.opts) + -- Redraw terminal buffer on initial render. + -- Fixes empty columns on the right side. local auid auid = vim.api.nvim_create_autocmd("TermRequest", { buffer = self.bufnr, callback = function(ev) if ev.data.cursor[1] > 1 then - -- Trigger terminal buffer redrawing. vim.api.nvim_del_autocmd(auid) vim.api.nvim_set_current_win(self.winid) vim.cmd([[startinsert | call feedkeys("\\\p", "n")]])