diff --git a/CHANGES b/CHANGES index d53d065f..7f308674 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,10 @@ +23 November 2007 + +* history-limit option to set maximum history. Does not apply retroactively to + existing windows! Lines take up a variable amount of space, but a reasonable + guess for an 80-column terminal is 250 KB per 1000 lines (of history used, + an empty history takes no space). + 21 November 2007 * Create every line as zero length and only expand it as data is written, @@ -249,4 +256,4 @@ (including mutt, emacs). No status bar yet and no key remapping or other customisation. -$Id: CHANGES,v 1.80 2007-11-21 22:20:44 nicm Exp $ +$Id: CHANGES,v 1.81 2007-11-23 12:48:20 nicm Exp $ diff --git a/cmd-set-option.c b/cmd-set-option.c index e6a89432..70a4c3e4 100644 --- a/cmd-set-option.c +++ b/cmd-set-option.c @@ -1,4 +1,4 @@ -/* $Id: cmd-set-option.c,v 1.13 2007-11-16 21:12:31 nicm Exp $ */ +/* $Id: cmd-set-option.c,v 1.14 2007-11-23 12:48:20 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -193,6 +193,16 @@ cmd_set_option_exec(void *ptr, unused struct cmd_ctx *ctx) } xfree(default_command); default_command = xstrdup(data->value); + } else if (strcmp(data->option, "history-limit") == 0) { + if (data->value == NULL) { + ctx->error(ctx, "invalid value"); + return; + } + if (number > SHRT_MAX) { + ctx->error(ctx, "history-limit too big: %u", number); + return; + } + history_limit = number; } else { ctx->error(ctx, "unknown option: %s", data->option); return; diff --git a/screen.c b/screen.c index f943c442..6a6ed3d2 100644 --- a/screen.c +++ b/screen.c @@ -1,4 +1,4 @@ -/* $Id: screen.c,v 1.40 2007-11-22 19:40:16 nicm Exp $ */ +/* $Id: screen.c,v 1.41 2007-11-23 12:48:20 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -91,7 +91,7 @@ screen_create(struct screen *s, u_int dx, u_int dy) s->rlower = s->dy - 1; s->hsize = 0; - s->hlimit = SHRT_MAX; + s->hlimit = history_limit; s->attr = SCREEN_DEFATTR; s->colr = SCREEN_DEFCOLR; diff --git a/tmux.c b/tmux.c index d3495f13..4d411e4b 100644 --- a/tmux.c +++ b/tmux.c @@ -1,4 +1,4 @@ -/* $Id: tmux.c,v 1.42 2007-11-20 12:59:27 nicm Exp $ */ +/* $Id: tmux.c,v 1.43 2007-11-23 12:48:20 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -43,6 +43,7 @@ u_int status_lines; u_char status_colour; char *default_command; int bell_action; +u_int history_limit; void sighandler(int); @@ -214,6 +215,8 @@ main(int argc, char **argv) bell_action = BELL_ANY; + history_limit = 2000; + if (path == NULL) { xasprintf(&path, "%s/%s-%lu", _PATH_TMP, __progname, (u_long) getuid()); diff --git a/tmux.h b/tmux.h index 601ad55f..7e6dcf45 100644 --- a/tmux.h +++ b/tmux.h @@ -1,4 +1,4 @@ -/* $Id: tmux.h,v 1.96 2007-11-22 19:40:16 nicm Exp $ */ +/* $Id: tmux.h,v 1.97 2007-11-23 12:48:20 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -620,6 +620,7 @@ extern int prefix_key; extern int debug_level; extern u_int status_lines; extern u_char status_colour; +extern u_int history_limit; extern char *default_command; void usage(char **, const char *, ...); void logfile(const char *);