From: lum Date: Tue, 2 Mar 2021 15:03:35 +0000 (+0000) Subject: This diff soaks up the user input while the the maximum character X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=cee96425899826a23caefa3f52c0302e3af2ae94;p=openbsd This diff soaks up the user input while the the maximum character length boundary is crossed in the minbuffer and allows the user to see the error message and respond accordingly. The goto named "null" changed to "skipkey" as per Emil Engler's suggestion on tech@. --- diff --git a/usr.bin/mg/echo.c b/usr.bin/mg/echo.c index de93d454176..ced1a2dc4a9 100644 --- a/usr.bin/mg/echo.c +++ b/usr.bin/mg/echo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: echo.c,v 1.67 2021/03/01 10:51:14 lum Exp $ */ +/* $OpenBSD: echo.c,v 1.68 2021/03/02 15:03:35 lum Exp $ */ /* This file is in the public domain. */ @@ -336,8 +336,8 @@ veread(const char *fp, char *buf, size_t nbuf, int flag, va_list ap) } if (!dynbuf && epos + 1 >= nbuf) { dobeep(); - ewprintf("Line too long"); - return (emptyval); + ewprintf("Line too long. Press Control-g to escape."); + goto skipkey; } for (t = epos; t > cpos; t--) buf[t] = buf[t - 1]; @@ -492,8 +492,8 @@ veread(const char *fp, char *buf, size_t nbuf, int flag, va_list ap) } if (!dynbuf && epos + 1 >= nbuf) { dobeep(); - ewprintf("Line too long"); - return (emptyval); + ewprintf("Line too long. Press Control-g to escape."); + goto skipkey; } for (i = epos; i > cpos; i--) buf[i] = buf[i - 1]; @@ -507,6 +507,9 @@ veread(const char *fp, char *buf, size_t nbuf, int flag, va_list ap) ttmove(rr, cc); ttflush(); } + +skipkey: /* ignore key press */ +; } done: if (cwin == TRUE) {