diff options
| author | Yinzuo Jiang <jiangyinzuo@foxmail.com> | 2026-03-14 12:48:23 +0800 |
|---|---|---|
| committer | zeertzjq <zeertzjq@outlook.com> | 2026-03-16 19:05:15 +0800 |
| commit | 34fea4fc64f719fd5384f6cc393d464cebed38bd (patch) | |
| tree | 3bdff5a50187afc0386ce84ab0905a9b5a29f239 /runtime/pack/dist/opt/termdebug/plugin/termdebug.vim | |
| parent | 3cd07709ba578657682a9a881759d03a2718fd23 (diff) | |
| download | rneovim-34fea4fc64f719fd5384f6cc393d464cebed38bd.tar.gz rneovim-34fea4fc64f719fd5384f6cc393d464cebed38bd.tar.bz2 rneovim-34fea4fc64f719fd5384f6cc393d464cebed38bd.zip | |
vim-patch:fce324f557: runtime(termdebug): close all buffers in the same way
For ASM and Variables buffer, check were done to make sure they existed
before attempting to close them, but not for debugged program or gdb
communication. The debugged program window is a user-facing one and
user might close it manually, so it's better to check if it exists.
https://github.com/vim/vim/commit/fce324f55718192ae7de389bb88d423eed7977a2
Co-authored-by: Damien Riegel <damien@riegel.io>
AI-assisted: Codex
Diffstat (limited to 'runtime/pack/dist/opt/termdebug/plugin/termdebug.vim')
| -rw-r--r-- | runtime/pack/dist/opt/termdebug/plugin/termdebug.vim | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim index a57f58164b..0ebdb78f6a 100644 --- a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim +++ b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim @@ -227,12 +227,16 @@ endfunc " Use when debugger didn't start or ended. func s:CloseBuffers() - exe $'bwipe! {s:ptybufnr}' - if s:asmbufnr > 0 && bufexists(s:asmbufnr) - exe $'bwipe! {s:asmbufnr}' - endif - if s:varbufnr > 0 && bufexists(s:varbufnr) - exe $'bwipe! {s:varbufnr}' + for bufnr in [get(s:, 'ptybufnr', 0), get(s:, 'asmbufnr', 0), get(s:, 'varbufnr', 0)] + if bufnr > 0 && bufexists(bufnr) + execute $'bwipe! {bufnr}' + endif + endfor + if exists('s:comm_job_id') + let commbufnr = get(nvim_get_chan_info(s:comm_job_id), 'buffer', 0) + if commbufnr > 0 && bufexists(commbufnr) + execute $'bwipe! {commbufnr}' + endif endif let s:running = v:false unlet! s:gdbwin |