summaryrefslogtreecommitdiff
path: root/usr.bin/mg
diff options
context:
space:
mode:
authorJason Wright <jason@cvs.openbsd.org>2005-05-25 05:57:33 +0000
committerJason Wright <jason@cvs.openbsd.org>2005-05-25 05:57:33 +0000
commit691dd3d6660af498cde05cd3f814720108cdfed3 (patch)
tree63f932739d8442d641f841bdeca4e94ef500c6c3 /usr.bin/mg
parent621f650766e230d792f754e3ee289a7f15b756a8 (diff)
'1' in buffer-list mode should open the listed buffer in its own window
(ie. it's just like ^M, except for a call to onlywind()).
Diffstat (limited to 'usr.bin/mg')
-rw-r--r--usr.bin/mg/buffer.c36
1 files changed, 31 insertions, 5 deletions
diff --git a/usr.bin/mg/buffer.c b/usr.bin/mg/buffer.c
index 439d7b781d6..648c3f7166e 100644
--- a/usr.bin/mg/buffer.c
+++ b/usr.bin/mg/buffer.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: buffer.c,v 1.38 2005/05/15 21:19:08 cloder Exp $ */
+/* $OpenBSD: buffer.c,v 1.39 2005/05/25 05:57:32 jason Exp $ */
/*
* Buffer handling.
@@ -196,17 +196,28 @@ savebuffers(int f, int n)
static int listbuf_ncol;
static int listbuf_goto_buffer(int f, int n);
+static int listbuf_goto_buffer_one(int f, int n);
+static int listbuf_goto_buffer_helper(int f, int n, int only);
static PF listbuf_pf[] = {
listbuf_goto_buffer
};
+static PF listbuf_one[] = {
+ listbuf_goto_buffer_one
+};
+
-static struct KEYMAPE (1 + IMAPEXT) listbufmap = {
- 1,
- 1 + IMAPEXT,
+static struct KEYMAPE (2 + IMAPEXT) listbufmap = {
+ 2,
+ 2 + IMAPEXT,
rescan,
{
- { CCHR('M'), CCHR('M'), listbuf_pf, NULL }
+ {
+ '1', '1', listbuf_one, NULL
+ },
+ {
+ CCHR('M'), CCHR('M'), listbuf_pf, NULL
+ }
}
};
@@ -305,6 +316,18 @@ makelist(void)
static int
listbuf_goto_buffer(int f, int n)
{
+ return (listbuf_goto_buffer_helper(f, n, 0));
+}
+
+static int
+listbuf_goto_buffer_one(int f, int n)
+{
+ return (listbuf_goto_buffer_helper(f, n, 1));
+}
+
+static int
+listbuf_goto_buffer_helper(int f, int n, int only)
+{
BUFFER *bp;
MGWIN *wp;
char *line;
@@ -340,6 +363,9 @@ listbuf_goto_buffer(int f, int n)
curbp = bp;
curwp = wp;
+ if (only)
+ return (onlywind(f, n));
+
return (TRUE);
}