• R/O
  • SSH
  • HTTPS

tortoisesvn: Commit


Commit MetaInfo

Revision28264 (tree)
Time2018-07-03 04:24:57
Authorstefankueng

Log Message

Enable bidirectional mode on Scintilla when editing, but create an option to disable this if necessary.

Change Summary

Incremental Difference

--- trunk/doc/source/en/TortoiseSVN/tsvn_dug/dug_settings_advanced.xml (revision 28263)
+++ trunk/doc/source/en/TortoiseSVN/tsvn_dug/dug_settings_advanced.xml (revision 28264)
@@ -471,6 +471,19 @@
471471 </listitem>
472472 </varlistentry>
473473 <varlistentry>
474+ <term condition="pot">ScintillaBidirectional</term>
475+ <listitem>
476+ <para>
477+ This option enables the bidirectional mode
478+ for the commit message edit box. If enabled,
479+ right-to-left language text editing is done
480+ properly. Since this feature is expensive, it
481+ can be disabled on slower machines by setting this value
482+ to <literal>false</literal>.
483+ </para>
484+ </listitem>
485+ </varlistentry>
486+ <varlistentry>
474487 <term condition="pot">ScintillaDirect2D</term>
475488 <listitem>
476489 <para>
--- trunk/src/TortoiseProc/Settings/SettingsAdvanced.cpp (revision 28263)
+++ trunk/src/TortoiseProc/Settings/SettingsAdvanced.cpp (revision 28264)
@@ -149,6 +149,10 @@
149149 settings[i].type = CSettingsAdvanced::SettingTypeBoolean;
150150 settings[i++].def.b = true;
151151
152+ settings[i].sName = L"ScintillaBidirectional";
153+ settings[i].type = CSettingsAdvanced::SettingTypeBoolean;
154+ settings[i++].def.b = true;
155+
152156 settings[i].sName = L"ScintillaDirect2D";
153157 settings[i].type = CSettingsAdvanced::SettingTypeBoolean;
154158 settings[i++].def.b = true;
@@ -181,7 +185,7 @@
181185 settings[i].type = CSettingsAdvanced::SettingTypeNone;
182186 settings[i++].def.b = false;
183187
184- // 39 so far...
188+ // 40 so far...
185189 ASSERT(i < _countof(settings));
186190 }
187191
--- trunk/src/Utils/MiscUI/SciEdit.cpp (revision 28263)
+++ trunk/src/Utils/MiscUI/SciEdit.cpp (revision 28264)
@@ -168,8 +168,6 @@
168168 //Set the default windows colors for edit controls
169169 Call(SCI_STYLESETFORE, STYLE_DEFAULT, ::GetSysColor(COLOR_WINDOWTEXT));
170170 Call(SCI_STYLESETBACK, STYLE_DEFAULT, ::GetSysColor(COLOR_WINDOW));
171- Call(SCI_SETSELFORE, TRUE, ::GetSysColor(COLOR_HIGHLIGHTTEXT));
172- Call(SCI_SETSELBACK, TRUE, ::GetSysColor(COLOR_HIGHLIGHT));
173171 Call(SCI_SETCARETFORE, ::GetSysColor(COLOR_WINDOWTEXT));
174172 Call(SCI_SETMODEVENTMASK, SC_MOD_INSERTTEXT | SC_MOD_DELETETEXT | SC_PERFORMED_UNDO | SC_PERFORMED_REDO);
175173 Call(SCI_INDICSETSTYLE, INDIC_MISSPELLED, INDIC_SQUIGGLE);
@@ -281,7 +279,36 @@
281279 // now enable D2D
282280 Call(SCI_SETTECHNOLOGY, SC_TECHNOLOGY_DIRECTWRITERETAIN);
283281 Call(SCI_SETBUFFEREDDRAW, 0);
282+ CRegStdDWORD useBiDi(L"Software\\TortoiseSVN\\ScintillaBidirectional", TRUE);
283+ if (DWORD(useBiDi))
284+ {
285+ // enable bidirectional mode
286+ // note: bidirectional mode requires d2d, and to make selections
287+ // work properly, the SCI_SETSELALPHA needs to be enabled.
288+ // See here for why:
289+ // https://groups.google.com/d/msg/scintilla-interest/0EnDpY9Tsbw/ohCgEZqqBwAJ
290+ // "For now, only translucent background selection works properly in bidirectional mode"
291+ //
292+ // note2: bidirectional mode is only required when editing.
293+ // Scintilla will show bidirectional text just fine even if bidirectional mode is not enabled.
294+ // And the cost of enabling bidirectional mode is ok since we're dealing here with
295+ // commit messages, not whole books.
296+ Call(SCI_SETSELFORE, TRUE, ::GetSysColor(COLOR_WINDOWTEXT));
297+ Call(SCI_SETSELBACK, TRUE, ::GetSysColor(COLOR_HIGHLIGHT));
298+ Call(SCI_SETSELALPHA, 128);
299+ Call(SCI_SETBIDIRECTIONAL, SC_BIDIRECTIONAL_L2R);
300+ }
301+ else
302+ {
303+ Call(SCI_SETSELFORE, TRUE, ::GetSysColor(COLOR_HIGHLIGHTTEXT));
304+ Call(SCI_SETSELBACK, TRUE, ::GetSysColor(COLOR_HIGHLIGHT));
305+ }
284306 }
307+ else
308+ {
309+ Call(SCI_SETSELFORE, TRUE, ::GetSysColor(COLOR_HIGHLIGHTTEXT));
310+ Call(SCI_SETSELBACK, TRUE, ::GetSysColor(COLOR_HIGHLIGHT));
311+ }
285312 }
286313
287314 void CSciEdit::Init(const ProjectProperties& props)
Show on old repository browser