Nicholas Marriott wrote: > It could be much smaller by doing: > > if (!options_get_number(&wp->window->options, "app-private-window")) > break; > > In both cases, instead of putting everything inside the if.
Yes, but I often introduce error checking, where a function is supposed to collect status info. At the end it should do whatever cleanup is needed and return a meaningful status code. So I tend to have one entry and one exit, and even use gotos to stick to this principle. I've seen the many sideways exits in the code, and I don't mind as long as I don't have to repair anything. > You also need to set a default value in tmux.c or tmux will die with > a fatal error the first time this code is hit, because the option > isn't set. Ah, thanks! Will do ASAP. > I'm not sure about the option name, I think it should be something > like use-alternate-screen. Ok, this is a better name. > Can't you change your editor to use tabs instead of spaces or enter > a literal tab? Sure. I grew tired of the tab+spaces-mix found in many sources and use spaces, but patches should be as small as possible. clemens Index: cmd-set-option.c =================================================================== --- cmd-set-option.c.orig +++ cmd-set-option.c @@ -155,6 +155,7 @@ const struct set_option_entry set_window { "monitor-content", SET_OPTION_STRING, 0, 0, NULL }, { "remain-on-exit", SET_OPTION_FLAG, 0, 0, NULL }, { "synchronize-panes", SET_OPTION_FLAG, 0, 0, NULL }, + { "use-alternate-screen", SET_OPTION_FLAG, 0, 0, NULL }, { "utf8", SET_OPTION_FLAG, 0, 0, NULL }, { "window-status-attr", SET_OPTION_ATTRIBUTES, 0, 0, NULL }, { "window-status-bg", SET_OPTION_COLOUR, 0, 0, NULL }, Index: input.c =================================================================== --- input.c.orig +++ input.c @@ -1178,14 +1178,17 @@ input_handle_sequence_sm(struct input_ct case 1049: if (wp->saved_grid != NULL) break; - sx = screen_size_x(s); - sy = screen_size_y(s); + + if (! options_get_number(&wp->window->options, "use-alternate-screen")) + break; /* * Enter alternative screen mode. A copy of the visible * screen is saved and the history is not updated */ + sx = screen_size_x(s); + sy = screen_size_y(s); wp->saved_grid = grid_create(sx, sy, 0); grid_duplicate_lines( wp->saved_grid, 0, s->grid, screen_hsize(s), sy); @@ -1254,14 +1257,17 @@ input_handle_sequence_rm(struct input_ct case 1049: if (wp->saved_grid == NULL) break; - sx = screen_size_x(s); - sy = screen_size_y(s); + + if (! options_get_number(&wp->window->options, "use-alternate-screen")) + break; /* * Exit alternative screen mode and restore the copied * grid. */ + sx = screen_size_x(s); + sy = screen_size_y(s); /* * If the current size is bigger, temporarily resize * to the old size before copying back. Index: tmux.1 =================================================================== --- tmux.1.orig +++ tmux.1 @@ -1893,6 +1893,17 @@ command. Duplicate input to any pane to all other panes in the same window, except for panes that are not in output mode. .Pp +.It Xo Ic use-alternate-screen +.Op Ic on | off +.Xc +Every application initializing its window can have it all to itself. +.Nm +will save the previous window contents and restore it afterwards, the +applications contents will not be saved in the history. This makes +sense if full screen edit sessions are not supposed to clutter the +history. +The default is on. +.Pp .It Xo Ic utf8 .Op Ic on | off .Xc Index: tmux.c =================================================================== --- tmux.c.orig +++ tmux.c @@ -409,6 +409,7 @@ main(int argc, char **argv) options_set_number(wo, "xterm-keys", 0); options_set_number(wo, "remain-on-exit", 0); options_set_number(wo, "synchronize-panes", 0); + options_set_number(wo, "use-alternate-screen", 1); if (flags & IDENTIFY_UTF8) { options_set_number(so, "status-utf8", 1); ------------------------------------------------------------------------------ The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com _______________________________________________ tmux-users mailing list tmux-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/tmux-users