summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2021-07-01 21:04:09 -0400
committerGarrett D'Amore <garrett@damore.org>2022-06-16 13:56:13 -0400
commitc43f6c5551067e7546f6e78df8e37d63bc255192 (patch)
tree4840465edc756c37625f4e0e1429c8092437eed4
parentec6a85f5d3beb28d36eda5ef325b7410d7f3cfa3 (diff)
downloadillumos-joyent-c43f6c5551067e7546f6e78df8e37d63bc255192.tar.gz
13920 support for hiding the cursor on the console
13921 tem could support longer attribute chains 13922 terminfo smso/bold fixups for sun-color Reviewed by: Toomas Soome <tsoome@me.com> Approved by: Dan McDonald <danmcd@mnx.io>
-rw-r--r--usr/src/data/terminfo/termcap.src2
-rw-r--r--usr/src/data/terminfo/terminfo.src7
-rw-r--r--usr/src/uts/common/io/tem_safe.c70
-rw-r--r--usr/src/uts/common/sys/tem_impl.h7
4 files changed, 76 insertions, 10 deletions
diff --git a/usr/src/data/terminfo/termcap.src b/usr/src/data/terminfo/termcap.src
index e77b43694c..49490d8069 100644
--- a/usr/src/data/terminfo/termcap.src
+++ b/usr/src/data/terminfo/termcap.src
@@ -4653,7 +4653,7 @@ sun-type4|Sun Workstation console with type 4 keyboard:\
sun-color|Sun Microsystems Workstation console with color support (IA systems):\
:Co#8:NC#3:pa#64:\
:AB=\E[4%dm:AF=\E[3%dm:DO=\E[%dB:LE=\E[%dD:RI=\E[%dC:\
- :UP=\E[%dA:ho=\E[H:op=\E[0m:so=\E[1m:tc=sun:
+ :UP=\E[%dA:ho=\E[H:op=\E[0m:so=\E[7m:se=\E[27m:md=\E[1m:tc=sun:
#### Iris consoles
#
diff --git a/usr/src/data/terminfo/terminfo.src b/usr/src/data/terminfo/terminfo.src
index 0a265bc9b1..8df5f77642 100644
--- a/usr/src/data/terminfo/terminfo.src
+++ b/usr/src/data/terminfo/terminfo.src
@@ -5301,11 +5301,12 @@ sun-type4|Sun Workstation console with type 4 keyboard,
sun-color|Sun Microsystems Workstation console with color support (IA systems),
colors#256, ncv#3, pairs#32767,
cub=\E[%p1%dD, cud=\E[%p1%dB, cuf=\E[%p1%dC,
- cuu=\E[%p1%dA, home=\E[H, op=\E[0m, setab=\E[4%p1%dm,
- setaf=\E[3%p1%dm,
+ cuu=\E[%p1%dA, home=\E[H, op=\E[0m, bold=\E[1m,
+ setab=\E[4%p1%dm, setaf=\E[3%p1%dm,
setb=\E[4%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m,
setf=\E[3%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m,
- smso=\E[1m, smul=\E[4m,rmul=\E[24m,use=sun,
+ civis=\E[?25l, cnorm=\E[?25h,
+ smso=\E[7m, rmso=\E[27m, smul=\E[4m, rmul=\E[24m, use=sun,
#### Iris consoles
#
diff --git a/usr/src/uts/common/io/tem_safe.c b/usr/src/uts/common/io/tem_safe.c
index 04e598f994..10b2cc8cf2 100644
--- a/usr/src/uts/common/io/tem_safe.c
+++ b/usr/src/uts/common/io/tem_safe.c
@@ -27,6 +27,7 @@
/*
* Copyright 2016 Joyent, Inc.
* Copyright 2021 Toomas Soome <tsoome@me.com>
+ * Copyright 2021 RackTop Systems, Inc.
*/
/*
@@ -379,7 +380,7 @@ tem_safe_terminal_emulate(
ASSERT((MUTEX_HELD(&tems.ts_lock) && MUTEX_HELD(&tem->tvs_lock)) ||
called_from == CALLED_FROM_STANDALONE);
- if (tem->tvs_isactive)
+ if (tem->tvs_isactive && !tem->tvs_cursor_hidden)
tem_safe_callback_cursor(tem,
VIS_HIDE_CURSOR, credp, called_from);
@@ -391,7 +392,7 @@ tem_safe_terminal_emulate(
*/
tem_safe_send_data(tem, credp, called_from);
- if (tem->tvs_isactive)
+ if (tem->tvs_isactive && !tem->tvs_cursor_hidden)
tem_safe_callback_cursor(tem,
VIS_DISPLAY_CURSOR, credp, called_from);
}
@@ -1165,6 +1166,49 @@ tem_safe_chkparam(struct tem_vt_state *tem, tem_char_t ch, cred_t *credp,
tem->tvs_state = A_STATE_START;
}
+static void
+tem_safe_chkparam_qmark(struct tem_vt_state *tem, tem_char_t ch, cred_t *credp,
+ enum called_from called_from)
+{
+ ASSERT((called_from == CALLED_FROM_STANDALONE) ||
+ MUTEX_HELD(&tem->tvs_lock));
+
+ switch (ch) {
+ case 'h': /* DEC private mode set */
+ tem_safe_setparam(tem, 1, 1);
+ switch (tem->tvs_params[0]) {
+ case 25: /* show cursor */
+ /*
+ * Note that cursor is not displayed either way
+ * at this entry point. Clearing the flag ensures
+ * that on exit from tem_safe_terminal_emulate
+ * we will display the cursor.
+ */
+ tem_safe_send_data(tem, credp, called_from);
+ tem->tvs_cursor_hidden = B_FALSE;
+ break;
+ }
+ break;
+
+ case 'l':
+ /* DEC private mode reset */
+ tem_safe_setparam(tem, 1, 1);
+ switch (tem->tvs_params[0]) {
+ case 25: /* hide cursor */
+ /*
+ * Note that the cursor is not displayed already.
+ * This is true regardless of the flag state.
+ * Setting this flag ensures we won't display it
+ * on exit from tem_safe_terminal_emulate.
+ */
+ tem_safe_send_data(tem, credp, called_from);
+ tem->tvs_cursor_hidden = B_TRUE;
+ break;
+ }
+ break;
+ }
+ tem->tvs_state = A_STATE_START;
+}
/*
* Gather the parameters of an ANSI escape sequence
@@ -1180,9 +1224,25 @@ tem_safe_getparams(struct tem_vt_state *tem, tem_char_t ch,
tem->tvs_paramval = ((tem->tvs_paramval * 10) + (ch - '0'));
tem->tvs_gotparam = B_TRUE; /* Remember got parameter */
return; /* Return immediately */
- } else if (tem->tvs_state == A_STATE_CSI_EQUAL ||
- tem->tvs_state == A_STATE_CSI_QMARK) {
+ } else if (tem->tvs_state == A_STATE_CSI_EQUAL) {
tem->tvs_state = A_STATE_START;
+ } else if (tem->tvs_state == A_STATE_CSI_QMARK) {
+ if (tem->tvs_curparam < TEM_MAXPARAMS) {
+ if (tem->tvs_gotparam) {
+ /* get the parameter value */
+ tem->tvs_params[tem->tvs_curparam] =
+ tem->tvs_paramval;
+ }
+ tem->tvs_curparam++;
+ }
+ if (ch == ';') {
+ /* Restart parameter search */
+ tem->tvs_gotparam = B_FALSE;
+ tem->tvs_paramval = 0; /* No parameter value yet */
+ } else {
+ /* Handle escape sequence */
+ tem_safe_chkparam_qmark(tem, ch, credp, called_from);
+ }
} else {
if (tem->tvs_curparam < TEM_MAXPARAMS) {
if (tem->tvs_gotparam) {
@@ -1196,7 +1256,7 @@ tem_safe_getparams(struct tem_vt_state *tem, tem_char_t ch,
if (ch == ';') {
/* Restart parameter search */
tem->tvs_gotparam = B_FALSE;
- tem->tvs_paramval = 0; /* No parame value yet */
+ tem->tvs_paramval = 0; /* No parameter value yet */
} else {
/* Handle escape sequence */
tem_safe_chkparam(tem, ch, credp, called_from);
diff --git a/usr/src/uts/common/sys/tem_impl.h b/usr/src/uts/common/sys/tem_impl.h
index 202eebb45b..d8731efc55 100644
--- a/usr/src/uts/common/sys/tem_impl.h
+++ b/usr/src/uts/common/sys/tem_impl.h
@@ -29,6 +29,10 @@
/* Copyright (c) 1984, 1986, 1987, 1988, 1989, 1990 AT&T */
/* All Rights Reserved */
+/*
+ * Copyright 2021 RackTop Systems, Inc.
+ */
+
#ifndef _SYS_TEM_IMPL_H
#define _SYS_TEM_IMPL_H
@@ -76,7 +80,7 @@ extern "C" {
#define TEM_ATTR(c) (((c) & TEM_ATTR_MASK) << 21)
#define TEM_ATTR_ISSET(c, a) ((TEM_CHAR_ATTR(c) & (a)) == (a))
-#define TEM_MAXPARAMS 5 /* maximum number of ANSI paramters */
+#define TEM_MAXPARAMS 32 /* maximum number of ANSI paramters */
#define TEM_MAXFKEY 30 /* max length of function key with <ESC>Q */
#define TEM_SCROLL_UP 0
@@ -228,6 +232,7 @@ struct tem_vt_state {
boolean_t tvs_isactive;
boolean_t tvs_initialized; /* initialization flag */
+ boolean_t tvs_cursor_hidden;
list_node_t tvs_list_node;
};