]> git.lyx.org Git - features.git/commitdiff
Getting rid of LTR bias --- part 3/4
authorDov Feldstern <dov@lyx.org>
Mon, 5 Nov 2007 19:41:16 +0000 (19:41 +0000)
committerDov Feldstern <dov@lyx.org>
Mon, 5 Nov 2007 19:41:16 +0000 (19:41 +0000)
This is a continuation of r21128, r21244

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21448 a592a061-630c-0410-9148-cb99ea01b6c8

14 files changed:
src/BufferView.cpp
src/Cursor.cpp
src/Cursor.h
src/LyXFunc.cpp
src/Text.cpp
src/Text3.cpp
src/TextMetrics.cpp
src/insets/Inset.h
src/mathed/InsetMathHull.cpp
src/mathed/InsetMathHull.h
src/mathed/InsetMathNest.cpp
src/mathed/InsetMathNest.h
src/mathed/InsetMathScript.h
src/mathed/MathMacro.h

index b538fc064945dee951b2080e0a36636cb6df5ddc..5275791927862902c13e92d9efcc3a4a0bd59bdd 100644 (file)
@@ -1320,7 +1320,7 @@ Update::flags BufferView::dispatch(FuncRequest const & cmd)
                if (inset) {
                        if (inset->isActive()) {
                                Cursor tmpcur = cur;
-                               tmpcur.pushLeft(*inset);
+                               tmpcur.pushBackward(*inset);
                                inset->dispatch(tmpcur, tmpcmd);
                                if (tmpcur.result().dispatched()) {
                                        cur.dispatched();
index a64381b018d2ea694dfa70efefeb0a1bd10645b3..791c2602bb97bda44446b8414c49727df1dab07c 100644 (file)
@@ -370,19 +370,19 @@ void Cursor::push(Inset & p)
 }
 
 
-void Cursor::pushLeft(Inset & p)
+void Cursor::pushBackward(Inset & p)
 {
        BOOST_ASSERT(!empty());
-       //lyxerr << "Entering inset " << t << " left" << endl;
+       //lyxerr << "Entering inset " << t << " front" << endl;
        push(p);
        p.idxFirst(*this);
 }
 
 
-bool Cursor::popLeft()
+bool Cursor::popBackward()
 {
        BOOST_ASSERT(!empty());
-       //lyxerr << "Leaving inset to the left" << endl;
+       //lyxerr << "Leaving inset from in front" << endl;
        inset().notifyCursorLeaves(*this);
        if (depth() == 1)
                return false;
@@ -391,10 +391,10 @@ bool Cursor::popLeft()
 }
 
 
-bool Cursor::popRight()
+bool Cursor::popForward()
 {
        BOOST_ASSERT(!empty());
-       //lyxerr << "Leaving inset to the right" << endl;
+       //lyxerr << "Leaving inset from in back" << endl;
        const pos_type lp = (depth() > 1) ? (*this)[depth() - 2].lastpos() : 0;
        inset().notifyCursorLeaves(*this);
        if (depth() == 1)
@@ -440,7 +440,7 @@ void Cursor::resetAnchor()
 
 
 
-bool Cursor::posLeft()
+bool Cursor::posBackward()
 {
        if (pos() == 0)
                return false;
@@ -449,7 +449,7 @@ bool Cursor::posLeft()
 }
 
 
-bool Cursor::posRight()
+bool Cursor::posForward()
 {
        if (pos() == lastpos())
                return false;
@@ -772,10 +772,10 @@ void Cursor::niceInsert(MathAtom const & t)
        plainInsert(t);
        // enter the new inset and move the contents of the selection if possible
        if (t->isActive()) {
-               posLeft();
-               // be careful here: don't use 'pushLeft(t)' as this we need to
+               posBackward();
+               // be careful here: don't use 'pushBackward(t)' as this we need to
                // push the clone, not the original
-               pushLeft(*nextInset());
+               pushBackward(*nextInset());
                // We may not use niceInsert here (recursion)
                MathData ar;
                asArray(safe, ar);
@@ -806,7 +806,7 @@ bool Cursor::backspace()
        if (pos() == 0) {
                // If empty cell, and not part of a big cell
                if (lastpos() == 0 && inset().nargs() == 1) {
-                       popLeft();
+                       popBackward();
                        // Directly delete empty cell: [|[]] => [|]
                        if (inMathed()) {
                                plainErase();
@@ -819,7 +819,7 @@ bool Cursor::backspace()
                        if (inMathed())
                                pullArg();
                        else
-                               popLeft();
+                               popBackward();
                        return true;
                }
        }
@@ -865,7 +865,7 @@ bool Cursor::erase()
        if (pos() == lastpos()) {
                bool one_cell = inset().nargs() == 1;
                if (one_cell && lastpos() == 0) {
-                       popLeft();
+                       popBackward();
                        // Directly delete empty cell: [|[]] => [|]
                        if (inMathed()) {
                                plainErase();
@@ -967,8 +967,8 @@ void Cursor::handleNest(MathAtom const & a, int c)
        MathAtom t = a;
        asArray(cap::grabAndEraseSelection(*this), t.nucleus()->cell(c));
        insert(t);
-       posLeft();
-       pushLeft(*nextInset());
+       posBackward();
+       pushBackward(*nextInset());
 }
 
 
@@ -1019,7 +1019,7 @@ void Cursor::pullArg()
 {
        // FIXME: Look here
        MathData ar = cell();
-       if (popLeft() && inMathed()) {
+       if (popBackward() && inMathed()) {
                plainErase();
                cell().insert(pos(), ar);
                resetAnchor();
@@ -1161,8 +1161,8 @@ bool Cursor::upDownInMath(bool up)
        }
        
        // any improvement going just out of inset?
-       if (popLeft() && inMathed()) {
-               //lyxerr << "updown: popLeft succeeded" << endl;
+       if (popBackward() && inMathed()) {
+               //lyxerr << "updown: popBackward succeeded" << endl;
                int xnew;
                int ynew;
                getPos(xnew, ynew);
@@ -1303,17 +1303,17 @@ void Cursor::handleFont(string const & font)
                // something left in the cell
                if (pos() == 0) {
                        // cursor in first position
-                       popLeft();
+                       popBackward();
                } else if (pos() == lastpos()) {
                        // cursor in last position
-                       popRight();
+                       popForward();
                } else {
                        // cursor in between. split cell
                        MathData::iterator bt = cell().begin();
                        MathAtom at = createInsetMath(from_utf8(font));
                        at.nucleus()->cell(0) = MathData(bt, bt + pos());
                        cell().erase(bt, bt + pos());
-                       popLeft();
+                       popBackward();
                        plainInsert(at);
                }
        } else {
index 1ee104cd52b8a6a9fcbcdb9d10c62c4315325b99..a275260bf895953ddc7397e3eaec7eedadc63bfc 100644 (file)
@@ -48,14 +48,14 @@ public:
        DispatchResult result() const;
        /// add a new cursor slice
        void push(Inset & inset);
-       /// add a new cursor slice, place cursor on left end
-       void pushLeft(Inset & inset);
+       /// add a new cursor slice, place cursor at front (move backwards)
+       void pushBackward(Inset & inset);
        /// pop one level off the cursor
        void pop();
-       /// pop one slice off the cursor stack and go left
-       bool popLeft();
-       /// pop one slice off the cursor stack and go right
-       bool popRight();
+       /// pop one slice off the cursor stack and go backwards
+       bool popBackward();
+       /// pop one slice off the cursor stack and go forward
+       bool popForward();
        /// make sure we are outside of given inset
        void leaveInset(Inset const & inset);
        /// sets cursor part
@@ -112,10 +112,10 @@ public:
        //
        // common part
        //
-       /// move one step to the left
-       bool posLeft();
-       /// move one step to the right
-       bool posRight();
+       /// move one step backwards
+       bool posBackward();
+       /// move one step forward
+       bool posForward();
 
        /// insert an inset
        void insert(Inset *);
index f91736925346c4fe179f1031443e805c50f7ebde..89bcdf1728067ace7ea067672138e57b1a20c2db 100644 (file)
@@ -1841,7 +1841,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                                    && (inset_code == NO_CODE
                                    || inset_code == it->lyxCode())) {
                                        Cursor tmpcur = cur;
-                                       tmpcur.pushLeft(*it);
+                                       tmpcur.pushBackward(*it);
                                        it->dispatch(tmpcur, fr);
                                }
                        }
index d7745e420355141683309ff98ba341f25e22a9f1..fce891497d1c47dd82393174ef4e666f54607881 100644 (file)
@@ -1053,7 +1053,7 @@ bool Text::dissolveInset(Cursor & cur) {
        ParagraphList plist;
        if (cur.lastpit() != 0 || cur.lastpos() != 0)
                plist = paragraphs();
-       cur.popLeft();
+       cur.popBackward();
        // store cursor offset
        if (spit == 0)
                spos += cur.pos();
index 887e9bd05068610bcc3f107efed245aa99368925..b04b475ca1164298a634e29b55d703b704bc2eba 100644 (file)
@@ -179,7 +179,7 @@ static void specialChar(Cursor & cur, InsetSpecialChar::Kind kind)
        cur.recordUndo();
        cap::replaceSelection(cur);
        cur.insert(new InsetSpecialChar(kind));
-       cur.posRight();
+       cur.posForward();
 }
 
 
@@ -558,7 +558,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                                cur.recordUndo();
                        cap::replaceSelection(cur);
                        cur.insert(new InsetNewline);
-                       cur.posRight();
+                       cur.posForward();
                        moveCursor(cur, false);
                }
                break;
@@ -714,7 +714,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                        if (cur.selection())
                                cutSelection(cur, true, false);
                        insertInset(cur, inset);
-                       cur.posRight();
+                       cur.posForward();
                }
                break;
        }
@@ -732,7 +732,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                        insertChar(cur, ' ');
                else {
                        doInsertInset(cur, this, cmd, false, false);
-                       cur.posRight();
+                       cur.posForward();
                }
                moveCursor(cur, false);
                break;
@@ -936,7 +936,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                                cur.insert(new InsetQuotes(c,
                                    bufparams.quotes_language,
                                    InsetQuotes::DoubleQ));
-                       cur.posRight();
+                       cur.posForward();
                }
                else
                        lyx::dispatch(FuncRequest(LFUN_SELF_INSERT, "\""));
@@ -1156,7 +1156,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                        static_cast<InsetInfo *>(inset)->setInfo(to_utf8(ds));
                }
                insertInset(cur, inset);
-               cur.posRight();
+               cur.posForward();
                break;
        }
 #if 0
@@ -1168,7 +1168,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                // Open the inset, and move the current selection
                // inside it.
                doInsertInset(cur, this, cmd, true, true);
-               cur.posRight();
+               cur.posForward();
                // These insets are numbered.
                updateLabels(bv->buffer());
                break;
@@ -1185,13 +1185,13 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                // Open the inset, and move the current selection
                // inside it.
                doInsertInset(cur, this, cmd, true, true);
-               cur.posRight();
+               cur.posForward();
                break;
 
        case LFUN_TABULAR_INSERT:
                // if there were no arguments, just open the dialog
                if (doInsertInset(cur, this, cmd, false, true))
-                       cur.posRight();
+                       cur.posForward();
                else
                        bv->showDialog("tabularcreate");
 
@@ -1203,7 +1203,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                bool content = cur.selection();  // will some text be moved into the inset?
 
                doInsertInset(cur, this, cmd, true, true);
-               cur.posRight();
+               cur.posForward();
                ParagraphList & pars = cur.text()->paragraphs();
 
                TextClass const & tclass = bv->buffer().params().getTextClass();
@@ -1242,7 +1242,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
 
        case LFUN_INDEX_INSERT:
                doInsertInset(cur, this, cmd, true, true);
-               cur.posRight();
+               cur.posForward();
                break;
 
        case LFUN_NOMENCL_INSERT: {
@@ -1260,7 +1260,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                // description entry still needs to be filled in.
                if (cmd.action == LFUN_NOMENCL_INSERT)
                        inset->edit(cur, true);
-               cur.posRight();
+               cur.posForward();
                break;
        }
 
@@ -1274,7 +1274,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
        case LFUN_CLEARDOUBLEPAGE_INSERT:
                // do nothing fancy
                doInsertInset(cur, this, cmd, false, false);
-               cur.posRight();
+               cur.posForward();
                break;
 
        case LFUN_DEPTH_DECREMENT:
@@ -1516,7 +1516,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                        ParagraphParameters p;
                        setParagraphs(cur, p);
                        insertInset(cur, new InsetFloatList(to_utf8(cmd.argument())));
-                       cur.posRight();
+                       cur.posForward();
                } else {
                        lyxerr << "Non-existent float type: "
                               << to_utf8(cmd.argument()) << endl;
index 1e317ba6e555590454773dc6c8768a12cabd6f26..6efe804f0b8fc2fd31ea0f426c9ebc73af6cb0a4 100644 (file)
@@ -369,11 +369,11 @@ bool TextMetrics::redoParagraph(pit_type const pit)
        // when layout is set; when material is pasted.
        int const moveCursor = par.checkBiblio(buffer.params().trackChanges);
        if (moveCursor > 0)
-               const_cast<Cursor &>(bv_->cursor()).posRight();
+               const_cast<Cursor &>(bv_->cursor()).posForward();
        else if (moveCursor < 0) {
                Cursor & cursor = const_cast<Cursor &>(bv_->cursor());
                if (cursor.pos() >= -moveCursor)
-                       cursor.posLeft();
+                       cursor.posBackward();
        }
 
        // Optimisation: this is used in the next two loops
index d7fdbd1439f9f8e454c280736c5decb1cc7b5116..e432a6406b80528e8b3c3bfe6e731c4fb5e481b3 100644 (file)
@@ -180,9 +180,9 @@ public:
        /// Move one physical cell down
        virtual bool idxPrev(Cursor &) const { return false; }
 
-       /// Target pos when we enter the inset from the left by pressing "Right"
+       /// Target pos when we enter the inset while moving forward
        virtual bool idxFirst(Cursor &) const { return false; }
-       /// Target pos when we enter the inset from the right by pressing "Left"
+       /// Target pos when we enter the inset while moving backwards
        virtual bool idxLast(Cursor &) const { return false; }
 
        /// Delete a cell and move cursor
index f344cc1e3c4eabbefdad8651e2db958de1c11462..daa89e1bb1b3b2dc001aabc22a24595b36b5d983 100644 (file)
@@ -1308,10 +1308,10 @@ void InsetMathHull::handleFont2(Cursor & cur, docstring const & arg)
 }
 
 
-void InsetMathHull::edit(Cursor & cur, bool left)
+void InsetMathHull::edit(Cursor & cur, bool front)
 {
        cur.push(*this);
-       left ? idxFirst(cur) : idxLast(cur);
+       front ? idxFirst(cur) : idxLast(cur);
        // The inset formula dimension is not necessarily the same as the
        // one of the instant preview image, so we have to indicate to the
        // BufferView that a metrics update is needed.
index b69b55f75ebeab2156796bd4c47d3659988053a2..e866874bcfd0b5c77167bd702cbe75004ba6d02a 100644 (file)
@@ -196,7 +196,7 @@ public:
        ///
        EDITABLE editable() const { return HIGHLY_EDITABLE; }
        ///
-       void edit(Cursor & cur, bool left);
+       void edit(Cursor & cur, bool front);
        ///
        Inset * editXY(Cursor & cur, int x, int y);
        ///
index f85f6d872f2054a56447bc08605804916126cf16..810dfaa2753ad5af7bd600cb18ffe0bb83aaa2b2 100644 (file)
@@ -507,10 +507,10 @@ void InsetMathNest::doDispatch(Cursor & cur, FuncRequest & cmd)
                cur.clearTargetX();
                cur.macroModeClose();
                if (cur.pos() != cur.lastpos() && cur.openable(cur.nextAtom())) {
-                       cur.pushLeft(*cur.nextAtom().nucleus());
+                       cur.pushBackward(*cur.nextAtom().nucleus());
                        cur.inset().idxFirst(cur);
-               } else if (cur.posRight() || idxRight(cur)
-                       || cur.popRight() || cur.selection())
+               } else if (cur.posForward() || idxRight(cur)
+                       || cur.popForward() || cur.selection())
                        ;
                else {
                        cmd = FuncRequest(LFUN_FINISHED_FORWARD);
@@ -526,11 +526,11 @@ void InsetMathNest::doDispatch(Cursor & cur, FuncRequest & cmd)
                cur.clearTargetX();
                cur.macroModeClose();
                if (cur.pos() != 0 && cur.openable(cur.prevAtom())) {
-                       cur.posLeft();
+                       cur.posBackward();
                        cur.push(*cur.nextAtom().nucleus());
                        cur.inset().idxLast(cur);
-               } else if (cur.posLeft() || idxLeft(cur)
-                       || cur.popLeft() || cur.selection())
+               } else if (cur.posBackward() || idxLeft(cur)
+                       || cur.popBackward() || cur.selection())
                        ;
                else {
                        cmd = FuncRequest(LFUN_FINISHED_BACKWARD);
@@ -729,7 +729,7 @@ void InsetMathNest::doDispatch(Cursor & cur, FuncRequest & cmd)
        case LFUN_INSET_TOGGLE:
                cur.recordUndo();
                lock(!lock());
-               cur.popRight();
+               cur.popForward();
                break;
 
        case LFUN_SELF_INSERT:
@@ -760,8 +760,8 @@ void InsetMathNest::doDispatch(Cursor & cur, FuncRequest & cmd)
                    && cur.macroModeClose()) {
                        MathAtom const atom = cur.prevAtom();
                        if (atom->asNestInset() && atom->isActive()) {
-                               cur.posLeft();
-                               cur.pushLeft(*cur.nextInset());
+                               cur.posBackward();
+                               cur.pushBackward(*cur.nextInset());
                        }
                } else if (!interpretChar(cur, cmd.argument()[0])) {
                        cmd = FuncRequest(LFUN_FINISHED_FORWARD);
@@ -881,8 +881,8 @@ void InsetMathNest::doDispatch(Cursor & cur, FuncRequest & cmd)
                selClearOrDel(cur);
                //cur.plainInsert(MathAtom(new InsetMathMBox(cur.bv())));
                cur.plainInsert(MathAtom(new InsetMathBox(from_ascii("mbox"))));
-               cur.posLeft();
-               cur.pushLeft(*cur.nextInset());
+               cur.posBackward();
+               cur.pushBackward(*cur.nextInset());
                cur.niceInsert(save_selection);
 #else
                if (currentMode() == Inset::TEXT_MODE) {
@@ -1463,7 +1463,7 @@ bool InsetMathNest::interpretChar(Cursor & cur, char_type c)
                        return true;
                }
 
-               if (cur.popRight()) {
+               if (cur.popForward()) {
                        // FIXME: we have to enable full redraw here because of the
                        // visual box corners that define the inset. If we know for
                        // sure that we stay within the same cell we can optimize for
index db4cfa74149cbe18a8c1882d49cc4d7890e438d0..3b54b3a8af1bba9ae72036798aec0785698ef298 100644 (file)
@@ -62,9 +62,9 @@ public:
        /// move one physical cell down
        bool idxPrev(Cursor &) const;
 
-       /// target pos when we enter the inset from the left by pressing "Right"
+       /// target pos when we enter the inset while moving forward
        bool idxFirst(Cursor &) const;
-       /// target pos when we enter the inset from the right by pressing "Left"
+       /// target pos when we enter the inset while moving backwards
        bool idxLast(Cursor &) const;
 
        /// number of cells currently governed by us
index 68a4572d7365df6f604c91bc6d0b25c7427246b0..ad6b1f5c5e540b7e5d62f51aaad80299750dca60 100644 (file)
@@ -47,9 +47,9 @@ public:
        bool idxRight(Cursor & cur) const;
        /// move cursor up or down
        bool idxUpDown(Cursor & cur, bool up) const;
-       /// Target pos when we enter the inset from the left by pressing "Right"
+       /// Target pos when we enter the inset while moving forward
        bool idxFirst(Cursor & cur) const;
-       /// Target pos when we enter the inset from the right by pressing "Left"
+       /// Target pos when we enter the inset while moving backwards
        bool idxLast(Cursor & cur) const;
 
        /// write LaTeX and Lyx code
index 050abe1849d4b2d3e432df0527c95fad91d0c08e..dc90e10304543ebc907e4ef7173cc952736653e7 100644 (file)
@@ -49,9 +49,9 @@ public:
        ///
        Inset * editXY(Cursor & cur, int x, int y);
 
-       /// target pos when we enter the inset from the left by pressing "Right"
+       /// target pos when we enter the inset while moving forward
        bool idxFirst(Cursor &) const;
-       /// target pos when we enter the inset from the right by pressing "Left"
+       /// target pos when we enter the inset while moving backwards
        bool idxLast(Cursor &) const;
 
        ///