[vte/wip/egmont/bidi: 12/79] BDSM and SPD escape sequences
- From: Egmont Koblinger <egmontkob src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vte/wip/egmont/bidi: 12/79] BDSM and SPD escape sequences
- Date: Fri, 28 Sep 2018 08:13:02 +0000 (UTC)
commit 4377591e4fd14a8610392c0bfcd45f8804896f60
Author: Egmont Koblinger <egmont gmail com>
Date: Fri Aug 17 20:00:14 2018 +0200
BDSM and SPD escape sequences
src/modes-ecma.hh | 17 +++++++++++++++--
src/modes.hh | 3 ++-
src/parser-cmd.hh | 2 +-
src/parser-csi.hh | 2 +-
src/vte.cc | 2 ++
src/vteinternal.hh | 3 +++
src/vteseq.cc | 19 +++++++++++++++++++
7 files changed, 43 insertions(+), 5 deletions(-)
---
diff --git a/src/modes-ecma.hh b/src/modes-ecma.hh
index 617d2985..9c767ac1 100644
--- a/src/modes-ecma.hh
+++ b/src/modes-ecma.hh
@@ -38,6 +38,20 @@
*/
MODE(IRM, 4)
+/*
+ * BDSM - Bi-Directional Support Mode
+ *
+ * Reset state is explicit mode, set state is implicit mode
+ *
+ * References: ECMA-48
+ * ECMA TR/53
+ * [FIXME link to our spec]
+ *
+ * Default in ECMA: reset
+ * Default in VTE: set
+ */
+MODE(BDSM, 8)
+
/*
* SRM - local echo send/receive mode
* If reset, characters entered by the keyboard are shown on the
@@ -59,8 +73,7 @@ MODE_FIXED(CRM, 3, ALWAYS_RESET)
MODE_FIXED(SRTM, 5, ALWAYS_RESET)
MODE_FIXED(ERM, 6, ALWAYS_RESET)
MODE_FIXED(VEM, 7, ALWAYS_RESET)
-MODE_FIXED(BDSM, 8, ALWAYS_RESET)
-MODE_FIXED(DCSM, 9, ALWAYS_RESET)
+MODE_FIXED(DCSM, 9, ALWAYS_SET)
MODE_FIXED(HEM, 10, ALWAYS_RESET)
MODE_FIXED(PUM, 11, ALWAYS_RESET) /* ECMA-48 § F.4.1 Deprecated */
MODE_FIXED(FEAM, 13, ALWAYS_RESET)
diff --git a/src/modes.hh b/src/modes.hh
index b7fe53fc..a6d62833 100644
--- a/src/modes.hh
+++ b/src/modes.hh
@@ -164,7 +164,8 @@ public:
#undef MODE
#undef MODE_FIXED
- constexpr ECMA() : Self{eSRM} { }
+ constexpr ECMA() : Self{eBDSM,
+ eSRM} { }
}; // class ECMA
diff --git a/src/parser-cmd.hh b/src/parser-cmd.hh
index 16d6458c..1946b92c 100644
--- a/src/parser-cmd.hh
+++ b/src/parser-cmd.hh
@@ -106,6 +106,7 @@ _VTE_CMD(SD_OR_XTERM_IHMT) /* scroll down or xterm initiate highlight mouse trac
_VTE_CMD(SGR) /* select graphics rendition */
_VTE_CMD(SM_DEC) /* set mode dec */
_VTE_CMD(SM_ECMA) /* set mode ecma */
+_VTE_CMD(SPD) /* select presentation directions */
_VTE_CMD(SS2) /* single shift 2 */
_VTE_CMD(SS3) /* single shift 3 */
_VTE_CMD(SUB) /* substitute */
@@ -286,7 +287,6 @@ _VTE_NOP(SL) /* scroll left */
_VTE_NOP(SLS) /* set line spacing */
_VTE_NOP(SOH) /* start of heading */
_VTE_NOP(SPA) /* start of protected area */
-_VTE_NOP(SPD) /* select presentation directions */
_VTE_NOP(SPH) /* set page home */
_VTE_NOP(SPI) /* spacing increment */
_VTE_NOP(SPL) /* set page limit */
diff --git a/src/parser-csi.hh b/src/parser-csi.hh
index 4a4a1dd9..ac242cd4 100644
--- a/src/parser-csi.hh
+++ b/src/parser-csi.hh
@@ -59,7 +59,7 @@ _VTE_NOQ(SEE, CSI, 'Q', NONE, 0, NONE ) /* select ed
_VTE_NOQ(PPR, CSI, 'Q', NONE, 1, SPACE ) /* page-position-relative */
_VTE_NOQ(PPB, CSI, 'R', NONE, 1, SPACE ) /* page-position-backward */
_VTE_SEQ(SU, CSI, 'S', NONE, 0, NONE ) /* scroll-up */
-_VTE_NOQ(SPD, CSI, 'S', NONE, 1, SPACE ) /* select presentation directions */
+_VTE_SEQ(SPD, CSI, 'S', NONE, 1, SPACE ) /* select presentation directions */
_VTE_NOQ(XTERM_SGFX, CSI, 'S', WHAT, 0, NONE ) /* xterm-sixel-graphics */
_VTE_SEQ(SD_OR_XTERM_IHMT, CSI, 'T', NONE, 0, NONE ) /* scroll-down or
xterm-initiate-highlight-mouse-tracking */
_VTE_NOQ(DTA, CSI, 'T', NONE, 1, SPACE ) /* dimension text area */
diff --git a/src/vte.cc b/src/vte.cc
index ba82f7a4..cb8e7d23 100644
--- a/src/vte.cc
+++ b/src/vte.cc
@@ -9888,6 +9888,8 @@ Terminal::reset(bool clear_tabstops,
/* Reset the saved cursor. */
save_cursor(&m_normal_screen);
save_cursor(&m_alternate_screen);
+ /* BiDi */
+ m_bidi_rtl = FALSE;
/* Cause everything to be redrawn (or cleared). */
invalidate_all();
diff --git a/src/vteinternal.hh b/src/vteinternal.hh
index 77d54276..e3f742f0 100644
--- a/src/vteinternal.hh
+++ b/src/vteinternal.hh
@@ -629,6 +629,9 @@ public:
const char *m_hyperlink_hover_uri; /* data is owned by the ring */
long m_hyperlink_auto_id;
+ /* BiDi */
+ gboolean m_bidi_rtl : 1;
+
public:
// FIXMEchpe inline!
diff --git a/src/vteseq.cc b/src/vteseq.cc
index 01488efd..abd308cb 100644
--- a/src/vteseq.cc
+++ b/src/vteseq.cc
@@ -7266,7 +7266,26 @@ Terminal::SPD(vte::parser::Sequence const& seq)
* args[1]: 0
*
* References: ECMA-48 § 8.3.130
+ * [FIXME link to our spec]
*/
+
+ auto const param = seq.collect1(0);
+ switch (param) {
+ case -1:
+ case 0:
+ m_bidi_rtl = FALSE;
+ _vte_debug_print(VTE_DEBUG_BIDI, "BiDi: switch to LTR\n");
+ break;
+ case 3:
+ m_bidi_rtl = TRUE;
+ _vte_debug_print(VTE_DEBUG_BIDI, "BiDi: switch to RTL\n");
+ break;
+ default:
+ /* FIXME switch to the emulator's default */
+ m_bidi_rtl = FALSE;
+ _vte_debug_print(VTE_DEBUG_BIDI, "BiDi: default direction restored\n");
+ break;
+ }
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]