summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorflorian <florian@openbsd.org>2017-03-13 20:32:58 +0000
committerflorian <florian@openbsd.org>2017-03-13 20:32:58 +0000
commit8949ac273d5a7d65325d1643cde08ea12761c366 (patch)
treee5d4a457b30a186c9256299d500926ba5954f1a8
parentPort ctags-style, less(1) :t internal searching from terminal output (diff)
downloadwireguard-openbsd-8949ac273d5a7d65325d1643cde08ea12761c366.tar.xz
wireguard-openbsd-8949ac273d5a7d65325d1643cde08ea12761c366.zip
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));
}