* aclocal.m4: Don't add wcwidth.o if we don't have wchar.h.
[deliverable/binutils-gdb.git] / readline / parens.c
index b6de529f1a000611783b33c7ed465ed989e74a88..54ef1f3695faf8ff4545139fe46357949134f42d 100644 (file)
 #include <stdio.h>
 #include <sys/types.h>
 
+#if defined (HAVE_UNISTD_H)
+#  include <unistd.h>
+#endif
+
 #if defined (FD_SET) && !defined (HAVE_SELECT)
 #  define HAVE_SELECT
 #endif
@@ -54,7 +58,7 @@ extern char *strchr (), *strrchr ();
 #include "readline.h"
 #include "rlprivate.h"
 
-static int find_matching_open __P((char *, int, int));
+static int find_matching_open PARAMS((char *, int, int));
 
 /* Non-zero means try to blink the matching open parenthesis when the
    close parenthesis is inserted. */
@@ -64,6 +68,8 @@ int rl_blink_matching_paren = 1;
 int rl_blink_matching_paren = 0;
 #endif /* !HAVE_SELECT */
 
+static int _paren_blink_usec = 500000;
+
 /* Change emacs_standard_keymap to have bindings for paren matching when
    ON_OR_OFF is 1, change them back to self_insert when ON_OR_OFF == 0. */
 void
@@ -84,12 +90,24 @@ _rl_enable_paren_matching (on_or_off)
     }
 }
 
+int
+rl_set_paren_blink_timeout (u)
+     int u;
+{
+  int o;
+
+  o = _paren_blink_usec;
+  if (u > 0)
+    _paren_blink_usec = u;
+  return (o);
+}
+
 int
 rl_insert_close (count, invoking_key)
      int count, invoking_key;
 {
   if (rl_explicit_arg || !rl_blink_matching_paren)
-    rl_insert (count, invoking_key);
+    _rl_insert_char (count, invoking_key);
   else
     {
 #if defined (HAVE_SELECT)
@@ -97,7 +115,7 @@ rl_insert_close (count, invoking_key)
       struct timeval timer;
       fd_set readfds;
 
-      rl_insert (1, invoking_key);
+      _rl_insert_char (1, invoking_key);
       (*rl_redisplay_function) ();
       match_point =
        find_matching_open (rl_line_buffer, rl_point - 2, invoking_key);
@@ -109,7 +127,7 @@ rl_insert_close (count, invoking_key)
       FD_ZERO (&readfds);
       FD_SET (fileno (rl_instream), &readfds);
       timer.tv_sec = 0;
-      timer.tv_usec = 500000;
+      timer.tv_usec = _paren_blink_usec;
 
       orig_point = rl_point;
       rl_point = match_point;
@@ -117,7 +135,7 @@ rl_insert_close (count, invoking_key)
       ready = select (1, &readfds, (fd_set *)NULL, (fd_set *)NULL, &timer);
       rl_point = orig_point;
 #else /* !HAVE_SELECT */
-      rl_insert (count, invoking_key);
+      _rl_insert_char (count, invoking_key);
 #endif /* !HAVE_SELECT */
     }
   return 0;
This page took 0.02598 seconds and 4 git commands to generate.