Wednesday, June 21, 2023

Re: BUG: terminal vim 9.0.1506 x64 window 10

> On *Windows Terminal Preview* (Windows 11) with Windows PowerShell or CMD
> as the shell, the 'columns=600' or any other such setting will be ignored
> and the variable will remain at whatever vim set it to. So nothing happens
> to the display.

OK, so this is for when Vim is started directly in the terminal.
It would be good if ":set columns=80" is working here. I often use that
after messing with the window size for whatever reason (I use 80
columns so I can fit several terminal windows side-by-side).

> Using the Windows CMD shell under the old CMD terminal, whatever that is
> called, will result in columns value being changed, but the terminal does
> not change and has no issues after the setting.
>
> Using RedHat's cygwin bash, which comes with Git-Desktop for instance,
> inside of *Windows Terminal*, performing a "set columns=600" will result in
> a corrupted terminal which cannot be fixed using the standard terminal
> reset commands (tset(1) or reset(1)). Only closing and reopening the
> terminal will return a good work session.

Perhaps it sets some environment variable only on startup?

> Using cygwin bash under the RedHat provided *mintty* terminal and
> performing a "set columns=600" will cause vim to resize to the maximum
> width of the system monitor and set Columns to a number that equates to the
> new terminal size. This is the only terminal software I found that behaves
> as one would expect a Linux terminal to work. This was the best terminal I
> saw on Windows.
>
> Finally, using the *GVim* provided with VIM for Windows will also change
> the Terminal size according to changes in the 'columns' setting. Again, vim
> will change the size of the terminal up to the actual maximum available on
> the system monitor. The columns variable reflects the proper terminal size
> like the *mintty *version does. I don't know what terminal that means is
> used or even if it can be called a terminal, but clearly it works properly
> with vim by design.

Vim uses libvterm, a "virtual" terminal that is build into Vim. On
MS-Windows it uses ConPTY or WinPTY. libvterm resembles an xterm and
many programs can work with it.

> So my conclusion is that this is a terminal software problem. Some
> terminals adhere to the resizing commands that vim sends, some ignore it
> but remain stable, and yet others become hopelessly corrupted requiring
> that the software be closed and restarted.

We can try to make it work. For some terminals we may require the
maintainers to make changes. I suppose there is no standard way for
handling size changes, like SIGWINCH on Unix. If there is a terminal
that does this well we can suggest to use it as an example, hopefully we
can then avoid every terminal doing something different.

> Obviously Bram knows far more than I do, but my recommendation would
> be to use a Terminal package that behaves like a fully functional soft
> terminal should or don't resize the window *after* launching VIM.

In the help we can list terminals we know and what works for each of
them. That can function as a recommendation. It will take some effort
to keep up-to-date, but it's worth it.

> Personally I use bash and Windows Terminal when I'm on Windows. It has
> features I prefer and I don't usually resize my work space after I've
> got set up. Will Microsoft fix their issues. Not gonna hold my breath.

I'm sure Microsoft will not fix *all* their issues, but the team working
on the Windows Terminal has been responsive. I hope at least one of
them is using Vim and fixes any encountered problems. That's why Vim
works well in the Chrome secure shell :-).

> Should there be smoke coming out of my CPU?

No, it's bad for the cooling system and shortens life.

--
hundred-and-one symptoms of being an internet addict:
200. You really believe in the concept of a "paperless" office.

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

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20230621230529.C8FAB1C0A9C%40moolenaar.net.

No comments: