diff options
author | Christian Brabandt <cb@256bit.org> | 2023-06-24 20:02:25 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2023-06-24 20:02:25 +0100 |
commit | c9a4a8ab28da2b11856a3f08ccba2e91f46b85c3 (patch) | |
tree | 5d1003e62963754e02302b50de7b074319818467 /runtime/pack/dist | |
parent | 4e2406c7a9d5f7f03faec8c42fac15c192fb59b0 (diff) |
patch 9.0.1663: Termdebug on MS-Windows: some file names are not recognizedv9.0.1663
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)
Diffstat (limited to 'runtime/pack/dist')
-rw-r--r-- | runtime/pack/dist/opt/termdebug/plugin/termdebug.vim | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim index d3d541cc95..b4dccc5503 100644 --- a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim +++ b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim @@ -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 |