]> git.lyx.org Git - lyx.git/blobdiff - src/Bidi.cpp
white space -> tabs
[lyx.git] / src / Bidi.cpp
index 342e7e86f76a8ba0ae674f3a896c0308389c75df..37cb87520a1e0f31b5a1ce84ef7e9d6bbf3fcc8a 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;
        }
@@ -94,7 +95,14 @@ void Bidi::computeTables(Paragraph const & par,
        pos_type const body_pos = par.beginOfBody();
 
        for (pos_type lpos = start_; lpos <= end_; ++lpos) {
-               bool is_space = par.isLineSeparator(lpos);
+               bool is_space = false;
+               // We do not handle spaces around an RTL segment in a special way anymore.
+               // Neither do we do so when generating the LaTeX, so setting is_space
+               // to false makes the view in the GUI consistent with the output of LaTeX 
+               // later. The old setting was:
+               //bool is_space = par.isLineSeparator(lpos);
+               // FIXME: once we're sure that this is what we really want, we should just
+               // get rid of this variable...
                pos_type const pos =
                        (is_space && lpos + 1 <= end_ &&
                         !par.isLineSeparator(lpos + 1) &&
@@ -209,4 +217,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