feat(terminal): surface exit code via virttext + nvim_get_chan_info #37987

Problem:
When a terminal process exits, "[Process Exited]" text is added
to the buffer contents.

Solution:
- Return `exitcode` field from `nvim_get_chan_info`.
- Show it in the default 'statusline'.
- Show exitcode as virtual text in the terminal buffer.
This commit is contained in:
Ayaan
2026-03-10 17:32:50 +05:30
committed by GitHub
parent 0cc4f53b40
commit c8693051a8
22 changed files with 132 additions and 57 deletions

View File

@@ -2834,6 +2834,7 @@ describe('API', function()
mode = 'terminal',
buffer = 1,
pty = '?',
exitcode = -1,
}
local event = api.nvim_get_var('opened_event')
if not is_os('win') then
@@ -2869,6 +2870,7 @@ describe('API', function()
mode = 'terminal',
buffer = 2,
pty = '?',
exitcode = -1,
}
local actual2 = eval('nvim_get_chan_info(&channel)')
expected2.pty = actual2.pty
@@ -2878,6 +2880,7 @@ describe('API', function()
eq(1, eval('jobstop(&channel)'))
eval('jobwait([&channel], 1000)') -- Wait.
expected2.pty = (is_os('win') and '?' or '') -- pty stream was closed.
expected2.exitcode = (is_os('win') and 143 or 129)
eq(expected2, eval('nvim_get_chan_info(&channel)'))
end)
end)