0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

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.

Signed-off-by: Damien Riegel <damien@riegel.io>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Damien Riegel 2024-06-14 12:15:11 -04:00 committed by Christian Brabandt
parent afbe5359e9
commit fce324f557
No known key found for this signature in database
GPG Key ID: F3F92DA383FDDE09

View File

@ -328,14 +328,14 @@ enddef
# Use when debugger didn't start or ended.
def CloseBuffers()
exe $'bwipe! {ptybufnr}'
exe $'bwipe! {commbufnr}'
if asmbufnr > 0 && bufexists(asmbufnr)
exe $'bwipe! {asmbufnr}'
endif
if varbufnr > 0 && bufexists(varbufnr)
exe $'bwipe! {varbufnr}'
endif
var bufnames = ['debugged\ program', 'gdb\ communication', asmbufname, varbufname]
for bufname in bufnames
var buf_nr = bufnr(bufname)
if buf_nr > 0 && bufexists(buf_nr)
exe $'bwipe! {bufname}'
endif
endfor
running = 0
gdbwin = 0
enddef