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@:rmcup@' 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 <grob...@gentoo.org> # 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: http://p.sf.net/sfu/wandisco-dev2dev
_______________________________________________ tmux-users mailing list tmux-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/tmux-users