summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKjell Wooding <kjell@cvs.openbsd.org>2006-06-01 01:41:50 +0000
committerKjell Wooding <kjell@cvs.openbsd.org>2006-06-01 01:41:50 +0000
commit7e12e4ad1d2380b7f1a2d253e4dcc8f2a01e8683 (patch)
treea14f4412633f9570e4d632ae50f07ff1173e182e
parent84b457c74b0967954ba0ae64d37293bf355d2ff9 (diff)
find-file-other-window and find-buffer-other-window should split
the window if you ask for whatever file you are currently visiting. pointed out, ok beck@
-rw-r--r--usr.bin/mg/buffer.c5
-rw-r--r--usr.bin/mg/file.c4
2 files changed, 6 insertions, 3 deletions
diff --git a/usr.bin/mg/buffer.c b/usr.bin/mg/buffer.c
index 52d0b3e21c9..4dcb2122152 100644
--- a/usr.bin/mg/buffer.c
+++ b/usr.bin/mg/buffer.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: buffer.c,v 1.58 2006/05/28 23:30:16 kjell Exp $ */
+/* $OpenBSD: buffer.c,v 1.59 2006/06/01 01:41:49 kjell Exp $ */
/* This file is in the public domain. */
@@ -89,7 +89,8 @@ poptobuffer(int f, int n)
bp = curbp->b_altb;
else if ((bp = bfind(bufn, TRUE)) == NULL)
return (FALSE);
-
+ if (bp == curbp)
+ return (splitwind(f, n));
/* and put it in a new window */
if ((wp = popbuf(bp)) == NULL)
return (FALSE);
diff --git a/usr.bin/mg/file.c b/usr.bin/mg/file.c
index 20809d53890..e1aea606821 100644
--- a/usr.bin/mg/file.c
+++ b/usr.bin/mg/file.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: file.c,v 1.55 2006/05/28 23:30:16 kjell Exp $ */
+/* $OpenBSD: file.c,v 1.56 2006/06/01 01:41:49 kjell Exp $ */
/* This file is in the public domain. */
@@ -152,6 +152,8 @@ poptofile(int f, int n)
return (FALSE);
if ((bp = findbuffer(adjf)) == NULL)
return (FALSE);
+ if (bp == curbp)
+ return (splitwind(f, n));
if ((wp = popbuf(bp)) == NULL)
return (FALSE);
curbp = bp;