summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2009-12-14 10:43:42 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2009-12-14 10:43:42 +0000
commitd9d503c04f5e5d9943aa2296e23cbbfeace1258a (patch)
tree27ca5948e11ef7da156fd393b2239a0df4229170
parent0413aabe3aa04641354d2cd9fc5dec011545b36b (diff)
New server option, escape-time, to set the timeout used to detect if escapes
are alone or part of a function key or meta sequence.
-rw-r--r--usr.bin/tmux/cmd-set-option.c3
-rw-r--r--usr.bin/tmux/tmux.114
-rw-r--r--usr.bin/tmux/tmux.c3
-rw-r--r--usr.bin/tmux/tmux.h7
-rw-r--r--usr.bin/tmux/tty-keys.c9
5 files changed, 21 insertions, 15 deletions
diff --git a/usr.bin/tmux/cmd-set-option.c b/usr.bin/tmux/cmd-set-option.c
index 2fdbe7e211b..d9b9eeadd30 100644
--- a/usr.bin/tmux/cmd-set-option.c
+++ b/usr.bin/tmux/cmd-set-option.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-set-option.c,v 1.30 2009/12/11 13:58:48 nicm Exp $ */
+/* $OpenBSD: cmd-set-option.c,v 1.31 2009/12/14 10:43:41 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -74,6 +74,7 @@ const char *set_option_bell_action_list[] = {
};
const struct set_option_entry set_option_table[] = {
+ { "escape-time", SET_OPTION_NUMBER, 0, INT_MAX, NULL },
{ "quiet", SET_OPTION_FLAG, 0, 0, NULL },
{ NULL, 0, 0, 0, NULL }
};
diff --git a/usr.bin/tmux/tmux.1 b/usr.bin/tmux/tmux.1
index b9b816e78f3..e286ee6f192 100644
--- a/usr.bin/tmux/tmux.1
+++ b/usr.bin/tmux/tmux.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: tmux.1,v 1.133 2009/12/10 09:16:52 nicm Exp $
+.\" $OpenBSD: tmux.1,v 1.134 2009/12/14 10:43:41 nicm Exp $
.\"
.\" Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
.\"
@@ -14,7 +14,7 @@
.\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
.\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: December 10 2009 $
+.Dd $Mdocdate: December 14 2009 $
.Dt TMUX 1
.Os
.Sh NAME
@@ -1288,8 +1288,14 @@ Available window options are listed under
.Pp
Available server options are:
.Bl -tag -width Ds
+.It Ic escape-time
+Set the time in milliseconds for which
+.Nm
+waits after an escape is input to determine if it is part of a function or meta
+key sequences.
+The default is 500 milliseconds.
.It Ic quiet
-Enable of disable the display of various informational messages (see also the
+Enable or disable the display of various informational messages (see also the
.Fl q
command line flag).
.El
@@ -1884,7 +1890,7 @@ The default is off.
Show the window options with
.Fl w
(equivalent to
-.Ic show-window-options ),
+.Ic show-window-options ) ,
the server options with
.Fl s ,
otherwise the session options for
diff --git a/usr.bin/tmux/tmux.c b/usr.bin/tmux/tmux.c
index 4710bf9044e..edff9be2501 100644
--- a/usr.bin/tmux/tmux.c
+++ b/usr.bin/tmux/tmux.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tmux.c,v 1.64 2009/12/11 13:58:48 nicm Exp $ */
+/* $OpenBSD: tmux.c,v 1.65 2009/12/14 10:43:41 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -317,6 +317,7 @@ main(int argc, char **argv)
options_init(&global_options, NULL);
oo = &global_options;
options_set_number(oo, "quiet", quiet);
+ options_set_number(oo, "escape-time", 500);
options_init(&global_s_options, NULL);
so = &global_s_options;
diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h
index 4b89862436c..855a3839e2e 100644
--- a/usr.bin/tmux/tmux.h
+++ b/usr.bin/tmux/tmux.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: tmux.h,v 1.194 2009/12/10 09:16:52 nicm Exp $ */
+/* $OpenBSD: tmux.h,v 1.195 2009/12/14 10:43:41 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -50,7 +50,7 @@ extern char **environ;
/* Default prompt history length. */
#define PROMPT_HISTORY 100
-/*
+/*
* Minimum layout cell size, NOT including separator line. The scroll region
* cannot be one line in height so this must be at least two.
*/
@@ -59,9 +59,6 @@ extern char **environ;
/* Automatic name refresh interval, in milliseconds. */
#define NAME_INTERVAL 500
-/* Escape timer period, in milliseconds. */
-#define ESCAPE_PERIOD 500
-
/* Maximum data to buffer for output before suspending reading from panes. */
#define BACKOFF_THRESHOLD 1024
diff --git a/usr.bin/tmux/tty-keys.c b/usr.bin/tmux/tty-keys.c
index 9f2abbfb807..503456bc088 100644
--- a/usr.bin/tmux/tty-keys.c
+++ b/usr.bin/tmux/tty-keys.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty-keys.c,v 1.27 2009/12/03 22:50:10 nicm Exp $ */
+/* $OpenBSD: tty-keys.c,v 1.28 2009/12/14 10:43:41 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -429,7 +429,7 @@ tty_keys_next(struct tty *tty)
const char *buf;
size_t len, size;
cc_t bspace;
- int key;
+ int key, delay;
buf = EVBUFFER_DATA(tty->event->input);
len = EVBUFFER_LENGTH(tty->event->input);
@@ -521,8 +521,9 @@ partial_key:
start_timer:
/* Start the timer and wait for expiry or more data. */
- tv.tv_sec = 0;
- tv.tv_usec = ESCAPE_PERIOD * 1000L;
+ delay = options_get_number(&global_options, "escape-time");
+ tv.tv_sec = delay / 1000;
+ tv.tv_usec = (delay % 1000) * 1000L;
evtimer_del(&tty->key_timer);
evtimer_set(&tty->key_timer, tty_keys_callback, tty);