> On Tue, 20 Jun 2023 22:52:05 -0700 (PDT)
> Steve Martin <smartin5...@gmail.com> wrote:
> > [...]
> >
> > Using the Windows CMD shell under the old CMD terminal, whatever that
> > is called
> 
> It's Console Host or Conhost in short.

There also is mention of "Win32 virtual console", the +vtp feature.
This is currently enabled for all MS-Windows non-GUI versions, thus it
doesn't appear to have an effect on how Vim works.  The feature itself
is useful to distinguish from an old Vim version that didn't support
this.

> > 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 assume by "Microsoft" and "their issue" you mean the issue in Conhost.
> If so, then yeah, it's not gonna get fixed.  There are compatibility
> reasons for that (which I don't care about), but to circumvent this the
> team decided to overhaul Conhost and replace it with the new Terminal.
> It'll be the default in the next . . . I donno, year perhaps?  Decade?
> 
> And just to clarify, resizing MS Terminal window after launching Vim
> doesn't cause any problem.  MS Terminal should behave like a Linux
> terminal emulator.  It advertizes itself as supporting all xterm
> features.  Well, perhaps not all, but most of the oft-used ones.

A problem related to this is that Vim was originally made for the
console, not for a generic terminal like on Unix.  In the code there are
calls to is_term_win32() and different behavior when it returns true.
That is when 'term' is set to "win32".  And it is set to that value in a
few places, some may not be correct.  E.g. near the end of
did_set_string_option():

        #if defined(FEAT_VTP) && defined(FEAT_TERMGUICOLORS)
            if (args.os_did_swaptcap)
            {
                set_termname((char_u *)"win32");
                init_highlight(TRUE, FALSE);
            }
        #endif

There is a check for Windows terminal in os_win32.c:

            wt_working = mch_getenv("WT_SESSION") != NULL;

This flag is then used in several places through the USE_WT macro.

There are several other flags for VTP and CONPTY, with very specific
build versions.  I don't know how relevant these still are,  It mainly
results in conpty_type to be set to a certain number, which isn't
explained anywhere.  Looks like it is only used in libvterm and only the
value "2" makes a difference.

What matters for the original problem is how Vim obtains the size of the
console or terminal.  If it is a console then "g_cbTermcap.Info.dwSize"
is used.  Otherwise "csbi.srWindow" or fall back to 25 x 80.  This is in
mch_get_shellsize() in os_win32.c.  But mch_get_shellsize() in
os_mswin.c doesn't do anything, it is not supposed to be used, but is
it?  If it is, then doing something similar to mch_get_shellsize() in
os_unix.c would be helpful.  Using the MS-Windows equivalent of the
ioctl() calls.

> > In the end there are a lot of choices out there, which can be both
> > good and bad.
> 
> Before MS Terminal, Wezterm was the best choice.  Before that, Cmder and
> ConEmu.  And the problem with Mintty is that it's not independent.  The
> reason it behaves so like a Linux terminal is because it's built with
> Cygwin or Cygwin-like shells (MSys, git-bash, etc.) in mind.  You can't
> run Command Prompt or PowerShell on it.  You can't even run Win32
> version of Vim on it.  You'll need a Vim built with Cygwin.  That's an
> extra hassle in my opinion.

Can we assume that MS Terminal is included with the distribution, or
installed most widely?  If so, then investing time in making this work
properly is well worth it.

-- 
Some of the well known MS-Windows errors:
        ETIME           Wrong time, wait a little while
        ECRASH          Try again...
        EDETECT         Unable to detect errors
        EOVER           You lost!  Play another game?
        ENOCLUE         Eh, what did you want?

 /// Bram Moolenaar -- b...@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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_use/20230621124103.A86A01C0A9C%40moolenaar.net.

Reply via email to