vim / vim

The official Vim repository
https://www.vim.org
Vim License
36.04k stars 5.38k forks source link

After upgrading vim to 9.1506 problem with console. vim-9.0 is o.K #12338

Closed Kadelka closed 1 year ago

Kadelka commented 1 year ago

Steps to reproduce

call vim in console change with mouse to another console return with mouse to the console with vim

Expected behaviour

I expect, as in vim-9.0, that nothing happens to the konsole.

Version of Vim

9.0.1506

Environment

Linux Suse Leap 15.1 Kde console 18.12.3 xterm-color bash 4.4.23(1)

Logs and stack traces

No response

tonymec commented 1 year ago

I cannot reproduce this with:

After going back and forth between two konsoles, what is your problem? I don't see anything untoward.

Best regards, Tony.

chrisbra commented 1 year ago

As mentioned on vim.stackexchange.com, we need a lot more information.

You say "that nothing happens to the konsole." so what exactly is the problem? Can you share a screencast or a screenshot of the problem? what is your $TERM variable set to? Have you tried using vim --clean? Have you tried using a different terminal? Can you upgrade konsole?

I suppose vim is somehow trying to enable some terminal feature that your konsole does not understand. Maybe xterms ModifyOtherKeys? You may want to try disable this, see :h modifyOtherKeys on how to do it.

Kadelka commented 1 year ago

When I'm in vim (no problem with gvim), change the console with the mouse and return to the first console with vim I get garbage. with the mouse and the keyboard (cursor o.k.). Even if I kill vim, the console is unusable. I have to close it.

After killing vim I get the message: Vim: Caught deadly signal Vim: Finished Then the mouse doesn't work: Pressing the mouse I get on the command line something as 0; 66; 34M0; ...

$TERM=xterm-color

chrisbra commented 1 year ago

change the console with the mouse and return to the first console with vim I get garbage.

And what exactly would that garbage be? Can you please be a bit more specific? Show screenshots? Anything that would help us understand what is going on please.

chrisbra commented 1 year ago

Also try disabling the mouse explicitly in your :vimrc :set mouse=

Kadelka commented 1 year ago

Calling vim I get ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ VIM - verbesserter Vi ~ ~ Version 9.0.1506 ~ von Bram Moolenaar und Anderen ~ Vim ist Open Source und kann frei weitergegeben werden ~ ~ Unterstützen Sie die Entwicklung von Vim ~ Tippe :help sponsor für mehr Informationen ~ ~ Tippe :q zum Beenden ~ Tippe :help oder für Online Hilfe ~ Tippe :help version9 für Versions-Informationen ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ [Unbenannt] 0,0-1 Alles

Then going to another konsole with the mouse, and returning to the konsole with vim I cannot do nothing in vim. The keys are no longer available.

After killing vim externally, I get (Screenshot) gui_beval.c Make_ami.mak proto.h vimtutor gui.c Make_cyg.mak pty.c which.sh gui_dwrite.cpp Make_cyg_ming.mak quickfix.c winclip.c gui_dwrite.h Makefile README.md window.c gui_gtk.c Make_ming.mak regexp_bt.c xdiff gui_gtk_f.c Make_mvc.mak regexp.c xpm gui_gtk_f.h Make_vms.mms regexp.h xpm_w32.c gui_gtk_res.xml map.c regexp_nfa.c xpm_w32.h gui_gtk_vms.h mark.c register.c xxd ad08@mspckad:/install/vim-8.1/vim/src> ./vim ad08@mspckad:/install/vim-8.1/vim/src> ./vim Vim: Caught deadly signal TERM Vim: Finished. Beendet ad08@mspckad:/install/vim-8.1/vim/src> 0;13;43M0;13;43m0;36;44M0;36;44m64;30;50M64;30;50M65;30;50M Wenn '0' kein Tippfehler ist, k철nnen Sie command-not-found benutzen, um das Paket zu finden, das den Befehl enth채lt, z. B.: cnf 0 Wenn '13' kein Tippfehler ist, k철nnen Sie command-not-found benutzen, um das Paket zu finden, das den Befehl enth채lt, z. B.: cnf 13 Wenn '43M0' kein Tippfehler ist, k철nnen Sie command-not-found benutzen, um das Paket zu finden, das den Befehl enth채lt, z. B.: cnf 43M0 Wenn '13' kein Tippfehler ist, k철nnen Sie command-not-found benutzen, um das Paket zu finden, das den Befehl enth채lt, z. B.: cnf 13 Wenn '43m0' kein Tippfehler ist, k철nnen Sie command-not-found benutzen, um das Paket zu finden, das den Befehl enth채lt, z. B.: cnf 43m0 Wenn '36' kein Tippfehler ist, k철nnen Sie command-not-found benutzen, um das Paket zu finden, das den Befehl enth채lt, z. B.: cnf 36 Wenn '44M0' kein Tippfehler ist, k철nnen Sie command-not-found benutzen, um das Paket zu finden, das den Befehl enth채lt, z. B.: cnf 44M0 Wenn '36' kein Tippfehler ist, k철nnen Sie command-not-found benutzen, um das Paket zu finden, das den Befehl enth채lt, z. B.: cnf 36 Wenn '44m64' kein Tippfehler ist, k철nnen Sie command-not-found benutzen, um das Paket zu finden, das den Befehl enth채lt, z. B.:cnf 44m64 Wenn '30' kein Tippfehler ist, k철nnen Sie command-not-found benutzen, um das Paket zu finden, das den Befehl enth채lt, z. B.: cnf 30 Wenn '50M64' kein Tippfehler ist, k철nnen Sie command-not-found benutzen, um das Paket zu finden, das den Befehl enth채lt, z. B.: cnf 50M64 Wenn '30' kein Tippfehler ist, k철nnen Sie command-not-found benutzen, um das Paket zu finden, das den Befehl enth채lt, z. B.: cnf 30 Wenn '50M65' kein Tippfehler ist, k철nnen Sie command-not-found benutzen, um das Paket zu finden, das den Befehl enth채lt, z. B.: cnf 50M65 Wenn '30' kein Tippfehler ist, k철nnen Sie command-not-found benutzen, um das Paket zu finden, das den Befehl enth채lt, z. B.: cnf 30 Wenn '50M' kein Tippfehler ist, k철nnen Sie command-not-found benutzen, um das Paket zu finden, das den Befehl enth채lt, z. B.: cnf 50M ad08@mspckad:/install/vim-8.1/vim/src>

Kadelka commented 1 year ago

I tried vim with set mouse= This had no effect on the problem.

Kadelka commented 1 year ago

Is it possible to get vim-9.0 with patches 1-1000 f.i.? So that I can try to find the patch which causes the problem? (Binary search).

chrisbra commented 1 year ago

I am not sure the stack trace after killing vim is helpful. You might want to check with an updated konsole, e.g. from a flatpak build here, since Tony doesn't see this issue with a much more recent version.

Also please check if this works, when you are not setting $TERM to xterm (just to make sure that vim does not try to enable xterm specific features). Please also try disabling the modifyOtherKeys setting mentioned before. There are a few others like bracketed paste mode, focus reporting, etc.

Maybe also try running vim --clean -c 'call ch_logfile("logfile.txt")' reproduce the issue, kill Vim (i hope it will flush the logfile) and then check, if you see anything in logfile.txt. It should contain the raw received key input.

Is it possible to get vim-9.0 with patches 1-1000 f.i.? So that I can try to find the patch which causes the problem? (Binary search).

yes, it's called git-bisect and you need to build vim yourself to test this or you can try to download the appimage to try to bisect using binary builds.

jamessan commented 1 year ago

Maybe this is related to focus events? Does adding the below lines to your vimrc help?

set t_fd=
set t_fe=
Kadelka commented 1 year ago

Yes, setting t_fd= and t_fe has the effect, that now vim is usable after changing the window (without this setting changing the window doesn't have an effect). But still the problem remains that changing the konsole alone doesn't restore vim. Are there other t_f? which I can unset?

I have tried this in gnome with the console there. The problem remains. Similarly for calling vim in xterm, vim remains unusable.

chrisbra commented 1 year ago

yes, several tens. Check the output of :set! termcap. That's why I suggested to use a different $TERM, because it influences what termcap options will be set. You might try vim -T builtin_ansi and also check the output of vim -T foobar to see what internal terminals vim knows about.

Kadelka commented 1 year ago

Calling vim -T builtin_ansi works. Thank you!

Kadelka commented 1 year ago

Simply setting TERM=konsole solved my problem. The only (unimportant) problem: Why do vim-9.0 and vim-9.1506 behave differently?

chrisbra commented 1 year ago

I googled a bit trying to find out what the proper $TERM value for konsole was supposed to be and did not find anything officially documented. Most results mention to use the xterm* like variants, which of course will fail, if the terminal pretending to be xterm compatible is not really it. Most likely it failed, because Vim added additional xterm specific features (mentioned above already) and konsole does only understand half of it.

In any case, it seems to work with newer versions according to Tony, so it may also be an issue of out-dated software 🤷‍♂️

Kadelka commented 1 year ago

Thank you for your work!

brammool commented 1 year ago

Simply setting TERM=konsole solved my problem. The only (unimportant) problem: Why do vim-9.0 and vim-9.1506 behave differently?

I had started making the user of termcap/terminfo information more accurately. The main problem is that users have tended to set $TERM to whatever worked. And some developers actually included tricks in the default value to this. Such as Kitty setting $TERM to "xterm-kitty", so that the "xterm" part would pickup the internal xterm termcap. Although this might seem like a simple approach, it creates all kinds of problems, ignoring the actual termcap/terminfo entries as a workaround of those being invalid or incomplete.

Unfortunately this work is only halfway finished, leaving it at a state where it might not work well in some situations. I do think that taking this into the right direction will be best eventually. This will clean up hacks that are confusing or just wrong in the past. But there will be a short period as "under construction" note applies.

Hopefully I get through fixing bugs soon and can resume work on this.

-- Every engineer dreams about saving the universe and having sex with aliens. This is much more glamorous than the real life of an engineer, which consists of hiding from the universe and having sex without the participation of other life forms. (Scott Adams - The Dilbert principle)

/// Bram Moolenaar -- @.*** -- http://www.Moolenaar.net \\ /// \\ \\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\ help me help AIDS victims -- http://ICCF-Holland.org ///

tonymec commented 1 year ago

FWIW, I was using a Vim built without the "terminal" feature; it gives me term=xterm-256color when running in konsole; and it uses the CSApprox plugin. No idea if any of this makes any difference.

DominiquePelle-TomTom commented 1 year ago

@tonymec wrote:

and it uses the CSApprox plugin.

I wonder why you use this plugin. It is no longer needed nowadays. I think if you have set termguicolors in your ~/.vimrc, then Vim in the terminal should use the color of the GUI automatically without the CSApprox plugin.

I was also using CSApprox a long time ago, but not anymore. Removing it speeds up startup of Vim significantly if I recall correctly. You can check with `vim --startuptime foo' that CSApprox is quite slow at startup.

tonymec commented 1 year ago

I used CSApprox before 'termguicolors' existed, I intentionally did not remove it immediately for compatibility reasons when it arrived, I never learned the subtleties of the 'termguicolors' option, I'm still happy with it, and I haven't noticed any untoward startup slowness in gvim (which I use constantly) or even in Console Vim (which I use occasionally), so "I don't change a winning team".