diff --git a/src/ChangeLog b/src/ChangeLog index 21cd8f7092..baab579b36 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2002-07-13 Dekel Tsur + + * lyxfunc.C (dispatch): Correct cursor behaviour when exiting + an inset in a RTL paragraph. + 2002-07-12 John Levon * lyxfunc.C: repaint after a font size update diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index d0d9a64b0d..ac92d8bca4 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,8 @@ +2002-07-13 Dekel Tsur + + * insettext.C (unlockInsetInInset): Correct cursor behaviour for + RTL paragraphs. + 2002-07-05 Angus Leeming * inset.h (generatePreview): new virtual method. diff --git a/src/insets/insettabular.C b/src/insets/insettabular.C index 39138732fe..d205b6455d 100644 --- a/src/insets/insettabular.C +++ b/src/insets/insettabular.C @@ -585,10 +585,17 @@ void InsetTabular::edit(BufferView * bv, bool front) the_locking_inset = 0; inset_x = 0; inset_y = 0; - if (front) - actcell = 0; - else - actcell = tabular->GetNumberOfCells() - 1; + if (front) { + if (isRightToLeft(bv)) + actcell = tabular->GetLastCellInRow(0); + else + actcell = 0; + } else { + if (isRightToLeft(bv)) + actcell = tabular->GetFirstCellInRow(tabular->rows()-1); + else + actcell = tabular->GetNumberOfCells() - 1; + } clearSelection(); resetPos(bv); bv->fitCursor(); diff --git a/src/insets/insettext.C b/src/insets/insettext.C index c172d3ec13..21d24736d6 100644 --- a/src/insets/insettext.C +++ b/src/insets/insettext.C @@ -932,7 +932,7 @@ bool InsetText::unlockInsetInInset(BufferView * bv, UpdatableInset * inset, getLyXText(bv)->updateInset(bv, inset); the_locking_inset = 0; if (lr) - moveRight(bv, false); + moveRightIntern(bv, true, false); old_par = 0; // force layout setting if (scroll()) scroll(bv, 0.0F); @@ -1842,7 +1842,7 @@ UpdatableInset::RESULT InsetText::moveRight(BufferView * bv, bool activate_inset, bool selecting) { if (getLyXText(bv)->cursor.par()->isRightToLeftPar(bv->buffer()->params)) - return moveLeftIntern(bv, true, activate_inset, selecting); + return moveLeftIntern(bv, false, activate_inset, selecting); else return moveRightIntern(bv, true, activate_inset, selecting); } @@ -1852,7 +1852,7 @@ UpdatableInset::RESULT InsetText::moveLeft(BufferView * bv, bool activate_inset, bool selecting) { if (getLyXText(bv)->cursor.par()->isRightToLeftPar(bv->buffer()->params)) - return moveRightIntern(bv, false, activate_inset, selecting); + return moveRightIntern(bv, true, activate_inset, selecting); else return moveLeftIntern(bv, false, activate_inset, selecting); } diff --git a/src/lyxfunc.C b/src/lyxfunc.C index 8e20115b17..e1d32d92f5 100644 --- a/src/lyxfunc.C +++ b/src/lyxfunc.C @@ -878,18 +878,14 @@ string const LyXFunc::dispatch(kb_action action, string argument) goto exit_with_message; // If UNDISPATCHED, just soldier on else if (result == UpdatableInset::FINISHED) { - if (TEXT()->cursor.par()->isRightToLeftPar(owner->buffer()->params)) { - TEXT()->cursorRight(owner->view()); - moveCursorUpdate(true, false); - owner->showState(); - } - goto exit_with_message; + goto exit_with_message; + // We do not need special RTL handling here: + // FINISHED means that the cursor should be + // one position after the inset. } else if (result == UpdatableInset::FINISHED_RIGHT) { - if (!TEXT()->cursor.par()->isRightToLeftPar(owner->buffer()->params)) { - TEXT()->cursorRight(owner->view()); - moveCursorUpdate(true, false); - owner->showState(); - } + TEXT()->cursorRight(owner->view()); + moveCursorUpdate(true, false); + owner->showState(); goto exit_with_message; } else if (result == UpdatableInset::FINISHED_UP) { if (TEXT()->cursor.irow()->previous()) {