1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
|
# HG changeset patch
# User Neil <nyamatongwe@gmail.com>
# Date 1513656040 -39600
# Node ID 73343682cbda0937c5427ee45ea6c9104d97ac1e
# Parent 5246ca55cf2443dbd6d37bc6dfede6d5f3a14a36
Start of bidirectional code - implement SCI_SETBIDIRECTIONAL.
diff -r 5246ca55cf24 -r 73343682cbda doc/ScintillaDoc.html
--- a/doc/ScintillaDoc.html Wed Jan 10 10:04:03 2018 +1100
+++ b/doc/ScintillaDoc.html Tue Dec 19 15:00:40 2017 +1100
@@ -119,7 +119,7 @@
<h1>Scintilla Documentation</h1>
- <p>Last edited 11 August 2017 NH</p>
+ <p>Last edited 10 January 2018 NH</p>
<p>There is <a class="jump" href="Design.html">an overview of the internal design of
Scintilla</a>.<br />
@@ -3594,6 +3594,10 @@
<a class="message" href="#SCI_GETCODEPAGE">SCI_GETCODEPAGE → int</a><br />
<a class="message" href="#SCI_SETIMEINTERACTION">SCI_SETIMEINTERACTION(int imeInteraction)</a><br />
<a class="message" href="#SCI_GETIMEINTERACTION">SCI_GETIMEINTERACTION → int</a><br />
+<div class="provisional">
+ <a class="message" href="#SCI_SETBIDIRECTIONAL"><span class="provisional">SCI_SETBIDIRECTIONAL(int bidirectional)</span></a><br />
+ <a class="message" href="#SCI_GETBIDIRECTIONAL">SCI_GETBIDIRECTIONAL → int</a><br />
+</div>
<a class="message" href="#SCI_GRABFOCUS">SCI_GRABFOCUS</a><br />
<a class="message" href="#SCI_SETFOCUS">SCI_SETFOCUS(bool focus)</a><br />
<a class="message" href="#SCI_GETFOCUS">SCI_GETFOCUS → bool</a><br />
@@ -3718,6 +3722,27 @@
and the inline behaviour with <code>SCI_SETIMEINTERACTION(SC_IME_INLINE)</code>.
Scintilla may ignore this call in some cases. For example, the inline behaviour might only be supported for some languages.</p>
+<div class="provisional">
+ <a href="#ProvisionalMessages">These bidirectional features are not yet implemented and the API is provisional</a><br />
+ <p><b id="SCI_SETBIDIRECTIONAL">SCI_SETBIDIRECTIONAL(int bidirectional)</b><br />
+ <b id="SCI_GETBIDIRECTIONAL">SCI_GETBIDIRECTIONAL → int</b><br />
+ Some languages, like Arabic and Hebrew, are written from right to left instead of from left to right as English is.
+ Documents that use multiple languages may contain both directions and this is termed "bidirectional".
+ The default text direction may be right to left or left to right.
+ Scintilla only correctly displays bidirectional text on some platforms and there can be additional processing and storage
+ costs to this.
+ Currently, bidirectional text only works on Win32 using DirectWrite.
+ As some applications may not want to pay the costs, bidirectional support must be explicitly enabled by calling
+ <code>SCI_SETBIDIRECTIONAL(SC_BIDIRECTIONAL_L2R)</code> (1) which chooses left to right as the default direction or
+ <code>SCI_SETBIDIRECTIONAL(SC_BIDIRECTIONAL_R2L)</code> (2) for default right to left.
+ This should be done after setting the technology to <code>SC_TECHNOLOGY_DIRECTWRITE</code>,
+ <code>SC_TECHNOLOGY_DIRECTWRITERETAIN</code>, or
+ <code>SC_TECHNOLOGY_DIRECTWRITEDC</code>.</p>
+ <p>If the call succeeded <code>SCI_GETBIDIRECTIONAL</code> will return the same value otherwise
+ <code>SC_BIDIRECTIONAL_DISABLED</code> (0) is returned.
+ </p>
+</div>
+
<p><b id="SCI_GRABFOCUS">SCI_GRABFOCUS</b><br />
<b id="SCI_SETFOCUS">SCI_SETFOCUS(bool focus)</b><br />
<b id="SCI_GETFOCUS">SCI_GETFOCUS → bool</b><br />
@@ -8073,8 +8098,6 @@
<p>Provisional features are displayed in this document with <span class="provisional">a distinctive background colour</span>.</p>
- <p>There are currently no provisional messages or values.</p>
-
<p>Some developers may want to only use features that are stable and have graduated from
provisional status. To avoid using provisional messages compile with the symbol
<code>SCI_DISABLE_PROVISIONAL</code> defined.</p>
diff -r 5246ca55cf24 -r 73343682cbda include/Scintilla.h
--- a/include/Scintilla.h Wed Jan 10 10:04:03 2018 +1100
+++ b/include/Scintilla.h Tue Dec 19 15:00:40 2017 +1100
@@ -1103,6 +1103,13 @@
#define SCN_AUTOCCOMPLETED 2030
#define SCN_MARGINRIGHTCLICK 2031
#define SCN_AUTOCSELECTIONCHANGE 2032
+#ifndef SCI_DISABLE_PROVISIONAL
+#define SC_BIDIRECTIONAL_DISABLED 0
+#define SC_BIDIRECTIONAL_L2R 1
+#define SC_BIDIRECTIONAL_R2L 2
+#define SCI_GETBIDIRECTIONAL 2708
+#define SCI_SETBIDIRECTIONAL 2709
+#endif
/* --Autogenerated -- end of section automatically generated from Scintilla.iface */
/* These structures are defined to be exactly the same shape as the Win32
diff -r 5246ca55cf24 -r 73343682cbda include/Scintilla.iface
--- a/include/Scintilla.iface Wed Jan 10 10:04:03 2018 +1100
+++ b/include/Scintilla.iface Tue Dec 19 15:00:40 2017 +1100
@@ -4861,10 +4861,19 @@
evt void MarginRightClick=2031(int modifiers, int position, int margin)
evt void AutoCSelectionChange=2032(int listType, string text, int position)
-# There are no provisional APIs currently, but some arguments to SCI_SETTECHNOLOGY are provisional.
-
cat Provisional
+enu Bidirectional=SC_BIDIRECTIONAL_
+val SC_BIDIRECTIONAL_DISABLED=0
+val SC_BIDIRECTIONAL_L2R=1
+val SC_BIDIRECTIONAL_R2L=2
+
+# Retrieve bidirectional text display state.
+get int GetBidirectional=2708(,)
+
+# Set bidirectional text display state.
+set void SetBidirectional=2709(int bidirectional,)
+
cat Deprecated
# Divide each styling byte into lexical class bits (default: 5) and indicator
diff -r 5246ca55cf24 -r 73343682cbda src/EditModel.cxx
--- a/src/EditModel.cxx Wed Jan 10 10:04:03 2018 +1100
+++ b/src/EditModel.cxx Tue Dec 19 15:00:40 2017 +1100
@@ -63,6 +63,7 @@
highlightGuideColumn = 0;
primarySelection = true;
imeInteraction = imeWindowed;
+ bidirectional = bidiDisabled;
foldFlags = 0;
foldDisplayTextStyle = SC_FOLDDISPLAYTEXT_HIDDEN;
hotspot = Range(Sci::invalidPosition);
diff -r 5246ca55cf24 -r 73343682cbda src/EditModel.h
--- a/src/EditModel.h Wed Jan 10 10:04:03 2018 +1100
+++ b/src/EditModel.h Tue Dec 19 15:00:40 2017 +1100
@@ -38,6 +38,8 @@
enum IMEInteraction { imeWindowed, imeInline } imeInteraction;
+ enum Bidirectional { bidiDisabled, bidiL2R, bidiR2L } bidirectional;
+
int foldFlags;
int foldDisplayTextStyle;
ContractionState cs;
diff -r 5246ca55cf24 -r 73343682cbda src/Editor.cxx
--- a/src/Editor.cxx Wed Jan 10 10:04:03 2018 +1100
+++ b/src/Editor.cxx Tue Dec 19 15:00:40 2017 +1100
@@ -6736,6 +6736,13 @@
case SCI_GETIMEINTERACTION:
return imeInteraction;
+ case SCI_SETBIDIRECTIONAL:
+ // SCI_SETBIDIRECTIONAL is implemented on platform subclasses if they support bidirectional text.
+ break;
+
+ case SCI_GETBIDIRECTIONAL:
+ return static_cast<sptr_t>(bidirectional);
+
// Marker definition and setting
case SCI_MARKERDEFINE:
if (wParam <= MARKER_MAX) {
diff -r 5246ca55cf24 -r 73343682cbda win32/ScintillaWin.cxx
--- a/win32/ScintillaWin.cxx Wed Jan 10 10:04:03 2018 +1100
+++ b/win32/ScintillaWin.cxx Tue Dec 19 15:00:40 2017 +1100
@@ -1744,6 +1744,17 @@
}
break;
+ case SCI_SETBIDIRECTIONAL:
+ if (technology == SC_TECHNOLOGY_DEFAULT) {
+ bidirectional = EditModel::Bidirectional::bidiDisabled;
+ } else if ((wParam >= SC_BIDIRECTIONAL_DISABLED) && (wParam <= SC_BIDIRECTIONAL_R2L)) {
+ bidirectional = static_cast<EditModel::Bidirectional>(wParam);
+ }
+ // Invalidate all cached information including layout.
+ DropGraphics(true);
+ InvalidateStyleRedraw();
+ break;
+
#ifdef SCI_LEXER
case SCI_LOADLEXERLIBRARY:
LexerManager::GetInstance()->Load(reinterpret_cast<const char *>(lParam));
|