vim-patch:62ccaa6: runtime(termdebug): check for gdb file/dir before using as buffer name (#28908)

Add test so that this doesn't regress.

fixes: vim/vim#12718
closes: vim/vim#14792

62ccaa60d5

Co-authored-by: Ubaldo Tiberi <ubaldo.tiberi@volvo.com>
This commit is contained in:
zeertzjq
2024-05-22 08:41:07 +08:00
committed by GitHub
parent d6be78cc98
commit 10601ac5fa
2 changed files with 58 additions and 3 deletions

View File

@@ -427,7 +427,17 @@ func s:StartDebug_prompt(dict)
let s:promptbuf = bufnr('')
call prompt_setprompt(s:promptbuf, 'gdb> ')
set buftype=prompt
file gdb
if empty(glob('gdb'))
file gdb
elseif empty(glob('Termdebug-gdb-console'))
file Termdebug-gdb-console
else
call s:Echoerr("You have a file/folder named 'gdb'
\ or 'Termdebug-gdb-console'.
\ Please exit and rename them because Termdebug may not work as expected.")
endif
call prompt_setcallback(s:promptbuf, function('s:PromptCallback'))
call prompt_setinterrupt(s:promptbuf, function('s:PromptInterrupt'))
@@ -1481,9 +1491,12 @@ func s:GotoAsmwinOrCreateIt()
setlocal modifiable
if s:asmbuf > 0 && bufexists(s:asmbuf)
exe 'buffer' . s:asmbuf
exe 'buffer' . s:asmbuf
elseif empty(glob('Termdebug-asm-listing'))
silent file Termdebug-asm-listing
let s:asmbuf = bufnr('Termdebug-asm-listing')
else
call s:Echoerr("You have a file/folder named 'Termdebug-asm-listing'.
\ Please exit and rename it because Termdebug may not work as expected.")
endif
@@ -1550,9 +1563,12 @@ func s:GotoVariableswinOrCreateIt()
setlocal modifiable
if s:varbuf > 0 && bufexists(s:varbuf)
exe 'buffer' . s:varbuf
exe 'buffer' . s:varbuf
elseif empty(glob('Termdebug-variables-listing'))
silent file Termdebug-variables-listing
let s:varbuf = bufnr('Termdebug-variables-listing')
else
call s:Echoerr("You have a file/folder named 'Termdebug-variables-listing'.
\ Please exit and rename it because Termdebug may not work as expected.")
endif