=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mg/match.c,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- src/usr.bin/mg/match.c 2015/06/03 23:40:01 1.19 +++ src/usr.bin/mg/match.c 2019/06/26 16:42:30 1.20 @@ -1,4 +1,4 @@ -/* $OpenBSD: match.c,v 1.19 2015/06/03 23:40:01 bcallah Exp $ */ +/* $OpenBSD: match.c,v 1.20 2019/06/26 16:42:30 lum Exp $ */ /* This file is in the public domain. */ @@ -35,9 +35,30 @@ { '\0', '\0' } }; + /* - * Hack to show matching paren. Self-insert character, then show matching - * character, if any. Bound to "blink-and-insert". + * Self-insert character, then show matching character. + * Bound to "blink-and-insert". + */ +int +ask_showmatch(int f, int n) +{ + char *c, cbuf[2]; + + if ((c = eread("Insert a character: ", cbuf, sizeof(cbuf), + EFNEW)) == NULL || (c[0] == '\0')) + return (ABORT); + + key.k_chars[0] = *c; + key.k_chars[1] = '\0'; + key.k_count = 1; + + return (showmatch(FFRAND, 1)); +} + + +/* + * Hack to show matching paren. Bound to balance stucture chars ),],}. */ int showmatch(int f, int n)