aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHellmuth Michaelis <hm@FreeBSD.org>1999-12-30 16:17:11 +0000
committerHellmuth Michaelis <hm@FreeBSD.org>1999-12-30 16:17:11 +0000
commita8d08723fb8c05fbc5baff5c1708a3191059c7f8 (patch)
tree4af21681ec55441683378dc5390069191b24b6a8
parenta40fdd98b00260d9704dc32bfb843c43b6defa28 (diff)
downloadsrc-a8d08723fb8c05fbc5baff5c1708a3191059c7f8.tar.gz
src-a8d08723fb8c05fbc5baff5c1708a3191059c7f8.zip
Implement scrollback for pcvt based on code submitted by
Aaron Campbell <aaron@cs.dal.ca>. Use SHIFT-PgUp and SHIFT-PgDn to scroll back and forward. Aarons original code was enhanced to have a separate scrollbuffer for every virtual terminal and to preserve the screen contents when switching screen sizes. The scrollbuffer size is currently fixed at 8 pages but this will be made configurable through the use of scon(1) in the near future. For pcvt_kbd.h, a longstanding compiler warning was fixed by using excessive backetizing of the key2ascii[] table.
Notes
Notes: svn path=/head/; revision=55273
-rw-r--r--sys/i386/isa/pcvt/pcvt_conf.h14
-rw-r--r--sys/i386/isa/pcvt/pcvt_drv.c39
-rw-r--r--sys/i386/isa/pcvt/pcvt_ext.c34
-rw-r--r--sys/i386/isa/pcvt/pcvt_hdr.h40
-rw-r--r--sys/i386/isa/pcvt/pcvt_kbd.c172
-rw-r--r--sys/i386/isa/pcvt/pcvt_kbd.h270
-rw-r--r--sys/i386/isa/pcvt/pcvt_out.c89
-rw-r--r--sys/i386/isa/pcvt/pcvt_sup.c81
-rw-r--r--sys/i386/isa/pcvt/pcvt_tbl.h19
-rw-r--r--sys/i386/isa/pcvt/pcvt_vtf.c21
10 files changed, 470 insertions, 309 deletions
diff --git a/sys/i386/isa/pcvt/pcvt_conf.h b/sys/i386/isa/pcvt/pcvt_conf.h
index 52387e611f6a..3af4e5277dc2 100644
--- a/sys/i386/isa/pcvt/pcvt_conf.h
+++ b/sys/i386/isa/pcvt/pcvt_conf.h
@@ -1,4 +1,6 @@
/*
+ * Copyright (c) 1999 Hellmuth Michaelis
+ *
* Copyright (c) 1992, 1995 Hellmuth Michaelis and Joerg Wunsch.
*
* Copyright (c) 1992, 1994 Brian Dunford-Shore.
@@ -30,20 +32,16 @@
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- *
- * @(#)pcvt_conf.h, 3.20, Last Edit-Date: [Sun Apr 2 18:57:45 1995]
- *
*/
/*---------------------------------------------------------------------------
*
* pcvt_conf.h VT220 driver global configuration file
* ------------------------------------------------------
- * -hm introduced pcvt_conf.h
- * -hm re-integrated selfconfiguration for NetBSD from Onno
- * -hm patch from Onno for NetBSD-current
- * -hm removed PCVT_FAKE_SYSCONS10
+ *
+ * Last Edit-Date: [Mon Dec 27 14:09:58 1999]
+ *
+ * $FreeBSD$
*
*---------------------------------------------------------------------------*/
diff --git a/sys/i386/isa/pcvt/pcvt_drv.c b/sys/i386/isa/pcvt/pcvt_drv.c
index bee92209a374..112014e7b2ab 100644
--- a/sys/i386/isa/pcvt/pcvt_drv.c
+++ b/sys/i386/isa/pcvt/pcvt_drv.c
@@ -1,4 +1,6 @@
/*
+ * Copyright (c) 1999 Hellmuth Michaelis
+ *
* Copyright (c) 1992, 1995 Hellmuth Michaelis and Joerg Wunsch.
*
* Copyright (c) 1992, 1993 Brian Dunford-Shore and Scott Turner.
@@ -39,42 +41,16 @@
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- *
- * @(#)pcvt_drv.c, 3.20, Last Edit-Date: [Mon Apr 19 17:10:09 1999]
- *
- * $FreeBSD$
- *
*/
/*---------------------------------------------------------------------------*
*
* pcvt_drv.c VT220 Driver Main Module / OS - Interface
* ---------------------------------------------------------
- * -hm ------------ Release 3.00 --------------
- * -hm integrating NetBSD-current patches
- * -hm adding ttrstrt() proto for NetBSD 0.9
- * -hm kernel/console output cursor positioning fixed
- * -hm kernel/console output switches optional to screen 0
- * -hm FreeBSD 1.1 porting
- * -hm the NetBSD 0.9 compiler detected a nondeclared var which was
- * NOT detected by neither the NetBSD-current nor FreeBSD 1.x!
- * -hm including Michael's keyboard fifo code
- * -hm Joergs patch for FreeBSD tty-malloc code
- * -hm adjustments for NetBSD-current
- * -hm FreeBSD bugfix from Joerg re timeout/untimeout casts
- * -jw including Thomas Gellekum's FreeBSD 1.1.5 patch
- * -hm adjusting #if's for NetBSD-current
- * -hm applying Joerg's patch for FreeBSD 2.0
- * -hm patch from Onno & Martin for NetBSD-current (post 1.0)
- * -hm some adjustments for NetBSD 1.0
- * -hm NetBSD PR #400: screen size report for new session
- * -hm patch from Rafael Boni/Lon Willett for NetBSD-current
- * -hm bell patch from Thomas Eberhardt for NetBSD
- * -hm multiple X server bugfixes from Lon Willett
- * -hm patch from joerg - pcdevtotty for FreeBSD pre-2.1
- * -hm delay patch from Martin Husemann after port-i386 ml-discussion
- * -jw add some code to provide more FreeBSD pre-2.1 support
+ *
+ * Last Edit-Date: [Mon Dec 27 14:03:36 1999]
+ *
+ * $FreeBSD$
*
*---------------------------------------------------------------------------*/
@@ -994,6 +970,9 @@ pcstart(register struct tty *tp)
while((len = q_to_b(rbp, buf, PCVT_PCBURST)) > 0)
{
+ if(vs[minor(tp->t_dev)].scrolling)
+ sgetc(31337);
+
/*
* We need to do this outside spl since it could be fairly
* expensive and we don't want our serial ports to overflow.
diff --git a/sys/i386/isa/pcvt/pcvt_ext.c b/sys/i386/isa/pcvt/pcvt_ext.c
index c0b4a99af922..689304f3908f 100644
--- a/sys/i386/isa/pcvt/pcvt_ext.c
+++ b/sys/i386/isa/pcvt/pcvt_ext.c
@@ -1,4 +1,6 @@
/*
+ * Copyright (c) 1999 Hellmuth Michaelis
+ *
* Copyright (c) 1992, 1995 Hellmuth Michaelis and Joerg Wunsch.
*
* Copyright (C) 1992, 1993 Soeren Schmidt.
@@ -33,10 +35,6 @@
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- *
- * @(#)pcvt_ext.c, 3.20, Last Edit-Date: [Thu Apr 6 10:07:45 1995]
- *
*/
/*---------------------------------------------------------------------------*
@@ -44,26 +42,9 @@
* pcvt_ext.c VT220 Driver Extended Support Routines
* ------------------------------------------------------
*
- * -hm ------------ Release 3.00 --------------
- * -hm integrating NetBSD-current patches
- * -hm applied Onno van der Linden's patch for Cirrus BIOS upgrade
- * -hm pcvt_x_hook has to care about fkey labels now
- * -hm changed some bcopyb's to bcopy's
- * -hm TS_INDEX -> TS_DATA for cirrus (mail from Onno/Charles)
- * -jw removed kbc_8042(), and replaced by kbd_emulate_pc()
- * -hm X server patch from John Kohl <jtk@kolvir.blrc.ma.us>
- * -hm applying Joerg's patch for FreeBSD 2.0
- * -hm enable 132 col support for Trident TVGA8900CL
- * -hm applying patch from Joerg fixing Crtat bug
- * -hm removed PCVT_FAKE_SYSCONS10
- * -hm fastscroll/Crtat bugfix from Lon Willett
- * -hm bell patch from Thomas Eberhardt for NetBSD
- * -hm multiple X server bugfixes from Lon Willett
- * -hm patch from John Kohl fixing tsleep bug in usl_vt_ioctl()
- * -hm bugfix: clear 25th line when switching to a force 24 lines vt
- * -jw add some forward declarations
- * -hm fixing MDA re-init when leaving X
- * -hm patch from John Kohl fixing potential divide by 0 problem
+ * Last Edit-Date: [Mon Dec 27 14:05:16 1999]
+ *
+ * $FreeBSD$
*
*---------------------------------------------------------------------------*/
@@ -2370,6 +2351,7 @@ vgapage(int new_screen)
/* fallback to VT_AUTO if controlling processes died */
if(vsp->proc && vsp->proc != pfind(vsp->pid))
set_auto_mode(vsp);
+
if(vs[new_screen].proc
&& vs[new_screen].proc != pfind(vs[new_screen].pid))
set_auto_mode(&vs[new_screen]);
@@ -2409,16 +2391,19 @@ vgapage(int new_screen)
vs[new_screen].vt_status & VT_GRAFX);
x = spltty();
+
if(old_vsp->vt_status & VT_WAIT_ACT)
{
old_vsp->vt_status &= ~VT_WAIT_ACT;
wakeup((caddr_t)&old_vsp->smode);
}
+
if(vsp->vt_status & VT_WAIT_ACT)
{
vsp->vt_status &= ~VT_WAIT_ACT;
wakeup((caddr_t)&vsp->smode);
}
+
splx(x);
if(vsp->smode.mode == VT_PROCESS)
@@ -2432,6 +2417,7 @@ vgapage(int new_screen)
{
/* we are committed */
vt_switch_pending = 0;
+
#if PCVT_FREEBSD > 206
/*
* XXX: If pcvt is acting as the systems console,
diff --git a/sys/i386/isa/pcvt/pcvt_hdr.h b/sys/i386/isa/pcvt/pcvt_hdr.h
index 1a837b09188b..fee2c3c66a77 100644
--- a/sys/i386/isa/pcvt/pcvt_hdr.h
+++ b/sys/i386/isa/pcvt/pcvt_hdr.h
@@ -1,4 +1,6 @@
/*
+ * Copyright (c) 1999 Hellmuth Michaelis
+ *
* Copyright (c) 1992, 1995 Hellmuth Michaelis and Joerg Wunsch.
*
* Copyright (c) 1992, 1993 Brian Dunford-Shore.
@@ -30,36 +32,16 @@
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- *
- * @(#)pcvt_hdr.h, 3.20, Last Edit-Date: [Fri Apr 7 10:16:58 1995]
- * $FreeBSD$
*/
/*---------------------------------------------------------------------------
*
* pcvt_hdr.h VT220 Driver Global Include File
* ------------------------------------------------
- * -hm ------------ Release 3.00 --------------
- * -hm integrating NetBSD-current patches
- * -hm integrating patches from Thomas Gellekum
- * -hm moving vt_selattr() inline into this file
- * -hm Michael's keyboard fifo diffs
- * -hm documenting some #ifdef's ...
- * -hm Joerg's patches for FreeBSD's ttymalloc
- * -jw introduced kbd_emulate_pc() if scanset > 1
- * -hm moved user configurable items to pcvt_conf.h
- * -hm applying Joerg's patches for FreeBSD 2.0
- * -hm patch from Onno & Martin for NetBSD-current (post 1.0)
- * -hm some adjustments for NetBSD 1.0
- * -hm patch from Joerg fixing FreeBSD 2.0 support
- * -hm patch from Onno/John for NetBSD-current
- * -hm applying patch from Joerg fixing Crtat bug
- * -hm removed PCVT_FAKE_SYSCONS10
- * -hm added pcstop (patch from Onno)
- * -hm multiple X server bugfixes from Lon Willett
- * -hm patch from Joerg for FreeBSD pre-2.1
- * -jw adding more support for FreeBSD pre-2.1
+ *
+ * Last Edit-Date: [Mon Dec 27 14:06:31 1999]
+ *
+ * $FreeBSD$
*
*---------------------------------------------------------------------------*/
@@ -266,6 +248,9 @@ in the config file"
#error "Supported keyboard scancode sets are 1 and 2 only (for now)!!!"
#endif
+/* initial default scrollback buffer size (in pages) */
+#define SCROLLBACK_PAGES 8
+
/*---------------------------------------------------------------------------*
* Keyboard and Keyboard Controller
*---------------------------------------------------------------------------*/
@@ -895,6 +880,12 @@ typedef struct video_state {
u_char num_lock; /* num lock, true = keypad num mode */
u_char abs_write; /* write outside of scroll region */
+ u_short *Scrollback; /* scrollback buffer */
+ u_short scrollback_pages; /* size of scrollback buffer */
+ u_short scr_offset; /* current scrollback offset (lines) */
+ short scrolling; /* current scrollback page */
+ u_short max_off; /* maximum scrollback offset */
+
#if PCVT_USL_VT_COMPAT /* SysV compatibility :-( */
struct vt_mode smode;
@@ -1297,6 +1288,7 @@ void set_2ndcharset ( void );
void set_charset ( struct video_state *svsp, int curvgacs );
void set_emulation_mode ( struct video_state *svsp, int mode );
void set_screen_size ( struct video_state *svsp, int size );
+void reallocate_scrollbuffer ( struct video_state *svsp, int pages );
u_char *sgetc ( int noblock );
void sixel_vga ( struct sixels *charsixel, u_char *charvga );
void sput ( u_char *s, U_char attrib, int len, int page );
diff --git a/sys/i386/isa/pcvt/pcvt_kbd.c b/sys/i386/isa/pcvt/pcvt_kbd.c
index a394187bb14f..6155a1105c41 100644
--- a/sys/i386/isa/pcvt/pcvt_kbd.c
+++ b/sys/i386/isa/pcvt/pcvt_kbd.c
@@ -1,4 +1,6 @@
/*
+ * Copyright (c) 1999 Hellmuth Michaelis
+ *
* Copyright (c) 1992, 1995 Hellmuth Michaelis and Joerg Wunsch.
*
* Copyright (c) 1992, 1993 Brian Dunford-Shore and Holger Veit.
@@ -36,33 +38,16 @@
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- *
- * @(#)pcvt_kbd.c, 3.20, Last Edit-Date: [Mon Apr 19 17:16:47 1999]
- *
*/
/*---------------------------------------------------------------------------*
*
* pcvt_kbd.c VT220 Driver Keyboard Interface Code
* ----------------------------------------------------
- * -hm ------------ Release 3.00 --------------
- * -hm integrating NetBSD-current patches
- * -jw introduced kbd_emulate_pc() if scanset > 1
- * -hm patch from joerg for timeout in kbd_emulate_pc()
- * -hm starting to implement alt-shift/ctrl key mappings
- * -hm Gateway 2000 Keyboard fix from Brian Moore
- * -hm some #if adjusting for NetBSD 0.9
- * -hm split off pcvt_kbd.h
- * -hm applying Joerg's patches for FreeBSD 2.0
- * -hm patch from Martin, PCVT_NO_LED_UPDATE
- * -hm PCVT_VT220KEYB patches from Lon Willet
- * -hm PR #399, patch from Bill Sommerfeld: Return with PCVT_META_ESC
- * -hm allow keyboard-less kernel boot for serial consoles and such ..
- * -hm patch from Lon Willett for led-update and showkey()
- * -hm patch from Lon Willett to fix mapping of Control-R scancode
- * -hm delay patch from Martin Husemann after port-i386 ml-discussion
- * -hm added PCVT_NONRESP_KEYB_TRY definition to doreset()
+ *
+ * Last Edit-Date: [Mon Dec 27 14:01:50 1999]
+ *
+ * $FreeBSD$
*
*---------------------------------------------------------------------------*/
@@ -105,6 +90,11 @@ static int tpmrate = KBD_TPD500|KBD_TPM100;
static u_char altkpflag = 0;
static u_short altkpval = 0;
+static u_short *scrollback_savedscreen = (u_short *)0;
+static size_t scrnsv_size = (size_t)-1;
+static void scrollback_save_screen ( void );
+static void scrollback_restore_screen ( void );
+
#if PCVT_SHOWKEYS
u_char rawkeybuf[80];
#endif
@@ -1081,8 +1071,8 @@ u_char *
sgetc(int noblock)
{
u_char *cp;
- u_char dt;
- u_char key;
+ u_char dt = 0;
+ u_char key = 0;
u_short type;
#if PCVT_KBD_FIFO && PCVT_SLOW_INTERRUPT
@@ -1111,6 +1101,12 @@ sgetc(int noblock)
loop:
+ if(noblock == 31337)
+ {
+ vsp->scrolling = 1;
+ goto scroll_reset;
+ }
+
#ifdef XSERVER
#ifndef _DEV_KBD_KBDREG_H_
@@ -1590,6 +1586,100 @@ regular:
kbd_status.extended = kbd_status.ext1 = 0;
+ if ((key == 85) && shift_down && kbd_lastkey != 85)
+ {
+ if (vsp->scr_offset > (vsp->screen_rows - 1))
+ {
+ if (!vsp->scrolling)
+ {
+ vsp->scrolling += vsp->screen_rows - 2;
+ if (vsp->Scrollback)
+ {
+ scrollback_save_screen();
+ if (vsp->scr_offset == vsp->max_off)
+ {
+ bcopy(vsp->Scrollback +
+ vsp->maxcol,
+ vsp->Scrollback,
+ vsp->maxcol *
+ vsp->max_off * CHR);
+ vsp->scr_offset--;
+ }
+ bcopy(vsp->Crtat + vsp->cur_offset -
+ vsp->col, vsp->Scrollback +
+ ((vsp->scr_offset + 1) *
+ vsp->maxcol), vsp->maxcol * CHR);
+ }
+
+ if (vsp->cursor_on)
+ sw_cursor(0);
+ }
+
+ vsp->scrolling += vsp->screen_rows - 1;
+
+ if (vsp->scrolling > vsp->scr_offset)
+ vsp->scrolling = vsp->scr_offset;
+
+ bcopy(vsp->Scrollback + ((vsp->scr_offset -
+ vsp->scrolling) * vsp->maxcol), vsp->Crtat,
+ vsp->screen_rows * vsp->maxcol * CHR);
+ }
+
+ kbd_lastkey = 85;
+ goto loop;
+ }
+ else if ((key == 86) && shift_down && kbd_lastkey != 86)
+ {
+
+scroll_reset:
+ if (vsp->scrolling > 0)
+ {
+ vsp->scrolling -= vsp->screen_rows - 1;
+ if (vsp->scrolling < 0)
+ vsp->scrolling = 0;
+
+ if (vsp->scrolling <= vsp->screen_rows)
+ {
+ vsp->scrolling = 0;
+ scrollback_restore_screen();
+ }
+ else
+ {
+ bcopy(vsp->Scrollback + ((vsp->scr_offset -
+ vsp->scrolling) * vsp->maxcol),
+ vsp->Crtat, vsp->screen_rows *
+ vsp->maxcol * CHR);
+ }
+ }
+
+ if (vsp->scrolling == 0)
+ {
+ if (vsp->cursor_on)
+ {
+ sw_cursor(1);
+ }
+ }
+
+ if (noblock == 31337)
+ return NULL;
+
+ if (key != 86)
+ {
+ goto regular;
+ }
+ else
+ {
+ kbd_lastkey = 86;
+ goto loop;
+ }
+ }
+ else if (vsp->scrolling && key != 128 && key != 44 && key != 85 &&
+ key != 86)
+ {
+ vsp->scrolling = 1;
+ goto scroll_reset;
+ }
+
#if PCVT_CTRL_ALT_DEL /* Check for cntl-alt-del */
if((key == 76) && ctrl_down && (meta_down||altgr_down))
shutdown_nice();
@@ -3175,6 +3265,42 @@ cfkey12(void)
#endif /* PCVT_VT220KEYB */
+/*---------------------------------------------------------------------------*
+ *
+ *---------------------------------------------------------------------------*/
+static void
+scrollback_save_screen(void)
+{
+ int x = spltty();
+ register size_t s;
+
+ s = sizeof(u_short) * vsp->screen_rowsize * vsp->maxcol;
+
+ if (scrollback_savedscreen)
+ free(scrollback_savedscreen, M_TEMP);
+
+ scrnsv_size = s;
+
+ if (!(scrollback_savedscreen = (u_short *)malloc(s, M_TEMP, M_NOWAIT)))
+ {
+ splx(x);
+ return;
+ }
+ bcopy(vsp->Crtat, scrollback_savedscreen, scrnsv_size);
+ splx(x);
+}
+
+/*---------------------------------------------------------------------------*
+ *
+ *---------------------------------------------------------------------------*/
+static void
+scrollback_restore_screen(void)
+{
+ if (scrollback_savedscreen)
+ bcopy(scrollback_savedscreen, vsp->Crtat, scrnsv_size);
+}
+
+
#endif /* NVT > 0 */
/* ------------------------------- EOF -------------------------------------*/
diff --git a/sys/i386/isa/pcvt/pcvt_kbd.h b/sys/i386/isa/pcvt/pcvt_kbd.h
index 570dd792756f..29a00dfe4d38 100644
--- a/sys/i386/isa/pcvt/pcvt_kbd.h
+++ b/sys/i386/isa/pcvt/pcvt_kbd.h
@@ -1,4 +1,6 @@
/*
+ * Copyright (c) 1999 Hellmuth Michaelis
+ *
* Copyright (c) 1992, 1995 Hellmuth Michaelis and Joerg Wunsch.
*
* Copyright (c) 1992, 1993 Brian Dunford-Shore and Holger Veit.
@@ -36,18 +38,16 @@
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- *
- * @(#)pcvt_kbd.h, 3.20, Last Edit-Date: [Mon Apr 19 17:14:46 1999]
- *
*/
/*---------------------------------------------------------------------------*
*
* pcvt_kbd.h VT220 Driver Keyboard Interface Header
* ------------------------------------------------------
- * -hm split off from pcvt_kbd.c
- * -hm patch from Lon Willett to fix mapping of Control-R scancode
+ *
+ * Last Edit-Date: [Tue Dec 28 08:13:32 1999]
+ *
+ * $FreeBSD$
*
*---------------------------------------------------------------------------*/
@@ -364,138 +364,138 @@ static Keycap_def key2ascii[] =
/* type index unshift shift ctrl */
/* ---------------------------------------------------------- */
-/* 0*/ KBD_NONE, I, {S,C "df"}, {S,C ""}, {S,C ""},
-/* 1*/ KBD_ASCII, I, {S,C "`"}, {S,C "~"}, {S,C "`"},
-/* 2*/ KBD_ASCII, I, {S,C "1"}, {S,C "!"}, {S,C "1"},
-/* 3*/ KBD_ASCII, I, {S,C "2"}, {S,C "@"}, {S,C "\000"},
-/* 4*/ KBD_ASCII, I, {S,C "3"}, {S,C "#"}, {S,C "3"},
-/* 5*/ KBD_ASCII, I, {S,C "4"}, {S,C "$"}, {S,C "4"},
-/* 6*/ KBD_ASCII, I, {S,C "5"}, {S,C "%"}, {S,C "5"},
-/* 7*/ KBD_ASCII, I, {S,C "6"}, {S,C "^"}, {S,C "\036"},
-/* 8*/ KBD_ASCII, I, {S,C "7"}, {S,C "&"}, {S,C "7"},
-/* 9*/ KBD_ASCII, I, {S,C "8"}, {S,C "*"}, {S,C "8"},
-/* 10*/ KBD_ASCII, I, {S,C "9"}, {S,C "("}, {S,C "9"},
-/* 11*/ KBD_ASCII, I, {S,C "0"}, {S,C ")"}, {S,C "0"},
-/* 12*/ KBD_ASCII, I, {S,C "-"}, {S,C "_"}, {S,C "\037"},
-/* 13*/ KBD_ASCII, I, {S,C "="}, {S,C "+"}, {S,C "="},
-/* 14*/ KBD_NONE, I, {S,C ""}, {S,C ""}, {S,C ""},
-/* 15*/ KBD_ASCII, I, {S,C "\177"}, {S,C "\010"}, {S,C "\177"}, /* BS */
-/* 16*/ KBD_ASCII, I, {S,C "\t"}, {S,C "\t"}, {S,C "\t"}, /* TAB */
-/* 17*/ KBD_ASCII, I, {S,C "q"}, {S,C "Q"}, {S,C "\021"},
-/* 18*/ KBD_ASCII, I, {S,C "w"}, {S,C "W"}, {S,C "\027"},
-/* 19*/ KBD_ASCII, I, {S,C "e"}, {S,C "E"}, {S,C "\005"},
-/* 20*/ KBD_ASCII, I, {S,C "r"}, {S,C "R"}, {S,C "\022"},
-/* 21*/ KBD_ASCII, I, {S,C "t"}, {S,C "T"}, {S,C "\024"},
-/* 22*/ KBD_ASCII, I, {S,C "y"}, {S,C "Y"}, {S,C "\031"},
-/* 23*/ KBD_ASCII, I, {S,C "u"}, {S,C "U"}, {S,C "\025"},
-/* 24*/ KBD_ASCII, I, {S,C "i"}, {S,C "I"}, {S,C "\011"},
-/* 25*/ KBD_ASCII, I, {S,C "o"}, {S,C "O"}, {S,C "\017"},
-/* 26*/ KBD_ASCII, I, {S,C "p"}, {S,C "P"}, {S,C "\020"},
-/* 27*/ KBD_ASCII, I, {S,C "["}, {S,C "{"}, {S,C "\033"},
-/* 28*/ KBD_ASCII, I, {S,C "]"}, {S,C "}"}, {S,C "\035"},
-/* 29*/ KBD_ASCII, I, {S,C "\\"}, {S,C "|"}, {S,C "\034"},
-/* 30*/ KBD_CAPS, I, {S,C ""}, {S,C ""}, {S,C ""},
-/* 31*/ KBD_ASCII, I, {S,C "a"}, {S,C "A"}, {S,C "\001"},
-/* 32*/ KBD_ASCII, I, {S,C "s"}, {S,C "S"}, {S,C "\023"},
-/* 33*/ KBD_ASCII, I, {S,C "d"}, {S,C "D"}, {S,C "\004"},
-/* 34*/ KBD_ASCII, I, {S,C "f"}, {S,C "F"}, {S,C "\006"},
-/* 35*/ KBD_ASCII, I, {S,C "g"}, {S,C "G"}, {S,C "\007"},
-/* 36*/ KBD_ASCII, I, {S,C "h"}, {S,C "H"}, {S,C "\010"},
-/* 37*/ KBD_ASCII, I, {S,C "j"}, {S,C "J"}, {S,C "\n"},
-/* 38*/ KBD_ASCII, I, {S,C "k"}, {S,C "K"}, {S,C "\013"},
-/* 39*/ KBD_ASCII, I, {S,C "l"}, {S,C "L"}, {S,C "\014"},
-/* 40*/ KBD_ASCII, I, {S,C ";"}, {S,C ":"}, {S,C ";"},
-/* 41*/ KBD_ASCII, I, {S,C "'"}, {S,C "\""}, {S,C "'"},
-/* 42*/ KBD_ASCII, I, {S,C "\\"}, {S,C "|"}, {S,C "\034"}, /* special */
-/* 43*/ KBD_RETURN,I, {S,C "\r"}, {S,C "\r"}, {S,C "\r"}, /* RETURN */
-/* 44*/ KBD_SHIFT, I, {S,C ""}, {S,C ""}, {S,C ""}, /* SHIFT left */
-/* 45*/ KBD_ASCII, I, {S,C "<"}, {S,C ">"}, {S,C ""},
-/* 46*/ KBD_ASCII, I, {S,C "z"}, {S,C "Z"}, {S,C "\032"},
-/* 47*/ KBD_ASCII, I, {S,C "x"}, {S,C "X"}, {S,C "\030"},
-/* 48*/ KBD_ASCII, I, {S,C "c"}, {S,C "C"}, {S,C "\003"},
-/* 49*/ KBD_ASCII, I, {S,C "v"}, {S,C "V"}, {S,C "\026"},
-/* 50*/ KBD_ASCII, I, {S,C "b"}, {S,C "B"}, {S,C "\002"},
-/* 51*/ KBD_ASCII, I, {S,C "n"}, {S,C "N"}, {S,C "\016"},
-/* 52*/ KBD_ASCII, I, {S,C "m"}, {S,C "M"}, {S,C "\r"},
-/* 53*/ KBD_ASCII, I, {S,C ","}, {S,C "<"}, {S,C ","},
-/* 54*/ KBD_ASCII, I, {S,C "."}, {S,C ">"}, {S,C "."},
-/* 55*/ KBD_ASCII, I, {S,C "/"}, {S,C "?"}, {S,C "/"},
-/* 56*/ KBD_NONE, I, {S,C ""}, {S,C ""}, {S,C ""},
-/* 57*/ KBD_SHIFT, I, {S,C ""}, {S,C ""}, {S,C ""}, /* SHIFT right */
-/* 58*/ KBD_CTL, I, {S,C ""}, {S,C ""}, {S,C ""}, /* CTL left */
-/* 59*/ KBD_ASCII, I, {S,C ""}, {S,C ""}, {S,C ""},
-/* 60*/ KBD_META, I, {S,C ""}, {S,C ""}, {S,C ""}, /* ALT left */
+/* 0*/ {KBD_NONE, I, {S,{C "df"}}, {S,{C ""}}, {S,{C ""}}},
+/* 1*/ {KBD_ASCII, I, {S,{C "`"}}, {S,{C "~"}}, {S,{C "`"}}},
+/* 2*/ {KBD_ASCII, I, {S,{C "1"}}, {S,{C "!"}}, {S,{C "1"}}},
+/* 3*/ {KBD_ASCII, I, {S,{C "2"}}, {S,{C "@"}}, {S,{C "\000"}}},
+/* 4*/ {KBD_ASCII, I, {S,{C "3"}}, {S,{C "#"}}, {S,{C "3"}}},
+/* 5*/ {KBD_ASCII, I, {S,{C "4"}}, {S,{C "$"}}, {S,{C "4"}}},
+/* 6*/ {KBD_ASCII, I, {S,{C "5"}}, {S,{C "%"}}, {S,{C "5"}}},
+/* 7*/ {KBD_ASCII, I, {S,{C "6"}}, {S,{C "^"}}, {S,{C "\036"}}},
+/* 8*/ {KBD_ASCII, I, {S,{C "7"}}, {S,{C "&"}}, {S,{C "7"}}},
+/* 9*/ {KBD_ASCII, I, {S,{C "8"}}, {S,{C "*"}}, {S,{C "8"}}},
+/* 10*/ {KBD_ASCII, I, {S,{C "9"}}, {S,{C "("}}, {S,{C "9"}}},
+/* 11*/ {KBD_ASCII, I, {S,{C "0"}}, {S,{C ")"}}, {S,{C "0"}}},
+/* 12*/ {KBD_ASCII, I, {S,{C "-"}}, {S,{C "_"}}, {S,{C "\037"}}},
+/* 13*/ {KBD_ASCII, I, {S,{C "="}}, {S,{C "+"}}, {S,{C "="}}},
+/* 14*/ {KBD_NONE, I, {S,{C ""}}, {S,{C ""}}, {S,{C ""}}},
+/* 15*/ {KBD_ASCII, I, {S,{C "\177"}}, {S,{C "\010"}}, {S,{C "\177"}}}, /* BS */
+/* 16*/ {KBD_ASCII, I, {S,{C "\t"}}, {S,{C "\t"}}, {S,{C "\t"}}}, /* TAB */
+/* 17*/ {KBD_ASCII, I, {S,{C "q"}}, {S,{C "Q"}}, {S,{C "\021"}}},
+/* 18*/ {KBD_ASCII, I, {S,{C "w"}}, {S,{C "W"}}, {S,{C "\027"}}},
+/* 19*/ {KBD_ASCII, I, {S,{C "e"}}, {S,{C "E"}}, {S,{C "\005"}}},
+/* 20*/ {KBD_ASCII, I, {S,{C "r"}}, {S,{C "R"}}, {S,{C "\022"}}},
+/* 21*/ {KBD_ASCII, I, {S,{C "t"}}, {S,{C "T"}}, {S,{C "\024"}}},
+/* 22*/ {KBD_ASCII, I, {S,{C "y"}}, {S,{C "Y"}}, {S,{C "\031"}}},
+/* 23*/ {KBD_ASCII, I, {S,{C "u"}}, {S,{C "U"}}, {S,{C "\025"}}},
+/* 24*/ {KBD_ASCII, I, {S,{C "i"}}, {S,{C "I"}}, {S,{C "\011"}}},
+/* 25*/ {KBD_ASCII, I, {S,{C "o"}}, {S,{C "O"}}, {S,{C "\017"}}},
+/* 26*/ {KBD_ASCII, I, {S,{C "p"}}, {S,{C "P"}}, {S,{C "\020"}}},
+/* 27*/ {KBD_ASCII, I, {S,{C "["}}, {S,{C "{"}}, {S,{C "\033"}}},
+/* 28*/ {KBD_ASCII, I, {S,{C "]"}}, {S,{C "}"}}, {S,{C "\035"}}},
+/* 29*/ {KBD_ASCII, I, {S,{C "\\"}}, {S,{C "|"}}, {S,{C "\034"}}},
+/* 30*/ {KBD_CAPS, I, {S,{C ""}}, {S,{C ""}}, {S,{C ""}}},
+/* 31*/ {KBD_ASCII, I, {S,{C "a"}}, {S,{C "A"}}, {S,{C "\001"}}},
+/* 32*/ {KBD_ASCII, I, {S,{C "s"}}, {S,{C "S"}}, {S,{C "\023"}}},
+/* 33*/ {KBD_ASCII, I, {S,{C "d"}}, {S,{C "D"}}, {S,{C "\004"}}},
+/* 34*/ {KBD_ASCII, I, {S,{C "f"}}, {S,{C "F"}}, {S,{C "\006"}}},
+/* 35*/ {KBD_ASCII, I, {S,{C "g"}}, {S,{C "G"}}, {S,{C "\007"}}},
+/* 36*/ {KBD_ASCII, I, {S,{C "h"}}, {S,{C "H"}}, {S,{C "\010"}}},
+/* 37*/ {KBD_ASCII, I, {S,{C "j"}}, {S,{C "J"}}, {S,{C "\n"}}},
+/* 38*/ {KBD_ASCII, I, {S,{C "k"}}, {S,{C "K"}}, {S,{C "\013"}}},
+/* 39*/ {KBD_ASCII, I, {S,{C "l"}}, {S,{C "L"}}, {S,{C "\014"}}},
+/* 40*/ {KBD_ASCII, I, {S,{C ";"}}, {S,{C ":"}}, {S,{C ";"}}},
+/* 41*/ {KBD_ASCII, I, {S,{C "'"}}, {S,{C "\""}}, {S,{C "'"}}},
+/* 42*/ {KBD_ASCII, I, {S,{C "\\"}}, {S,{C "|"}}, {S,{C "\034"}}}, /* special */
+/* 43*/ {KBD_RETURN,I, {S,{C "\r"}}, {S,{C "\r"}}, {S,{C "\r"}}}, /* RETURN */
+/* 44*/ {KBD_SHIFT, I, {S,{C ""}}, {S,{C ""}}, {S,{C ""}}}, /* SHIFT left */
+/* 45*/ {KBD_ASCII, I, {S,{C "<"}}, {S,{C ">"}}, {S,{C ""}}},
+/* 46*/ {KBD_ASCII, I, {S,{C "z"}}, {S,{C "Z"}}, {S,{C "\032"}}},
+/* 47*/ {KBD_ASCII, I, {S,{C "x"}}, {S,{C "X"}}, {S,{C "\030"}}},
+/* 48*/ {KBD_ASCII, I, {S,{C "c"}}, {S,{C "C"}}, {S,{C "\003"}}},
+/* 49*/ {KBD_ASCII, I, {S,{C "v"}}, {S,{C "V"}}, {S,{C "\026"}}},
+/* 50*/ {KBD_ASCII, I, {S,{C "b"}}, {S,{C "B"}}, {S,{C "\002"}}},
+/* 51*/ {KBD_ASCII, I, {S,{C "n"}}, {S,{C "N"}}, {S,{C "\016"}}},
+/* 52*/ {KBD_ASCII, I, {S,{C "m"}}, {S,{C "M"}}, {S,{C "\r"}}},
+/* 53*/ {KBD_ASCII, I, {S,{C ","}}, {S,{C "<"}}, {S,{C ","}}},
+/* 54*/ {KBD_ASCII, I, {S,{C "."}}, {S,{C ">"}}, {S,{C "."}}},
+/* 55*/ {KBD_ASCII, I, {S,{C "/"}}, {S,{C "?"}}, {S,{C "/"}}},
+/* 56*/ {KBD_NONE, I, {S,{C ""}}, {S,{C ""}}, {S,{C ""}}},
+/* 57*/ {KBD_SHIFT, I, {S,{C ""}}, {S,{C ""}}, {S,{C ""}}}, /* SHIFT right */
+/* 58*/ {KBD_CTL, I, {S,{C ""}}, {S,{C ""}}, {S,{C ""}}}, /* CTL left */
+/* 59*/ {KBD_ASCII, I, {S,{C ""}}, {S,{C ""}}, {S,{C ""}}},
+/* 60*/ {KBD_META, I, {S,{C ""}}, {S,{C ""}}, {S,{C ""}}}, /* ALT left */
#if !PCVT_NULLCHARS
-/* 61*/ KBD_ASCII, I, {S,C " "}, {S,C " "}, {S,C " "}, /* SPACE */
+/* 61*/ {KBD_ASCII, I, {S,{C " "}}, {S,{C " "}}, {S,{C " "}}}, /* SPACE */
#else
-/* 61*/ KBD_ASCII, I, {S,C " "}, {S,C " "}, {S,C "\000"}, /* SPACE */
+/* 61*/ {KBD_ASCII, I, {S,{C " "}}, {S,{C " "}}, {S,{C "\000"}}}, /* SPACE */
#endif /* PCVT_NULLCHARS */
-/* 62*/ KBD_META, I, {S,C ""}, {S,C ""}, {S,C ""}, /* ALT right */
-/* 63*/ KBD_ASCII, I, {S,C ""}, {S,C ""}, {S,C ""},
-/* 64*/ KBD_CTL, I, {S,C ""}, {S,C ""}, {S,C ""}, /* CTL right */
-/* 65*/ KBD_NONE, I, {S,C ""}, {S,C ""}, {S,C ""},
-/* 66*/ KBD_NONE, I, {S,C ""}, {S,C ""}, {S,C ""},
-/* 67*/ KBD_NONE, I, {S,C ""}, {S,C ""}, {S,C ""},
-/* 68*/ KBD_NONE, I, {S,C ""}, {S,C ""}, {S,C ""},
-/* 69*/ KBD_NONE, I, {S,C ""}, {S,C ""}, {S,C ""},
-/* 70*/ KBD_NONE, I, {S,C ""}, {S,C ""}, {S,C ""},
-/* 71*/ KBD_NONE, I, {S,C ""}, {S,C ""}, {S,C ""},
-/* 72*/ KBD_NONE, I, {S,C ""}, {S,C ""}, {S,C ""},
-/* 73*/ KBD_NONE, I, {S,C ""}, {S,C ""}, {S,C ""},
-/* 74*/ KBD_NONE, I, {S,C ""}, {S,C ""}, {S,C ""},
-/* 75*/ KBD_FUNC, I, {S,C "\033[2~"},{S,C "\033[2~"},{S,C "\033[2~"},/* INS */
-/* 76*/ KBD_FUNC, I, {S,C "\033[3~"},{S,C "\033[3~"},{S,C "\033[3~"},/* DEL */
-/* 77*/ KBD_NONE, I, {S,C ""}, {S,C ""}, {S,C ""},
-/* 78*/ KBD_NONE, I, {S,C ""}, {S,C ""}, {S,C ""},
-/* 79*/ KBD_CURSOR,I, {S,C "\033[D"},{S,C "\033OD"},{S,C "\033[D"}, /* CU <- */
-/* 80*/ KBD_FUNC, I, {S,C "\033[1~"},{S,C "\033[1~"},{S,C "\033[1~"},/* HOME = FIND*/
-/* 81*/ KBD_FUNC, I, {S,C "\033[4~"},{S,C "\033[4~"},{S,C "\033[4~"},/* END = SELECT */
-/* 82*/ KBD_NONE, I, {S,C ""}, {S,C ""}, {S,C ""},
-/* 83*/ KBD_CURSOR,I, {S,C "\033[A"},{S,C "\033OA"},{S,C "\033[A"}, /* CU ^ */
-/* 84*/ KBD_CURSOR,I, {S,C "\033[B"},{S,C "\033OB"},{S,C "\033[B"}, /* CU v */
-/* 85*/ KBD_FUNC, I, {S,C "\033[5~"},{S,C "\033[5~"},{S,C "\033[5~"},/*PG UP*/
-/* 86*/ KBD_FUNC, I, {S,C "\033[6~"},{S,C "\033[6~"},{S,C "\033[6~"},/*PG DN*/
-/* 87*/ KBD_NONE, I, {S,C ""}, {S,C ""}, {S,C ""},
-/* 88*/ KBD_NONE, I, {S,C ""}, {S,C ""}, {S,C ""},
-/* 89*/ KBD_CURSOR,I, {S,C "\033[C"},{S,C "\033OC"},{S,C "\033[C"}, /* CU -> */
-/* 90*/ KBD_NUM, I, {S,C ""}, {S,C ""}, {S,C ""},
-/* 91*/ KBD_KP, I, {S,C "7"}, {S,C "\033Ow"},{S,C "7"},
-/* 92*/ KBD_KP, I, {S,C "4"}, {S,C "\033Ot"},{S,C "4"},
-/* 93*/ KBD_KP, I, {S,C "1"}, {S,C "\033Oq"},{S,C "1"},
-/* 94*/ KBD_NONE, I, {S,C ""}, {S,C ""}, {S,C ""},
-/* 95*/ KBD_KP, I, {S,C "/"}, {S,C "/"}, {S,C "/"},
-/* 96*/ KBD_KP, I, {S,C "8"}, {S,C "\033Ox"},{S,C "8"},
-/* 97*/ KBD_KP, I, {S,C "5"}, {S,C "\033Ou"},{S,C "5"},
-/* 98*/ KBD_KP, I, {S,C "2"}, {S,C "\033Or"},{S,C "2"},
-/* 99*/ KBD_KP, I, {S,C "0"}, {S,C "\033Op"},{S,C "0"},
-/*100*/ KBD_KP, I, {S,C "*"}, {S,C "*"}, {S,C "*"},
-/*101*/ KBD_KP, I, {S,C "9"}, {S,C "\033Oy"},{S,C "9"},
-/*102*/ KBD_KP, I, {S,C "6"}, {S,C "\033Ov"},{S,C "6"},
-/*103*/ KBD_KP, I, {S,C "3"}, {S,C "\033Os"},{S,C "3"},
-/*104*/ KBD_KP, I, {S,C "."}, {S,C "\033On"},{S,C "."},
-/*105*/ KBD_KP, I, {S,C "-"}, {S,C "\033Om"},{S,C "-"},
-/*106*/ KBD_KP, I, {S,C "+"}, {S,C "+"}, {S,C "+"},
-/*107*/ KBD_NONE, I, {S,C ""}, {S,C ""}, {S,C ""},
-/*108*/ KBD_RETURN,I, {S,C "\r"}, {S,C "\033OM"},{S,C "\r"}, /* KP ENTER */
-/*109*/ KBD_NONE, I, {S,C ""}, {S,C ""}, {S,C ""},
-/*110*/ KBD_ASCII, I, {S,C "\033"}, {S,C "\033"}, {S,C "\033"},
-/*111*/ KBD_NONE, I, {S,C ""}, {S,C ""}, {S,C ""},
-/*112*/ KBD_FUNC, I, {F,V fkey1}, {F,V sfkey1}, {F,V cfkey1}, /* F1 */
-/*113*/ KBD_FUNC, I, {F,V fkey2}, {F,V sfkey2}, {F,V cfkey2}, /* F2 */
-/*114*/ KBD_FUNC, I, {F,V fkey3}, {F,V sfkey3}, {F,V cfkey3}, /* F3 */
-/*115*/ KBD_FUNC, I, {F,V fkey4}, {F,V sfkey4}, {F,V cfkey4}, /* F4 */
-/*116*/ KBD_FUNC, I, {F,V fkey5}, {F,V sfkey5}, {F,V cfkey5}, /* F5 */
-/*117*/ KBD_FUNC, I, {F,V fkey6}, {F,V sfkey6}, {F,V cfkey6}, /* F6 */
-/*118*/ KBD_FUNC, I, {F,V fkey7}, {F,V sfkey7}, {F,V cfkey7}, /* F7 */
-/*119*/ KBD_FUNC, I, {F,V fkey8}, {F,V sfkey8}, {F,V cfkey8}, /* F8 */
-/*120*/ KBD_FUNC, I, {F,V fkey9}, {F,V sfkey9}, {F,V cfkey9}, /* F9 */
-/*121*/ KBD_FUNC, I, {F,V fkey10}, {F,V sfkey10}, {F,V cfkey10}, /* F10 */
-/*122*/ KBD_FUNC, I, {F,V fkey11}, {F,V sfkey11}, {F,V cfkey11}, /* F11 */
-/*123*/ KBD_FUNC, I, {F,V fkey12}, {F,V sfkey12}, {F,V cfkey12}, /* F12 */
-/*124*/ KBD_KP, I, {S,C ""}, {S,C ""}, {S,C ""},
-/*125*/ KBD_SCROLL,I, {S,C ""}, {S,C ""}, {S,C ""},
-/*126*/ KBD_BREAK, I, {S,C ""}, {S,C ""}, {S,C ""},
-/*127*/ KBD_FUNC, I, {S,C ""}, {S,C ""}, {S,C ""}, /* SysRq */
+/* 62*/ {KBD_META, I, {S,{C ""}}, {S,{C ""}}, {S,{C ""}}}, /* ALT right */
+/* 63*/ {KBD_ASCII, I, {S,{C ""}}, {S,{C ""}}, {S,{C ""}}},
+/* 64*/ {KBD_CTL, I, {S,{C ""}}, {S,{C ""}}, {S,{C ""}}}, /* CTL right */
+/* 65*/ {KBD_NONE, I, {S,{C ""}}, {S,{C ""}}, {S,{C ""}}},
+/* 66*/ {KBD_NONE, I, {S,{C ""}}, {S,{C ""}}, {S,{C ""}}},
+/* 67*/ {KBD_NONE, I, {S,{C ""}}, {S,{C ""}}, {S,{C ""}}},
+/* 68*/ {KBD_NONE, I, {S,{C ""}}, {S,{C ""}}, {S,{C ""}}},
+/* 69*/ {KBD_NONE, I, {S,{C ""}}, {S,{C ""}}, {S,{C ""}}},
+/* 70*/ {KBD_NONE, I, {S,{C ""}}, {S,{C ""}}, {S,{C ""}}},
+/* 71*/ {KBD_NONE, I, {S,{C ""}}, {S,{C ""}}, {S,{C ""}}},
+/* 72*/ {KBD_NONE, I, {S,{C ""}}, {S,{C ""}}, {S,{C ""}}},
+/* 73*/ {KBD_NONE, I, {S,{C ""}}, {S,{C ""}}, {S,{C ""}}},
+/* 74*/ {KBD_NONE, I, {S,{C ""}}, {S,{C ""}}, {S,{C ""}}},
+/* 75*/ {KBD_FUNC, I, {S,{C "\033[2~"}},{S,{C "\033[2~"}},{S,{C "\033[2~"}}},/* INS */
+/* 76*/ {KBD_FUNC, I, {S,{C "\033[3~"}},{S,{C "\033[3~"}},{S,{C "\033[3~"}}},/* DEL */
+/* 77*/ {KBD_NONE, I, {S,{C ""}}, {S,{C ""}}, {S,{C ""}}},
+/* 78*/ {KBD_NONE, I, {S,{C ""}}, {S,{C ""}}, {S,{C ""}}},
+/* 79*/ {KBD_CURSOR,I, {S,{C "\033[D"}},{S,{C "\033OD"}},{S,{C "\033[D"}}}, /* CU <- */
+/* 80*/ {KBD_FUNC, I, {S,{C "\033[1~"}},{S,{C "\033[1~"}},{S,{C "\033[1~"}}},/* HOME = FIND*/
+/* 81*/ {KBD_FUNC, I, {S,{C "\033[4~"}},{S,{C "\033[4~"}},{S,{C "\033[4~"}}},/* END = SELECT */
+/* 82*/ {KBD_NONE, I, {S,{C ""}}, {S,{C ""}}, {S,{C ""}}},
+/* 83*/ {KBD_CURSOR,I, {S,{C "\033[A"}},{S,{C "\033OA"}},{S,{C "\033[A"}}}, /* CU ^ */
+/* 84*/ {KBD_CURSOR,I, {S,{C "\033[B"}},{S,{C "\033OB"}},{S,{C "\033[B"}}}, /* CU v */
+/* 85*/ {KBD_FUNC, I, {S,{C "\033[5~"}},{S,{C "\033[5~"}},{S,{C "\033[5~"}}},/*PG UP*/
+/* 86*/ {KBD_FUNC, I, {S,{C "\033[6~"}},{S,{C "\033[6~"}},{S,{C "\033[6~"}}},/*PG DN*/
+/* 87*/ {KBD_NONE, I, {S,{C ""}}, {S,{C ""}}, {S,{C ""}}},
+/* 88*/ {KBD_NONE, I, {S,{C ""}}, {S,{C ""}}, {S,{C ""}}},
+/* 89*/ {KBD_CURSOR,I, {S,{C "\033[C"}},{S,{C "\033OC"}},{S,{C "\033[C"}}}, /* CU -> */
+/* 90*/ {KBD_NUM, I, {S,{C ""}}, {S,{C ""}}, {S,{C ""}}},
+/* 91*/ {KBD_KP, I, {S,{C "7"}}, {S,{C "\033Ow"}},{S,{C "7"}}},
+/* 92*/ {KBD_KP, I, {S,{C "4"}}, {S,{C "\033Ot"}},{S,{C "4"}}},
+/* 93*/ {KBD_KP, I, {S,{C "1"}}, {S,{C "\033Oq"}},{S,{C "1"}}},
+/* 94*/ {KBD_NONE, I, {S,{C ""}}, {S,{C ""}}, {S,{C ""}}},
+/* 95*/ {KBD_KP, I, {S,{C "/"}}, {S,{C "/"}}, {S,{C "/"}}},
+/* 96*/ {KBD_KP, I, {S,{C "8"}}, {S,{C "\033Ox"}},{S,{C "8"}}},
+/* 97*/ {KBD_KP, I, {S,{C "5"}}, {S,{C "\033Ou"}},{S,{C "5"}}},
+/* 98*/ {KBD_KP, I, {S,{C "2"}}, {S,{C "\033Or"}},{S,{C "2"}}},
+/* 99*/ {KBD_KP, I, {S,{C "0"}}, {S,{C "\033Op"}},{S,{C "0"}}},
+/*100*/ {KBD_KP, I, {S,{C "*"}}, {S,{C "*"}}, {S,{C "*"}}},
+/*101*/ {KBD_KP, I, {S,{C "9"}}, {S,{C "\033Oy"}},{S,{C "9"}}},
+/*102*/ {KBD_KP, I, {S,{C "6"}}, {S,{C "\033Ov"}},{S,{C "6"}}},
+/*103*/ {KBD_KP, I, {S,{C "3"}}, {S,{C "\033Os"}},{S,{C "3"}}},
+/*104*/ {KBD_KP, I, {S,{C "."}}, {S,{C "\033On"}},{S,{C "."}}},
+/*105*/ {KBD_KP, I, {S,{C "-"}}, {S,{C "\033Om"}},{S,{C "-"}}},
+/*106*/ {KBD_KP, I, {S,{C "+"}}, {S,{C "+"}}, {S,{C "+"}}},
+/*107*/ {KBD_NONE, I, {S,{C ""}}, {S,{C ""}}, {S,{C ""}}},
+/*108*/ {KBD_RETURN,I, {S,{C "\r"}}, {S,{C "\033OM"}},{S,{C "\r"}}}, /* KP ENTER */
+/*109*/ {KBD_NONE, I, {S,{C ""}}, {S,{C ""}}, {S,{C ""}}},
+/*110*/ {KBD_ASCII, I, {S,{C "\033"}}, {S,{C "\033"}}, {S,{C "\033"}}},
+/*111*/ {KBD_NONE, I, {S,{C ""}}, {S,{C ""}}, {S,{C ""}}},
+/*112*/ {KBD_FUNC, I, {F,{V fkey1}}, {F,{V sfkey1}}, {F,{V cfkey1}}}, /* F1 */
+/*113*/ {KBD_FUNC, I, {F,{V fkey2}}, {F,{V sfkey2}}, {F,{V cfkey2}}}, /* F2 */
+/*114*/ {KBD_FUNC, I, {F,{V fkey3}}, {F,{V sfkey3}}, {F,{V cfkey3}}}, /* F3 */
+/*115*/ {KBD_FUNC, I, {F,{V fkey4}}, {F,{V sfkey4}}, {F,{V cfkey4}}}, /* F4 */
+/*116*/ {KBD_FUNC, I, {F,{V fkey5}}, {F,{V sfkey5}}, {F,{V cfkey5}}}, /* F5 */
+/*117*/ {KBD_FUNC, I, {F,{V fkey6}}, {F,{V sfkey6}}, {F,{V cfkey6}}}, /* F6 */
+/*118*/ {KBD_FUNC, I, {F,{V fkey7}}, {F,{V sfkey7}}, {F,{V cfkey7}}}, /* F7 */
+/*119*/ {KBD_FUNC, I, {F,{V fkey8}}, {F,{V sfkey8}}, {F,{V cfkey8}}}, /* F8 */
+/*120*/ {KBD_FUNC, I, {F,{V fkey9}}, {F,{V sfkey9}}, {F,{V cfkey9}}}, /* F9 */
+/*121*/ {KBD_FUNC, I, {F,{V fkey10}}, {F,{V sfkey10}}, {F,{V cfkey10}}}, /* F10 */
+/*122*/ {KBD_FUNC, I, {F,{V fkey11}}, {F,{V sfkey11}}, {F,{V cfkey11}}}, /* F11 */
+/*123*/ {KBD_FUNC, I, {F,{V fkey12}}, {F,{V sfkey12}}, {F,{V cfkey12}}}, /* F12 */
+/*124*/ {KBD_KP, I, {S,{C ""}}, {S,{C ""}}, {S,{C ""}}},
+/*125*/ {KBD_SCROLL,I, {S,{C ""}}, {S,{C ""}}, {S,{C ""}}},
+/*126*/ {KBD_BREAK, I, {S,{C ""}}, {S,{C ""}}, {S,{C ""}}},
+/*127*/ {KBD_FUNC, I, {S,{C ""}}, {S,{C ""}}, {S,{C ""}}}, /* SysRq */
#undef C
#undef V
diff --git a/sys/i386/isa/pcvt/pcvt_out.c b/sys/i386/isa/pcvt/pcvt_out.c
index e7ce9e21f29e..2c6d008bf89a 100644
--- a/sys/i386/isa/pcvt/pcvt_out.c
+++ b/sys/i386/isa/pcvt/pcvt_out.c
@@ -1,4 +1,6 @@
/*
+ * Copyright (c) 1999 Hellmuth Michaelis
+ *
* Copyright (c) 1992, 1995 Hellmuth Michaelis and Joerg Wunsch.
*
* Copyright (c) 1992, 1993 Brian Dunford-Shore.
@@ -33,29 +35,16 @@
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- *
- * @(#)pcvt_out.c, 3.20, Last Edit-Date: [Mon Apr 19 17:18:58 1999]
- *
*/
/*---------------------------------------------------------------------------*
*
* pcvt_out.c VT220 Terminal Emulator
* ---------------------------------------
- * -hm ------------ Release 3.00 --------------
- * -hm integrating NetBSD-current patches
- * -hm integrating patch from Thomas Gellekum
- * -hm bugfix: clear last line when hpmode 28lines and force 24
- * -hm right fkey labels after soft/hard reset
- * -hm patch from Joerg for comconsole operation
- * -hm patch from Lon Willet to preserve the initial cursor shape
- * -hm if FAT_CURSOR is defined, you get the old cursor type back ..
- * -hm patch from Lon Willett regarding winsize settings
- * -hm applying patch from Joerg fixing Crtat bug, non VGA startup bug
- * -hm setting variable color for CGA and MDA/HGC in coldinit
- * -hm fixing bug initializing cursor position on startup
- * -hm fixing support for EGA boards in vt_coldinit()
+ *
+ * Last Edit-Date: [Mon Dec 27 14:07:39 1999]
+ *
+ * $FreeBSD$
*
*---------------------------------------------------------------------------*/
@@ -79,6 +68,7 @@ static void vt_coldinit ( void );
static void wrfkl ( int num, u_char *string, struct video_state *svsp );
static void writefkl ( int num, u_char *string, struct video_state *svsp );
+static int check_scrollback ( struct video_state *svsp );
/*---------------------------------------------------------------------------*
* do character set transformation and write to display memory (inline)
@@ -148,7 +138,8 @@ sput (u_char *s, U_char kernel, int len, int page)
register struct video_state *svsp;
u_short attrib;
u_short ch;
-
+ u_short extra;
+
if(page >= PCVT_NSCREENS) /* failsafe */
page = 0;
@@ -263,6 +254,18 @@ sput (u_char *s, U_char kernel, int len, int page)
case 0x0a: /* LF */
case 0x0b: /* VT */
case 0x0c: /* FF */
+ if (check_scrollback(svsp))
+ {
+ extra = (svsp->cur_offset %
+ svsp->maxcol) ?
+ svsp->col : 0;
+ bcopy(svsp->Crtat +
+ svsp->cur_offset - extra,
+ svsp->Scrollback +
+ (svsp->scr_offset *
+ svsp->maxcol),
+ svsp->maxcol * CHR);
+ }
if(svsp->lnm)
{
svsp->cur_offset -= svsp->col;
@@ -343,6 +346,17 @@ sput (u_char *s, U_char kernel, int len, int page)
svsp->cur_offset++;
svsp->col = 0;
svsp->lastchar = 0;
+
+ if (check_scrollback(svsp))
+ {
+ bcopy(svsp->Crtat +
+ svsp->cur_offset -
+ svsp->maxcol,
+ svsp->Scrollback +
+ (svsp->scr_offset *
+ svsp->maxcol),
+ svsp->maxcol * CHR);
+ }
check_scroll(svsp);
}
@@ -735,6 +749,9 @@ sput (u_char *s, U_char kernel, int len, int page)
case 'K': /* erase line */
vt_clreol(svsp);
svsp->state = STATE_INIT;
+ if (svsp->scr_offset > 0 &&
+ svsp == vsp)
+ svsp->scr_offset--;
break;
case 'L': /* insert line */
@@ -1009,6 +1026,9 @@ vt_coldinit(void)
{
svsp->Crtat = Crtat; /* all same until malloc'ed */
svsp->Memory = Crtat; /* until malloc'ed */
+ svsp->Scrollback = 0; /* until malloc'ed */
+ svsp->scr_offset = 0; /* scrollback offset (lines) */
+ svsp->scrolling = 0; /* current scrollback page */
svsp->cur_offset = 0; /* cursor offset */
svsp->c_attr = user_attr; /* non-kernel attributes */
svsp->bell_on = 1; /* enable bell */
@@ -1042,6 +1062,7 @@ vt_coldinit(void)
#endif /* PCVT_24LINESDEF */
svsp->screen_rowsize = 25; /* default 25 rows on screen */
+ svsp->max_off = svsp->screen_rowsize * SCROLLBACK_PAGES - 1;
svsp->scrr_beg = 0; /* scrolling region begin row*/
svsp->scrr_len = svsp->screen_rows; /* scrolling region length*/
svsp->scrr_end = svsp->scrr_len - 1;/* scrolling region end */
@@ -1287,15 +1308,15 @@ vt_coldmalloc(void)
for(nscr = 0; nscr < PCVT_NSCREENS; nscr++)
{
- if((vs[nscr].Memory =
- (u_short *)malloc(screen_max_size * 2, M_DEVBUF, M_WAITOK))
- == NULL)
+ if((vs[nscr].Memory = (u_short *)malloc(screen_max_size * 2,
+ M_DEVBUF, M_WAITOK)) == NULL)
{
printf("pcvt: screen memory malloc failed, "
"NSCREEN=%d, nscr=%d\n",
PCVT_NSCREENS, nscr);
break;
}
+
if(nscr != 0)
{
vs[nscr].Crtat = vs[nscr].Memory;
@@ -1304,6 +1325,10 @@ vt_coldmalloc(void)
vs[nscr].maxcol * vs[nscr].screen_rowsize);
totalscreens++;
}
+
+ vs[nscr].scrollback_pages = SCROLLBACK_PAGES;
+
+ reallocate_scrollbuffer(&(vs[nscr]), vs[nscr].scrollback_pages);
}
}
@@ -1347,6 +1372,27 @@ check_scroll(struct video_state *svsp)
}
}
+static int
+check_scrollback(struct video_state *svsp)
+{
+ /* still waiting for scrollback memory or not on current page */
+ if (!svsp->Scrollback || svsp != vsp)
+ return 0;
+
+ /* remove first line of scrollback buffer to make room for new line */
+ if (svsp->scr_offset == svsp->max_off)
+ {
+ bcopy(svsp->Scrollback + svsp->maxcol, svsp->Scrollback,
+ svsp->maxcol * svsp->max_off * CHR);
+ }
+ else
+ {
+ /* still room left, increase scroll offset (lines) */
+ svsp->scr_offset++;
+ }
+ return 1;
+}
+
/*---------------------------------------------------------------------------*
* write to one user function key label
*---------------------------------------------------------------------------*/
@@ -1831,6 +1877,7 @@ vt_col(struct video_state *svsp, int cols)
#endif /* PCVT_SIGWINCH */
}
+ reallocate_scrollbuffer(svsp, svsp->scrollback_pages);
return(1);
}
diff --git a/sys/i386/isa/pcvt/pcvt_sup.c b/sys/i386/isa/pcvt/pcvt_sup.c
index de7f938840e8..6917f7f4c7be 100644
--- a/sys/i386/isa/pcvt/pcvt_sup.c
+++ b/sys/i386/isa/pcvt/pcvt_sup.c
@@ -1,4 +1,6 @@
/*
+ * Copyright (c) 1999 Hellmuth Michaelis
+ *
* Copyright (c) 1992, 1995 Hellmuth Michaelis and Joerg Wunsch.
*
* Copyright (c) 1992, 1993 Brian Dunford-Shore and Scott Turner.
@@ -35,29 +37,16 @@
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- *
- * @(#)pcvt_sup.c, 3.20, Last Edit-Date: [Thu Apr 6 10:49:44 1995]
- *
*/
/*---------------------------------------------------------------------------*
*
* pcvt_sup.c VT220 Driver Support Routines
* ---------------------------------------------
- * -hm ------------ Release 3.00 --------------
- * -hm integrating NetBSD-current patches
- * -hm removed paranoid delay()/DELAY() from vga_test()
- * -hm removing vgapage() protection if PCVT_KBD_FIFO
- * -hm some new CONF_ - values
- * -hm Joerg's patches for FreeBSD ttymalloc
- * -hm applying Joerg's patches for FreeBSD 2.0
- * -hm applying Lon Willet's patches for NetBSD
- * -hm NetBSD PR #400: patch to short-circuit TIOCSWINSZ
- * -hm getting PCVT_BURST reported correctly for FreeBSD 2.0
- * -hm applying patch from Joerg fixing Crtat bug
- * -hm moving ega/vga coldinit support code to mda2egaorvga()
- * -hm patch from Thomas Eberhardt fixing force 24 lines fkey update
+ *
+ * Last Edit-Date: [Thu Dec 30 17:01:03 1999]
+ *
+ * $FreeBSD$
*
*---------------------------------------------------------------------------*/
@@ -242,6 +231,12 @@ vgaioctl(Dev_t dev, int cmd, caddr_t data, int flag)
return EINVAL;
break;
+#if 0
+ case SETSCROLLSIZE:
+ reallocate_scrollbuffer(vsp, *(u_short *)data);
+ break;
+#endif
+
case TIOCSWINSZ:
/* do nothing here */
break;
@@ -778,12 +773,64 @@ set_screen_size(struct video_state *svsp, int size)
pgsignal(svsp->vs_tty->t_pgrp, SIGWINCH, 1);
#endif /* PCVT_SIGWINCH */
+ reallocate_scrollbuffer(svsp, svsp->scrollback_pages);
break;
}
}
}
/*---------------------------------------------------------------------------*
+ * resize the scrollback buffer to the specified number of "pages"
+ *---------------------------------------------------------------------------*/
+void
+reallocate_scrollbuffer(struct video_state *svsp, int pages)
+{
+ int s;
+ u_short *stmp;
+
+ if(pages < 2)
+ pages = 2;
+ if(pages > 50)
+ pages = 50;
+
+ s = splhigh();
+
+ if((stmp = (u_short *)malloc(svsp->maxcol * svsp->screen_rows *
+ pages * CHR, M_DEVBUF, M_NOWAIT)) == NULL)
+ {
+ splx(s);
+ printf("pcvt: reallocate_scrollbuffer, malloc failed\n");
+ return;
+ }
+
+ svsp->max_off = svsp->screen_rows * pages - 1;
+
+ if(svsp->Scrollback)
+ {
+ bcopy(svsp->Scrollback, stmp,
+ (min(pages, svsp->scrollback_pages)) *
+ svsp->screen_rows * svsp->maxcol * CHR);
+ free(svsp->Scrollback, M_DEVBUF);
+ svsp->Scrollback = stmp;
+ }
+ else
+ {
+ svsp->scr_offset = 0;
+ svsp->scrolling = 0;
+ svsp->Scrollback = stmp;
+
+ bcopy(svsp->Crtat, svsp->Scrollback,
+ svsp->screen_rows * svsp->maxcol * CHR);
+
+ svsp->scr_offset = svsp->row;
+ }
+
+ svsp->scrollback_pages = pages;
+
+ splx(s);
+}
+
+/*---------------------------------------------------------------------------*
* VGA ioctl - read DAC palette entry
*---------------------------------------------------------------------------*/
static void
diff --git a/sys/i386/isa/pcvt/pcvt_tbl.h b/sys/i386/isa/pcvt/pcvt_tbl.h
index c5156797716b..4efc841bdbfc 100644
--- a/sys/i386/isa/pcvt/pcvt_tbl.h
+++ b/sys/i386/isa/pcvt/pcvt_tbl.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1992, 1995 Hellmuth Michaelis.
+ * Copyright (c) 1992, 1999 Hellmuth Michaelis.
*
* All rights reserved.
*
@@ -11,11 +11,6 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Hellmuth Michaelis
- * 4. The name authors may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
@@ -27,18 +22,18 @@
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- *
- * @(#)pcvt_tbl.h, 3.20, Last Edit-Date: [Sun Apr 2 18:59:19 1995]
- *
*/
/*---------------------------------------------------------------------------*
*
* pcvt_tbl.h VT220 Driver Character Set Conversion Tables
* ------------------------------------------------------------
- * -hm splitting off pccons_out.c
- * -hm default tables for pure mda/hcg/cga
+ *
+ * Last Edit-Date: [Mon Dec 27 14:12:37 1999]
+ *
+ * $FreeBSD$
+ *
+ *---------------------------------------------------------------------------*
*
* in pcvt_out.c, hooks are provided for the following charactersets:
*
diff --git a/sys/i386/isa/pcvt/pcvt_vtf.c b/sys/i386/isa/pcvt/pcvt_vtf.c
index e3f78785e733..2923b14716f0 100644
--- a/sys/i386/isa/pcvt/pcvt_vtf.c
+++ b/sys/i386/isa/pcvt/pcvt_vtf.c
@@ -1,4 +1,6 @@
/*
+ * Copyright (c) 1999 Hellmuth Michaelis
+ *
* Copyright (c) 1992, 1995 Hellmuth Michaelis and Joerg Wunsch.
*
* Copyright (c) 1992, 1993 Brian Dunford-Shore.
@@ -33,27 +35,16 @@
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- *
- * @(#)pcvt_vtf.c, 3.20, Last Edit-Date: [Wed Apr 5 18:08:50 1995]
*/
/*---------------------------------------------------------------------------*
*
* pcvt_vtf.c VT220 Terminal Emulator Functions
* -------------------------------------------------
- * -hm ------------ Release 3.00 --------------
- * -hm integrating NetBSD-current patches
- * -hm integrating patch from Thomas Gellekum
- * -hm fixed bug fkey labels not properly (re)set after ris
- * -hm Michael Havemester fixed NOFASTSCROLL define bug
- * -hm set caps/scroll/num_lock in vt_str() and made led_update()
- * -hm applying patch from Joerg fixing Crtat bug
- * -hm fixing NOFASTSCROLL operation for MDA/Hercules
- * -jw/hm fixing bug in roll_up() and roll_down()
- * -hm fastscroll/Crtat bugfix from Lon Willett
- * -hm patch for non-XSERVER/UCONSOLE compiles from Rafal Boni
- * -hm bugfix: PCVT_USL_COMPAT renamed to PCVT_USL_VT_COMPAT ...
+ *
+ * Last Edit-Date: [Mon Dec 27 14:13:33 1999]
+ *
+ * $FreeBSD$
*
*---------------------------------------------------------------------------*/