Commit: runtime(termdebug): close all buffers in the same way

9 views
Skip to first unread message

Christian Brabandt

unread,
Jun 14, 2024, 2:45:09 PM6/14/24
to vim...@googlegroups.com
runtime(termdebug): close all buffers in the same way

Commit: https://github.com/vim/vim/commit/fce324f55718192ae7de389bb88d423eed7977a2
Author: Damien Riegel <dam...@riegel.io>
Date: Fri Jun 14 12:15:11 2024 -0400

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 <dam...@riegel.io>
Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
index 15d039719..a1c92ba0b 100644
--- a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
+++ b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
@@ -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
Reply all
Reply to author
Forward
0 new messages