[vte/wip/egmont/bidi: 78/91] SCP
- From: Egmont Koblinger <egmontkob src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vte/wip/egmont/bidi: 78/91] SCP
- Date: Tue, 5 Feb 2019 19:22:34 +0000 (UTC)
commit ac6af2dfaf7529e86206e796efbd2f2284a7e2e0
Author: Egmont Koblinger <egmont gmail com>
Date: Tue Nov 20 01:00:28 2018 +0100
SCP
BIDI-STATUS | 8 ++++----
doc/bidi.txt | 50 +++++++++++++++++++++++++-------------------------
src/parser-cmd.hh | 2 +-
src/parser-csi.hh | 2 +-
src/vteseq.cc | 22 ++++++++++++++++++++++
5 files changed, 53 insertions(+), 31 deletions(-)
---
diff --git a/BIDI-STATUS b/BIDI-STATUS
index aea647ee..27e5d656 100644
--- a/BIDI-STATUS
+++ b/BIDI-STATUS
@@ -1,6 +1,6 @@
Done:
- Implicit (level 1) and Explicit (a small subset only) modes (SM / RM 8).
-- Overall LTR or RTL direction (SPD 0 / 3).
+- Overall LTR or RTL direction (SPD 0 / 3 or SCP 1 / 2).
- Possibility to autodetect paragraph direction (DECSET / DECRST 2501).
- Possibility to make box drawing characters mirrorable (DECSET / DECRST 2500).
- I-Beam cursor shows the character's resolved directionality when the
@@ -19,6 +19,7 @@ Bugs:
- The way the modes apply to paragraphs, and what happens when a paragraph
is split or two paragraphs are joined is just a first hack, needs to be
reviewed, adjusted, fixed properly.
+- SPD should also update all the onscreen lines.
Missing from first release:
- The entire screen is always invalidated. Have some more fine grained
@@ -47,11 +48,10 @@ Not planned at all:
- Operating on the presentation component (DCSM reset).
- BiDi in explicit mode by transferring the embedding levels (SDS, SRS...).
- Escape sequences that modify the emulation behavior (SIMD...).
-- Other silly escape sequences (SCP...).
Useful aliases:
- alias ltr='echo -ne "\e[0 S"'
- alias rtl='echo -ne "\e[3 S"'
+ alias ltr='echo -ne "\e[1 k"'
+ alias rtl='echo -ne "\e[2 k"'
alias implicit='echo -ne "\e[8h"'
alias explicit='echo -ne "\e[8l"'
alias bidi='echo -ne "\e[8h"' # same as implicit
diff --git a/doc/bidi.txt b/doc/bidi.txt
index 3bd4b3ea..200b3b48 100644
--- a/doc/bidi.txt
+++ b/doc/bidi.txt
@@ -54,41 +54,41 @@ squares everywhere.
└──────────────┘
[01m⸤Hello⸣ ⸤Shlm⸣[m
[32m⸢oi7w⸥ ⸢Hello⸥[m
-[36m[3 S⸤Hello⸣ ⸤שָׁלוֹם⸣[0 S[m
+[36m[2 k⸤Hello⸣ ⸤שָׁלוֹם⸣[1 k[m
[01mHello01 ⸤Hello02⸣ Hello03 Shlm01 ⸤Shlm02⸣ Shlm03[m
[32m03oi7w ⸢02oi7w⸥ 01oi7w Hello01 ⸤Hello02⸣ Hello03[m
-[36m[3 SHello01 ⸤Hello02⸣ Hello03 שָׁלוֹם01 ⸤שָׁלוֹם02⸣ שָׁלוֹם03[0 S[m
+[36m[2 kHello01 ⸤Hello02⸣ Hello03 שָׁלוֹם01 ⸤שָׁלוֹם02⸣ שָׁלוֹם03[1 k[m
[01m⸤Shlm⸣ ⸤Hello⸣[m
[32m⸢Hello⸥ ⸢oi7w⸥[m
-[36m[3 S⸤שָׁלוֹם⸣ ⸤Hello⸣[0 S[m
+[36m[2 k⸤שָׁלוֹם⸣ ⸤Hello⸣[1 k[m
[01mShlm01 ⸤Shlm02⸣ Shlm03 Hello01 ⸤Hello02⸣ Hello03[m
[32mHello01 ⸤Hello02⸣ Hello03 03oi7w ⸢02oi7w⸥ 01oi7w[m
-[36m[3 Sשָׁלוֹם01 ⸤שָׁלוֹם02⸣ שָׁלוֹם03 Hello01 ⸤Hello02⸣ Hello03[0 S[m
+[36m[2 kשָׁלוֹם01 ⸤שָׁלוֹם02⸣ שָׁלוֹם03 Hello01 ⸤Hello02⸣ Hello03[1 k[m
[01mParagraph with wrong direction (should look broken)[m
[32mw Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor[m
[32m.incididunt ut labore et dolore magna aliqua oi7[m
-[36m[3 SLorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor שָׁלוֹם incididunt
ut labore et dolore magna aliqua.[0 S[m
+[36m[2 kLorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor שָׁלוֹם incididunt
ut labore et dolore magna aliqua.[1 k[m
[01mDouble wide[m
[32ma<z n>x[m
-[36m[3 Sא<ת a<z[0 S[m
+[36m[2 kא<ת a<z[1 k[m
[01mOld Hungarian Rovásírás[m
(font at https://github.com/OldHungarian/old-hungarian-font)
[32mΛᛩHTΛᛩMↄH ↄ4TH4Λↄ¤ᛝ +ΛↃ[m
-[36m[3 S𐲛𐳖𐳇 𐲏𐳪𐳙𐳍𐳀𐳢𐳐𐳀𐳙 𐲢𐳛𐳮𐳁𐳤𐳑𐳢𐳁𐳤[0 S[m
+[36m[2 k𐲛𐳖𐳇 𐲏𐳪𐳙𐳍𐳀𐳢𐳐𐳀𐳙 𐲢𐳛𐳮𐳁𐳤𐳑𐳢𐳁𐳤[1 k[m
[01mBox[m
- [32m╭─╮ a┌─┐z n╔═╗x ┏━┓[m[3 S
-[36m┛━┗ א╝═╚ת a└─┘z ╯─╰[m[0 S
+ [32m╭─╮ a┌─┐z n╔═╗x ┏━┓[m[2 k
+[36m┛━┗ א╝═╚ת a└─┘z ╯─╰[m[1 k
[01mBox in mirrored mode[m
- [32m╭─╮ a┌─┐z n╔═╗x ┏━┓[m[3 S[?2500h
-[36m┗━┛ א╚═╝ת a└─┘z ╰─╯[m[?2500l[0 S
+ [32m╭─╮ a┌─┐z n╔═╗x ┏━┓[m[2 k[?2500h
+[36m┗━┛ א╚═╝ת a└─┘z ╰─╯[m[?2500l[1 k
┌──────────────────────────────┐
────────────────────────┤ Implicit auto (LTR fallback) ├────────────────────────
@@ -119,24 +119,24 @@ squares everywhere.
└──────────────────────────────┘
[01m⸤Hello⸣ ⸤Shlm⸣[m
[32m⸤Hello⸣ ⸤oi7w⸣[m
-[36m[3 S[?2501h⸤Hello⸣ ⸤שָׁלוֹם⸣[?2501l[0 S[m
+[36m[2 k[?2501h⸤Hello⸣ ⸤שָׁלוֹם⸣[?2501l[1 k[m
[01m⸤Shlm⸣ ⸤Hello⸣[m
[32m⸢Hello⸥ ⸢oi7w⸥[m
-[36m[3 S[?2501h⸤שָׁלוֹם⸣ ⸤Hello⸣[?2501l[0 S[m
+[36m[2 k[?2501h⸤שָׁלוֹם⸣ ⸤Hello⸣[?2501l[1 k[m
[01mParagraph wrapping at foreign word[m
[32mLorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor w[m
[32moi7 incididunt ut labore et dolore magna aliqua.[m
-[36m[3 S[?2501hLorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor שָׁלוֹם
incididunt ut labore et dolore magna aliqua.[?2501l[0 S[m
+[36m[2 k[?2501hLorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor שָׁלוֹם
incididunt ut labore et dolore magna aliqua.[?2501l[1 k[m
[01mBox[m
- [32m╭─╮ a┌─┐z n╔═╗x ┏━┓[m[3 S[?2501h
-[36m┛━┗ א╝═╚ת a└─┘z ╯─╰[m[?2501l[0 S
+ [32m╭─╮ a┌─┐z n╔═╗x ┏━┓[m[2 k[?2501h
+[36m┛━┗ א╝═╚ת a└─┘z ╯─╰[m[?2501l[1 k
[01mBox in mirrored mode[m
- [32m╭─╮ a┌─┐z n╔═╗x ┏━┓[m[3 S[?2501h[?2500h
-[36m┗━┛ א╚═╝ת a└─┘z ╰─╯[m[?2500l[?2501l[0 S
+ [32m╭─╮ a┌─┐z n╔═╗x ┏━┓[m[2 k[?2501h[?2500h
+[36m┗━┛ א╚═╝ת a└─┘z ╰─╯[m[?2500l[?2501l[1 k
┌──────────────┐
────────────────────────────────┤ Explicit LTR ├────────────────────────────────
@@ -162,22 +162,22 @@ squares everywhere.
└──────────────┘
[01m⸤olleH⸣ ⸤Shlm⸣[m
[32m⸢oi7w⸥ ⸢Hello⸥[m
-[36m[8l[3 S⸤olleH⸣ ⸤שָׁלוֹם⸣[0 S[8h[m
+[36m[8l[2 k⸤olleH⸣ ⸤שָׁלוֹם⸣[1 k[8h[m
[01m⸤Shlm⸣ ⸤olleH⸣[m
[32m⸢Hello⸥ ⸢oi7w⸥[m
-[36m[8l[3 S⸤שָׁלוֹם⸣ ⸤olleH⸣[0 S[8h[m
+[36m[8l[2 k⸤שָׁלוֹם⸣ ⸤olleH⸣[1 k[8h[m
[01mFullwidth characters with underlines[m
[32m[4m[Lorem[24m ipsum dolor sit [4:3mamet)[m
-[36m[8l[3 S[4:3m(tema[24m tis rolod muspi [4mmeroL][0 S[8h[m
+[36m[8l[2 k[4:3m(tema[24m tis rolod muspi [4mmeroL][1 k[8h[m
[01mBox[m
- [32m╭─╮ a┌─┐z n╔═╗x ┏━┓[m[8l[3 S
-[36m┛━┗ א╝═╚ת z┘─└a ╯─╰[m[0 S[8h
+ [32m╭─╮ a┌─┐z n╔═╗x ┏━┓[m[8l[2 k
+[36m┛━┗ א╝═╚ת z┘─└a ╯─╰[m[1 k[8h
[01mBox in mirrored mode[m
- [32m╭─╮ a┌─┐z n╔═╗x ┏━┓[m[8l[3 S[?2500h
-[36m┗━┛ א╚═╝ת z└─┘a ╰─╯[m[?2500l[0 S[8h
+ [32m╭─╮ a┌─┐z n╔═╗x ┏━┓[m[8l[2 k[?2500h
+[36m┗━┛ א╚═╝ת z└─┘a ╰─╯[m[?2500l[1 k[8h
────────────────────────────────────────────────────────────────────────────────
diff --git a/src/parser-cmd.hh b/src/parser-cmd.hh
index 8299a002..c562d7c0 100644
--- a/src/parser-cmd.hh
+++ b/src/parser-cmd.hh
@@ -104,6 +104,7 @@ _VTE_CMD(RM_DEC) /* reset mode dec */
_VTE_CMD(RM_ECMA) /* reset mode ecma */
_VTE_CMD(SCORC) /* SCO restore cursor */
_VTE_CMD(SCOSC) /* SCO save cursor */
+_VTE_CMD(SCP) /* select character path */
_VTE_CMD(SD) /* scroll down */
_VTE_CMD(SD_OR_XTERM_IHMT) /* scroll down or xterm initiate highlight mouse tracking */
_VTE_CMD(SGR) /* select graphics rendition */
@@ -277,7 +278,6 @@ _VTE_NOP(RLOGIN_MML) /* RLogin music macro language */
_VTE_NOP(SACS) /* set additional character separation */
_VTE_NOP(SAPV) /* select alternative presentation variants */
_VTE_NOP(SCO) /* select character orientation */
-_VTE_NOP(SCP) /* select character path */
_VTE_NOP(SCS) /* set character spacing */
_VTE_NOP(SDS) /* start directed string */
_VTE_NOP(SEE) /* select editing extent */
diff --git a/src/parser-csi.hh b/src/parser-csi.hh
index 5a21f4b7..53e1f1f8 100644
--- a/src/parser-csi.hh
+++ b/src/parser-csi.hh
@@ -114,7 +114,7 @@ _VTE_NOQ(MC_DEC, CSI, 'i', WHAT, 0, NONE ) /* media-cop
_VTE_NOQ(HPB, CSI, 'j', NONE, 0, NONE ) /* horizontal position backward */
_VTE_NOQ(SPL, CSI, 'j', NONE, 1, SPACE ) /* set page limit */
_VTE_NOQ(VPB, CSI, 'k', NONE, 0, NONE ) /* line position backward */
-_VTE_NOQ(SCP, CSI, 'k', NONE, 1, SPACE ) /* select character path */
+_VTE_SEQ(SCP, CSI, 'k', NONE, 1, SPACE ) /* select character path */
_VTE_SEQ(RM_ECMA, CSI, 'l', NONE, 0, NONE ) /* reset-mode-ecma */
_VTE_SEQ(RM_DEC, CSI, 'l', WHAT, 0, NONE ) /* reset-mode-dec */
_VTE_SEQ(SGR, CSI, 'm', NONE, 0, NONE ) /* select-graphics-rendition */
diff --git a/src/vteseq.cc b/src/vteseq.cc
index 90365006..51f5310f 100644
--- a/src/vteseq.cc
+++ b/src/vteseq.cc
@@ -6913,7 +6913,27 @@ Terminal::SCP(vte::parser::Sequence const& seq)
* args[1]: no default
*
* References: ECMA-48 § 8.3.111
+ * [FIXME link to our spec]
*/
+
+ auto const param = seq.collect1(0);
+ switch (param) {
+ case 1:
+ m_bidi_rtl = FALSE;
+ _vte_debug_print(VTE_DEBUG_BIDI, "BiDi: switch to LTR\n");
+ break;
+ case 2:
+ 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;
+ }
+
+ maybe_apply_bidi_attributes(); // FIXME only apply the one that changed here?
}
void
@@ -7403,6 +7423,8 @@ Terminal::SPD(vte::parser::Sequence const& seq)
}
maybe_apply_bidi_attributes(); // FIXME only apply the one that changed here?
+
+ // FIXME apply to all the onscreen lines!
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]