kern/156137: [syscons] [patch] support for vi mode keys in scrollback history

Andy Kosela akosela at andykosela.com
Sat Apr 2 22:20:11 UTC 2011


>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:


More information about the freebsd-bugs mailing list