Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: vim sends a strange escape sequence when gnome-terminal is used #14407

Closed
tigran123 opened this issue Jan 8, 2023 · 9 comments
Closed

Comments

@tigran123
Copy link

tigran123 commented Jan 8, 2023

Problem description

When vim is started up or exits, even without any file it displays a strange Unicode character, see the two screenshots.
Screenshot from 2023-01-08 15-19-09
Screenshot from 2023-01-08 15-19-03

What steps will reproduce the bug?

just run vim and then exit it via :q

What is the expected behavior?

There should be no garbage characters. Also, this only happens when I login via ssh from a Linux session running gnome-terminal, but if I login (again via ssh) from a Linux text console, then everything is fine -- no garbage is thrown by vim. I thought maybe something in my .vimrc/.viminfo is incompatible with vim (I normally use vim 8.0.3741, i.e. what is current on Ubuntu 18.04.6, so I moved those files out of the way, but no -- the problem is still there.

System information

termux-info:

Termux Variables:
TERMUX_APP_PACKAGE_MANAGER=apt
TERMUX_MAIN_PACKAGE_FORMAT=debian
TERMUX_VERSION=0.117
Packages CPU architecture:
aarch64
Subscribed repositories:
# sources.list
deb https://grimler.se/termux/termux-main stable main
Updatable packages:
All packages up to date
termux-tools version:
1.35.0
Android version:
10
Kernel build information:
Linux localhost 4.4.205-22915538 #1 SMP PREEMPT Mon Jul 25 09:40:28 KST 2022 aarch64 Android
Device manufacturer:
samsung
Device model:
SM-T835
@tigran123 tigran123 added bug report Something is not working properly. untriaged labels Jan 8, 2023
@landfillbaby
Copy link
Member

this is less a problem with vim and more one with gnome, that's a standard escape sequence being rendered as text...

@xtkoba
Copy link
Contributor

xtkoba commented Jan 9, 2023

Not reproducible for me, when SSHing from x11-terms/gnome-terminal-3.46.7 in Gentoo Portage. Those sequences are actually sent, but are handled correctly by my GNOME Terminal. Though it may [EDIT] not be of much help, I suggest sharing strace output of vim command, just in case.

A suggested workaround is to set TERM environment variable to something other than xterm (or xterm-256color.)

@xtkoba xtkoba added not reproducible / bug report and removed bug report Something is not working properly. untriaged labels Jan 9, 2023
@landfillbaby
Copy link
Member

landfillbaby commented Jan 9, 2023

OK, looking into it more, it's actually a slightly nonstandard code added by xterm to set its modifyOtherKeys level to 2, basically allowing raw keyboard input.
Related to vim's t_TE/t_TI variables, set by keyprotocol, and by default chosen from the TERM environment variable. Fixing it may be as simple as changing one of those.
https://vi.stackexchange.com/questions/27399/whats-t-te-and-t-ti-added-by-vim-8/ (slightly outdated as it doesn't account for keyprotocol in vim 9)
https://linux.die.net/man/1/xterm

What's your $TERM? if it's not gnome-256color or similar that's your problem.

@landfillbaby
Copy link
Member

landfillbaby commented Jan 9, 2023

tl;dr you need to set TERM=gnome-256color. gnome doesn't support xterm stuff.

@xtkoba xtkoba reopened this Jan 9, 2023
@xtkoba
Copy link
Contributor

xtkoba commented Jan 9, 2023

gnome-256color is not supported in Termux:

~ $ TERM=gnome-256color vim

E557: Cannot open termcap file
'gnome-256color' not known. Available builtin terminals are:
    builtin_ansi
    builtin_vt320
    builtin_vt52
    builtin_xterm
    builtin_iris-ansi
    builtin_pcansi
    builtin_win32
    builtin_amiga
    builtin_dumb
    builtin_debug
defaulting to 'ansi'

@xtkoba
Copy link
Contributor

xtkoba commented Jan 9, 2023

Note that it does not reproduce with my GNOME Terminal even when TERM=xterm-256color. I suspect that the version of GNOME Terminal is too old that the author is using.

@landfillbaby
Copy link
Member

ah you're right yes. maybe we should add gnome terminfo files? or just leave ssh via old gnome unsupported

@xtkoba
Copy link
Contributor

xtkoba commented Jan 9, 2023

Adding terminfo is trivial and I will handle that.

@landfillbaby
Copy link
Member

to clarify, the user should wait for #14409, pkg up in termux, then set TERM=gnome-256color when using ssh via outdated gnome, no matter the host.

xtkoba added a commit that referenced this issue Jan 9, 2023
termux-pacman-bot added a commit to termux-pacman/termux-packages that referenced this issue Jan 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants