summaryrefslogtreecommitdiff
path: root/readline/parens.c
diff options
context:
space:
mode:
Diffstat (limited to 'readline/parens.c')
-rw-r--r--readline/parens.c28
1 files changed, 23 insertions, 5 deletions
diff --git a/readline/parens.c b/readline/parens.c
index b6de529f1a0..54ef1f3695f 100644
--- a/readline/parens.c
+++ b/readline/parens.c
@@ -30,6 +30,10 @@
#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
@@ -85,11 +91,23 @@ _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;