Sync OpenBSD patchset 587:

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.
This commit is contained in:
Tiago Cunha
2009-12-16 01:09:01 +00:00
parent ef3e483a0d
commit 90d40e27da
5 changed files with 21 additions and 15 deletions

View File

@@ -1,4 +1,4 @@
/* $Id: tty-keys.c,v 1.53 2009-12-04 22:14:47 tcunha Exp $ */
/* $Id: tty-keys.c,v 1.54 2009-12-16 01:09:01 tcunha 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);