Closed maxscott closed 1 year ago
@fortenforge I can also reproduce this on macOS but not Ubuntu
I can reproduce this (long line of control characters printed over the buffer as pictured in #126) with wezterm and vim 9.0 (patches 1-1658). On the same system using urxvt it only puts a couple of characters there instead of a huge list.
I did the old "follow the logic flow and comment out functionality until the symptoms change" trick and traced it to these two system()
calls: https://github.com/Exafunction/codeium.vim/blob/7e0054a/autoload/codeium/server.vim#L123-L124
Removing the substitute and using echom
on the raw string returned from system()
it looks like the "garbage" on the screen is control characters that are read after the end of the output from uname. Interestingly, when I comment out the call to StartLanguageServer
that is triggering that code path the garbage doesn't show up when I later call CodeiumEnable
, so possibly it's something that only happens when system()
is called while vim is starting up before it's initialized the terminal fully.
Anyway, :help system
says to prepend the calls with silent
when you don't need user input because it "avoids stray characters showing up on the screen", and that seems to resolve the issue here just fine:
diff --git i/autoload/codeium/server.vim w/autoload/codeium/server.vim
index 569c4abf5171..9cd65ea9fa73 100644
--- i/autoload/codeium/server.vim
+++ w/autoload/codeium/server.vim
@@ -120,8 +120,8 @@ function! s:SendHeartbeat(timer) abort
endfunction
function! codeium#server#Start(...) abort
- let os = substitute(system('uname'), '\n', '', '')
- let arch = substitute(system('uname -m'), '\n', '', '')
+ silent let os = substitute(system('uname'), '\n', '', '')
+ silent let arch = substitute(system('uname -m'), '\n', '', '')
let is_arm = stridx(arch, 'arm') == 0 || stridx(arch, 'aarch64') == 0
if os ==# 'Linux' && is_arm
Wow really good find
@toofar thanks for looking into this. Happy to accept this as a PR if you'd like to create one, otherwise we'll likely make this change ourselves then.
Description
I'm seeing a "report mode settings" control sequence-looking thing:
^[[?12;4$y
inserted at the beginning of vim buffers when the plugin in activated in my vimrc via:I could be misconfiguring the plugin somehow, or using incompatible tools, but this seems to be bug in the vim plugin.
Current Workaround
The character goes away when I remove the plugin and imap call from my vimrc.
Versions
VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Feb 24 2023 12:08:45) macOS version - x86_64 Included patches: 1-1350
Iterm: Build 3.4.19