This is what you're talking about. C-n & C-p
warp the dot on the filename. I've overwritten
the default forwline() and backline() functions.

I like this.

If others don't find it annoying, we can go forward.

I'll look at another issue that Mark brought up
when I'll be done with work.

Index: dired.c
===================================================================
RCS file: /cvs/src/usr.bin/mg/dired.c,v
retrieving revision 1.48
diff -u -p -r1.48 dired.c
--- dired.c     23 Jan 2011 00:45:03 -0000      1.48
+++ dired.c     1 Aug 2011 06:04:01 -0000
@@ -36,6 +36,11 @@ static int    d_rename(int, int);
 static int      d_shell_command(int, int);
 static int      d_create_directory(int, int);
 static int      d_makename(struct line *, char *, size_t);
+static int      d_forwpage(int, int);
+static int      d_backpage(int, int);
+static int      d_forwline(int, int);
+static int      d_backline(int, int);  
+static int      d_gotoline(int, int);
 static void     reaper(int);
 
 extern struct keymap_s helpmap, cXmap, metamap;
@@ -57,16 +62,16 @@ static PF dirednul[] = {
 static PF diredcl[] = {
        reposition,             /* ^L */
        d_findfile,             /* ^M */
-       forwline,               /* ^N */
-       rescan,                 /* ^O */
-       backline,               /* ^P */
+       d_forwline,             /* ^N */
+       d_gotoline,             /* ^O */
+       d_backline,             /* ^P */
        rescan,                 /* ^Q */
        backisearch,            /* ^R */
        forwisearch,            /* ^S */
-       rescan,                 /* ^T */
+       d_backpage,             /* ^T */
        universal_argument,     /* ^U */
        forwpage,               /* ^V */
-       rescan,                 /* ^W */
+       d_forwpage,             /* ^W */
        NULL                    /* ^X */
 };
 
@@ -77,7 +82,7 @@ static PF diredcz[] = {
        rescan,                 /* ^] */
        rescan,                 /* ^^ */
        rescan,                 /* ^_ */
-       forwline,               /* SP */
+       d_forwline,             /* SP */
        d_shell_command,        /* ! */
        rescan,                 /* " */
        rescan,                 /* # */
@@ -99,9 +104,9 @@ static PF diredc[] = {
 };
 
 static PF diredn[] = {
-       forwline,               /* n */
+       d_forwline,             /* n */
        d_ffotherwindow,        /* o */
-       backline,               /* p */
+       d_backline,             /* p */
        rescan,                 /* q */
        d_rename,               /* r */
        rescan,                 /* s */
@@ -590,6 +595,56 @@ d_makename(struct line *lp, char *fn, si
        if (strlcat(fn, p, len) >= len)
                return (FALSE);
        return ((lgetc(lp, 2) == 'd') ? TRUE : FALSE);
+}
+
+static int
+d_forwpage(int f, int n)
+{
+       forwpage(f | FFRAND, n);
+       if ((strrchr(curwp->w_dotp->l_text, ' ')) != NULL)
+               curwp->w_doto = strrchr(curwp->w_dotp->l_text, ' ') -
+                  curwp->w_dotp->l_text + 1;
+       return TRUE;
+}
+
+static int
+d_backpage(int f, int n)
+{
+       backpage(f | FFRAND, n);
+       if ((strrchr(curwp->w_dotp->l_text, ' ')) != NULL)
+               curwp->w_doto = strrchr(curwp->w_dotp->l_text, ' ') -
+                  curwp->w_dotp->l_text + 1;
+       return TRUE;
+}
+
+static int
+d_gotoline(int f, int n)
+{
+       gotoline(f | FFRAND, n);
+       if ((strrchr(curwp->w_dotp->l_text, ' ')) != NULL)
+               curwp->w_doto = strrchr(curwp->w_dotp->l_text, ' ') -
+                  curwp->w_dotp->l_text + 1;
+       return TRUE;
+}
+
+static int
+d_forwline(int f, int n)
+{
+       forwline(f | FFRAND, n);
+       if ((strrchr(curwp->w_dotp->l_text, ' ')) != NULL)
+               curwp->w_doto = strrchr(curwp->w_dotp->l_text, ' ') -
+                  curwp->w_dotp->l_text + 1;
+       return TRUE;
+}
+
+static int
+d_backline(int f, int n)
+{
+       backline(f | FFRAND, n);
+       if ((strrchr(curwp->w_dotp->l_text, ' ')) != NULL)
+               curwp->w_doto = strrchr(curwp->w_dotp->l_text, ' ') -
+                  curwp->w_dotp->l_text + 1;
+       return TRUE;
 }
 
 /*

Reply via email to