1
0
forked from aniani/vim

runtime(termdebug): remove line-continuation characters

Those are no longer needed for Vim9.

related: #14961

Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Yegappan Lakshmanan
2024-06-11 19:10:32 +02:00
committed by Christian Brabandt
parent 2e3b2a8d89
commit 971378eed9

View File

@@ -302,9 +302,8 @@ enddef
# Open a terminal window without a job, to run the debugged program in. # Open a terminal window without a job, to run the debugged program in.
def StartDebug_term(dict: dict<any>) def StartDebug_term(dict: dict<any>)
ptybuf = term_start('NONE', { ptybuf = term_start('NONE', {
\ 'term_name': 'debugged program', term_name: 'debugged program',
\ 'vertical': vvertical, vertical: vvertical})
\ })
if ptybuf == 0 if ptybuf == 0
Echoerr('Failed to open the program terminal window') Echoerr('Failed to open the program terminal window')
return return
@@ -323,10 +322,10 @@ def StartDebug_term(dict: dict<any>)
# Create a hidden terminal window to communicate with gdb # Create a hidden terminal window to communicate with gdb
commbuf = term_start('NONE', { commbuf = term_start('NONE', {
\ 'term_name': 'gdb communication', term_name: 'gdb communication',
\ 'out_cb': function('CommOutput'), out_cb: function('CommOutput'),
\ 'hidden': 1, hidden: 1
\ }) })
if commbuf == 0 if commbuf == 0
Echoerr('Failed to open the communication terminal window') Echoerr('Failed to open the communication terminal window')
exe 'bwipe! ' .. ptybuf exe 'bwipe! ' .. ptybuf
@@ -366,9 +365,9 @@ def StartDebug_term(dict: dict<any>)
ch_log('executing "' .. join(gdb_cmd) .. '"') ch_log('executing "' .. join(gdb_cmd) .. '"')
gdbbuf = term_start(gdb_cmd, { gdbbuf = term_start(gdb_cmd, {
\ 'term_name': 'gdb', term_name: 'gdb',
\ 'term_finish': 'close', term_finish: 'close',
\ }) })
if gdbbuf == 0 if gdbbuf == 0
Echoerr('Failed to open the gdb terminal window') Echoerr('Failed to open the gdb terminal window')
CloseBuffers() CloseBuffers()
@@ -482,9 +481,10 @@ def StartDebug_prompt(dict: dict<any>)
elseif empty(glob('Termdebug-gdb-console')) elseif empty(glob('Termdebug-gdb-console'))
file Termdebug-gdb-console file Termdebug-gdb-console
else else
Echoerr("You have a file/folder named 'gdb' Echoerr("You have a file/folder named 'gdb' " ..
\ or 'Termdebug-gdb-console'. "or 'Termdebug-gdb-console'. " ..
\ Please exit and rename them because Termdebug may not work as expected.") "Please exit and rename them because Termdebug may not work " ..
"as expected.")
endif endif
prompt_setcallback(promptbuf, function('PromptCallback')) prompt_setcallback(promptbuf, function('PromptCallback'))
@@ -516,16 +516,16 @@ def StartDebug_prompt(dict: dict<any>)
ch_log('executing "' .. join(gdb_cmd) .. '"') ch_log('executing "' .. join(gdb_cmd) .. '"')
gdbjob = job_start(gdb_cmd, { gdbjob = job_start(gdb_cmd, {
\ 'exit_cb': function('EndPromptDebug'), exit_cb: function('EndPromptDebug'),
\ 'out_cb': function('GdbOutCallback'), out_cb: function('GdbOutCallback'),
\ }) })
if job_status(gdbjob) != "run" if job_status(gdbjob) != "run"
Echoerr('Failed to start gdb') Echoerr('Failed to start gdb')
exe 'bwipe! ' .. promptbuf exe 'bwipe! ' .. promptbuf
return return
endif endif
exe $'au BufUnload <buffer={promptbuf}> ++once ' .. exe $'au BufUnload <buffer={promptbuf}> ++once ' ..
\ 'call job_stop(gdbjob, ''kill'')' 'call job_stop(gdbjob, ''kill'')'
# Mark the buffer modified so that it's not easy to close. # Mark the buffer modified so that it's not easy to close.
set modified set modified
gdb_channel = job_getchannel(gdbjob) gdb_channel = job_getchannel(gdbjob)
@@ -538,8 +538,8 @@ def StartDebug_prompt(dict: dict<any>)
# Unix: Run the debugged program in a terminal window. Open it below the # Unix: Run the debugged program in a terminal window. Open it below the
# gdb window. # gdb window.
belowright ptybuf = term_start('NONE', { belowright ptybuf = term_start('NONE', {
\ 'term_name': 'debugged program', term_name: 'debugged program',
\ }) })
if ptybuf == 0 if ptybuf == 0
Echoerr('Failed to open the program terminal window') Echoerr('Failed to open the program terminal window')
job_stop(gdbjob) job_stop(gdbjob)
@@ -707,7 +707,7 @@ def GdbOutCallback(channel: channel, text: string)
# Drop the gdb prompt, we have our own. # Drop the gdb prompt, we have our own.
# Drop status and echo'd commands. # Drop status and echo'd commands.
if text == '(gdb) ' || text == '^done' || if text == '(gdb) ' || text == '^done' ||
\ (text[0] == '&' && text !~ '^&"disassemble') (text[0] == '&' && text !~ '^&"disassemble')
return return
endif endif
@@ -765,8 +765,8 @@ def DecodeMessage(quotedText: string, literal: bool): string
\ ->substitute(NullRepl, '\\000', 'g') \ ->substitute(NullRepl, '\\000', 'g')
if !literal if !literal
return msg return msg
\ ->substitute('\\t', "\t", 'g') ->substitute('\\t', "\t", 'g')
\ ->substitute('\\n', '', 'g') ->substitute('\\n', '', 'g')
else else
return msg return msg
endif endif
@@ -967,10 +967,7 @@ def HandleVariablesMsg(msg: string)
silent! :%delete _ silent! :%delete _
var spaceBuffer = 20 var spaceBuffer = 20
setline(1, 'Type' .. setline(1, 'Type' ..
\ repeat(' ', 16) .. repeat(' ', 16) .. 'Name' .. repeat(' ', 16) .. 'Value')
\ 'Name' ..
\ repeat(' ', 16) ..
\ 'Value')
var cnt = 1 var cnt = 1
var capture = '{name=".\{-}",\%(arg=".\{-}",\)\{0,1\}type=".\{-}"\%(,value=".\{-}"\)\{0,1\}}' var capture = '{name=".\{-}",\%(arg=".\{-}",\)\{0,1\}type=".\{-}"\%(,value=".\{-}"\)\{0,1\}}'
var varinfo = matchstr(msg, capture, 0, cnt) var varinfo = matchstr(msg, capture, 0, cnt)
@@ -978,10 +975,10 @@ def HandleVariablesMsg(msg: string)
while varinfo != '' while varinfo != ''
var vardict = ParseVarinfo(varinfo) var vardict = ParseVarinfo(varinfo)
setline(cnt + 1, vardict['type'] .. setline(cnt + 1, vardict['type'] ..
\ repeat(' ', max([20 - len(vardict['type']), 1])) .. repeat(' ', max([20 - len(vardict['type']), 1])) ..
\ vardict['name'] .. vardict['name'] ..
\ repeat(' ', max([20 - len(vardict['name']), 1])) .. repeat(' ', max([20 - len(vardict['name']), 1])) ..
\ vardict['value']) vardict['value'])
cnt += 1 cnt += 1
varinfo = matchstr(msg, capture, 0, cnt) varinfo = matchstr(msg, capture, 0, cnt)
endwhile endwhile
@@ -1255,7 +1252,7 @@ def Until(at: string)
# Use the fname:lnum format # Use the fname:lnum format
var AT = empty(at) ? var AT = empty(at) ?
\ fnameescape(expand('%:p')) .. ':' .. line('.') : at fnameescape(expand('%:p')) .. ':' .. line('.') : at
SendCommand('-exec-until ' .. AT) SendCommand('-exec-until ' .. AT)
else else
ch_log('dropping command, program is running: exec-until') ch_log('dropping command, program is running: exec-until')
@@ -1275,7 +1272,7 @@ def SetBreakpoint(at: string, tbreak=false)
# Use the fname:lnum format, older gdb can't handle --source. # Use the fname:lnum format, older gdb can't handle --source.
var AT = empty(at) ? var AT = empty(at) ?
\ fnameescape(expand('%:p')) .. ':' .. line('.') : at fnameescape(expand('%:p')) .. ':' .. line('.') : at
var cmd = '' var cmd = ''
if tbreak if tbreak
cmd = '-break-insert -t ' .. AT cmd = '-break-insert -t ' .. AT
@@ -1303,7 +1300,7 @@ def ClearBreakpoint()
SendCommand('-break-delete ' .. id) SendCommand('-break-delete ' .. id)
for subid in keys(breakpoints[id]) for subid in keys(breakpoints[id])
sign_unplace('TermDebug', sign_unplace('TermDebug',
\ {'id': Breakpoint2SignNumber(id, str2nr(subid))}) {id: Breakpoint2SignNumber(id, str2nr(subid))})
endfor endfor
remove(breakpoints, id) remove(breakpoints, id)
remove(breakpoint_locations[bploc], idx) remove(breakpoint_locations[bploc], idx)
@@ -1374,8 +1371,8 @@ def SendEval(expr: string)
# encoding expression to prevent bad errors # encoding expression to prevent bad errors
var expr_escaped = expr var expr_escaped = expr
\ ->substitute('\\', '\\\\', 'g') ->substitute('\\', '\\\\', 'g')
\ ->substitute('"', '\\"', 'g') ->substitute('"', '\\"', 'g')
SendCommand('-data-evaluate-expression "' .. expr_escaped .. '"') SendCommand('-data-evaluate-expression "' .. expr_escaped .. '"')
evalexpr = exprLHS evalexpr = exprLHS
enddef enddef
@@ -1564,8 +1561,9 @@ def GotoAsmwinOrCreateIt()
silent file Termdebug-asm-listing silent file Termdebug-asm-listing
asmbuf = bufnr('Termdebug-asm-listing') asmbuf = bufnr('Termdebug-asm-listing')
else else
Echoerr("You have a file/folder named 'Termdebug-asm-listing'. Echoerr("You have a file/folder named 'Termdebug-asm-listing'. " ..
\ Please exit and rename it because Termdebug may not work as expected.") "Please exit and rename it because Termdebug may not work " ..
"as expected.")
endif endif
if mdf != 'vert' && GetDisasmWindowHeight() > 0 if mdf != 'vert' && GetDisasmWindowHeight() > 0
@@ -1637,8 +1635,9 @@ def GotoVariableswinOrCreateIt()
silent file Termdebug-variables-listing silent file Termdebug-variables-listing
varbuf = bufnr('Termdebug-variables-listing') varbuf = bufnr('Termdebug-variables-listing')
else else
Echoerr("You have a file/folder named 'Termdebug-variables-listing'. Echoerr("You have a file/folder named 'Termdebug-variables-listing'. " ..
\ Please exit and rename it because Termdebug may not work as expected.") "Please exit and rename it because Termdebug may not work " ..
"as expected.")
endif endif
if mdf != 'vert' && GetVariablesWindowHeight() > 0 if mdf != 'vert' && GetVariablesWindowHeight() > 0
@@ -1709,9 +1708,9 @@ def HandleCursor(msg: string)
# prompt, since it is unlikely we want to edit the file. # prompt, since it is unlikely we want to edit the file.
# The file may be changed but not saved, warn for that. # The file may be changed but not saved, warn for that.
au SwapExists * echohl WarningMsg au SwapExists * echohl WarningMsg
\ | echo 'Warning: file is being edited elsewhere' | echo 'Warning: file is being edited elsewhere'
\ | echohl None | echohl None
\ | let v:swapchoice = 'o' | let v:swapchoice = 'o'
augroup END augroup END
if &modified if &modified
# TODO: find existing window # TODO: find existing window
@@ -1729,7 +1728,7 @@ def HandleCursor(msg: string)
normal! zv normal! zv
sign_unplace('TermDebug', {'id': pc_id}) sign_unplace('TermDebug', {'id': pc_id})
sign_place(pc_id, 'TermDebug', 'debugPC', fname, sign_place(pc_id, 'TermDebug', 'debugPC', fname,
\ {'lnum': str2nr(lnum), priority: 110}) {lnum: str2nr(lnum), priority: 110})
if !exists('b:save_signcolumn') if !exists('b:save_signcolumn')
b:save_signcolumn = &signcolumn b:save_signcolumn = &signcolumn
add(signcolumn_buflist, bufnr()) add(signcolumn_buflist, bufnr())
@@ -1764,8 +1763,8 @@ def CreateBreakpoint(id: number, subid: number, enabled: string)
endif endif
endif endif
sign_define('debugBreakpoint' .. nr, sign_define('debugBreakpoint' .. nr,
\ {'text': slice(label, 0, 2), {text: slice(label, 0, 2),
\ 'texthl': hiName}) texthl: hiName})
endif endif
enddef enddef
@@ -1852,8 +1851,8 @@ enddef
def PlaceSign(id: number, subid: number, entry: dict<any>) def PlaceSign(id: number, subid: number, entry: dict<any>)
var nr = printf('%d.%d', id, subid) var nr = printf('%d.%d', id, subid)
sign_place(Breakpoint2SignNumber(id, subid), 'TermDebug', sign_place(Breakpoint2SignNumber(id, subid), 'TermDebug',
\ 'debugBreakpoint' .. nr, entry['fname'], 'debugBreakpoint' .. nr, entry['fname'],
\ {'lnum': entry['lnum'], priority: 110}) {lnum: entry['lnum'], priority: 110})
entry['placed'] = 1 entry['placed'] = 1
enddef enddef
@@ -1868,7 +1867,7 @@ def HandleBreakpointDelete(msg: string)
for [subid, entry] in items(breakpoints[id]) for [subid, entry] in items(breakpoints[id])
if has_key(entry, 'placed') if has_key(entry, 'placed')
sign_unplace('TermDebug', sign_unplace('TermDebug',
\ {'id': Breakpoint2SignNumber(str2nr(id), str2nr(subid))}) {'id': Breakpoint2SignNumber(str2nr(id), str2nr(subid))})
remove(entry, 'placed') remove(entry, 'placed')
endif endif
endfor endfor