On 22-08-2011 22:28:09 +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.

Yesterday, I've been toying a lot to achieve the "right effect(tm)".
What I want, is in the first place, use my terminal's scrollback buffer.
If possible, I'd like to reduce the use of the buffer from screen/tmux
to a maximum.

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.
Normally, the alternative buffer just kicks in, and restores when you
quit Vim, but I don't like that, as I want to scroll up in my terminal
buffer to see e.g. my ls output.
In tmux, Vim would overwrite the above 4 lines, the same what would
happen if I would call clear (or tput clear).

After my post I realised how bad my patch was.  Checking in screen
itself, I found that the desired behaviour is there, because I use the
clear entire screen sequence of the terminal (\E[2J) as te (smcup) in
screen's termcapinfo overrides.  In tmux, this doesn't work, my guessing
is that the sequence isn't sent as is, but interpreted and replaced by
the clearscreen function, because otherwise the multiple panes wouldn't
work as expected.

I now did simply this:

--- a/tty.c Mon Aug 22 20:14:55 2011 +0200
+++ b/tty.c Tue Aug 23 09:14:33 2011 +0200
@@ -899,6 +899,12 @@

    tty_reset(tty);

+   if (!options_get_number(&wp->window->options, "alternate-screen")) {
+       /* 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);

which seems to work without breaking things badly.  I'm not sure if it
is the right thing though.  I expect not, because it will mess up the
screen when multiple panes are active.

Is there a way to know if there is just a single pane in the window?
Then I guess the terminal output preserving code from above should only
be triggered when there is just a single window on the screen.

Thanks,

-- 
Fabian Groffen
Gentoo on a different level

------------------------------------------------------------------------------
Get a FREE DOWNLOAD! and learn more about uberSVN rich system, 
user administration capabilities and model configuration. Take 
the hassle out of deploying and managing Subversion and the 
tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to