repl: highlight matching parenthesis

This commit is contained in:
Přemysl Eric Janouch 2017-05-23 18:08:00 +02:00
parent 9f51b986d2
commit fa06aff875
Signed by: p
GPG Key ID: B715679E3A361BE6
1 changed files with 7 additions and 0 deletions

7
repl.c
View File

@ -42,6 +42,12 @@ run (struct context *ctx, struct item *program) {
} }
} }
static int
init_readline (void) {
rl_variable_bind ("blink-matching-paren", "on");
return 0;
}
int int
main (int argc, char *argv[]) { main (int argc, char *argv[]) {
(void) argc; (void) argc;
@ -54,6 +60,7 @@ main (int argc, char *argv[]) {
using_history (); using_history ();
const char *slash = strrchr (argv[0], '/'); const char *slash = strrchr (argv[0], '/');
rl_readline_name = slash ? ++slash : argv[0]; rl_readline_name = slash ? ++slash : argv[0];
rl_startup_hook = init_readline;
char *line; char *line;
while ((line = readline ("> "))) { while ((line = readline ("> "))) {