From 691dd3d6660af498cde05cd3f814720108cdfed3 Mon Sep 17 00:00:00 2001 From: Jason Wright Date: Wed, 25 May 2005 05:57:33 +0000 Subject: '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()). --- usr.bin/mg/buffer.c | 36 +++++++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) (limited to 'usr.bin/mg') 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 + } } }; @@ -304,6 +315,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; @@ -340,6 +363,9 @@ listbuf_goto_buffer(int f, int n) curbp = bp; curwp = wp; + if (only) + return (onlywind(f, n)); + return (TRUE); } -- cgit v1.2.3