From ec44c748cfe4a5aa3a130a6fe93e3934330b707a Mon Sep 17 00:00:00 2001 From: Mark Lumsden Date: Mon, 3 Jun 2013 05:11:00 +0000 Subject: Add the 'g' character and dired-revert to refresh the dired buffer. ok jmc@ for man page. --- usr.bin/mg/dired.c | 19 ++++++++++++++++--- usr.bin/mg/mg.1 | 8 ++++++-- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/usr.bin/mg/dired.c b/usr.bin/mg/dired.c index 0259d54d375..2d8e4e71bcd 100644 --- a/usr.bin/mg/dired.c +++ b/usr.bin/mg/dired.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dired.c,v 1.62 2013/06/02 10:09:21 lum Exp $ */ +/* $OpenBSD: dired.c,v 1.63 2013/06/03 05:10:59 lum Exp $ */ /* This file is in the public domain. */ @@ -45,6 +45,7 @@ static int d_backpage(int, int); static int d_forwline(int, int); static int d_backline(int, int); static int d_killbuffer_cmd(int, int); +static int d_refreshbuffer(int, int); static void reaper(int); static struct buffer *refreshbuffer(struct buffer *); @@ -103,7 +104,8 @@ static PF diredc[] = { d_copy, /* c */ d_del, /* d */ d_findfile, /* e */ - d_findfile /* f */ + d_findfile, /* f */ + d_refreshbuffer /* g */ }; static PF diredn[] = { @@ -166,7 +168,7 @@ static struct KEYMAPE (7 + NDIRED_XMAPS + IMAPEXT) diredmap = { CCHR('Z'), '+', diredcz, (KEYMAP *) & metamap }, { - 'c', 'f', diredc, NULL + 'c', 'g', diredc, NULL }, { 'n', 'x', diredn, NULL @@ -651,6 +653,17 @@ d_killbuffer_cmd(int f, int n) return(killbuffer_cmd(FFRAND, 0)); } +int +d_refreshbuffer(int f, int n) +{ + struct buffer *bp; + + if ((bp = refreshbuffer(curbp)) == NULL) + return (FALSE); + + return (showbuffer(bp, curwp, WFFULL | WFMODE)); +} + struct buffer * refreshbuffer(struct buffer *bp) { diff --git a/usr.bin/mg/mg.1 b/usr.bin/mg/mg.1 index b646de5316c..0944df0ada5 100644 --- a/usr.bin/mg/mg.1 +++ b/usr.bin/mg/mg.1 @@ -1,7 +1,7 @@ -.\" $OpenBSD: mg.1,v 1.83 2013/06/02 10:09:21 lum Exp $ +.\" $OpenBSD: mg.1,v 1.84 2013/06/03 05:10:59 lum Exp $ .\" This file is in the public domain. .\" -.Dd $Mdocdate: June 2 2013 $ +.Dd $Mdocdate: June 3 2013 $ .Dt MG 1 .Os .Sh NAME @@ -941,6 +941,8 @@ dired-do-copy dired-flag-file-deletion .It e, f and C-m dired-find-file +.It g +dired-revert .It n dired-next-line .It o @@ -989,6 +991,8 @@ This function works just like dired, except that it puts the dired buffer in another window. .It dired-previous-line Move the cursor to the previous line. +.It dired-revert +Refresh the dired buffer. .It dired-scroll-down Scroll down the dired buffer. .It dired-scroll-up -- cgit v1.2.3