Wednesday, August 29, 2012

Re: vim window clears the terminal history

Hello John,

Thanks a lot for your analysis. Your observations are spot-on.

I took my t_is string and started echo'ing it on the terminal by
removing different escape codes and realised that "\E[2J" is
responsible for clearing the terminal.

I removed that and echoed the rest and this is what I received:

--(/tmp) -- my shell prompt
infocmp -C rxvt-unicode-256color
# Reconstructed via infocmp from file:
/usr/share/terminfo/r/rxvt-unicode-256color
# (untranslatable capabilities removed to fit entry within 1023 bytes)
rxvt-unicode-256color|rxvt-unicode terminal with 256 colors (X Window System):\
:am:bw:eo:hs:km:mi:ms:xn:xo:\
:co#80:it#8:li#24:lm#0:\
:AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:\
:K1=\EOw:K2=\EOu:K3=\EOy:K4=\EOq:K5=\EOs:LE=\E[%dD:\
:RI=\E[%dC:SF=\E[%dS:SR=\E[%dT:UP=\E[%dA:ae=\E(B:al=\E[L:\
:as=\E(0:bl=^G:cd=\E[J:ce=\E[K:cl=\E[H\E[2J:\
:cm=\E[%i%d;%dH:cr=^M:cs=\E[%i%d;%dr:ct=\E[3g:dc=\E[P:\
:dl=\E[M:do=^J:ds=\E]2;\007:ec=\E[%dX:ei=\E[4l:fs=^G:\
:ho=\E[H:i1=\E[!p:ic=\E[@:im=\E[4h:\
:is=\E[r\E[m\E[2J\E[?7;25h\E[?1;3;4;5;6;9;66;1000;1001;1049l\E[4l:\
:k1=\E[11~:k2=\E[12~:k3=\E[13~:k4=\E[14~:k5=\E[15~:\
:k6=\E[17~:k7=\E[18~:k8=\E[19~:k9=\E[20~:kD=\E[3~:\
:kI=\E[2~:kN=\E[6~:kP=\E[5~:kb=\177:kd=\E[B:ke=\E>:\
:kh=\E[7~:kl=\E[D:kr=\E[C:ks=\E=:ku=\E[A:le=^H:mb=\E[5m:\
:md=\E[1m:me=\E[0m:mr=\E[7m:nd=\E[C:rc=\E8:sc=\E7:\
:se=\E[27m:sf=^J:so=\E[7m:sr=\EM:st=\EH:ta=^I:\
:te=\E[r\E[?1049l:ti=\E[?1049h:ts=\E]2;:ue=\E[24m:\
:up=\E[A:us=\E[4m:vb=\E[?5h\E[?5l:ve=\E[?25h:vi=\E[?25l:\
:vs=\E[?25h:
--(/tmp)
echo "\E[r\E[m\E[?7;25h\E[?1;3;4;5;6;9;66;1000;1001;1049l\E[4l"
r

" | 180x71 |
pts/3@master\E[r\E[m\E[?7;25h\E[?1;3;4;5;6;9;66;1000;1001;1049l\E[4l
--(/tmp)

The above behaviour is what I want from vim:

I changed vimrc with these different settings and realise that they
are not affecting vim's behaviour with respect to the blank screen (I
can see some changes in how vim is acting when changing t_IS though)

"set t_is=\E[r\E[m\E[?7;25h\E[?1;3;4;5;6;9;66;1000;1001;1049l\E[4l
set t_IS=\E[r\E[m\E[?7;25h\E[?1;3;4;5;6;9;66;1000;1001;1049l\E[4l
" set t_is=
" set t_IS=

This made me think that changing the terminfo is a better idea.

I changed the terminfo as below, by removing the t_is in the terminfo files:

--(/tmp)
infocmp -C xterm
# Reconstructed via infocmp from file: /usr/share/terminfo/x/xterm
xterm|xterm terminal emulator (X Window System):\
:am:bs:km:mi:ms:xn:\
:co#80:it#8:li#24:\
:AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:\
:K2=\EOE:LE=\E[%dD:RI=\E[%dC:SF=\E[%dS:SR=\E[%dT:\
:UP=\E[%dA:ae=\E(B:al=\E[L:as=\E(0:bl=^G:bt=\E[Z:cd=\E[J:\
:ce=\E[K:cl=\E[H\E[2J:cm=\E[%i%d;%dH:cr=^M:\
:cs=\E[%i%d;%dr:ct=\E[3g:dc=\E[P:dl=\E[M:do=^J:ec=\E[%dX:\
:ei=\E[4l:ho=\E[H:im=\E[4h:is=\E[!p\E[?3;4l\E[4l\E>:\
:k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:k5=\E[15~:k6=\E[17~:\
:k7=\E[18~:k8=\E[19~:k9=\E[20~:kD=\E[3~:kI=\E[2~:kN=\E[6~:\
:kP=\E[5~:kb=^H:kd=\EOB:ke=\E[?1l\E>:kh=\EOH:kl=\EOD:\
:kr=\EOC:ks=\E[?1h\E=:ku=\EOA:le=^H:mb=\E[5m:md=\E[1m:\
:me=\E[0m:mm=\E[?1034h:mo=\E[?1034l:mr=\E[7m:nd=\E[C:\
:rc=\E8:\
:..sa=%?%p9%t\E(0%e\E(B%;\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m:\
:sc=\E7:se=\E[27m:sf=^J:so=\E[7m:sr=\EM:st=\EH:ta=^I:\
:te=\E[?1049l:ti=\E[?1049h:ue=\E[24m:up=\E[A:us=\E[4m:\
:vb=\E[?5h\E[?5l:ve=\E[?12l\E[?25h:vi=\E[?25l:\
:vs=\E[?12;25h:
--(/tmp)
infocmp -C rxvt-unicode-256color
# Reconstructed via infocmp from file: /home/j/.terminfo/r/rxvt-unicode-256color
rxvt-unicode-256color|rxvt-unicode terminal with 256 colors (X Window System):\
:am:bw:eo:hs:km:mi:ms:xn:xo:\
:co#80:it#8:li#24:lm#0:\
:AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:\
:K1=\EOw:K2=\EOu:K3=\EOy:K4=\EOq:K5=\EOs:LE=\E[%dD:\
:RI=\E[%dC:SF=\E[%dS:SR=\E[%dT:UP=\E[%dA:ae=\E(B:al=\E[L:\
:as=\E(0:bl=^G:cd=\E[J:ce=\E[K:cl=\E[H\E[2J:\
:cm=\E[%i%d;%dH:cr=^M:cs=\E[%i%d;%dr:ct=\E[3g:dc=\E[P:\
:dl=\E[M:do=^J:ds=\E]2;\007:ec=\E[%dX:ei=\E[4l:fs=^G:\
:ho=\E[H:i1=\E[!p:ic=\E[@:im=\E[4h:is=:k1=\E[11~:k2=\E[12~:\
:k3=\E[13~:k4=\E[14~:k5=\E[15~:k6=\E[17~:k7=\E[18~:\
:k8=\E[19~:k9=\E[20~:kD=\E[3~:kI=\E[2~:kN=\E[6~:kP=\E[5~:\
:kb=\177:kd=\E[B:ke=\E>:kh=\E[7~:kl=\E[D:kr=\E[C:ks=\E=:\
:ku=\E[A:le=^H:mb=\E[5m:md=\E[1m:me=\E[0m:mr=\E[7m:nd=\E[C:\
:nw=^M^J:rc=\E8:sc=\E7:se=\E[27m:sf=^J:so=\E[7m:sr=\EM:\
:st=\EH:ta=^I:te=\E[r\E[?1049l:ti=\E[?1049h:ts=\E]2;:\
:ue=\E[24m:up=\E[A:us=\E[4m:vb=\E[?5h\E[?5l:ve=\E[?25h:\
:vi=\E[?25l:vs=\E[?25h:
--(/tmp)
infocmp -C rxvt-unicode-256color | grep -i is
:ho=\E[H:i1=\E[!p:ic=\E[@:im=\E[4h:is=:k1=\E[11~:k2=\E[12~:\
--(/tmp)
infocmp -C xterm | grep -i is
:ei=\E[4l:ho=\E[H:im=\E[4h:is=\E[!p\E[?3;4l\E[4l\E>:\
--(/tmp)

even with export TERM=xterm or rxvt-unicode-256color, I am still
getting the same behaviour.

It might be a lot simpler if I can tell vim to behave as vi does. But,
even if I do that, I probably will have issues with colors in files,
etc. Any thoughts on this, please?

I noticed this in my terminfo file: cl=\E[H\E[2J: and removed the
\E[2J from that and tried it. But, that did not change the behavioiur
much.

At this point, I guess, the only option is to read up on the terminfo
codes and see what else could be affecting it.

Can you please let me know if you can think of any better ideas?

Thanks
Joe


On Wed, Aug 29, 2012 at 2:58 AM, John Little <John.B.Little@gmail.com> wrote:
> See my post in vim_use. I reckon the initialization string is the culprit. If it is sent before ti, it clears the stuff you want kept, and if after, makes vim not use the alternate buffer.
>
> Regards, John Little
>
> --
> 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 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

No comments:

Post a Comment