diff -r dd15228b06e7 doc/ScintillaDoc.html
--- a/doc/ScintillaDoc.html	Fri Sep 15 19:51:21 2017 +1000
+++ b/doc/ScintillaDoc.html	Sat Sep 16 11:25:00 2017 +1000
@@ -3589,6 +3589,8 @@
      <a class="message" href="#SCI_GETCODEPAGE">SCI_GETCODEPAGE &rarr; int</a><br />
      <a class="message" href="#SCI_SETIMEINTERACTION">SCI_SETIMEINTERACTION(int imeInteraction)</a><br />
      <a class="message" href="#SCI_GETIMEINTERACTION">SCI_GETIMEINTERACTION &rarr; int</a><br />
+     <a class="message" href="#SCI_SETBIDIRECTIONAL">SCI_SETBIDIRECTIONAL(int bidirectional)</a><br />
+     <a class="message" href="#SCI_GETBIDIRECTIONAL">SCI_GETBIDIRECTIONAL &rarr; int</a><br />
      <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 &rarr; bool</a><br />
@@ -3713,6 +3715,22 @@
      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>
 
+    <p><b id="SCI_SETBIDIRECTIONAL">SCI_SETBIDIRECTIONAL(int bidirectional)</b><br />
+     <b id="SCI_GETBIDIRECTIONAL">SCI_GETBIDIRECTIONAL &rarr; 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".
+     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_ENABLED)</code>.
+     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 <code>SC_BIDIRECTIONAL_ENABLED</code> (1) otherwise
+     <code>SC_BIDIRECTIONAL_DISABLED</code> (0) is returned.
+     </p>
+
     <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 &rarr; bool</b><br />
diff -r dd15228b06e7 include/Scintilla.h
--- a/include/Scintilla.h	Fri Sep 15 19:51:21 2017 +1000
+++ b/include/Scintilla.h	Sat Sep 16 11:25:00 2017 +1000
@@ -107,6 +107,10 @@
 #define SC_IME_INLINE 1
 #define SCI_GETIMEINTERACTION 2678
 #define SCI_SETIMEINTERACTION 2679
+#define SC_BIDIRECTIONAL_DISABLED 0
+#define SC_BIDIRECTIONAL_ENABLED 1
+#define SCI_GETBIDIRECTIONAL 2706
+#define SCI_SETBIDIRECTIONAL 2707
 #define MARKER_MAX 31
 #define SC_MARK_CIRCLE 0
 #define SC_MARK_ROUNDRECT 1
diff -r dd15228b06e7 include/Scintilla.iface
--- a/include/Scintilla.iface	Fri Sep 15 19:51:21 2017 +1000
+++ b/include/Scintilla.iface	Sat Sep 16 11:25:00 2017 +1000
@@ -266,6 +266,16 @@
 # Choose to display the the IME in a winow or inline.
 set void SetIMEInteraction=2679(int imeInteraction,)
 
+enu Bidirectional=SC_BIDIRECTIONAL_
+val SC_BIDIRECTIONAL_DISABLED=0
+val SC_BIDIRECTIONAL_ENABLED=1
+
+# Retrieve whether bidirectional text is correctly displayed.
+get int GetBidirectional=2706(,)
+
+# Set whether bidirectional text is correctly displayed.
+set void SetBidirectional=2707(int bidirectional,)
+
 enu MarkerSymbol=SC_MARK_
 val MARKER_MAX=31
 val SC_MARK_CIRCLE=0
diff -r dd15228b06e7 src/EditModel.cxx
--- a/src/EditModel.cxx	Fri Sep 15 19:51:21 2017 +1000
+++ b/src/EditModel.cxx	Sat Sep 16 11:25:00 2017 +1000
@@ -63,6 +63,7 @@
 	highlightGuideColumn = 0;
 	primarySelection = true;
 	imeInteraction = imeWindowed;
+	bidirectional = Bidirectional::bidiDisabled;
 	foldFlags = 0;
 	foldDisplayTextStyle = SC_FOLDDISPLAYTEXT_HIDDEN;
 	hotspot = Range(Sci::invalidPosition);
diff -r dd15228b06e7 src/EditModel.h
--- a/src/EditModel.h	Fri Sep 15 19:51:21 2017 +1000
+++ b/src/EditModel.h	Sat Sep 16 11:25:00 2017 +1000
@@ -38,6 +38,8 @@
 
 	enum IMEInteraction { imeWindowed, imeInline } imeInteraction;
 
+	enum class Bidirectional { bidiDisabled, bidiEnabled } bidirectional;
+
 	int foldFlags;
 	int foldDisplayTextStyle;
 	ContractionState cs;
diff -r dd15228b06e7 src/Editor.cxx
--- a/src/Editor.cxx	Fri Sep 15 19:51:21 2017 +1000
+++ b/src/Editor.cxx	Sat Sep 16 11:25:00 2017 +1000
@@ -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 dd15228b06e7 win32/ScintillaWin.cxx
--- a/win32/ScintillaWin.cxx	Fri Sep 15 19:51:21 2017 +1000
+++ b/win32/ScintillaWin.cxx	Sat Sep 16 11:25:00 2017 +1000
@@ -1744,6 +1744,17 @@
 			}
 			break;
 
+		case SCI_SETBIDIRECTIONAL:
+			if (technology == SC_TECHNOLOGY_DEFAULT) {
+				bidirectional = EditModel::Bidirectional::bidiDisabled;
+			} else {
+				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));
