summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Obser <florian@cvs.openbsd.org>2017-03-13 20:32:59 +0000
committerFlorian Obser <florian@cvs.openbsd.org>2017-03-13 20:32:59 +0000
commit8b0be719a0d4c72da3bafe084d5a360a582e248d (patch)
tree37b335070f6a18ff3a5ccb27b1503720cbbabfe2
parentd503cf875d9735128d9615144ff96530173afdaf (diff)
When aborting switch-to-buffer keep current buffer instead of
switching to *scratch*. (Which seems to be the least useful thing to do.) This brings mg in line with emacs. OK lum; deraadt@ was bugged by this, too
-rw-r--r--usr.bin/mg/buffer.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/usr.bin/mg/buffer.c b/usr.bin/mg/buffer.c
index ca1f30177f1..f5aba4c243d 100644
--- a/usr.bin/mg/buffer.c
+++ b/usr.bin/mg/buffer.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: buffer.c,v 1.102 2016/09/07 11:42:01 lum Exp $ */
+/* $OpenBSD: buffer.c,v 1.103 2017/03/13 20:32:58 florian Exp $ */
/* This file is in the public domain. */
@@ -89,6 +89,9 @@ usebuffer(int f, int n)
bufp = eread("Switch to buffer: (default %s) ", bufn, NBUFN,
EFNUL | EFNEW | EFBUF, curbp->b_altb->b_bname);
+ if (bufp == NULL)
+ return FALSE;
+
return (usebufname(bufp));
}