Skip to content

Commit c9a4a8a

Browse files
chrisbrabrammool
authored andcommitted
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)
1 parent 4e2406c commit c9a4a8a

2 files changed

Lines changed: 19 additions & 11 deletions

File tree

runtime/pack/dist/opt/termdebug/plugin/termdebug.vim

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -602,14 +602,14 @@ func s:GdbOutCallback(channel, text)
602602
return
603603
endif
604604
if a:text =~ '^\^error,msg='
605-
let text = s:DecodeMessage(a:text[11:])
605+
let text = s:DecodeMessage(a:text[11:], v:false)
606606
if exists('s:evalexpr') && text =~ 'A syntax error in expression, near\|No symbol .* in current context'
607607
" Silently drop evaluation errors.
608608
unlet s:evalexpr
609609
return
610610
endif
611611
elseif a:text[0] == '~'
612-
let text = s:DecodeMessage(a:text[1:])
612+
let text = s:DecodeMessage(a:text[1:], v:false)
613613
else
614614
call s:CommOutput(a:channel, a:text)
615615
return
@@ -625,21 +625,20 @@ func s:GdbOutCallback(channel, text)
625625
call win_gotoid(curwinid)
626626
endfunc
627627

628-
" Decode a message from gdb. quotedText starts with a ", return the text up
628+
" Decode a message from gdb. "quotedText" starts with a ", return the text up
629629
" to the next ", unescaping characters:
630-
" - remove line breaks
631-
" - change \\t to \t
630+
" - remove line breaks (unless "literal" is v:true)
631+
" - change \\t to \t (unless "literal" is v:true)
632632
" - change \0xhh to \xhh (disabled for now)
633633
" - change \ooo to octal
634634
" - change \\ to \
635-
func s:DecodeMessage(quotedText)
635+
func s:DecodeMessage(quotedText, literal)
636636
if a:quotedText[0] != '"'
637637
echoerr 'DecodeMessage(): missing quote in ' . a:quotedText
638638
return
639639
endif
640-
return a:quotedText
641-
\ ->substitute('^"\|".*\|\\n', '', 'g')
642-
\ ->substitute('\\t', "\t", 'g')
640+
let msg = a:quotedText
641+
\ ->substitute('^"\|".*', '', 'g')
643642
" multi-byte characters arrive in octal form
644643
" NULL-values must be kept encoded as those break the string otherwise
645644
\ ->substitute('\\000', s:NullRepl, 'g')
@@ -651,6 +650,13 @@ func s:DecodeMessage(quotedText)
651650
" \ ->substitute('\\0x00', s:NullRepl, 'g')
652651
\ ->substitute('\\\\', '\', 'g')
653652
\ ->substitute(s:NullRepl, '\\000', 'g')
653+
if !a:literal
654+
return msg
655+
\ ->substitute('\\t', "\t", 'g')
656+
\ ->substitute('\\n', '', 'g')
657+
else
658+
return msg
659+
endif
654660
endfunc
655661
const s:NullRepl = 'XXXNULLXXX'
656662

@@ -659,7 +665,7 @@ func s:GetFullname(msg)
659665
if a:msg !~ 'fullname'
660666
return ''
661667
endif
662-
let name = s:DecodeMessage(substitute(a:msg, '.*fullname=', '', ''))
668+
let name = s:DecodeMessage(substitute(a:msg, '.*fullname=', '', ''), v:true)
663669
if has('win32') && name =~ ':\\\\'
664670
" sometimes the name arrives double-escaped
665671
let name = substitute(name, '\\\\', '\\', 'g')
@@ -672,7 +678,7 @@ func s:GetAsmAddr(msg)
672678
if a:msg !~ 'addr='
673679
return ''
674680
endif
675-
let addr = s:DecodeMessage(substitute(a:msg, '.*addr=', '', ''))
681+
let addr = s:DecodeMessage(substitute(a:msg, '.*addr=', '', ''), v:false)
676682
return addr
677683
endfunc
678684

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -695,6 +695,8 @@ static char *(features[]) =
695695

696696
static int included_patches[] =
697697
{ /* Add new patch number below this line */
698+
/**/
699+
1663,
698700
/**/
699701
1662,
700702
/**/

0 commit comments

Comments
 (0)