diff options
author | Vincent Labrecque <vincent@cvs.openbsd.org> | 2002-02-15 01:05:00 +0000 |
---|---|---|
committer | Vincent Labrecque <vincent@cvs.openbsd.org> | 2002-02-15 01:05:00 +0000 |
commit | 648e6b7fa37914996829fbe855f5cec71580831a (patch) | |
tree | c6fd4fefd49e478d91a557979fec27b5d4be13bb /usr.bin/mg | |
parent | feda04322533bdabbfe419267ad98ad777555ffb (diff) |
make pressing return in dired mode open the file we're currently at.
ok deraadt@
Diffstat (limited to 'usr.bin/mg')
-rw-r--r-- | usr.bin/mg/dired.c | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/usr.bin/mg/dired.c b/usr.bin/mg/dired.c index 7bdedcc7482..95978351781 100644 --- a/usr.bin/mg/dired.c +++ b/usr.bin/mg/dired.c @@ -1,25 +1,48 @@ -/* $OpenBSD: dired.c,v 1.8 2002/02/14 22:58:20 vincent Exp $ */ +/* $OpenBSD: dired.c,v 1.9 2002/02/15 01:04:59 vincent Exp $ */ /* dired module for mg 2a */ /* by Robert A. Larson */ #include "def.h" +#include "kbd.h" #ifndef NO_DIRED +static PF dired_pf[] = { + d_findfile, +}; + +static struct KEYMAPE (1 + IMAPEXT) diredmap = { + 1, + 1 + IMAPEXT, + rescan, + { + { CCHR('M'), CCHR('M'), dired_pf, NULL }, + } +}; + /* ARGSUSED */ int dired(f, n) int f, n; { + static int inited = 0; char dirname[NFILEN]; BUFFER *bp; + if (inited == 0) { + maps_add((KEYMAP *)&diredmap, "dired"); + inited = 1; + } + dirname[0] = '\0'; if (eread("Dired: ", dirname, NFILEN, EFNEW | EFCR) == ABORT) return ABORT; if ((bp = dired_(dirname)) == NULL) return FALSE; + bp->b_modes[0] = name_mode("fundamental"); + bp->b_modes[1] = name_mode("dired"); + bp->b_nmodes = 1; curbp = bp; return showbuffer(bp, curwp, WFHARD | WFMODE); } |