changeset 32663:118a098718d8 v9.0.1663

patch 9.0.1663: Termdebug on MS-Windows: some file names are not recognized Commit: https://github.com/vim/vim/commit/c9a4a8ab28da2b11856a3f08ccba2e91f46b85c3 Author: Christian Brabandt <cb@256bit.org> Date: Sat Jun 24 20:02:25 2023 +0100 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)
author Bram Moolenaar <Bram@vim.org>
date Sat, 24 Jun 2023 21:15:03 +0200
parents bed7285e0bb3
children 3ca4b0fb58e8
files runtime/pack/dist/opt/termdebug/plugin/termdebug.vim src/version.c
diffstat 2 files changed, 19 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- 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
 
--- a/src/version.c
+++ b/src/version.c
@@ -696,6 +696,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1663,
+/**/
     1662,
 /**/
     1661,