diff --git a/src/model/document_data.js b/src/model/document_data.js
index <HASH>..<HASH> 100644
--- a/src/model/document_data.js
+++ b/src/model/document_data.js
@@ -94,6 +94,7 @@ export function attachDoc(cm, doc) {
   estimateLineHeights(cm)
   loadMode(cm)
   setDirectionClass(cm)
+  cm.options.direction = doc.direction
   if (!cm.options.lineWrapping) findMaxLine(cm)
   cm.options.mode = doc.modeOption
   regChange(cm)
Make sure options.direction and doc.direction stay in sync

Closes #<I>