2017-10-04 19:25 GMT+09:00 Christian Brabandt <[email protected]>:

> Hi,
> I am facing a strange problem with putty as terminal emulator and using
> termguicolors and I hope someone here can give me a tip on how to debug
> this.
>
> Putty recently learned to use 24bit colors which in Vim is enabled by
> setting the termguicolors option. However, when I set this, my cursor
> vanishes and I don't know how to debug this properly. This only happens,
> if I do not run tmux. Within tmux everything works as expected.
>
> This works:
> vim --clean --cmd 'set termguicolors' \
> --cmd 'let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"' \
> --cmd 'let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"'
>
> However, as soon as the Normal highlighting group is not empty, the
> cursor block vanishes in non-empty lines (but will be drawn on empty
> lines (where no highlighting is done)):
>
> vim --clean --cmd 'set termguicolors' \
> --cmd 'let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"' \
> --cmd 'let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"' \
> --cmd 'hi Normal guibg=#262626' ~/.vim/vimrc
>
> Empty lines are still drawn correctly. However, I usually set `:set t_ut=`
> which makes the problem worse, because then no cursor is drawn anymore.
>
> vim --clean --cmd 'set termguicolors' \
> --cmd 'let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"' \
> --cmd 'let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"' \
> --cmd 'hi Normal guibg=#262626' \
> --cmd ':set t_ut=' ~/.vim/vimrc
>
> However, loading the default scheme makes it work again. But I believe
> this is, because default.vim does `:hi clear` which resets the Normal
> highlighting group and then the cursor will be drawn correctly. However
> this means, it basically breaks every colorscheme I have
>
> Now, I suspected the keycodes t_vi (cursor invisible) and t_ve (cursor
> visible) to be the culprit, however setting those keycodes have no
> effect inside Vim. They are currently set (not by me but by default,
> reformated for copy-pasting):
> ,----
> | let &t_vi="\e[?25l"
> | let &t_ve="\e[?25h"
> `----
>
> And in a plain putty terminal I can make the cursor vanish using
> `printf "\e[?25l"` (t_vi)  and appear again using `printf "\e[?25h"`
>
> I tried making t_vi empty, because I saw in a script session a bunch of
> `t_vi` terminal keys appear, but the cursor still vanishes afterwards.
>
> I then tried playing around with the t_SI, t_SR and t_EI keycodes as
> suggested by the help `:h termcap-cursor-shape` then I tried settting
> all those `request terminal feature` keycodes (t_u7, t_RB and t_RV) to
> empty, but I still see the problem and does not seem to help.
>
> So I am now basically out of ideas.
>

I'm not, either.  And I'm not a user of putty.  So what I'm going to write
below is "FWIW".

Let's recall that t_ve and t_vi correspond to terminfo's cnorm and civis,
respectively.  With the terminfo of my locally installed ncurse-20170916,
infocmp(1) gave me

putty-256color: cnorm=\E[?25h
xterm-256color: cnorm=\E[?12l\E[?25h
tmux-256color: cnorm=\E[34h\E[?25h

and civis was all the same for them, civis=\E[?25l.

I have no idea why the cnorm of xterm-256color is prefixed with \E[?12h,
which is, according to
http://invisible-island.net/xterm/ctlseqs/ctlseqs.html , "Stop Blinking
Cursor (att610)".  Indeed, I was surprised at the fact because I had long
thought xterm's cnorm was \E[?25h.  As for tmux-256color, the prefix \E[34h
isn't documented there; the only thing I found on the Internet was
https://www.gnu.org/software/screen/manual/html_node/Control-Sequences.html
(Near the bottom of the article, you'll see "34 Normal Cursor Visibility",
but no further description given).

Seems like those prefixes make difference, but I don't know why.  So if
hit-or-miss "set v_te=\e[?12l\e[?25h" should work for putty, I would say we
are pretty lucky.  Hopefully, someone will kindly enlighten me.


> Has anybody any clue, what could cause this only with the putty terminfo
> (but I also see this with xterm-256color TERM string) but not within
> tmux? Or how to further debug this? This is actually quite annoying.
>
> Thanks,
> Christian
>

My two cents,
Kazunobu

>
> --
> --
> 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].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
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].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui