ESC[4m is "set underline mode"
On Saturday, 3 December 2022 at 09:45:20 UTC+11 Gary Johnson wrote:
> On 2022-12-02, Bram Moolenaar wrote:
> > Gary Johnson wrote:
> >
> > > After updating to the latest Vim, 9.0.0984, and starting Vim in
> > > a terminal without a file specified, the command line font was
> > > extremely tiny. (I'd estimate the font size to be 4 points.) If
> > > a file was opened from the command line, its font in the buffer was
> > > also tiny. Subsequent commands typed in the command line were of
> > > the expected font. The font in the buffer remained tiny until ^L
> > > was typed.
> > >
> > > Bisecting my vimrc and my usual color scheme plugin revealed the
> > > command causing the tiny font to be
> > >
> > > :set bg&
> > >
> > > and bisecting the git commits showed the bad commit to be
> > > 733a69b29f0b0c3d2ddca463a41bdd912379bc5e, tag v9.0.0980.
> > >
> > > Steps to reproduce
> > >
> > > 1. vim -N -u NONE -i NONE --cmd 'set bg&'
> > > 2. Type a colon (:) and note that it is in a very tiny font.
> > > 3. Continue typing the ex command to edit some file, e.g.,
> > > ":e feature.h". Note that the file is displayed in the buffer
> > > in the same tiny font.
> > >
> > > Expected behavior
> > >
> > > I expect Vim to use the same 11-pt font it normally uses, as set in
> > > the terminal's preferences.
> > >
> > > Version of Vim
> > >
> > > 9.0.0980 and 9.0.0984
> > >
> > > Environment
> > >
> > > Operating system: Cygwin version 3.3.6-1 (latest as of 2022-12-01)
> > > on Windows 10 Pro version 22H2
> > > Terminal: mintty version 3.6.2-1 (also latest as of 2022-12-01)
> > > Value of $TERM: xterm-256color
> >
> > This doesn't look right. Doesn't mintty have a termcap/terminfo entry
> > and you can set $TERM accordingly?
>
> Thanks very much for the reply.
>
> It turns out that it does and you can. I've always left it set to
> xterm-256color for the usual reason that "everything" knows how to
> talk to an xterm-256color terminal.
>
> I set TERM to mintty and the problem disappears.
>
> > Since $TERM includes "xterm" Vim assumes the terminal behaves like an
> > xterm and will enable modifyOtherKeys level 2. This should be harmless
> > if the terminal advertises to be working like xterm but doesn't actually
> > support it.
> >
> > I assume that mintty can't handle the escape sequences that do work for
> > xterm. To find out which one please use a log:
> >
> > vim -N -u NONE -i NONE --log logfile --cmd 'set bg&'
> >
> > Around where you type the edit command you should be able to find some
> > "raw key input:" and "raw terminal output:" lines that hopefully provide
> > more information.
>
> I did that with TERM=xterm-256color and TERM=mintty and used vimdiff
> to compare the two logfiles. I found the offending escape sequence,
> but I don't know what it means.
>
> When TERM=xterm-256color, at the end of the "raw terminal output:"
> line that prints the introductory message is the sequence
>
> ^[[?4m
>
> I looked in the xterm source, in the file ctlseqs.txt, but could not
> find that sequence, i.e., CSI ? ... m.
>
> When I send that sequence from Vim to mintty with
>
> :call echoraw("\e[?4m")
>
> characters on the command line are printed in the tiny font.
>
> I did a similar comparison between the logfiles with and without "-c
> 'set bg&'" argument. When that argument was _not_ present, the
> logfile contained additional "raw terminal output:" lines that
> presumably reset the font.
>
> > You can also change the 'keyprotocol' option, e.g. make it empty, and
> > see what effect that has.
>
> Adding the argument
>
> --cmd 'set keyprotocol='
>
> or
>
> -c 'set keyprotocol='
>
> had no effect, whether set before or after bg&: the font on the
> command line was always tiny.
>
> So the correct solution is to set TERM=mintty. I'll do that and see
> if anything else breaks, although I don't use that computer much for
> my current work, so I won't notice anything for a while.
>
> I would still like to know what that escape sequence is supposed to
> do. If mintty's response seems to be a bug, then I'll report it to
> the author.
>
> Regards,
> Gary
>
>
--
--
You received this message from the "vim_dev" 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_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/0bcae808-6a37-4828-abe6-6b929443a22fn%40googlegroups.com.