diff options
author | Kjell Wooding <kjell@cvs.openbsd.org> | 2005-05-31 20:39:00 +0000 |
---|---|---|
committer | Kjell Wooding <kjell@cvs.openbsd.org> | 2005-05-31 20:39:00 +0000 |
commit | f454f5b2cd6f4addda2387f5bb72d0e1bf8ae327 (patch) | |
tree | 2f8ebb46dba5ce0b37654c40ad5d7b61be2566d5 /usr.bin | |
parent | 7c7c0b8f3915fc8f09780b284bfc98055c5ed9a8 (diff) |
fix broken minibuffer defaults introduced in echo.c:1.33
adds eread flag EFDEF allowing null minibuffer response
noticed by otto
ok cloder@ jason@, works otto@
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/mg/buffer.c | 12 | ||||
-rw-r--r-- | usr.bin/mg/def.h | 3 | ||||
-rw-r--r-- | usr.bin/mg/echo.c | 4 |
3 files changed, 10 insertions, 9 deletions
diff --git a/usr.bin/mg/buffer.c b/usr.bin/mg/buffer.c index 648c3f7166e..bb310e43da0 100644 --- a/usr.bin/mg/buffer.c +++ b/usr.bin/mg/buffer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: buffer.c,v 1.39 2005/05/25 05:57:32 jason Exp $ */ +/* $OpenBSD: buffer.c,v 1.40 2005/05/31 20:38:59 kjell Exp $ */ /* * Buffer handling. @@ -45,7 +45,7 @@ usebuffer(int f, int n) bufp = eread("Switch to buffer: ", bufn, NBUFN, EFNEW | EFBUF); else bufp = eread("Switch to buffer: (default %s) ", bufn, NBUFN, - EFNEW | EFBUF, curbp->b_altb->b_bname); + EFNUL | EFNEW | EFBUF, curbp->b_altb->b_bname); if (bufp == NULL) return (ABORT); @@ -77,7 +77,7 @@ poptobuffer(int f, int n) EFNEW | EFBUF); else bufp = eread("Switch to buffer in other window: (default %s) ", - bufn, NBUFN, EFNEW | EFBUF, curbp->b_altb->b_bname); + bufn, NBUFN, EFNUL | EFNEW | EFBUF, curbp->b_altb->b_bname); if (bufp == NULL) return (ABORT); if (bufp[0] == 0 && curbp->b_altb != NULL) @@ -107,8 +107,8 @@ killbuffer_cmd(int f, int n) BUFFER *bp; char bufn[NBUFN], *bufp; - if ((bufp = eread("Kill buffer: (default %s) ", bufn, NBUFN, EFNEW | EFBUF, - curbp->b_bname)) == NULL) + if ((bufp = eread("Kill buffer: (default %s) ", bufn, NBUFN, + EFNUL | EFNEW | EFBUF, curbp->b_bname)) == NULL) return (ABORT); else if (bufp[0] == 0) bp = curbp; @@ -607,7 +607,7 @@ bufferinsert(int f, int n) /* Get buffer to use from user */ if (curbp->b_altb != NULL) bufp = eread("Insert buffer: (default %s) ", bufn, NBUFN, - EFNEW | EFBUF, curbp->b_altb->b_bname); + EFNUL | EFNEW | EFBUF, curbp->b_altb->b_bname); else bufp = eread("Insert buffer: ", bufn, NBUFN, EFNEW | EFBUF); if (bufp == NULL) diff --git a/usr.bin/mg/def.h b/usr.bin/mg/def.h index b426fc01d60..483e4c6403e 100644 --- a/usr.bin/mg/def.h +++ b/usr.bin/mg/def.h @@ -1,4 +1,4 @@ -/* $OpenBSD: def.h,v 1.62 2005/05/30 13:13:50 jason Exp $ */ +/* $OpenBSD: def.h,v 1.63 2005/05/31 20:38:59 kjell Exp $ */ #include <sys/queue.h> @@ -97,6 +97,7 @@ typedef int (*PF)(int, int); /* generally useful type */ #define EFNEW 0x0008 /* New prompt. */ #define EFCR 0x0010 /* Echo CR at end; last read. */ #define EFDEF 0x0020 /* buffer contains default args */ +#define EFNUL 0x0040 /* Null Minibuffer OK */ /* * Flags for "ldelete"/"kinsert" diff --git a/usr.bin/mg/echo.c b/usr.bin/mg/echo.c index 206f3d90619..3f855bf215a 100644 --- a/usr.bin/mg/echo.c +++ b/usr.bin/mg/echo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: echo.c,v 1.33 2005/05/28 00:41:13 cloder Exp $ */ +/* $OpenBSD: echo.c,v 1.34 2005/05/31 20:38:59 kjell Exp $ */ /* * Echo line reading and writing. * @@ -203,7 +203,7 @@ veread(const char *fp, char *buf, size_t nbuf, int flag, va_list ap) /* FALLTHROUGH */ case CCHR('M'): /* return, done */ /* if there's nothing in the minibuffer, quit */ - if (cpos == 0) { + if (cpos == 0 && !(flag & EFNUL)) { (void)ctrlg(FFRAND, 0); ttflush(); return (NULL); |