Skip to content

Funny characters happen on gnome-terminal/mate-terminal starting from v9.0.0980 #11728

Closed

Description

@antarestrue

The upper-left characters (see below). This happens at the cursor position. If you have opened a file and moved the cursor, next time you open the file, this will happen there.
And this only happens on gnome-terminal and mate-terminal, but not konsole nor xterm.
image

Activity

  1. chrisbra commented on Dec 19, 2022

    @chrisbra
    Member

    I guess this comes from Vim requesting the terminals support for Keyboard protocol and your terminal does not support it.

    so try to disable this:

    :set t_RK=
    
  2. brammool commented on Dec 19, 2022

    @brammool
    Contributor

    Please describe exactly what you did. You say you opened a file, how?
    The screenshot actually shows Vim not editing any file.
    How did you start gnome-terminal?
    What shell are you using?
    What is the value of $TERM, or the value of 'term' in Vim?

  3. antarestrue commented on Dec 20, 2022

    @antarestrue
    Author

    The screenshot was showing when not editing a file, the cursor is at the upper-left corner, and the char sequence is at the upper-left corner. If you open a previously opened file, the char sequence can be anywhere at the last position of the cursor (see below). Moving cursor away does not make it disappear. The char sequence stays at its initial position. And it will not be saved to the file.

    I start gnome-terminal simply by typing gnome-terminal on console, and start vim by typing src/vim, which is the build folder. $TERM is xterm-256color. Tried letting $TERM=xterm and does not make difference. My shell is tcsh, but bash is the same. The desktop is Mate Desktop.

    Using :set t_RK= can remove the char sequence, but putting this line in .vimrc has no effect, unfortunately. I think it is still related to t_RK and also related to VTE.

    image

  4. brammool commented on Dec 20, 2022

    @brammool
    Contributor
  5. chrisbra commented on Dec 20, 2022

    @chrisbra
    Member

    I also tried to repduce and couldn't using gnome-terminal from bullseye (3.38.3), buster (3.30.2) and stretch (3.22) and neither shows this error. It may depend on the version of libvte. Ah, I see it, once I downgrade libvte-2.91 (0.62.3, bullseye) to 0.46.1 (stretch). Once I upgrade libvte to 0.54 (buster) it does not show it again.

    grafik

    As mentioned it goes away, if I use :set t_RK=
    Alternatively, I have :set term=builtin_xterm in my vimrc (I forgot why) which also works around/fixes that problem.

    @antarestrue would it be possible to test a newer version of gnome-terminal? Or test the above mentioned work-arounds please.

  6. Shane-XB-Qian commented on Dec 20, 2022

    @Shane-XB-Qian
  7. antarestrue commented on Dec 20, 2022

    @antarestrue
    Author

    I don't own the machine so I cannot upgrade the system VTE (which is 0.52.2). set t_RK= in .vimrc has no effect somehow. I need to use :set t_RK= every time after opening a file, which is not so good. set term=builtin_xterm does not work and it becomes only black and white...
    Anyway, now we are sure it is related to VTE and it is fixed in later version of VTE.

  8. chrisbra commented on Dec 20, 2022

    @chrisbra
    Member

    After startup, try :verbose set t_RK? to find out where it was last set.

  9. antarestrue commented on Dec 20, 2022

    @antarestrue
    Author

    I just found an interesting result. With the latest vim 9.0.1083, set t_RK= works in .vimrc! However, when I close vim, it outputs another character sequence to console right before the prompt, no matter set t_RK= is there or not. The code is �[>4;m, seems different than t_RK.

  10. antarestrue commented on Dec 20, 2022

    @antarestrue
    Author

    :verbose set t_RK?

    In v9.0.0980, it shows E846: Key code not set: t_RK?. In latest vim, it shows set from ~/.vimrc

  11. Shane-XB-Qian commented on Dec 20, 2022

    @Shane-XB-Qian
  12. antarestrue commented on Dec 20, 2022

    @antarestrue
    Author

    I found �[>4;m is t_TE. So, I have a workaround now. Using latest vim 9.0.1083, add both set t_RK= and set t_TE= in .vimrc. Not sure if there is any side-effect, though.

  13. chrisbra commented on Dec 20, 2022

    @chrisbra
    Member

    You can see using :h t_TE what it is about.

    let me close it, since it looks like an issue with an old VTE version.

  14. antarestrue commented on Dec 20, 2022

    @antarestrue
    Author

    Okay thanks for help!

  15. brammool commented on Dec 20, 2022

    @brammool
    Contributor

    So there is a sequence of things that happen, and a few places that "should work" but don't really work as expected.
    The start is setting $TERM to xterm-256color. This makes Vim think this terminal is xterm-compatible. Vim then tries to switch on modifyOtherKeys level 2, so that more keys can be mapped. This probably doesn't work for gnome-terminal, but Vim doesn't know that so sets up t_TI, t_TE and t_RK for when it works. Either way, an xterm-compatible terminal should ignore the codes, even when not supported.

    The core of the problem appears to be that this terminal doesn't ignore these codes. This was fixed in a later version, with the fix in libvte, apparently. If you can't upgrade the terminal or libvte you will keep getting these characters.

    A way to avoid the problem is making 'keyprotocol' empty. Vim will then not try use modifyOtherKeys, even though the value of $TERM contains "xterm". That should work better than making t_TE and t_RK empty, because those may be set later.

  16. antarestrue commented on Dec 21, 2022

    @antarestrue
    Author

    I tried set keyprotocol= and set keyprotocol=xterm:none but that doesn't make difference, still seeing the key code on the screen.

  17. Shane-XB-Qian commented on Dec 21, 2022

    @Shane-XB-Qian
  18. antarestrue commented on Dec 21, 2022

    @antarestrue
    Author

    It works adding let &term=&term after set keyprotocol=, thanks!

  19. mikeSGman commented on Jun 12, 2023

    @mikeSGman

    set t_RK= and set t_TE

    This worked; I've tried EVERYTHING. Thank you!!

    This fixed systems with VTE_VERSION=5202, and none at all!

  20. mrinterestfull commented on Apr 26, 2025

    @mrinterestfull

    Thanks for the workaround solution.
    Was the permanent fix checked into a main repo?
    The characters are now default Debian Stable. Finally after few months of being annoyed with it I found this thread. It would vim settings should be updated.

    Can someone confirm the fix was included with next release. And what version.

    Thank you
    Lucas

  21. chrisbra commented on Apr 26, 2025

    @chrisbra
    Member

    It's a bug in your terminal emulator, not in Vim.

  22. mrinterestfull commented on May 1, 2025

    @mrinterestfull

    Can you elaborate?
    a) What is the ticket# for the affected terminal? for debian stable?
    b) is it schedule to go into testing release or fixed in backports
    c) was this bug accidental, and high priority. It cripples the whole vim ecosystem and renders it nu-usable for majority of new vim users?

  23. antarestrue commented on May 1, 2025

    @antarestrue
    Author

    I would not say it is a bug in either vim or vte, IMO. The new vim uses a feature that the old vte does not support. So, the problem is more like that Debian packager should not upgrade vim until they upgrade vte.

  24. chrisbra commented on May 1, 2025

    @chrisbra
    Member

    Please read the ticket carefully again. The bug is in Libvte, but already fixed in a later version. With that information you can go to debian and ask if they want to package a later Libvte version for stable (I doubt they will, however). I am not sure why you are asking all those vte/Debian related questions in the Vim bug tracker, we don't know those. But you have enough information to find those details at the relevant projects and their issue trackers.

    We have documented here in this ticket a workaround to make this bug go away, if you are affected. That is all we can do for you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions