aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-07-18 13:26:16 +0800
committerzeertzjq <zeertzjq@outlook.com>2024-07-18 13:28:12 +0800
commitbe7b5774531364e6f1e2b2cec3c297a3bb84a60d (patch)
tree62fa36eea55e9a60b99de1b87b073e3d30664e74
parent8ce85d5fc706ff523950f17d7464eb7dd2842633 (diff)
downloadrneovim-be7b5774531364e6f1e2b2cec3c297a3bb84a60d.tar.gz
rneovim-be7b5774531364e6f1e2b2cec3c297a3bb84a60d.tar.bz2
rneovim-be7b5774531364e6f1e2b2cec3c297a3bb84a60d.zip
vim-patch:27f5334: runtime(termdebug): quote filename arguments using double quotes
closes: vim/vim#15270 https://github.com/vim/vim/commit/27f53346a303c5cf1bdfb8abca20e4fea8ec05e4 Co-authored-by: Ubaldo Tiberi <ubaldo.tiberi@google.com>
-rw-r--r--runtime/pack/dist/opt/termdebug/plugin/termdebug.vim10
1 files changed, 8 insertions, 2 deletions
diff --git a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
index cf14f66c4b..6227a20e3c 100644
--- a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
+++ b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
@@ -1181,6 +1181,12 @@ func s:DeleteCommands()
let s:BreakpointSigns = []
endfunc
+func s:QuoteArg(x)
+ " Find all the occurrences of " and \ and escape them and double quote
+ " the resulting string.
+ return printf('"%s"', a:x->substitute('[\\"]', '\\&', 'g'))
+endfunc
+
" :Until - Execute until past a specified position or current line
func s:Until(at)
if s:stopped
@@ -1188,7 +1194,7 @@ func s:Until(at)
let s:stopped = v:false
" call ch_log('assume that program is running after this command')
" Use the fname:lnum format
- let at = empty(a:at) ? $"\"{expand('%:p')}:{line('.')}\"" : a:at
+ let at = empty(a:at) ? s:QuoteArg($"{expand('%:p')}:{line('.')}") : a:at
call s:SendCommand($'-exec-until {at}')
" else
" call ch_log('dropping command, program is running: exec-until')
@@ -1207,7 +1213,7 @@ func s:SetBreakpoint(at, tbreak=v:false)
endif
" Use the fname:lnum format, older gdb can't handle --source.
- let at = empty(a:at) ? $"\"{expand('%:p')}:{line('.')}\"" : a:at
+ let at = empty(a:at) ? s:QuoteArg($"{expand('%:p')}:{line('.')}") : a:at
if a:tbreak
let cmd = $'-break-insert -t {at}'
else