[vte] emulation: Implement DECRQM
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vte] emulation: Implement DECRQM
- Date: Tue, 27 Mar 2018 17:44:54 +0000 (UTC)
commit 20eb6baeb78652a585154150a27dd3ec8e58ca2d
Author: Christian Persch <chpe src gnome org>
Date: Tue Mar 27 19:40:12 2018 +0200
emulation: Implement DECRQM
https://bugzilla.gnome.org/show_bug.cgi?id=787007
src/parser-cmd.hh | 2 +-
src/parser.cc | 4 ++--
src/vteseq.cc | 48 ++++++++++++++++++++++++++++++++++++++++++------
3 files changed, 45 insertions(+), 9 deletions(-)
---
diff --git a/src/parser-cmd.hh b/src/parser-cmd.hh
index a6ed6b2..535ccb3 100644
--- a/src/parser-cmd.hh
+++ b/src/parser-cmd.hh
@@ -85,7 +85,7 @@ _VTE_CMD(DECRQCRA) /* request-checksum-of-rectangular-area */
_VTE_CMD(DECRQDE) /* request-display-extent */
_VTE_CMD(DECRQKT) /* request-key-type */
_VTE_CMD(DECRQLP) /* request-locator-position */
-_VTE_CMD(DECRQM_ANSI) /* request-mode-ansi */
+_VTE_CMD(DECRQM_ECMA) /* request-mode-ecma */
_VTE_CMD(DECRQM_DEC) /* request-mode-dec */
_VTE_CMD(DECRQPKFM) /* request-program-key-free-memory */
_VTE_CMD(DECRQPSR) /* request-presentation-state-report */
diff --git a/src/parser.cc b/src/parser.cc
index 53beeca..f03661b 100644
--- a/src/parser.cc
+++ b/src/parser.cc
@@ -553,8 +553,8 @@ static unsigned int vte_parse_host_csi(const struct vte_seq *seq)
return VTE_CMD_DECSTR;
else if (flags == VTE_SEQ_FLAG_DQUOTE) /* DECSCL */
return VTE_CMD_DECSCL;
- else if (flags == VTE_SEQ_FLAG_CASH) /* DECRQM-ANSI */
- return VTE_CMD_DECRQM_ANSI;
+ else if (flags == VTE_SEQ_FLAG_CASH) /* DECRQM-ECMA */
+ return VTE_CMD_DECRQM_ECMA;
else if (flags == (VTE_SEQ_FLAG_CASH |
VTE_SEQ_FLAG_WHAT)) /* DECRQM-DEC */
return VTE_CMD_DECRQM_DEC;
diff --git a/src/vteseq.cc b/src/vteseq.cc
index 69b444a..c832c3f 100644
--- a/src/vteseq.cc
+++ b/src/vteseq.cc
@@ -2860,10 +2860,10 @@ VteTerminalPrivate::DECRQLP(vte::parser::Sequence const& seq)
}
void
-VteTerminalPrivate::DECRQM_ANSI(vte::parser::Sequence const& seq)
+VteTerminalPrivate::DECRQM_ECMA(vte::parser::Sequence const& seq)
{
/*
- * DECRQM_ANSI - request-mode-ansi
+ * DECRQM_ECMA - request-mode-ecma
* The host sends this control function to find out if a particular mode
* is set or reset. The terminal responds with a report mode function.
* @args[0] contains the mode to query.
@@ -2872,11 +2872,29 @@ VteTerminalPrivate::DECRQM_ANSI(vte::parser::Sequence const& seq)
* queried, second argument is 0 if mode is invalid, 1 if mode is set,
* 2 if mode is not set (reset), 3 if mode is permanently set and 4 if
* mode is permanently not set (reset):
- * ANSI: ^[ MODE ; VALUE $ y
+ * ECMA: ^[ MODE ; VALUE $ y
* DEC: ^[ ? MODE ; VALUE $ y
*
- * TODO: implement
+ * References: VT525
*/
+
+ auto const param = seq.collect1(0);
+ auto const mode = m_modes_ecma.mode_from_param(param);
+
+ int value;
+ switch (mode) {
+ case vte::terminal::modes::ECMA::eUNKNOWN: value = 0; break;
+ case vte::terminal::modes::ECMA::eALWAYS_SET: value = 3; break;
+ case vte::terminal::modes::ECMA::eALWAYS_RESET: value = 4; break;
+ default: assert(mode >= 0); value = m_modes_ecma.get(mode) ? 1 : 2; break;
+ }
+
+ _vte_debug_print(VTE_DEBUG_MODES,
+ "Reporting mode %d (%s) is %d\n",
+ param, m_modes_ecma.mode_to_cstring(mode),
+ value);
+
+ reply(seq, VTE_REPLY_DECRPM_ECMA, {param, value});
}
void
@@ -2884,10 +2902,28 @@ VteTerminalPrivate::DECRQM_DEC(vte::parser::Sequence const& seq)
{
/*
* DECRQM_DEC - request-mode-dec
- * Same as DECRQM_ANSI but for DEC modes.
+ * Same as DECRQM_ECMA but for DEC modes.
*
- * TODO: implement
+ * References: VT525
*/
+
+ auto const param = seq.collect1(0);
+ auto const mode = m_modes_private.mode_from_param(param);
+
+ int value;
+ switch (mode) {
+ case vte::terminal::modes::ECMA::eUNKNOWN: value = 0; break;
+ case vte::terminal::modes::ECMA::eALWAYS_SET: value = 3; break;
+ case vte::terminal::modes::ECMA::eALWAYS_RESET: value = 4; break;
+ default: assert(mode >= 0); value = m_modes_private.get(mode) ? 1 : 2; break;
+ }
+
+ _vte_debug_print(VTE_DEBUG_MODES,
+ "Reporting private mode %d (%s) is %d\n",
+ param, m_modes_private.mode_to_cstring(mode),
+ value);
+
+ reply(seq, VTE_REPLY_DECRPM_DEC, {param, value});
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]