summaryrefslogtreecommitdiff
path: root/usr/src/uts/common
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 /usr/src/uts/common
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>
Diffstat (limited to 'usr/src/uts/common')
-rw-r--r--usr/src/uts/common/io/tem_safe.c70
-rw-r--r--usr/src/uts/common/sys/tem_impl.h7
2 files changed, 71 insertions, 6 deletions
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;
};