Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 2 Apr 2011 22:18:33 GMT
From:      Andy Kosela <akosela@andykosela.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   kern/156137: [syscons] [patch] support for vi mode keys in scrollback history
Message-ID:  <201104022218.p32MIXdE084341@red.freebsd.org>
Resent-Message-ID: <201104022220.p32MKALM053491@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         156137
>Category:       kern
>Synopsis:       [syscons] [patch] support for vi mode keys in scrollback history
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sat Apr 02 22:20:10 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator:     Andy Kosela
>Release:        -CURRENT
>Organization:
>Environment:
>Description:
Some of us prefer the h-j-k-l vi mantra from traditional arrow keys.  It would be very convenient to have those keys work in scrollback history buffer.  I am submitting a patch to enable j-k keys for up and down, and u-d for page up and page down -- works much faster to browse the history screens now.
>How-To-Repeat:

>Fix:


Patch attached with submission follows:

Index: syscons.c
===================================================================
--- syscons.c	(revision 220281)
+++ syscons.c	(working copy)
@@ -3312,6 +3312,20 @@
 		    sc_bell(scp, bios_value.bell_pitch, BELL_DURATION);
 	    goto next_code;
 
+	case 'k':  /* up key */
+	    sc_remove_cutmarking(scp);
+	    if (sc_hist_up_line(scp))
+		if (!(flags & SCGETC_CN))
+		    sc_bell(scp, bios_value.bell_pitch, BELL_DURATION);
+	    goto next_code;
+
+	case 'j':  /* down key */
+	    sc_remove_cutmarking(scp);
+	    if (sc_hist_down_line(scp))
+		if (!(flags & SCGETC_CN))
+		    sc_bell(scp, bios_value.bell_pitch, BELL_DURATION);
+	    goto next_code;
+
 	case SPCLKEY | FKEY | F(51):  /* page up key */
 	    sc_remove_cutmarking(scp);
 	    for (i=0; i<scp->ysize; i++)
@@ -3331,6 +3345,26 @@
 		break;
 	    }
 	    goto next_code;
+
+	case 'u':  /* page up key */
+	    sc_remove_cutmarking(scp);
+	    for (i=0; i<scp->ysize; i++)
+	    if (sc_hist_up_line(scp)) {
+		if (!(flags & SCGETC_CN))
+		    sc_bell(scp, bios_value.bell_pitch, BELL_DURATION);
+		break;
+	    }
+	    goto next_code;
+
+	case 'd':  /* page down key */
+	    sc_remove_cutmarking(scp);
+	    for (i=0; i<scp->ysize; i++)
+	    if (sc_hist_down_line(scp)) {
+		if (!(flags & SCGETC_CN))
+		    sc_bell(scp, bios_value.bell_pitch, BELL_DURATION);
+		break;
+	    }
+	    goto next_code;
 	}
 #endif /* SC_NO_HISTORY */
     }


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201104022218.p32MIXdE084341>