mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-24 21:55:29 +00:00
Getting rid of LTR bias --- part 1/?
This is the first patch in a series meant to remove LTR bias from the code. Currently, there are many places in the code where "right" and "left" are used, but where we actually mean "forward" and "backwards" --- which is the same thing in LTR text, but not in RTL/Bidi text. See full details in http://permalink.gmane.org/gmane.editors.lyx.devel/97550. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21128 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
3911d72568
commit
662b58497e
@ -126,8 +126,8 @@
|
||||
# Motion + select group
|
||||
#
|
||||
|
||||
\bind "S-Right" "forward-select"
|
||||
\bind "S-Left" "backward-select"
|
||||
\bind "S-Right" "char-right-select"
|
||||
\bind "S-Left" "char-left-select"
|
||||
\bind "S-Up" "up-select"
|
||||
\bind "S-Down" "down-select"
|
||||
\bind "S-C-Right" "word-forward-select"
|
||||
@ -145,8 +145,8 @@
|
||||
\bind "S-Delete" "cut"
|
||||
|
||||
# Numeric keypad (if Shift+KP_XXX does not switch the NumLock state)
|
||||
\bind "S-KP_Right" "forward-select"
|
||||
\bind "S-KP_Left" "backward-select"
|
||||
\bind "S-KP_Right" "char-right-select"
|
||||
\bind "S-KP_Left" "char-left-select"
|
||||
\bind "S-KP_Up" "up-select"
|
||||
\bind "S-KP_Down" "down-select"
|
||||
\bind "S-C-KP_Right" "word-forward-select"
|
||||
|
@ -182,10 +182,10 @@
|
||||
# Motion + select group
|
||||
#
|
||||
|
||||
\bind "S-Right" "forward-select"
|
||||
\bind "S-Left" "backward-select"
|
||||
\bind "S-C-F" "forward-select"
|
||||
\bind "S-C-B" "backward-select"
|
||||
\bind "S-Right" "char-right-select"
|
||||
\bind "S-Left" "char-left-select"
|
||||
\bind "S-C-F" "char-forward-select"
|
||||
\bind "S-C-B" "char-backward-select"
|
||||
\bind "S-Up" "up-select"
|
||||
\bind "S-Down" "down-select"
|
||||
\bind "S-C-Right" "word-forward-select"
|
||||
@ -220,8 +220,8 @@
|
||||
\bind "Escape" "meta-prefix"
|
||||
|
||||
# Numeric keypad (if Shift+KP_XXX does not switch the NumLock state)
|
||||
\bind "S-KP_Right" "forward-select"
|
||||
\bind "S-KP_Left" "backward-select"
|
||||
\bind "S-KP_Right" "char-right-select"
|
||||
\bind "S-KP_Left" "char-left-select"
|
||||
\bind "S-KP_Up" "up-select"
|
||||
\bind "S-KP_Down" "down-select"
|
||||
\bind "S-C-KP_Right" "word-forward-select"
|
||||
|
@ -108,8 +108,8 @@
|
||||
# Motion + select group
|
||||
#
|
||||
|
||||
\bind "S-Right" "forward-select"
|
||||
\bind "S-Left" "backward-select"
|
||||
\bind "S-Right" "char-right-select"
|
||||
\bind "S-Left" "char-left-select"
|
||||
\bind "S-Up" "up-select"
|
||||
\bind "S-Down" "down-select"
|
||||
\bind "S-M-Right" "word-forward-select"
|
||||
@ -127,8 +127,8 @@
|
||||
\bind "S-Delete" "cut"
|
||||
|
||||
# Numeric keypad (if Shift+KP_XXX does not switch the NumLock state)
|
||||
\bind "S-KP_Right" "forward-select"
|
||||
\bind "S-KP_Left" "backward-select"
|
||||
\bind "S-KP_Right" "char-right-select"
|
||||
\bind "S-KP_Left" "char-left-select"
|
||||
\bind "S-KP_Up" "up-select"
|
||||
\bind "S-KP_Down" "down-select"
|
||||
\bind "S-M-KP_Right" "word-forward-select"
|
||||
|
@ -219,8 +219,8 @@
|
||||
|
||||
\bind "M-Up" "paragraph-move-up"
|
||||
\bind "M-Down" "paragraph-move-down"
|
||||
\bind "S-KP_Right" "forward-select"
|
||||
\bind "S-KP_Left" "backward-select"
|
||||
\bind "S-KP_Right" "char-right-select"
|
||||
\bind "S-KP_Left" "char-left-select"
|
||||
\bind "S-KP_Up" "up-select"
|
||||
\bind "S-KP_Down" "down-select"
|
||||
\bind "S-C-KP_Right" "word-forward-select"
|
||||
|
@ -192,10 +192,10 @@
|
||||
# Motion + select group
|
||||
#
|
||||
|
||||
\bind "S-Right" "forward-select"
|
||||
\bind "S-Left" "backward-select"
|
||||
\bind "S-C-F" "forward-select"
|
||||
\bind "S-C-B" "backward-select"
|
||||
\bind "S-Right" "char-right-select"
|
||||
\bind "S-Left" "char-left-select"
|
||||
\bind "S-C-F" "char-forward-select"
|
||||
\bind "S-C-B" "char-backward-select"
|
||||
\bind "S-Up" "up-select"
|
||||
\bind "S-Down" "down-select"
|
||||
\bind "S-C-Right" "word-forward-select"
|
||||
@ -231,8 +231,8 @@
|
||||
\bind "Escape" "meta-prefix"
|
||||
|
||||
# Numeric keypad (if Shift+KP_XXX does not switch the NumLock state)
|
||||
\bind "S-KP_Right" "forward-select"
|
||||
\bind "S-KP_Left" "backward-select"
|
||||
\bind "S-KP_Right" "char-right-select"
|
||||
\bind "S-KP_Left" "char-left-select"
|
||||
\bind "S-KP_Up" "up-select"
|
||||
\bind "S-KP_Down" "down-select"
|
||||
\bind "S-C-KP_Right" "word-forward-select"
|
||||
|
@ -1031,8 +1031,8 @@ bool LyX::init()
|
||||
|
||||
void LyX::defaultKeyBindings(KeyMap * kbmap)
|
||||
{
|
||||
kbmap->bind("Right", FuncRequest(LFUN_CHAR_FORWARD));
|
||||
kbmap->bind("Left", FuncRequest(LFUN_CHAR_BACKWARD));
|
||||
kbmap->bind("Right", FuncRequest(LFUN_CHAR_RIGHT));
|
||||
kbmap->bind("Left", FuncRequest(LFUN_CHAR_LEFT));
|
||||
kbmap->bind("Up", FuncRequest(LFUN_UP));
|
||||
kbmap->bind("Down", FuncRequest(LFUN_DOWN));
|
||||
|
||||
@ -1070,8 +1070,8 @@ void LyX::defaultKeyBindings(KeyMap * kbmap)
|
||||
//kbmap->bind("KP_Divide", FuncRequest(LFUN_SELF_INSERT));
|
||||
//kbmap->bind("KP_Multiply", FuncRequest(LFUN_SELF_INSERT));
|
||||
//kbmap->bind("KP_Subtract", FuncRequest(LFUN_SELF_INSERT));
|
||||
kbmap->bind("KP_Right", FuncRequest(LFUN_CHAR_FORWARD));
|
||||
kbmap->bind("KP_Left", FuncRequest(LFUN_CHAR_BACKWARD));
|
||||
kbmap->bind("KP_Right", FuncRequest(LFUN_CHAR_RIGHT));
|
||||
kbmap->bind("KP_Left", FuncRequest(LFUN_CHAR_LEFT));
|
||||
kbmap->bind("KP_Up", FuncRequest(LFUN_UP));
|
||||
kbmap->bind("KP_Down", FuncRequest(LFUN_DOWN));
|
||||
kbmap->bind("KP_Home", FuncRequest(LFUN_LINE_BEGIN));
|
||||
|
@ -138,11 +138,15 @@ void LyXAction::init()
|
||||
{ LFUN_CANCEL, "cancel", NoBuffer, System },
|
||||
{ LFUN_CAPTION_INSERT, "caption-insert", Noop, Edit },
|
||||
{ LFUN_CHAR_BACKWARD, "char-backward", ReadOnly | NoUpdate, Edit },
|
||||
{ LFUN_CHAR_BACKWARD_SELECT, "backward-select", ReadOnly | SingleParUpdate, Edit },
|
||||
{ LFUN_CHAR_BACKWARD_SELECT, "char-backward-select", ReadOnly | SingleParUpdate, Edit },
|
||||
{ LFUN_CHAR_DELETE_BACKWARD, "delete-backward", SingleParUpdate, Edit },
|
||||
{ LFUN_CHAR_DELETE_FORWARD, "delete-forward", SingleParUpdate, Edit },
|
||||
{ LFUN_CHAR_FORWARD, "char-forward", ReadOnly | NoUpdate, Edit },
|
||||
{ LFUN_CHAR_FORWARD_SELECT, "forward-select", ReadOnly | SingleParUpdate, Edit },
|
||||
{ LFUN_CHAR_FORWARD_SELECT, "char-forward-select", ReadOnly | SingleParUpdate, Edit },
|
||||
{ LFUN_CHAR_LEFT, "char-left", ReadOnly | NoUpdate, Edit },
|
||||
{ LFUN_CHAR_LEFT_SELECT, "char-left-select", ReadOnly | SingleParUpdate, Edit },
|
||||
{ LFUN_CHAR_RIGHT, "char-right", ReadOnly | NoUpdate, Edit },
|
||||
{ LFUN_CHAR_RIGHT_SELECT, "char-right-select", ReadOnly | SingleParUpdate, Edit },
|
||||
{ LFUN_CLIPBOARD_PASTE, "clipboard-paste", Noop, Edit },
|
||||
{ LFUN_COMMAND_EXECUTE, "command-execute", NoBuffer, Edit },
|
||||
{ LFUN_COMMAND_PREFIX, "command-prefix", NoBuffer, Hidden },
|
||||
@ -357,6 +361,8 @@ void LyXAction::init()
|
||||
{ LFUN_BUFFER_NEXT, "buffer-next", ReadOnly, Buffer },
|
||||
{ LFUN_BUFFER_PREVIOUS, "buffer-previous", ReadOnly, Buffer },
|
||||
{ LFUN_WORDS_COUNT, "words-count", ReadOnly, System },
|
||||
{ LFUN_FINISHED_FORWARD, "", ReadOnly, Hidden },
|
||||
{ LFUN_FINISHED_BACKWARD, "", ReadOnly, Hidden },
|
||||
{ LFUN_FINISHED_RIGHT, "", ReadOnly, Hidden },
|
||||
{ LFUN_FINISHED_LEFT, "", ReadOnly, Hidden },
|
||||
{ LFUN_MOUSE_PRESS, "", ReadOnly, Hidden },
|
||||
|
@ -799,7 +799,7 @@ void Text::deleteWordForward(Cursor & cur)
|
||||
{
|
||||
BOOST_ASSERT(this == cur.text());
|
||||
if (cur.lastpos() == 0)
|
||||
cursorRight(cur);
|
||||
cursorForward(cur);
|
||||
else {
|
||||
cur.resetAnchor();
|
||||
cur.selection() = true;
|
||||
@ -815,7 +815,7 @@ void Text::deleteWordBackward(Cursor & cur)
|
||||
{
|
||||
BOOST_ASSERT(this == cur.text());
|
||||
if (cur.lastpos() == 0)
|
||||
cursorLeft(cur);
|
||||
cursorBackward(cur);
|
||||
else {
|
||||
cur.resetAnchor();
|
||||
cur.selection() = true;
|
||||
@ -1078,9 +1078,9 @@ bool Text::backspace(Cursor & cur)
|
||||
// this is the code for a normal backspace, not pasting
|
||||
// any paragraphs
|
||||
cur.recordUndo(DELETE_UNDO);
|
||||
// We used to do cursorLeftIntern() here, but it is
|
||||
// We used to do cursorBackwardIntern() here, but it is
|
||||
// not a good idea since it triggers the auto-delete
|
||||
// mechanism. So we do a cursorLeftIntern()-lite,
|
||||
// mechanism. So we do a cursorBackwardIntern()-lite,
|
||||
// without the dreaded mechanism. (JMarc)
|
||||
setCursorIntern(cur, cur.pit(), cur.pos() - 1,
|
||||
false, cur.boundary());
|
||||
|
@ -163,16 +163,16 @@ public:
|
||||
///
|
||||
void recUndo(Cursor & cur, pit_type first) const;
|
||||
|
||||
/// Move cursor one position left
|
||||
/// Move cursor one position backwards
|
||||
/**
|
||||
* Returns true if an update is needed after the move.
|
||||
*/
|
||||
bool cursorLeft(Cursor & cur);
|
||||
/// Move cursor one position right
|
||||
bool cursorBackward(Cursor & cur);
|
||||
/// Move cursor one position forward
|
||||
/**
|
||||
* Returns true if an update is needed after the move.
|
||||
*/
|
||||
bool cursorRight(Cursor & cur);
|
||||
bool cursorForward(Cursor & cur);
|
||||
///
|
||||
bool cursorLeftOneWord(Cursor & cur);
|
||||
///
|
||||
|
@ -602,7 +602,7 @@ bool Text::checkAndActivateInset(Cursor & cur, bool front)
|
||||
}
|
||||
|
||||
|
||||
bool Text::cursorLeft(Cursor & cur)
|
||||
bool Text::cursorBackward(Cursor & cur)
|
||||
{
|
||||
// Tell BufferView to test for FitCursor in any case!
|
||||
cur.updateFlags(Update::FitCursor);
|
||||
@ -644,7 +644,7 @@ bool Text::cursorLeft(Cursor & cur)
|
||||
}
|
||||
|
||||
|
||||
bool Text::cursorRight(Cursor & cur)
|
||||
bool Text::cursorForward(Cursor & cur)
|
||||
{
|
||||
// Tell BufferView to test for FitCursor in any case!
|
||||
cur.updateFlags(Update::FitCursor);
|
||||
|
@ -381,15 +381,12 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
|
||||
//lyxerr << BOOST_CURRENT_FUNCTION
|
||||
// << " LFUN_CHAR_FORWARD[SEL]:\n" << cur << endl;
|
||||
needsUpdate |= cur.selHandle(cmd.action == LFUN_CHAR_FORWARD_SELECT);
|
||||
if (reverseDirectionNeeded(cur))
|
||||
needsUpdate |= cursorLeft(cur);
|
||||
else
|
||||
needsUpdate |= cursorRight(cur);
|
||||
needsUpdate |= cursorForward(cur);
|
||||
|
||||
if (!needsUpdate && oldTopSlice == cur.top()
|
||||
&& cur.boundary() == oldBoundary) {
|
||||
cur.undispatched();
|
||||
cmd = FuncRequest(LFUN_FINISHED_RIGHT);
|
||||
cmd = FuncRequest(LFUN_FINISHED_FORWARD);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -397,15 +394,40 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
|
||||
case LFUN_CHAR_BACKWARD_SELECT:
|
||||
//lyxerr << "handle LFUN_CHAR_BACKWARD[_SELECT]:\n" << cur << endl;
|
||||
needsUpdate |= cur.selHandle(cmd.action == LFUN_CHAR_BACKWARD_SELECT);
|
||||
if (reverseDirectionNeeded(cur))
|
||||
needsUpdate |= cursorRight(cur);
|
||||
else
|
||||
needsUpdate |= cursorLeft(cur);
|
||||
needsUpdate |= cursorBackward(cur);
|
||||
|
||||
if (!needsUpdate && oldTopSlice == cur.top()
|
||||
&& cur.boundary() == oldBoundary) {
|
||||
cur.undispatched();
|
||||
cmd = FuncRequest(LFUN_FINISHED_LEFT);
|
||||
cmd = FuncRequest(LFUN_FINISHED_BACKWARD);
|
||||
}
|
||||
break;
|
||||
|
||||
case LFUN_CHAR_LEFT:
|
||||
case LFUN_CHAR_LEFT_SELECT:
|
||||
//FIXME: for visual cursor, really move left
|
||||
if (reverseDirectionNeeded(cur)) {
|
||||
lyx::dispatch(FuncRequest(
|
||||
cmd.action == LFUN_CHAR_LEFT_SELECT ?
|
||||
LFUN_CHAR_FORWARD_SELECT : LFUN_CHAR_FORWARD));
|
||||
} else {
|
||||
lyx::dispatch(FuncRequest(
|
||||
cmd.action == LFUN_CHAR_LEFT_SELECT ?
|
||||
LFUN_CHAR_BACKWARD_SELECT : LFUN_CHAR_BACKWARD));
|
||||
}
|
||||
break;
|
||||
|
||||
case LFUN_CHAR_RIGHT:
|
||||
case LFUN_CHAR_RIGHT_SELECT:
|
||||
//FIXME: for visual cursor, really move right
|
||||
if (reverseDirectionNeeded(cur)) {
|
||||
lyx::dispatch(FuncRequest(
|
||||
cmd.action == LFUN_CHAR_RIGHT_SELECT ?
|
||||
LFUN_CHAR_BACKWARD_SELECT : LFUN_CHAR_BACKWARD));
|
||||
} else {
|
||||
lyx::dispatch(FuncRequest(
|
||||
cmd.action == LFUN_CHAR_RIGHT_SELECT ?
|
||||
LFUN_CHAR_FORWARD_SELECT : LFUN_CHAR_FORWARD));
|
||||
}
|
||||
break;
|
||||
|
||||
@ -536,8 +558,8 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
|
||||
// Reverse the effect of LFUN_BREAK_PARAGRAPH_SKIP.
|
||||
if (!cur.selection()) {
|
||||
if (cur.pos() == cur.lastpos()) {
|
||||
cursorRight(cur);
|
||||
cursorLeft(cur);
|
||||
cursorForward(cur);
|
||||
cursorBackward(cur);
|
||||
}
|
||||
erase(cur);
|
||||
cur.resetAnchor();
|
||||
@ -1390,6 +1412,16 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
|
||||
}
|
||||
break;
|
||||
|
||||
case LFUN_FINISHED_BACKWARD:
|
||||
LYXERR(Debug::DEBUG) << "handle LFUN_FINISHED_BACKWARD:\n" << cur << endl;
|
||||
break;
|
||||
|
||||
case LFUN_FINISHED_FORWARD:
|
||||
LYXERR(Debug::DEBUG) << "handle LFUN_FINISHED_FORWARD:\n" << cur << endl;
|
||||
++cur.pos();
|
||||
cur.setCurrentFont();
|
||||
break;
|
||||
|
||||
case LFUN_LAYOUT_PARAGRAPH: {
|
||||
string data;
|
||||
params2string(cur.paragraph(), data);
|
||||
@ -1442,7 +1474,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
|
||||
breakParagraph(cur);
|
||||
|
||||
if (cur.lastpos() != 0) {
|
||||
cursorLeft(cur);
|
||||
cursorBackward(cur);
|
||||
breakParagraph(cur);
|
||||
}
|
||||
|
||||
@ -1510,7 +1542,9 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
|
||||
cur.selection() = false;
|
||||
} else {
|
||||
cur.undispatched();
|
||||
cmd = FuncRequest(LFUN_FINISHED_RIGHT);
|
||||
// This used to be LFUN_FINISHED_RIGHT, I think FORWARD is more
|
||||
// correct, but I'm not 100% sure -- dov, 071019
|
||||
cmd = FuncRequest(LFUN_FINISHED_FORWARD);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -1851,6 +1885,10 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
case LFUN_CHAR_FORWARD_SELECT:
|
||||
case LFUN_CHAR_BACKWARD:
|
||||
case LFUN_CHAR_BACKWARD_SELECT:
|
||||
case LFUN_CHAR_LEFT:
|
||||
case LFUN_CHAR_LEFT_SELECT:
|
||||
case LFUN_CHAR_RIGHT:
|
||||
case LFUN_CHAR_RIGHT_SELECT:
|
||||
case LFUN_UP:
|
||||
case LFUN_UP_SELECT:
|
||||
case LFUN_DOWN:
|
||||
|
@ -1655,8 +1655,8 @@ void TextMetrics::deleteLineForward(Cursor & cur)
|
||||
{
|
||||
BOOST_ASSERT(text_ == cur.text());
|
||||
if (cur.lastpos() == 0) {
|
||||
// Paragraph is empty, so we just go to the right
|
||||
text_->cursorRight(cur);
|
||||
// Paragraph is empty, so we just go forward
|
||||
text_->cursorForward(cur);
|
||||
} else {
|
||||
cur.resetAnchor();
|
||||
cur.selection() = true; // to avoid deletion
|
||||
@ -2080,9 +2080,9 @@ void TextMetrics::drawRowSelection(PainterInfo & pi, int x, Row const & row,
|
||||
while (cur < end) {
|
||||
bool drawNow = false;
|
||||
|
||||
// simplified cursorRight code below which does not
|
||||
// simplified cursorForward code below which does not
|
||||
// descend into insets and which does not go into the
|
||||
// next line. Compare the logic with the original cursorRight
|
||||
// next line. Compare the logic with the original cursorForward
|
||||
|
||||
// if left of boundary -> just jump to right side
|
||||
// but for RTL boundaries don't, because: abc|DDEEFFghi -> abcDDEEF|Fghi
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include "Language.h"
|
||||
#include "LaTeXFeatures.h"
|
||||
#include "Lexer.h"
|
||||
#include "LyXFunc.h"
|
||||
#include "MetricsInfo.h"
|
||||
#include "OutputParams.h"
|
||||
#include "paragraph_funcs.h"
|
||||
@ -3256,9 +3257,9 @@ void InsetTabular::doDispatch(Cursor & cur, FuncRequest & cmd)
|
||||
case LFUN_CHAR_FORWARD:
|
||||
cell(cur.idx())->dispatch(cur, cmd);
|
||||
if (!cur.result().dispatched()) {
|
||||
isRightToLeft(cur) ? movePrevCell(cur) : moveNextCell(cur);
|
||||
moveNextCell(cur);
|
||||
if (sl == cur.top())
|
||||
cmd = FuncRequest(LFUN_FINISHED_RIGHT);
|
||||
cmd = FuncRequest(LFUN_FINISHED_FORWARD);
|
||||
else
|
||||
cur.dispatched();
|
||||
}
|
||||
@ -3268,14 +3269,40 @@ void InsetTabular::doDispatch(Cursor & cur, FuncRequest & cmd)
|
||||
case LFUN_CHAR_BACKWARD:
|
||||
cell(cur.idx())->dispatch(cur, cmd);
|
||||
if (!cur.result().dispatched()) {
|
||||
isRightToLeft(cur) ? moveNextCell(cur) : movePrevCell(cur);
|
||||
movePrevCell(cur);
|
||||
if (sl == cur.top())
|
||||
cmd = FuncRequest(LFUN_FINISHED_LEFT);
|
||||
cmd = FuncRequest(LFUN_FINISHED_BACKWARD);
|
||||
else
|
||||
cur.dispatched();
|
||||
}
|
||||
break;
|
||||
|
||||
case LFUN_CHAR_RIGHT_SELECT:
|
||||
case LFUN_CHAR_RIGHT:
|
||||
//FIXME: for visual cursor, really move right
|
||||
if (isRightToLeft(cur))
|
||||
lyx::dispatch(FuncRequest(
|
||||
cmd.action == LFUN_CHAR_RIGHT_SELECT ?
|
||||
LFUN_CHAR_BACKWARD_SELECT : LFUN_CHAR_BACKWARD));
|
||||
else
|
||||
lyx::dispatch(FuncRequest(
|
||||
cmd.action == LFUN_CHAR_RIGHT_SELECT ?
|
||||
LFUN_CHAR_FORWARD_SELECT : LFUN_CHAR_FORWARD));
|
||||
break;
|
||||
|
||||
case LFUN_CHAR_LEFT_SELECT:
|
||||
case LFUN_CHAR_LEFT:
|
||||
//FIXME: for visual cursor, really move left
|
||||
if (isRightToLeft(cur))
|
||||
lyx::dispatch(FuncRequest(
|
||||
cmd.action == LFUN_CHAR_LEFT_SELECT ?
|
||||
LFUN_CHAR_FORWARD_SELECT : LFUN_CHAR_FORWARD));
|
||||
else
|
||||
lyx::dispatch(FuncRequest(
|
||||
cmd.action == LFUN_CHAR_LEFT_SELECT ?
|
||||
LFUN_CHAR_BACKWARD_SELECT : LFUN_CHAR_BACKWARD));
|
||||
break;
|
||||
|
||||
case LFUN_DOWN_SELECT:
|
||||
case LFUN_DOWN:
|
||||
cell(cur.idx())->dispatch(cur, cmd);
|
||||
@ -3292,9 +3319,9 @@ void InsetTabular::doDispatch(Cursor & cur, FuncRequest & cmd)
|
||||
cur.pos() = tm.x2pos(cur.pit(), 0, cur.targetX());
|
||||
}
|
||||
if (sl == cur.top()) {
|
||||
// we trick it to go to the RIGHT after leaving the
|
||||
// we trick it to go to forward after leaving the
|
||||
// tabular.
|
||||
cmd = FuncRequest(LFUN_FINISHED_RIGHT);
|
||||
cmd = FuncRequest(LFUN_FINISHED_FORWARD);
|
||||
cur.undispatched();
|
||||
}
|
||||
break;
|
||||
|
@ -407,6 +407,13 @@ enum kb_action {
|
||||
// 295
|
||||
LFUN_CALL, // broider, 20071002
|
||||
LFUN_BUFFER_TOGGLE_EMBEDDING, // bpeng, 20071021
|
||||
LFUN_CHAR_LEFT, // dov, 20071022
|
||||
LFUN_CHAR_LEFT_SELECT, // dov, 20071022
|
||||
LFUN_CHAR_RIGHT, // dov, 20071022
|
||||
// 300
|
||||
LFUN_CHAR_RIGHT_SELECT, // dov, 20071022
|
||||
LFUN_FINISHED_BACKWARD, // dov, 20071022
|
||||
LFUN_FINISHED_FORWARD, // dov, 20071022
|
||||
|
||||
LFUN_LASTACTION // end of the table
|
||||
};
|
||||
|
@ -1104,7 +1104,7 @@ void InsetMathGrid::doDispatch(Cursor & cur, FuncRequest & cmd)
|
||||
// See below.
|
||||
cur.selection() = false;
|
||||
if (!idxPrev(cur)) {
|
||||
cmd = FuncRequest(LFUN_FINISHED_LEFT);
|
||||
cmd = FuncRequest(LFUN_FINISHED_BACKWARD);
|
||||
cur.undispatched();
|
||||
}
|
||||
break;
|
||||
@ -1114,7 +1114,7 @@ void InsetMathGrid::doDispatch(Cursor & cur, FuncRequest & cmd)
|
||||
// hard bound to LFUN_CELL_BACKWARD
|
||||
cur.selection() = false;
|
||||
if (!idxNext(cur)) {
|
||||
cmd = FuncRequest(LFUN_FINISHED_RIGHT);
|
||||
cmd = FuncRequest(LFUN_FINISHED_FORWARD);
|
||||
cur.undispatched();
|
||||
}
|
||||
break;
|
||||
@ -1136,7 +1136,7 @@ void InsetMathGrid::doDispatch(Cursor & cur, FuncRequest & cmd)
|
||||
cur.pos() = cur.lastpos();
|
||||
|
||||
//mathcursor->normalize();
|
||||
//cmd = FuncRequest(LFUN_FINISHED_LEFT);
|
||||
//cmd = FuncRequest(LFUN_FINISHED_BACKWARD);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1249,6 +1249,7 @@ void InsetMathGrid::doDispatch(Cursor & cur, FuncRequest & cmd)
|
||||
cur.undispatched();
|
||||
break;
|
||||
}
|
||||
// perhaps this should be FINISHED_BACKWARD -- just for clarity?
|
||||
lyxerr << "returning FINISHED_LEFT" << endl;
|
||||
break;
|
||||
}
|
||||
@ -1318,7 +1319,7 @@ void InsetMathGrid::doDispatch(Cursor & cur, FuncRequest & cmd)
|
||||
cur.idx() = 0;
|
||||
cur.pos() = 0;
|
||||
} else {
|
||||
cmd = FuncRequest(LFUN_FINISHED_LEFT);
|
||||
cmd = FuncRequest(LFUN_FINISHED_BACKWARD);
|
||||
cur.undispatched();
|
||||
}
|
||||
break;
|
||||
@ -1340,7 +1341,7 @@ void InsetMathGrid::doDispatch(Cursor & cur, FuncRequest & cmd)
|
||||
cur.idx() = cur.lastidx();
|
||||
cur.pos() = cur.lastpos();
|
||||
} else {
|
||||
cmd = FuncRequest(LFUN_FINISHED_RIGHT);
|
||||
cmd = FuncRequest(LFUN_FINISHED_FORWARD);
|
||||
cur.undispatched();
|
||||
}
|
||||
break;
|
||||
|
@ -1036,8 +1036,8 @@ void InsetMathHull::doDispatch(Cursor & cur, FuncRequest & cmd)
|
||||
//lyxerr << "action: " << cmd.action << endl;
|
||||
switch (cmd.action) {
|
||||
|
||||
case LFUN_FINISHED_LEFT:
|
||||
case LFUN_FINISHED_RIGHT:
|
||||
case LFUN_FINISHED_BACKWARD:
|
||||
case LFUN_FINISHED_FORWARD:
|
||||
//lyxerr << "action: " << cmd.action << endl;
|
||||
InsetMathGrid::doDispatch(cur, cmd);
|
||||
notifyCursorLeaves(cur);
|
||||
@ -1173,8 +1173,8 @@ bool InsetMathHull::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
FuncStatus & status) const
|
||||
{
|
||||
switch (cmd.action) {
|
||||
case LFUN_FINISHED_LEFT:
|
||||
case LFUN_FINISHED_RIGHT:
|
||||
case LFUN_FINISHED_BACKWARD:
|
||||
case LFUN_FINISHED_FORWARD:
|
||||
case LFUN_UP:
|
||||
case LFUN_DOWN:
|
||||
status.enabled(true);
|
||||
|
@ -43,6 +43,7 @@
|
||||
#include "DispatchResult.h"
|
||||
#include "FuncRequest.h"
|
||||
#include "FuncStatus.h"
|
||||
#include "LyXFunc.h"
|
||||
#include "gettext.h"
|
||||
#include "Text.h"
|
||||
#include "OutputParams.h"
|
||||
@ -490,11 +491,11 @@ void InsetMathNest::doDispatch(Cursor & cur, FuncRequest & cmd)
|
||||
lfunMouseRelease(cur, cmd);
|
||||
break;
|
||||
|
||||
case LFUN_FINISHED_LEFT:
|
||||
case LFUN_FINISHED_BACKWARD:
|
||||
cur.bv().cursor() = cur;
|
||||
break;
|
||||
|
||||
case LFUN_FINISHED_RIGHT:
|
||||
case LFUN_FINISHED_FORWARD:
|
||||
++cur.pos();
|
||||
cur.bv().cursor() = cur;
|
||||
break;
|
||||
@ -506,10 +507,6 @@ void InsetMathNest::doDispatch(Cursor & cur, FuncRequest & cmd)
|
||||
cur.autocorrect() = false;
|
||||
cur.clearTargetX();
|
||||
cur.macroModeClose();
|
||||
if (reverseDirectionNeeded(cur))
|
||||
goto goto_char_backwards;
|
||||
|
||||
goto_char_forwards:
|
||||
if (cur.pos() != cur.lastpos() && cur.openable(cur.nextAtom())) {
|
||||
cur.pushLeft(*cur.nextAtom().nucleus());
|
||||
cur.inset().idxFirst(cur);
|
||||
@ -517,7 +514,7 @@ goto_char_forwards:
|
||||
|| cur.popRight() || cur.selection())
|
||||
;
|
||||
else {
|
||||
cmd = FuncRequest(LFUN_FINISHED_RIGHT);
|
||||
cmd = FuncRequest(LFUN_FINISHED_FORWARD);
|
||||
cur.undispatched();
|
||||
}
|
||||
break;
|
||||
@ -529,10 +526,6 @@ goto_char_forwards:
|
||||
cur.autocorrect() = false;
|
||||
cur.clearTargetX();
|
||||
cur.macroModeClose();
|
||||
if (reverseDirectionNeeded(cur))
|
||||
goto goto_char_forwards;
|
||||
|
||||
goto_char_backwards:
|
||||
if (cur.pos() != 0 && cur.openable(cur.prevAtom())) {
|
||||
cur.posLeft();
|
||||
cur.push(*cur.nextAtom().nucleus());
|
||||
@ -541,11 +534,37 @@ goto_char_backwards:
|
||||
|| cur.popLeft() || cur.selection())
|
||||
;
|
||||
else {
|
||||
cmd = FuncRequest(LFUN_FINISHED_LEFT);
|
||||
cmd = FuncRequest(LFUN_FINISHED_BACKWARD);
|
||||
cur.undispatched();
|
||||
}
|
||||
break;
|
||||
|
||||
case LFUN_CHAR_RIGHT:
|
||||
case LFUN_CHAR_RIGHT_SELECT:
|
||||
//FIXME: for visual cursor, really move right
|
||||
if (reverseDirectionNeeded(cur))
|
||||
lyx::dispatch(FuncRequest(
|
||||
cmd.action == LFUN_CHAR_RIGHT_SELECT ?
|
||||
LFUN_CHAR_BACKWARD_SELECT : LFUN_CHAR_BACKWARD));
|
||||
else
|
||||
lyx::dispatch(FuncRequest(
|
||||
cmd.action == LFUN_CHAR_RIGHT_SELECT ?
|
||||
LFUN_CHAR_FORWARD_SELECT : LFUN_CHAR_FORWARD));
|
||||
break;
|
||||
|
||||
case LFUN_CHAR_LEFT:
|
||||
case LFUN_CHAR_LEFT_SELECT:
|
||||
//FIXME: for visual cursor, really move left
|
||||
if (reverseDirectionNeeded(cur))
|
||||
lyx::dispatch(FuncRequest(
|
||||
cmd.action == LFUN_CHAR_LEFT_SELECT ?
|
||||
LFUN_CHAR_FORWARD_SELECT : LFUN_CHAR_FORWARD));
|
||||
else
|
||||
lyx::dispatch(FuncRequest(
|
||||
cmd.action == LFUN_CHAR_LEFT_SELECT ?
|
||||
LFUN_CHAR_BACKWARD_SELECT : LFUN_CHAR_BACKWARD));
|
||||
break;
|
||||
|
||||
case LFUN_DOWN:
|
||||
case LFUN_UP:
|
||||
cur.updateFlags(Update::Decoration | Update::FitCursor);
|
||||
@ -617,7 +636,7 @@ goto_char_backwards:
|
||||
cur.idx() = 0;
|
||||
cur.pos() = 0;
|
||||
} else {
|
||||
cmd = FuncRequest(LFUN_FINISHED_LEFT);
|
||||
cmd = FuncRequest(LFUN_FINISHED_BACKWARD);
|
||||
cur.undispatched();
|
||||
}
|
||||
break;
|
||||
@ -640,18 +659,18 @@ goto_char_backwards:
|
||||
cur.idx() = cur.lastidx();
|
||||
cur.pos() = cur.lastpos();
|
||||
} else {
|
||||
cmd = FuncRequest(LFUN_FINISHED_RIGHT);
|
||||
cmd = FuncRequest(LFUN_FINISHED_FORWARD);
|
||||
cur.undispatched();
|
||||
}
|
||||
break;
|
||||
|
||||
case LFUN_SCREEN_UP_SELECT:
|
||||
cmd = FuncRequest(LFUN_FINISHED_LEFT);
|
||||
cmd = FuncRequest(LFUN_FINISHED_BACKWARD);
|
||||
cur.undispatched();
|
||||
break;
|
||||
|
||||
case LFUN_SCREEN_DOWN_SELECT:
|
||||
cmd = FuncRequest(LFUN_FINISHED_RIGHT);
|
||||
cmd = FuncRequest(LFUN_FINISHED_FORWARD);
|
||||
cur.undispatched();
|
||||
break;
|
||||
|
||||
@ -697,7 +716,7 @@ goto_char_backwards:
|
||||
if (cur.selection())
|
||||
cur.clearSelection();
|
||||
else {
|
||||
cmd = FuncRequest(LFUN_FINISHED_RIGHT);
|
||||
cmd = FuncRequest(LFUN_FINISHED_FORWARD);
|
||||
cur.undispatched();
|
||||
}
|
||||
break;
|
||||
@ -740,7 +759,7 @@ goto_char_backwards:
|
||||
cur.pushLeft(*cur.nextInset());
|
||||
}
|
||||
} else if (!interpretChar(cur, cmd.argument()[0])) {
|
||||
cmd = FuncRequest(LFUN_FINISHED_RIGHT);
|
||||
cmd = FuncRequest(LFUN_FINISHED_FORWARD);
|
||||
cur.undispatched();
|
||||
}
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user