From 90bdbe955c57bbd54492ffb1adb1edc8f316439d Mon Sep 17 00:00:00 2001 From: Bruce Evans Date: Fri, 1 Feb 2019 16:07:49 +0000 Subject: [PATCH] Fix function keys for syscons in cons25 mode (vidcontrol -T cons25). kbd(4) (but only documented in atkbd(4)) maintains a table of strings for 96 function keys. Using teken broke this 9+ years ago for the most usable first 12 function keys and for 10 cursor keys, by supplying its own non-programmable strings so that the keyboard driver's strings are not used. Fix this by supplying NULL in the teken layer for syscons in cons25 mode so that the the strings are found in the kbd(4) layer. vt needs more changes to use kbd(4)'s tables. Teken's cons25 table is still needed to supply nonempty strings for vt in cons25 mode. Keep using teken's xterm tables for both syscons and vt in xterm mode. Function keys should at least default to xterm values in xterm mode, and kbd(4) doesn't support this. teken_set_cons25() sets a sticky flag to ask for the fix, and space is reserved for another new flag. vt should set this flag when it uses kbd(4)'s tables. PR: 226553 (for vt) --- sys/teken/teken.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sys/teken/teken.c b/sys/teken/teken.c index bc3af434e2d9..f4e4c8a57a2d 100644 --- a/sys/teken/teken.c +++ b/sys/teken/teken.c @@ -58,6 +58,7 @@ #define TS_CONS25 0x0040 /* cons25 emulation. */ #define TS_INSTRING 0x0080 /* Inside string. */ #define TS_CURSORKEYS 0x0100 /* Cursor keys mode. */ +#define TS_CONS25KEYS 0x0400 /* Fuller cons25 emul (fix function keys). */ /* Character that blanks a cell. */ #define BLANK ' ' @@ -411,7 +412,7 @@ void teken_set_cons25(teken_t *t) { - t->t_stateflags |= TS_CONS25; + t->t_stateflags |= TS_CONS25 | TS_CONS25KEYS; } /* @@ -722,6 +723,9 @@ teken_get_sequence(const teken_t *t, unsigned int k) { /* Cons25 mode. */ + if ((t->t_stateflags & (TS_CONS25 | TS_CONS25KEYS)) == + (TS_CONS25 | TS_CONS25KEYS)) + return (NULL); /* Don't override good kbd(4) strings. */ if (t->t_stateflags & TS_CONS25 && k < sizeof special_strings_cons25 / sizeof(char *)) return (special_strings_cons25[k]);