]> git.lyx.org Git - lyx.git/blobdiff - src/Bidi.cpp
* do not lookup the same macro all the time
[lyx.git] / src / Bidi.cpp
index 342e7e86f76a8ba0ae674f3a896c0308389c75df..df1f7495d6c11751b167d2cc0ceaec360e577d89 100644 (file)
@@ -12,6 +12,7 @@
 
 #include "Bidi.h"
 #include "Buffer.h"
+#include "BufferView.h"
 #include "Font.h"
 #include "Row.h"
 #include "LyXRC.h"
@@ -59,7 +60,7 @@ void Bidi::computeTables(Paragraph const & par,
                return;
        }
 
-       if (par.ownerCode() == Inset::ERT_CODE) {
+       if (par.ownerCode() == Inset::ERT_CODE || par.ownerCode() == Inset::LISTINGS_CODE) {
                start_ = -1;
                return;
        }
@@ -209,4 +210,24 @@ bool Bidi::isBoundary(Buffer const & buf, Paragraph const & par,
 }
 
 
+bool reverseDirectionNeeded(Cursor const & cur) 
+{
+       /*
+        * We determine the directions based on the direction of the
+        * bottom() --- i.e., outermost --- paragraph, because that is
+        * the only way to achieve consistency of the arrow's movements
+        * within a paragraph, and thus avoid situations in which the
+        * cursor gets stuck.
+        */
+       return cur.bottom().paragraph().isRightToLeftPar(
+                       cur.bv().buffer()->params());
+}
+
+
+bool isWithinRtlParagraph(Cursor const & cur)
+{
+       return cur.innerParagraph().isRightToLeftPar(
+               cur.bv().buffer()->params());
+}
+
 } // namespace lyx