]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.0.1663: Termdebug on MS-Windows: some file names are not recognized v9.0.1663
authorChristian Brabandt <cb@256bit.org>
Sat, 24 Jun 2023 19:02:25 +0000 (20:02 +0100)
committerBram Moolenaar <Bram@vim.org>
Sat, 24 Jun 2023 19:02:25 +0000 (20:02 +0100)
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)

runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
src/version.c

index d3d541cc958e299bcb965aaa624b241f37977a30..b4dccc55035d63126133e686e5d51d9622d5a22b 100644 (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
 
index 8840b3acc65b0f07196a3734cf058affd7330b02..53ac924fecb63413eb63e3fffdd3d31adb9b5c9c 100644 (file)
@@ -695,6 +695,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1663,
 /**/
     1662,
 /**/