Dov Feldstern wrote:

So how do we decide? If you like, I can send a questionnaire to the user's list (and to everyone I know who uses LyX in Hebrew), and we'll see what they say. But what do we do if it's a tie?


This is what I would send out:

Dear LyX Bidi users!

This is your chance to provide some feedback which could make your LyXing experience just a little bit simpler. We're discussing the issue of how the arrow keys should make the cursor move in bidi documents. We basically have two suggestions, and would like your help in deciding --- based on your experience in writing bidi documents --- which you prefer. Please only respond if you do have experience writing mixed-language documents. If you can supply your own documents which demonstrate where you've run into troubles --- please do so!

See the attached file for details.

Please indicate which version of LyX you tested with. If you know how to check out from svn and compile from the sources, it would be best if you tested this file with an updated version (a fix has already gone in for math insets). And if you're really adventurous, you could test out both alternatives by applying the attached patch to the latest version from svn.

Thanks for your cooperation!
The LyX developers

Attachment: rtl_insets_test.lyx
Description: application/lyx

Index: src/Text3.cpp
===================================================================
--- src.orig/Text3.cpp  2007-05-09 18:50:13.000000000 +0300
+++ src/Text3.cpp       2007-05-09 18:53:31.000000000 +0300
@@ -298,6 +298,19 @@
 }
 
 
+bool Text::reverseDirections(Cursor const & cur) const
+{
+       /*
+        * 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 isRTL(*cur.bv().buffer(), cur.bottom().paragraph());
+}
+
+
 void Text::dispatch(Cursor & cur, FuncRequest & cmd)
 {
        LYXERR(Debug::ACTION) << "Text::dispatch: cmd: " << cmd << endl;
@@ -433,7 +446,7 @@
                //lyxerr << BOOST_CURRENT_FUNCTION
                //       << " LFUN_CHAR_FORWARD[SEL]:\n" << cur << endl;
                needsUpdate |= cur.selHandle(cmd.action == 
LFUN_CHAR_FORWARD_SELECT);
-               if (isRTL(*cur.bv().buffer(), cur.paragraph()))
+               if (reverseDirections(cur))
                        needsUpdate |= cursorLeft(cur);
                else
                        needsUpdate |= cursorRight(cur);
@@ -451,7 +464,7 @@
        case LFUN_CHAR_BACKWARD_SELECT:
                //lyxerr << "handle LFUN_CHAR_BACKWARD[_SELECT]:\n" << cur << 
endl;
                needsUpdate |= cur.selHandle(cmd.action == 
LFUN_CHAR_BACKWARD_SELECT);
-               if (isRTL(*cur.bv().buffer(), cur.paragraph()))
+               if (reverseDirections(cur))
                        needsUpdate |= cursorRight(cur);
                else
                        needsUpdate |= cursorLeft(cur);
@@ -557,7 +570,7 @@
        case LFUN_WORD_FORWARD:
        case LFUN_WORD_FORWARD_SELECT:
                needsUpdate |= cur.selHandle(cmd.action == 
LFUN_WORD_FORWARD_SELECT);
-               if (isRTL(*cur.bv().buffer(), cur.paragraph()))
+               if (reverseDirections(cur))
                        needsUpdate |= cursorLeftOneWord(cur);
                else
                        needsUpdate |= cursorRightOneWord(cur);
@@ -568,7 +581,7 @@
        case LFUN_WORD_BACKWARD:
        case LFUN_WORD_BACKWARD_SELECT:
                needsUpdate |= cur.selHandle(cmd.action == 
LFUN_WORD_BACKWARD_SELECT);
-               if (isRTL(*cur.bv().buffer(), cur.paragraph()))
+               if (reverseDirections(cur))
                        needsUpdate |= cursorRightOneWord(cur);
                else
                        needsUpdate |= cursorLeftOneWord(cur);
@@ -1433,11 +1446,16 @@
 
        case LFUN_FINISHED_LEFT:
                LYXERR(Debug::DEBUG) << "handle LFUN_FINISHED_LEFT:\n" << cur 
<< endl;
+               if (reverseDirections(cur)) {
+                       ++cur.pos();
+               }
                break;
 
        case LFUN_FINISHED_RIGHT:
                LYXERR(Debug::DEBUG) << "handle LFUN_FINISHED_RIGHT:\n" << cur 
<< endl;
-               ++cur.pos();
+               if (!reverseDirections(cur)) {
+                       ++cur.pos();
+               }
                break;
 
        case LFUN_FINISHED_UP:
Index: src/Text.h
===================================================================
--- src.orig/Text.h     2007-05-09 18:50:13.000000000 +0300
+++ src/Text.h  2007-05-09 20:00:07.000000000 +0300
@@ -328,6 +328,8 @@
        docstring getPossibleLabel(Cursor & cur) const;
        /// is this paragraph right-to-left?
        bool isRTL(Buffer const &, Paragraph const & par) const;
+       /// should cursor movements be reversed (for bidi)?
+       bool reverseDirections(Cursor const & cur) const;
        ///
        bool checkAndActivateInset(Cursor & cur, bool front);
 
Index: src/Cursor.cpp
===================================================================
--- src.orig/Cursor.cpp 2007-05-09 19:57:21.000000000 +0300
+++ src/Cursor.cpp      2007-05-09 20:30:36.000000000 +0300
@@ -1345,4 +1345,10 @@
 }
 
 
+bool Cursor::reverseDirections() const
+{
+       return bottom().paragraph().isRightToLeftPar(bv().buffer()->params());
+}
+
+
 } // namespace lyx
Index: src/Cursor.h
===================================================================
--- src.orig/Cursor.h   2007-05-09 19:57:19.000000000 +0300
+++ src/Cursor.h        2007-05-09 19:57:25.000000000 +0300
@@ -309,6 +309,8 @@
        Font getFont() const;
        ///
        bool isRTL() const;
+       ///
+       bool reverseDirections() const;
 };
 
 
Index: src/mathed/InsetMathNest.cpp
===================================================================
--- src.orig/mathed/InsetMathNest.cpp   2007-05-09 19:55:33.000000000 +0300
+++ src/mathed/InsetMathNest.cpp        2007-05-09 20:00:49.000000000 +0300
@@ -492,7 +492,7 @@
                cur.autocorrect() = false;
                cur.clearTargetX();
                cur.macroModeClose();
-               if (cur.isRTL() )
+               if (cur.reverseDirections())
                        goto goto_char_backwards;
 
 goto_char_forwards:
@@ -515,7 +515,7 @@
                cur.autocorrect() = false;
                cur.clearTargetX();
                cur.macroModeClose();
-               if (cur.isRTL())
+               if (cur.reverseDirections())
                        goto goto_char_forwards;
 
 goto_char_backwards:

Reply via email to