aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES5
-rw-r--r--TODO8
-rw-r--r--cmd-set-option.c5
-rw-r--r--server.c33
-rw-r--r--tmux.c3
-rw-r--r--tmux.h5
6 files changed, 37 insertions, 22 deletions
diff --git a/CHANGES b/CHANGES
index 6e4e9c8f..0e786101 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,8 @@
12 January 2009
+* Option to set prefix time, allowing multiple commands to be entered without
+ pressing the prefix key again, so long as they each typed within this time of
+ each other.
* Yet more hacks for key handling. Think it is just about working now.
* Two commands, resize-pane-up and resize-pane-down to resize a pane.
* Make the window pane code handle panes of different sizes, and add a -l
@@ -884,7 +887,7 @@
(including mutt, emacs). No status bar yet and no key remapping or other
customisation.
-$Id: CHANGES,v 1.198 2009-01-12 22:48:00 nicm Exp $
+$Id: CHANGES,v 1.199 2009-01-12 23:37:02 nicm Exp $
LocalWords: showw utf UTF fulvio ciriaco joshe OSC APC gettime abc DEF OA clr
LocalWords: rivo nurges lscm Erdely eol smysession mysession ek dstname RB
diff --git a/TODO b/TODO
index 4f489dae..28b0c523 100644
--- a/TODO
+++ b/TODO
@@ -61,12 +61,10 @@
- tty.c is a bit ugly
- document default-path
- document xterm-keys
-- document server-info
- document window options changes
-- document clock-mode
- document password/locking commands
-- document lock-after-time
- document panes and window splitting: split-window and switch-pane
+- document prefix-time
- a command to display the status line briefly when it is turned off
- neww should support -k
- FAQ "Can I have some examples of cool things I can do with tmux?" -- linkw, more??
@@ -93,7 +91,6 @@
swap-panes
close-pane
move-pane (to window)
- pane resizing
>2 panes per window
- would be nice if tmux could be the shell
- some sort of extension to command prompt so can do eg
@@ -101,7 +98,4 @@
bind r command-prompt 'renamew "%%"'
which then asks for a string, substitutes %% in command and executes it
- fix rxvt cursor fg issue (text under cursor has non-white fg)
-- should have a repeat-command delay - if you execute a key binding then
- press another key within the delay time it is treated as if it was anoth
- key binding (ie the ^A prefix is implied)
- key handling sucks a bit and needs to be reworked
diff --git a/cmd-set-option.c b/cmd-set-option.c
index 4af2e06c..7df56f25 100644
--- a/cmd-set-option.c
+++ b/cmd-set-option.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-set-option.c,v 1.51 2009-01-11 00:48:42 nicm Exp $ */
+/* $Id: cmd-set-option.c,v 1.52 2009-01-12 23:37:02 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -50,12 +50,13 @@ const struct set_option_entry set_option_table[NSETOPTION] = {
{ "buffer-limit", SET_OPTION_NUMBER, 1, INT_MAX, NULL },
{ "default-command", SET_OPTION_STRING, 0, 0, NULL },
{ "default-path", SET_OPTION_STRING, 0, 0, NULL },
- { "display-time", SET_OPTION_NUMBER, 1, INT_MAX, NULL },
+ { "display-time", SET_OPTION_NUMBER, 1, SHRT_MAX, NULL },
{ "history-limit", SET_OPTION_NUMBER, 0, SHRT_MAX, NULL },
{ "lock-after", SET_OPTION_NUMBER, 0, INT_MAX, NULL },
{ "message-bg", SET_OPTION_COLOUR, 0, 0, NULL },
{ "message-fg", SET_OPTION_COLOUR, 0, 0, NULL },
{ "prefix", SET_OPTION_KEY, 0, 0, NULL },
+ { "prefix-time", SET_OPTION_NUMBER, 0, SHRT_MAX, NULL },
{ "set-titles", SET_OPTION_FLAG, 0, 0, NULL },
{ "status", SET_OPTION_FLAG, 0, 0, NULL },
{ "status-bg", SET_OPTION_COLOUR, 0, 0, NULL },
diff --git a/server.c b/server.c
index d3ba9909..575c9159 100644
--- a/server.c
+++ b/server.c
@@ -1,4 +1,4 @@
-/* $Id: server.c,v 1.97 2009-01-12 19:36:53 nicm Exp $ */
+/* $Id: server.c,v 1.98 2009-01-12 23:37:02 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -567,7 +567,16 @@ server_handle_client(struct client *c)
{
struct winlink *wl = c->session->curw;
struct window_pane *wp = wl->window->active;
- int key, prefix, status;
+ struct timeval tv;
+ int key, prefix, status, xtimeout;
+
+ xtimeout = options_get_number(&c->session->options, "prefix-time");
+ if (xtimeout != 0) {
+ if (gettimeofday(&tv, NULL) != 0)
+ fatal("gettimeofday");
+ if (timercmp(&tv, &c->command_timer, >))
+ c->flags &= ~CLIENT_PREFIX;
+ }
/* Process keys. */
prefix = options_get_number(&c->session->options, "prefix");
@@ -582,13 +591,19 @@ server_handle_client(struct client *c)
if (server_locked)
continue;
- if (c->flags & CLIENT_PREFIX) {
- key_bindings_dispatch(key, c);
- c->flags &= ~CLIENT_PREFIX;
- continue;
- } else if (key == prefix)
- c->flags |= CLIENT_PREFIX;
- else
+ if (key == prefix || c->flags & CLIENT_PREFIX) {
+ memcpy(&c->command_timer, &tv, sizeof c->command_timer);
+ tv.tv_sec = 0;
+ tv.tv_usec = xtimeout * 1000L;
+ timeradd(&c->command_timer, &tv, &c->command_timer);
+
+ if (c->flags & CLIENT_PREFIX) {
+ key_bindings_dispatch(key, c);
+ if (xtimeout == 0)
+ c->flags &= ~CLIENT_PREFIX;
+ } else if (key == prefix)
+ c->flags |= CLIENT_PREFIX;
+ } else
window_pane_key(wp, c, key);
}
diff --git a/tmux.c b/tmux.c
index 580c59e4..d2493ef5 100644
--- a/tmux.c
+++ b/tmux.c
@@ -1,4 +1,4 @@
-/* $Id: tmux.c,v 1.92 2009-01-11 00:48:42 nicm Exp $ */
+/* $Id: tmux.c,v 1.93 2009-01-12 23:37:02 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -234,6 +234,7 @@ main(int argc, char **argv)
options_set_number(&global_options, "message-bg", 3);
options_set_number(&global_options, "message-fg", 0);
options_set_number(&global_options, "prefix", META);
+ options_set_number(&global_options, "prefix-time", 300);
options_set_number(&global_options, "set-titles", 1);
options_set_number(&global_options, "lock-after-time", 1800);
options_set_number(&global_options, "status", 1);
diff --git a/tmux.h b/tmux.h
index dbc7abcc..dcdea19a 100644
--- a/tmux.h
+++ b/tmux.h
@@ -1,4 +1,4 @@
-/* $Id: tmux.h,v 1.227 2009-01-12 22:48:00 nicm Exp $ */
+/* $Id: tmux.h,v 1.228 2009-01-12 23:37:02 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -741,6 +741,7 @@ struct client {
struct tty tty;
struct timeval status_timer;
+ struct timeval command_timer;
u_int sx;
u_int sy;
@@ -887,7 +888,7 @@ struct set_option_entry {
};
extern const struct set_option_entry set_option_table[];
extern const struct set_option_entry set_window_option_table[];
-#define NSETOPTION 19
+#define NSETOPTION 20
#define NSETWINDOWOPTION 12
/* Edit keys. */