aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Dewar <seandewar@users.noreply.github.com>2023-08-21 11:06:44 +0100
committerSean Dewar <seandewar@users.noreply.github.com>2023-08-25 10:59:56 +0100
commitaf78060b188236cca9ef3479cbab94df56c89721 (patch)
tree20c9fadc26aeb4129b4e299250be70f149659783
parentec971288267dece8f1bc492847b3ae6e5271acd0 (diff)
downloadrneovim-af78060b188236cca9ef3479cbab94df56c89721.tar.gz
rneovim-af78060b188236cca9ef3479cbab94df56c89721.tar.bz2
rneovim-af78060b188236cca9ef3479cbab94df56c89721.zip
fix(termdebug): trim suffixed "\r" in CommOutput
Vim splits lines on "\r", then trims any prefixed "\n". But in Nvim, job output lines are split on "\n" (like readfile() in binary mode), so trim any suffixed "\r" instead. This gets rid of the trailing "^M" character in messages parsed from the jobs.
-rw-r--r--runtime/pack/dist/opt/termdebug/plugin/termdebug.vim11
1 files changed, 6 insertions, 5 deletions
diff --git a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
index 83857221de..c490fbf441 100644
--- a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
+++ b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
@@ -875,7 +875,9 @@ func s:HandleDisasmMsg(msg)
else
let value = substitute(a:msg, '^\~\"[ ]*', '', '')
let value = substitute(value, '^=>[ ]*', '', '')
- let value = substitute(value, '\\n\"\r$', '', '')
+ " Nvim already trims the final "\r" in s:CommOutput()
+ " let value = substitute(value, '\\n\"\r$', '', '')
+ let value = substitute(value, '\\n\"$', '', '')
let value = substitute(value, '\r', '', '')
let value = substitute(value, '\\t', ' ', 'g')
@@ -929,11 +931,10 @@ func s:HandleVariablesMsg(msg)
endfunc
func s:CommOutput(job_id, msgs, event)
-
for msg in a:msgs
- " remove prefixed NL
- if msg[0] == "\n"
- let msg = msg[1:]
+ " Nvim job lines are split on "\n", so trim a suffixed CR.
+ if msg[-1:] == "\r"
+ let msg = msg[:-2]
endif
if s:parsing_disasm_msg