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

patch 9.0.1663: Termdebug on MS-Windows: some file names are not recognized

Problem:    Termdebug on MS-Windows: some file names are not recognized.
Solution:   Do not always change \t and \n. (Christian Brabandt,
            closes #12565, closes #12560, closes #12550)
This commit is contained in:
Christian Brabandt 2023-06-24 20:02:25 +01:00 committed by Bram Moolenaar
parent 4e2406c7a9
commit c9a4a8ab28
2 changed files with 19 additions and 11 deletions

View File

@ -602,14 +602,14 @@ func s:GdbOutCallback(channel, text)
return
endif
if a:text =~ '^\^error,msg='
let text = s:DecodeMessage(a:text[11:])
let text = s:DecodeMessage(a:text[11:], v:false)
if exists('s:evalexpr') && text =~ 'A syntax error in expression, near\|No symbol .* in current context'
" Silently drop evaluation errors.
unlet s:evalexpr
return
endif
elseif a:text[0] == '~'
let text = s:DecodeMessage(a:text[1:])
let text = s:DecodeMessage(a:text[1:], v:false)
else
call s:CommOutput(a:channel, a:text)
return
@ -625,21 +625,20 @@ func s:GdbOutCallback(channel, text)
call win_gotoid(curwinid)
endfunc
" Decode a message from gdb. quotedText starts with a ", return the text up
" Decode a message from gdb. "quotedText" starts with a ", return the text up
" to the next ", unescaping characters:
" - remove line breaks
" - change \\t to \t
" - remove line breaks (unless "literal" is v:true)
" - change \\t to \t (unless "literal" is v:true)
" - change \0xhh to \xhh (disabled for now)
" - change \ooo to octal
" - change \\ to \
func s:DecodeMessage(quotedText)
func s:DecodeMessage(quotedText, literal)
if a:quotedText[0] != '"'
echoerr 'DecodeMessage(): missing quote in ' . a:quotedText
return
endif
return a:quotedText
\ ->substitute('^"\|".*\|\\n', '', 'g')
\ ->substitute('\\t', "\t", 'g')
let msg = a:quotedText
\ ->substitute('^"\|".*', '', 'g')
" multi-byte characters arrive in octal form
" NULL-values must be kept encoded as those break the string otherwise
\ ->substitute('\\000', s:NullRepl, 'g')
@ -651,6 +650,13 @@ func s:DecodeMessage(quotedText)
" \ ->substitute('\\0x00', s:NullRepl, 'g')
\ ->substitute('\\\\', '\', 'g')
\ ->substitute(s:NullRepl, '\\000', 'g')
if !a:literal
return msg
\ ->substitute('\\t', "\t", 'g')
\ ->substitute('\\n', '', 'g')
else
return msg
endif
endfunc
const s:NullRepl = 'XXXNULLXXX'
@ -659,7 +665,7 @@ func s:GetFullname(msg)
if a:msg !~ 'fullname'
return ''
endif
let name = s:DecodeMessage(substitute(a:msg, '.*fullname=', '', ''))
let name = s:DecodeMessage(substitute(a:msg, '.*fullname=', '', ''), v:true)
if has('win32') && name =~ ':\\\\'
" sometimes the name arrives double-escaped
let name = substitute(name, '\\\\', '\\', 'g')
@ -672,7 +678,7 @@ func s:GetAsmAddr(msg)
if a:msg !~ 'addr='
return ''
endif
let addr = s:DecodeMessage(substitute(a:msg, '.*addr=', '', ''))
let addr = s:DecodeMessage(substitute(a:msg, '.*addr=', '', ''), v:false)
return addr
endfunc

View File

@ -695,6 +695,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1663,
/**/
1662,
/**/