tmux already moves the content into the history on clear.


On Thu, Mar 08, 2012 at 11:32:02AM -0800, Gustavo Baratto wrote:
>    Hi guys...
> 
>    Is there any news regarding this?
>    I'm on tmux 1.5, and having problem with tmux overwriting existing content
>    on the terminal when starting vi.
>    I cannot send clear as '\E[H\E[2J' with either terminal-override:
> 
>    set -g terminal-overrides *'*:smcup@:rmcup@:clear=\E[H\E[2J'
> 
>    or by compiling my own terminal.
> 
>    Recapping what the problem is (in the well crafted words of Fabian in an
>    earlier post):
>    ---
> 
>    What typically happens is something like this for a 4 line terminal:
> 
>    shell% ls
>    file1
>    file2
>    shell%
> 
>    Now if I would type vim as command (and execute it by pressing enter),
>    what I want to happen, is that the above 4 lines are moved up in my
>    terminal's buffer, and Vim to use "new space" below what was already on
>    the screen.
>    ---
> 
>    I really like tmux, but this behavior is a showstopper for me and many
>    co-workers that now use screen.
>    Thanks a bunch :)
>    g.
> 
>    On Sun, Sep 25, 2011 at 07:55:27AM +0100, Nicholas Marriott wrote:
>    > It wasn't supported in tmux 1.4, try tmux 1.5?
>    >
>    > If that doesn't work, send me the output of "clear|cat -v" on your
>    > box.
>    >
>    >
>    > On Sat, Sep 24, 2011 at 06:25:40PM -0700, Robin Lee Powell wrote:
>    > > Note, by the way, that on other machines "clear" *used* to do the
>    > > right thing for me; we had a long thread about it a while back;
>    > > [1]http://www.mail-archive.com/tmux-users@...>
>    > >
>    > > This is a completely new system, and I don't know what changed.
>    > > It's Fedora 15, running tmux 1.4.
>    > >
>    > > Suggestions welcome for how to test/debug this, as usual.
>    > >
>    > > -Robin
>    > >
>    > > On Sat, Sep 24, 2011 at 06:15:29PM -0700, Robin Lee Powell wrote:
>    > > > On my current Fedora machine, no, it doesn't.
>    > > >
>    > > > If I run "clear", with alternate-screen off, it simply destroys
>    > > > what's on the screen; it doesn't go into tmux's backscroll/history
>    > > > or anything, it's just *gone*.
>    > > >
>    > > > I want this fixed so very, very badly. ;_;
>    > > >
>    > > > It annoys me so much that I may have to switch back to GNU screen,
>    > > > where I never had this problem, despite it being a worse program in
>    > > > basically every other respect.
>    > > >
>    > > > -Robin
>    > > >
>    > > > On Mon, Aug 22, 2011 at 10:28:09PM +0100, Nicholas Marriott wrote:
>    > > > > Don't we do this already? Clear screen scrolls lines into the
>    history?
>    > > > > Or do you want something else? It isn't very obvious.
>    > > > >
>    > > > >
>    > > > >
>    > > > > On Mon, Aug 22, 2011 at 10:22:16PM +0200, Fabian Groffen wrote:
>    > > > > > Hi list,
>    > > > > >
>    > > > > > In my quest to get rid of the alternative buffer feature of
>    todays
>    > > > > > terminals, I've configured tmux with:
>    > > > > >
>    > > > > > set -g terminal-overrides 'xterm*:smcup@...@'
>    > > > > > set -g alternate-screen off
>    > > > > >
>    > > > > > This basically does everything I want, except that compared to a
>    > > > > > non-tmux session (with terminfo settings to remove smcup and
>    rmcup
>    > > > > > capabilities) a "clear" overwrites the existing contents of the
>    > > > > > terminal. E.g. when I run Vim in tmux, I lose the information on
>    my
>    > > > > > screen, whereas outside it isn't. The \E[2J sequence triggers a
>    full
>    > > > > > clear screen, and the attached patch changes the behaviour for
>    that
>    > > > > > sequence in the tty_cmd_clearscreen function not to overwrite,
>    but
>    > > > > > rather add empty lines to make the terminal clean. This is only
>    done
>    > > > > > when alternate-screen is set to off, when this behaviour makes
>    sense.
>    > > > > >
>    > > > > > Please consider the attached patch.
>    > > > > >
>    > > > > >
>    > > > > > --
>    > > > > > Fabian Groffen
>    > > > > > Gentoo on a different level
>    > > > >
>    > > > > > # HG changeset patch
>    > > > > > # User Fabian Groffen <grobian@...>
>    > > > > > # Date 1314042382 -7200
>    > > > > > # Node ID 1b455a85ed6ca5e6aeea23a7152bffcc902966b3
>    > > > > > # Parent 051fdc014dc5bc730e4b0eb380af8b09938dd9b8
>    > > > > > tty_cmd_clearscreen: don't overwrite the buffer if
>    alternate-screen=off
>    > > > > >
>    > > > > > If the alternative-screen isn't used, overwriting the buffer
>    contents
>    > > > > > loses the information that the user probably wanted to retain
>    (hence no
>    > > > > > alternate-screen). Instead, write enough newlines to clear the
>    screen
>    > > > > > and reset the cursor, such that we retain all information that
>    was on
>    > > > > > the screen before the clear.
>    > > > > >
>    > > > > > For example: having ls output and starting Vim won't overwrite
>    the ls
>    > > > > > output, but show the output including the vim invocation.
>    > > > > >
>    > > > > > diff -r 051fdc014dc5 -r 1b455a85ed6c tty.c
>    > > > > > --- a/tty.c Mon Aug 22 20:14:55 2011 +0200
>    > > > > > +++ b/tty.c Mon Aug 22 21:46:22 2011 +0200
>    > > > > > @@ -899,24 +899,32 @@
>    > > > > >
>    > > > > > tty_reset(tty);
>    > > > > >
>    > > > > > - tty_region_pane(tty, ctx, 0, screen_size_y(s) - 1);
>    > > > > > - tty_cursor_pane(tty, ctx, 0, 0);
>    > > > > > + if (options_get_number(&wp->window->options,
>    "alternate-screen")) {
>    > > > > > + tty_region_pane(tty, ctx, 0, screen_size_y(s) - 1);
>    > > > > > + tty_cursor_pane(tty, ctx, 0, 0);
>    > > > > >
>    > > > > > - if (wp->xoff == 0 && screen_size_x(s) >= tty->sx &&
>    > > > > > - tty_term_has(tty->term, TTYC_EL)) {
>    > > > > > - for (i = 0; i < screen_size_y(s); i++) {
>    > > > > > - tty_putcode(tty, TTYC_EL);
>    > > > > > - if (i != screen_size_y(s) - 1) {
>    > > > > > - tty_emulate_repeat(tty, TTYC_CUD, TTYC_CUD1, 1);
>    > > > > > - tty->cy++;
>    > > > > > + if (wp->xoff == 0 && screen_size_x(s) >= tty->sx &&
>    > > > > > + tty_term_has(tty->term, TTYC_EL)) {
>    > > > > > + for (i = 0; i < screen_size_y(s); i++) {
>    > > > > > + tty_putcode(tty, TTYC_EL);
>    > > > > > + if (i != screen_size_y(s) - 1) {
>    > > > > > + tty_emulate_repeat(tty, TTYC_CUD, TTYC_CUD1, 1);
>    > > > > > + tty->cy++;
>    > > > > > + }
>    > > > > > + }
>    > > > > > + } else {
>    > > > > > + for (j = 0; j < screen_size_y(s); j++) {
>    > > > > > + tty_cursor_pane(tty, ctx, 0, j);
>    > > > > > + for (i = 0; i < screen_size_x(s); i++)
>    > > > > > + tty_putc(tty, ' ');
>    > > > > > }
>    > > > > > }
>    > > > > > } else {
>    > > > > > - for (j = 0; j < screen_size_y(s); j++) {
>    > > > > > - tty_cursor_pane(tty, ctx, 0, j);
>    > > > > > - for (i = 0; i < screen_size_x(s); i++)
>    > > > > > - tty_putc(tty, ' ');
>    > > > > > - }
>    > > > > > + /* make sure we don't overwrite buffer contents, move down */
>    > > > > > + for (j = 0; j < screen_size_y(s); j++)
>    > > > > > + tty_putc(tty, '\n');
>    > > > > > + tty_region_pane(tty, ctx, 0, screen_size_y(s) - 1);
>    > > > > > + tty_cursor_pane(tty, ctx, 0, 0);
>    > > > > > }
>    > > > > > }
>    > > > > >
>    > > > >
>    > > > > >
>    
> ------------------------------------------------------------------------------
>    > > > > > uberSVN's rich system and user administration capabilities and
>    model
>    > > > > > configuration take the hassle out of deploying and managing
>    Subversion and
>    > > > > > the tools developers use with it. Learn more about uberSVN and
>    get a free
>    > > > > > download at: [2]http://p.sf.net/sfu/wandisco-dev2dev
>    > > > >
>    > > > > > _______________________________________________
>    > > > > > tmux-users mailing list
>    > > > > > tmux-users@...
>    > > > > > [3]https://lists.sourceforge.net/lists/listinfo/tmux-users
>    > > > >
>    > > > >
>    > > > >
>    
> ------------------------------------------------------------------------------
>    > > > > uberSVN's rich system and user administration capabilities and
>    model
>    > > > > configuration take the hassle out of deploying and managing
>    Subversion and
>    > > > > the tools developers use with it. Learn more about uberSVN and get
>    a free
>    > > > > download at: [4]http://p.sf.net/sfu/wandisco-dev2dev
>    > > > > _______________________________________________
>    > > > > tmux-users mailing list
>    > > > > tmux-users@...
>    > > > > [5]https://lists.sourceforge.net/lists/listinfo/tmux-users
>    >
>    >
>    
> ------------------------------------------------------------------------------
>    > All of the data generated in your IT infrastructure is seriously
>    valuable.
>    > Why? It contains a definitive record of application performance,
>    security
>    > threats, fraudulent activity, and more. Splunk takes this data and makes
>    > sense of it. IT sense. And common sense.
>    > [6]http://p.sf.net/sfu/splunk-d2dcopy2
>    > _______________________________________________
>    > tmux-users mailing list
>    > tmux-users@...
>    > [7]https://lists.sourceforge.net/lists/listinfo/tmux-users
>    >
> 
> References
> 
>    Visible links
>    1. http://www.mail-archive.com/tmux-users@..
>    2. http://p.sf.net/sfu/wandisco-dev2dev
>    3. https://lists.sourceforge.net/lists/listinfo/tmux-users
>    4. http://p.sf.net/sfu/wandisco-dev2dev
>    5. https://lists.sourceforge.net/lists/listinfo/tmux-users
>    6. http://p.sf.net/sfu/splunk-d2dcopy2
>    7. https://lists.sourceforge.net/lists/listinfo/tmux-users

> ------------------------------------------------------------------------------
> Virtualization & Cloud Management Using Capacity Planning
> Cloud computing makes use of virtualization - but cloud computing 
> also focuses on allowing computing to be delivered as a service.
> http://www.accelacomm.com/jaw/sfnl/114/51521223/

> _______________________________________________
> tmux-users mailing list
> tmux-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/tmux-users


------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to