Alternate screen buffer in Xterm/FreeBSD

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Alternate screen buffer in Xterm/FreeBSD

Bertram Scharpf

Hi,

this is difficult to google for. I remember the old Linux times when
it worked but it doesn't in FreeBSD.

In a terminal window I oftenly pipe some progams output to vim:

  $ someprg | vim -

When the program fails and outputs an error message to stderr the
terminals contents will be overwritten by Vim.

I know from some old Linux installations that Less and Vim are able to
switch to an alternate screen buffer. They use the escape sequences
"\e[?1049h" and "\e[?1049l" to switch back respectively.

Probably I have to recompile some library. Where is the switch to
activate it in FreeBSD?

Thanks in advance.

Bertram

--
Bertram Scharpf
Stuttgart, Deutschland/Germany
http://www.bertram-scharpf.de

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Alternate screen buffer in Xterm/FreeBSD

Ben Schmidt

Bertram Scharpf wrote:

> Hi,
>
> this is difficult to google for. I remember the old Linux times when
> it worked but it doesn't in FreeBSD.
>
> In a terminal window I oftenly pipe some progams output to vim:
>
>   $ someprg | vim -
>
> When the program fails and outputs an error message to stderr the
> terminals contents will be overwritten by Vim.
>
> I know from some old Linux installations that Less and Vim are able to
> switch to an alternate screen buffer. They use the escape sequences
> "\e[?1049h" and "\e[?1049l" to switch back respectively.
>
> Probably I have to recompile some library. Where is the switch to
> activate it in FreeBSD?
>
> Thanks in advance.
>
> Bertram

I thought this usually 'just worked'. But check :help xterm-save-screen
perhaps. It mentions a Vim feature that needs to be compiled in, so
maybe that is missing. Else it mentions the Vim termcap options to set,
for turning the feature off, and I suppose you could use the reverse
idea to turn it on.

Cheers,

Ben.



--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Alternate screen buffer in Xterm/FreeBSD

Bram Moolenaar
In reply to this post by Bertram Scharpf


Bertram Scharpf wrote:

> this is difficult to google for. I remember the old Linux times when
> it worked but it doesn't in FreeBSD.
>
> In a terminal window I oftenly pipe some progams output to vim:
>
>   $ someprg | vim -
>
> When the program fails and outputs an error message to stderr the
> terminals contents will be overwritten by Vim.
>
> I know from some old Linux installations that Less and Vim are able to
> switch to an alternate screen buffer. They use the escape sequences
> "\e[?1049h" and "\e[?1049l" to switch back respectively.
>
> Probably I have to recompile some library. Where is the switch to
> activate it in FreeBSD?

No need to recompile.  You just need to change your termcap to set the
"ti" and "te" entries.  Here is a hint:

        :ti=\E7\E[r\E[?47h:te=\E[?47l\E8:

--
Shit makes the flowers grow and that's beautiful

 /// Bram Moolenaar -- [hidden email] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Alternate screen buffer in Xterm/FreeBSD

Bertram Scharpf
In reply to this post by Ben Schmidt

Hi Ben,

Am Samstag, 26. Jul 2008, 21:30:35 +1000 schrieb Ben Schmidt:

>
> Bertram Scharpf wrote:
> > I know from some old Linux installations that Less and Vim are able to
> > switch to an alternate screen buffer. They use the escape sequences
> > "\e[?1047h" and "\e[?1047l" to switch back respectively.
> >
> > Probably I have to recompile some library. Where is the switch to
> > activate it in FreeBSD?
>
> I thought this usually 'just worked'. But check :help xterm-save-screen
> perhaps. It mentions a Vim feature that needs to be compiled in, so
> maybe that is missing. Else it mentions the Vim termcap options to set,
> for turning the feature off, and I suppose you could use the reverse
> idea to turn it on.

The help topic describes it exactly and I solved it.

Much thanks!

Bertram


--
Bertram Scharpf
Stuttgart, Deutschland/Germany
http://www.bertram-scharpf.de

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Alternate screen buffer in Xterm/FreeBSD

Tony Mechelynck
In reply to this post by Ben Schmidt

On 26/07/08 13:30, Ben Schmidt wrote:

> Bertram Scharpf wrote:
>> Hi,
>>
>> this is difficult to google for. I remember the old Linux times when
>> it worked but it doesn't in FreeBSD.
>>
>> In a terminal window I oftenly pipe some progams output to vim:
>>
>>    $ someprg | vim -
>>
>> When the program fails and outputs an error message to stderr the
>> terminals contents will be overwritten by Vim.
>>
>> I know from some old Linux installations that Less and Vim are able to
>> switch to an alternate screen buffer. They use the escape sequences
>> "\e[?1049h" and "\e[?1049l" to switch back respectively.
>>
>> Probably I have to recompile some library. Where is the switch to
>> activate it in FreeBSD?
>>
>> Thanks in advance.
>>
>> Bertram
>
> I thought this usually 'just worked'. But check :help xterm-save-screen
> perhaps. It mentions a Vim feature that needs to be compiled in, so
> maybe that is missing. Else it mentions the Vim termcap options to set,
> for turning the feature off, and I suppose you could use the reverse
> idea to turn it on.
>
> Cheers,
>
> Ben.

IIUC, that's the +xterm_save feature. It is never enabled by default,
not even in huge builds with +x11. To enable it, uncomment the #define
FEAT_XTERM_SAVE at (or near) line 831 of src/feature.h, then delete
src/auto/config.cache if it exists, and use "make reconfig 2>&1 |tee
makecfg.log" to reconfigure and recompile (after making sure your
configure arguments are set up in their respective environment
variables, see
http://users.skynet.be/antoine.mechelynck/vim/compunix.htm#p1 ). Then,
of course, if the configure, compilation & link look all right, install
the result with "make install".

I have set this feature, and in konsole ('term'=xterm) I see
        t_ti=^[7^[[?47h
        t_te=^[[2J^[?47l^[8

In the GUI ('term'=builtin_gui) and the linux console ('term'=linux)
they are unset.


Best regards,
Tony.
--
Fakir, n:
        A psychologist whose charismatic data have inspired almost
religious devotion in his followers, even though the sources seem to
have shinnied up a rope and vanished.

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Alternate screen buffer in Xterm/FreeBSD

Bertram Scharpf

Hi,

Am Dienstag, 29. Jul 2008, 19:51:12 +0200 schrieb Tony Mechelynck:
>
> On 26/07/08 13:30, Ben Schmidt wrote:
> > Bertram Scharpf wrote:
> IIUC, that's the +xterm_save feature. It is never enabled by default,
> not even in huge builds with +x11.

Indeed, a :version call reveals that the feature is not enabled here.
Anyway, the termcap trimming helped!?!?

> I have set this feature, and in konsole ('term'=xterm) I see
> t_ti=^[7^[[?47h
> t_te=^[[2J^[?47l^[8

As Tom Dickey already mentioned, \e[?1049 better reflects the combined
save-cursor, clear-screen and change-to-alternate operations.

Bertram


--
Bertram Scharpf
Stuttgart, Deutschland/Germany
http://www.bertram-scharpf.de

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---