diff options
author | Nicholas Marriott <nicholas.marriott@gmail.com> | 2008-06-19 23:20:45 +0000 |
---|---|---|
committer | Nicholas Marriott <nicholas.marriott@gmail.com> | 2008-06-19 23:20:45 +0000 |
commit | a1db273dc21ba28bbc5b578bd5c20e28a8b1a370 (patch) | |
tree | e031d498ff8c866c0fef5aca0921eb6d99aaf941 | |
parent | 7cebf4768b90bd004eadcec4eb7ff67d6868183f (diff) |
display-time option to set message display time.
-rw-r--r-- | CHANGES | 7 | ||||
-rw-r--r-- | cmd-set-option.c | 16 | ||||
-rw-r--r-- | server-fn.c | 9 | ||||
-rw-r--r-- | tmux.c | 3 |
4 files changed, 30 insertions, 5 deletions
@@ -1,3 +1,8 @@ +20 June 2008 + +* New option, display-time, sets the time status line messages stay on screen + (unless a key is pressed). Set in milliseconds, default is 750 (0.75 seconds). + 19 June 2008 * Use "status" consistently for status line option, and prefix for "prefix" key @@ -511,4 +516,4 @@ (including mutt, emacs). No status bar yet and no key remapping or other customisation. -$Id: CHANGES,v 1.128 2008-06-19 22:04:01 nicm Exp $ +$Id: CHANGES,v 1.129 2008-06-19 23:20:45 nicm Exp $ diff --git a/cmd-set-option.c b/cmd-set-option.c index 1cbd85aa..b4b9ece0 100644 --- a/cmd-set-option.c +++ b/cmd-set-option.c @@ -1,4 +1,4 @@ -/* $Id: cmd-set-option.c,v 1.32 2008-06-19 22:04:02 nicm Exp $ */ +/* $Id: cmd-set-option.c,v 1.33 2008-06-19 23:20:45 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -236,6 +236,20 @@ cmd_set_option_exec(struct cmd *self, unused struct cmd_ctx *ctx) return; } options_set_number(oo, "history-limit", number); + } else if (strcmp(data->option, "display-time") == 0) { + if (data->value == NULL || number == -1) { + ctx->error(ctx, "invalid value"); + return; + } + if (errstr != NULL) { + ctx->error(ctx, "display-time %s", errstr); + return; + } + if (number > INT_MAX) { + ctx->error(ctx, "display-time too big: %u", number); + return; + } + options_set_number(oo, "display-time", number); } else if (strcmp(data->option, "status-left") == 0) { if (data->value == NULL) { ctx->error(ctx, "invalid value"); diff --git a/server-fn.c b/server-fn.c index de5ae0ed..4f0ef67a 100644 --- a/server-fn.c +++ b/server-fn.c @@ -1,4 +1,4 @@ -/* $Id: server-fn.c,v 1.46 2008-06-19 23:07:11 nicm Exp $ */ +/* $Id: server-fn.c,v 1.47 2008-06-19 23:20:45 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -26,7 +26,12 @@ void server_set_client_message(struct client *c, const char *msg) { - struct timespec ts = { 0, 750000000L }; + struct timespec ts; + int delay; + + delay = options_get_number(&c->session->options, "display-time"); + ts.tv_sec = delay / 1000; + ts.tv_nsec = (delay % 1000) * 1000000L; c->message_string = xstrdup(msg); if (clock_gettime(CLOCK_REALTIME, &c->message_timer) != 0) @@ -1,4 +1,4 @@ -/* $Id: tmux.c,v 1.63 2008-06-19 22:04:02 nicm Exp $ */ +/* $Id: tmux.c,v 1.64 2008-06-19 23:20:45 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -214,6 +214,7 @@ main(int argc, char **argv) options_set_colours(&global_options, "status-colour", 0x02); options_set_number(&global_options, "bell-action", BELL_ANY); options_set_number(&global_options, "history-limit", 2000); + options_set_number(&global_options, "display-time", 750); options_set_key(&global_options, "prefix", META); options_set_string(&global_options, "status-left", "%s", ""); /* ugh */ options_set_string( |