Saturday, October 28, 2017

Re: Varying behaviour when exiting vim depending on filetype (perhaps)

O>
>
>Am 10/27/17 um 19:15 schrieb David Woodfall:
>> … sometimes when I exit I am still at the top of the terminal. Other
>> times vim drops me at the bottom.
>> … My $TERM is screen-256color-bce … setting the term variable …
>> … doesn't seem to make any difference.
>
> I fear, this is really complex. The 'pty' (pseudo tty, abstract
>terminal the window works with) 'sits' between shell+vim and the
>program which shows the characters onscreen. In the special case
>of using 'screen', you even have TWO ptys stacked (one for your
>'display' where you look on 'screen' PLUS one inside 'screen'
>on which the shell+vim work. This makes the switching possible).
>So each of the two steps reacts on the TERM codes and is assumed
>to do exactly the same things.
> Now the 'screen' has TWO scrollbacks to enable exactly what
>you want, one for keeping the screen the shell works on with
>the position and command line, the other for running programs
>(e.g. vim) with random cursor movement on.
>When vim starts, it (normally) switches to the second screen,
>on ending it switches back.
> BUT, if by any means, this switched state is switched back
>by something else while vim runs (other programs running in
>background, hitting ^Z to suspend vim, or running interactive
>programs from inside vim), THEN the state of the normal
>(command line) scrollback changes 'behind' vim and you drop
>to a surprisingly different screen by ending vim. Having so
>many possibilities makes it really hard to find each single
>cause of unwanted changes.
> The seeming dependence on filetype might stem from the
>set of programs you (or vim) use to work with that filetype.
> Even more complex are cases of remote 'screen' (may be even
>on a local 'screen') possibly calling on a xterm:
>$ screen ssh -t SOME_HOST screen
>here you get even more ptys and the remote connection in
>between and you local window in xterm. Each should do/show
>the same, but each level can get out of whack and loose
>the position your terminal falls back to at the end of vim.
> All this did not mention the problem, which begins if
>different ptys/terminal-programs run on different $TERMs.
>The program 'screen' maps the $TERMinal of your window
>(or display) to its own terminal type 'screen-...-bce'
>(so if you work with an 'xterm' or 'gnome-terminal',
>screen remaps the terminfo codes, then runs screens with
>TERM='screen-....' inside.
> NOW this adds the differences in TERMinal definitions into
>the problem's complexity ;-)
>
>Working ~30 years with vi(m), and 'screen' since it exists,
>I saw SO many strange 'messups', that after a while I simply
>begun to ignore it as long as it does not hinder me from
>working ...
>
>Stucki

That is definitely complex :)

Thanks,

Dave

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

No comments: