summaryrefslogtreecommitdiff
path: root/readline/parens.c
diff options
context:
space:
mode:
authorElena Zannoni <ezannoni@kwikemart.cygnus.com>2002-12-08 22:31:39 +0000
committerElena Zannoni <ezannoni@kwikemart.cygnus.com>2002-12-08 22:31:39 +0000
commit711a125cd3c4a70294cd96615120cb61b64ef88e (patch)
treecd5afad1dcbda8ecd4316225edaed77fc3174ee6 /readline/parens.c
parent726941b1ecf998b928ad0e0f84d637849f6c3e63 (diff)
downloadgdb-711a125cd3c4a70294cd96615120cb61b64ef88e.tar.gz
Import of readline 4.3.
Non-readline modified files: src/gdb/ChangeLog src/gdb/defs.h src/gdb/cli/cli-cmds.c src/gdb/cli/cli-setshow.c src/gdb/tui/ChangeLog src/gdb/tui/tuiWin.c In readline directory: * compat.c, mbutil.c, misc.c, rlmbutil.h, rltypedefs.h, text.c, doc/history.0, doc/history.3, support/wcwidth.c, examples/readlinebuf.h, examples/rlcat.c: New files. * CHANGELOG, CHANGES, INSTALL, MANIFEST, Makefile.in, README, aclocal.m4, ansi_stdlib.h, bind.c, callback.c, chardefs.h, complete.c, config.h.in, configure, configure.in, display.c, emacs_keymap.c, funmap.c, histexpand.c, histfile.c, histlib.h, history.c, history.h, histsearch.c, input.c, isearch.c, keymaps.c, keymaps.h, kill.c, macro.c, nls.c, parens.c, posixdir.h, readline.c, readline.h, rlconf.h, rldefs.h, rlprivate.h, rlshell.h, rlstdc.h, rltty.c, savestring.c, search.c, shell.c, signals.c, terminal.c, tilde.c, tilde.h, undo.c, util.c, vi_keymap.c, vi_mode.c, xmalloc.c, xmalloc.h, doc/Makefile.in, doc/hist.texinfo, doc/hstech.texinfo, doc/hsuser.texinfo, doc/manvers.texinfo, doc/readline.3, doc/rlman.texinfo, doc/rltech.texinfo, doc/rluser.texinfo doc/rluserman.texinfo, doc/texi2dvi, doc/texi2html, shlib/Makefile.in, support/install.sh, support/mkdirs, support/mkdist, support/shlib-install, support/shobj-conf, examples/Inputrc, examples/Makefile.in, examples/fileman.c, examples/histexamp.c, examples/manexamp.c, examples/rl.c, examples/rlfe.c, examples/rltest.c, examples/rlversion.c: Modified files.
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;