bug-readline
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-readline] Escape sequence handling fails when an event hook is inst


From: Mike Miller
Subject: [Bug-readline] Escape sequence handling fails when an event hook is installed
Date: Thu, 12 Sep 2013 08:57:38 -0400
User-agent: Mutt/1.5.21 (2010-09-15)

Hi, I've been tracking down a bug in GNU Octave and I think it's
actually a bug in readline. The attached example program reproduces the
error only when USE_HOOK is defined, which installs a trivial
rl_event_hook function.

Without USE_HOOK:

>>> hello
<<< hello

Entering ^R e <Right Arrow> displays ">>> hello" with the cursor on the
first l, as expected.

With USE_HOOK:

>>> hello
<<< hello

Entering ^R e <Right Arrow> displays ">>> h[Cello" with the cursor on
the e.

The following patch to readline git master resolves this issue for me.
Does this look like a reasonable fix?

---

diff --git a/isearch.c b/isearch.c
index 712b9ea..d830f99 100644
--- a/isearch.c
+++ b/isearch.c
@@ -393,7 +393,7 @@ _rl_isearch_dispatch (cxt, c)
         XXX - since _rl_input_available depends on the application-
         settable keyboard timeout value, this could alternatively
         use _rl_input_queued(100000) */
-      if (cxt->lastc == ESC && _rl_input_available ())
+      if (cxt->lastc == ESC && (_rl_any_typein () || _rl_input_available ()))
        rl_execute_next (ESC);
       return (0);
     }

-- 
mike

Attachment: rltest.c
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]