history-limit option.

This commit is contained in:
Nicholas Marriott 2007-11-23 12:48:20 +00:00
parent 26c8303733
commit 9c584432d0
5 changed files with 27 additions and 6 deletions

View File

@ -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 $

View File

@ -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 <nicm@users.sourceforge.net>
@ -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;

View File

@ -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 <nicm@users.sourceforge.net>
@ -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;

5
tmux.c
View File

@ -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 <nicm@users.sourceforge.net>
@ -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());

3
tmux.h
View File

@ -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 <nicm@users.sourceforge.net>
@ -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 *);