From 3f101cbfb74adfdb46934aea06cc4c3885f25f0f Mon Sep 17 00:00:00 2001 From: Artur Grabowski Date: Thu, 3 May 2001 20:43:13 +0000 Subject: Fix another annoying feature in mg. When I try to use the keypad to escape from I-search (I don't know if it's legal, but it works in emacs) the initial ESC in the sequence is caugth by I-search (which exits), but not the rest of it which ends up written into the buffer. This is extra annoying when we don't have undo. Note that this is better than emacs because the ESC is removed if nothing indicating a multi-char sequence comes within 300 miliseconds. (Try to ESC from I-search in emacs and then press 'x'). --- usr.bin/mg/search.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/usr.bin/mg/search.c b/usr.bin/mg/search.c index b4b67e2c69d..1d8d22ab233 100644 --- a/usr.bin/mg/search.c +++ b/usr.bin/mg/search.c @@ -1,4 +1,4 @@ -/* $OpenBSD: search.c,v 1.4 2001/01/29 01:58:09 niklas Exp $ */ +/* $OpenBSD: search.c,v 1.5 2001/05/03 20:43:12 art Exp $ */ /* * Search commands. @@ -190,6 +190,14 @@ isearch(dir) switch (c = getkey(FALSE)) { case CCHR('['): + /* + * If new characters come in the next 300 msec, + * we can assume that they belong to a longer + * escaped sequence so we should ungetkey the + * ESC to avoid writing out garbage. + */ + if (ttwait(300) == FALSE) + ungetkey(c); srch_lastdir = dir; curwp->w_markp = clp; curwp->w_marko = cbo; -- cgit v1.2.3