Getting rid of LTR bias --- part 2/?

This is a continuation of r21128. This round fixes the "Word" movement
functions and LFUNS.

Behavior should remain unchanged by this fix.



git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21244 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Dov Feldstern 2007-10-28 20:35:57 +00:00
parent 725f07728b
commit b4372a37d9
12 changed files with 88 additions and 41 deletions

View File

@ -111,8 +111,8 @@
\bind "M-Up" "paragraph-move-up"
\bind "M-Down" "paragraph-move-down"
\bind "C-Right" "word-forward"
\bind "C-Left" "word-backward"
\bind "C-Right" "word-right"
\bind "C-Left" "word-left"
\bind "C-Up" "paragraph-up"
\bind "C-Down" "paragraph-down"
\bind "C-Home" "buffer-begin"
@ -130,8 +130,8 @@
\bind "S-Left" "char-left-select"
\bind "S-Up" "up-select"
\bind "S-Down" "down-select"
\bind "S-C-Right" "word-forward-select"
\bind "S-C-Left" "word-backward-select"
\bind "S-C-Right" "word-right-select"
\bind "S-C-Left" "word-left-select"
\bind "S-C-Up" "paragraph-up-select"
\bind "S-C-Down" "paragraph-down-select"
\bind "S-Home" "line-begin-select"
@ -149,8 +149,8 @@
\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"
\bind "S-C-KP_Left" "word-backward-select"
\bind "S-C-KP_Right" "word-right-select"
\bind "S-C-KP_Left" "word-left-select"
\bind "S-C-KP_Up" "paragraph-up-select"
\bind "S-C-KP_Down" "paragraph-down-select"
\bind "S-KP_Home" "line-begin-select"

View File

@ -141,8 +141,8 @@
\bind "M-Up" "paragraph-move-up"
\bind "M-Down" "paragraph-move-down"
\bind "C-Right" "word-forward"
\bind "C-Left" "word-backward"
\bind "C-Right" "word-right"
\bind "C-Left" "word-left"
\bind "C-Up" "paragraph-up"
\bind "C-Down" "paragraph-down"
\bind "Home" "buffer-begin"
@ -188,8 +188,8 @@
\bind "S-C-B" "char-backward-select"
\bind "S-Up" "up-select"
\bind "S-Down" "down-select"
\bind "S-C-Right" "word-forward-select"
\bind "S-C-Left" "word-backward-select"
\bind "S-C-Right" "word-right-select"
\bind "S-C-Left" "word-left-select"
\bind "S-C-A" "line-begin-select"
\bind "S-C-E" "line-end-select"
\bind "S-C-Up" "paragraph-up-select"
@ -224,8 +224,8 @@
\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"
\bind "S-C-KP_Left" "word-backward-select"
\bind "S-C-KP_Right" "word-right-select"
\bind "S-C-KP_Left" "word-left-select"
\bind "S-C-KP_Up" "paragraph-up-select"
\bind "S-C-KP_Down" "paragraph-down-select"
\bind "S-KP_Home" "line-begin-select"

View File

@ -91,8 +91,8 @@
# Motion group
#
\bind "M-Right" "word-forward"
\bind "M-Left" "word-backward"
\bind "M-Right" "word-right"
\bind "M-Left" "word-left"
\bind "M-Up" "paragraph-up"
\bind "M-Down" "paragraph-down"
\bind "C-Up" "buffer-begin"
@ -112,8 +112,8 @@
\bind "S-Left" "char-left-select"
\bind "S-Up" "up-select"
\bind "S-Down" "down-select"
\bind "S-M-Right" "word-forward-select"
\bind "S-M-Left" "word-backward-select"
\bind "S-M-Right" "word-right-select"
\bind "S-M-Left" "word-left-select"
\bind "S-M-Up" "paragraph-up-select"
\bind "S-M-Down" "paragraph-down-select"
\bind "S-C-Left" "line-begin-select"
@ -131,8 +131,8 @@
\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"
\bind "S-M-KP_Left" "word-backward-select"
\bind "S-M-KP_Right" "word-right-select"
\bind "S-M-KP_Left" "word-left-select"
\bind "S-M-KP_Up" "paragraph-up-select"
\bind "S-M-KP_Down" "paragraph-down-select"
\bind "S-KP_Home" "line-begin-select"

View File

@ -223,8 +223,8 @@
\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"
\bind "S-C-KP_Left" "word-backward-select"
\bind "S-C-KP_Right" "word-right-select"
\bind "S-C-KP_Left" "word-left-select"
\bind "S-C-KP_Up" "paragraph-up-select"
\bind "S-C-KP_Down" "paragraph-down-select"
\bind "S-KP_Home" "line-begin-select"

View File

@ -146,8 +146,8 @@
\bind "M-Up" "paragraph-move-up"
\bind "M-Down" "paragraph-move-down"
\bind "C-Right" "word-forward"
\bind "C-Left" "word-backward"
\bind "C-Right" "word-right"
\bind "C-Left" "word-left"
\bind "C-Up" "paragraph-up"
\bind "C-Down" "paragraph-down"
\bind "M-bracketleft" "paragraph-up"
@ -198,8 +198,8 @@
\bind "S-C-B" "char-backward-select"
\bind "S-Up" "up-select"
\bind "S-Down" "down-select"
\bind "S-C-Right" "word-forward-select"
\bind "S-C-Left" "word-backward-select"
\bind "S-C-Right" "word-right-select"
\bind "S-C-Left" "word-left-select"
\bind "S-C-Up" "paragraph-up-select"
\bind "S-C-Down" "paragraph-down-select"
\bind "S-Home" "line-begin-select"
@ -235,8 +235,8 @@
\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"
\bind "S-C-KP_Left" "word-backward-select"
\bind "S-C-KP_Right" "word-right-select"
\bind "S-C-KP_Left" "word-left-select"
\bind "S-C-KP_Up" "paragraph-up-select"
\bind "S-C-KP_Down" "paragraph-down-select"
\bind "S-KP_Home" "line-begin-select"

View File

@ -315,7 +315,11 @@ void LyXAction::init()
{ LFUN_WORD_FIND_FORWARD, "word-find-forward", ReadOnly, Edit },
{ LFUN_WORD_FORWARD, "word-forward", ReadOnly | NoUpdate, Edit },
{ LFUN_WORD_FORWARD_SELECT, "word-forward-select", ReadOnly | SingleParUpdate, Edit },
{ LFUN_WORD_LEFT, "word-left", ReadOnly | NoUpdate, Edit },
{ LFUN_WORD_LEFT_SELECT, "word-left-select", ReadOnly | SingleParUpdate, Edit },
{ LFUN_WORD_LOWCASE, "word-lowcase", Noop, Edit },
{ LFUN_WORD_RIGHT, "word-right", ReadOnly | NoUpdate, Edit },
{ LFUN_WORD_RIGHT_SELECT, "word-right-select", ReadOnly | SingleParUpdate, Edit },
{ LFUN_WORD_SELECT, "word-select", ReadOnly, Edit },
{ LFUN_WORD_UPCASE, "word-upcase", Noop, Edit },
{ LFUN_MESSAGE, "message", NoBuffer, System },

View File

@ -575,7 +575,7 @@ void Text::charInserted(Cursor & cur)
// the cursor set functions have a special mechanism. When they
// realize, that you left an empty paragraph, they will delete it.
bool Text::cursorRightOneWord(Cursor & cur)
bool Text::cursorForwardOneWord(Cursor & cur)
{
BOOST_ASSERT(this == cur.text());
@ -596,7 +596,7 @@ bool Text::cursorRightOneWord(Cursor & cur)
}
bool Text::cursorLeftOneWord(Cursor & cur)
bool Text::cursorBackwardOneWord(Cursor & cur)
{
BOOST_ASSERT(this == cur.text());
@ -799,7 +799,7 @@ void Text::deleteWordForward(Cursor & cur)
else {
cur.resetAnchor();
cur.selection() = true;
cursorRightOneWord(cur);
cursorForwardOneWord(cur);
cur.setSelection();
cutSelection(cur, true, false);
checkBufferStructure(cur.buffer(), cur);
@ -815,7 +815,7 @@ void Text::deleteWordBackward(Cursor & cur)
else {
cur.resetAnchor();
cur.selection() = true;
cursorLeftOneWord(cur);
cursorBackwardOneWord(cur);
cur.setSelection();
cutSelection(cur, true, false);
checkBufferStructure(cur.buffer(), cur);
@ -836,7 +836,7 @@ void Text::changeCase(Cursor & cur, TextCase action)
} else {
from = cur.top();
getWord(from, to, PARTIAL_WORD);
cursorRightOneWord(cur);
cursorForwardOneWord(cur);
}
cur.recordUndoSelection();

View File

@ -174,9 +174,9 @@ public:
*/
bool cursorForward(Cursor & cur);
///
bool cursorLeftOneWord(Cursor & cur);
bool cursorBackwardOneWord(Cursor & cur);
///
bool cursorRightOneWord(Cursor & cur);
bool cursorForwardOneWord(Cursor & cur);
/// Delete from cursor up to the end of the current or next word.
void deleteWordForward(Cursor & cur);
/// Delete from cursor to start of current or prior word.

View File

@ -500,22 +500,44 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
needsUpdate |= tm.cursorEnd(cur);
break;
case LFUN_WORD_RIGHT:
case LFUN_WORD_RIGHT_SELECT:
//FIXME: for visual cursor mode, really move right
if (reverseDirectionNeeded(cur)) {
lyx::dispatch(FuncRequest(
cmd.action == LFUN_WORD_RIGHT_SELECT ?
LFUN_WORD_BACKWARD_SELECT : LFUN_WORD_BACKWARD));
} else {
lyx::dispatch(FuncRequest(
cmd.action == LFUN_WORD_RIGHT_SELECT ?
LFUN_WORD_FORWARD_SELECT : LFUN_WORD_FORWARD));
}
break;
case LFUN_WORD_FORWARD:
case LFUN_WORD_FORWARD_SELECT:
needsUpdate |= cur.selHandle(cmd.action == LFUN_WORD_FORWARD_SELECT);
if (reverseDirectionNeeded(cur))
needsUpdate |= cursorLeftOneWord(cur);
else
needsUpdate |= cursorRightOneWord(cur);
needsUpdate |= cursorForwardOneWord(cur);
break;
case LFUN_WORD_LEFT:
case LFUN_WORD_LEFT_SELECT:
//FIXME: for visual cursor mode, really move left
if (reverseDirectionNeeded(cur)) {
lyx::dispatch(FuncRequest(
cmd.action == LFUN_WORD_LEFT_SELECT ?
LFUN_WORD_FORWARD_SELECT : LFUN_WORD_FORWARD));
} else {
lyx::dispatch(FuncRequest(
cmd.action == LFUN_WORD_LEFT_SELECT ?
LFUN_WORD_BACKWARD_SELECT : LFUN_WORD_BACKWARD));
}
break;
case LFUN_WORD_BACKWARD:
case LFUN_WORD_BACKWARD_SELECT:
needsUpdate |= cur.selHandle(cmd.action == LFUN_WORD_BACKWARD_SELECT);
if (reverseDirectionNeeded(cur))
needsUpdate |= cursorRightOneWord(cur);
else
needsUpdate |= cursorLeftOneWord(cur);
needsUpdate |= cursorBackwardOneWord(cur);
break;
case LFUN_WORD_SELECT: {
@ -1883,6 +1905,8 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
case LFUN_LINE_DELETE:
case LFUN_WORD_FORWARD:
case LFUN_WORD_BACKWARD:
case LFUN_WORD_RIGHT:
case LFUN_WORD_LEFT:
case LFUN_CHAR_FORWARD:
case LFUN_CHAR_FORWARD_SELECT:
case LFUN_CHAR_BACKWARD:
@ -1903,6 +1927,8 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
case LFUN_LINE_END_SELECT:
case LFUN_WORD_FORWARD_SELECT:
case LFUN_WORD_BACKWARD_SELECT:
case LFUN_WORD_RIGHT_SELECT:
case LFUN_WORD_LEFT_SELECT:
case LFUN_WORD_SELECT:
case LFUN_PARAGRAPH_UP:
case LFUN_PARAGRAPH_DOWN:

View File

@ -414,6 +414,11 @@ enum kb_action {
LFUN_CHAR_RIGHT_SELECT, // dov, 20071022
LFUN_FINISHED_BACKWARD, // dov, 20071022
LFUN_FINISHED_FORWARD, // dov, 20071022
LFUN_WORD_LEFT, // dov, 20071028
LFUN_WORD_LEFT_SELECT, // dov, 20071028
// 305
LFUN_WORD_RIGHT, // dov, 20071028
LFUN_WORD_RIGHT_SELECT, // dov, 20071028
LFUN_LASTACTION // end of the table
};

View File

@ -1306,7 +1306,10 @@ void InsetMathGrid::doDispatch(Cursor & cur, FuncRequest & cmd)
case LFUN_LINE_BEGIN:
case LFUN_WORD_BACKWARD_SELECT:
case LFUN_WORD_BACKWARD:
case LFUN_WORD_LEFT_SELECT:
case LFUN_WORD_LEFT:
cur.selHandle(cmd.action == LFUN_WORD_BACKWARD_SELECT ||
cmd.action == LFUN_WORD_LEFT_SELECT ||
cmd.action == LFUN_LINE_BEGIN_SELECT);
cur.macroModeClose();
if (cur.pos() != 0) {
@ -1325,9 +1328,12 @@ void InsetMathGrid::doDispatch(Cursor & cur, FuncRequest & cmd)
case LFUN_WORD_FORWARD_SELECT:
case LFUN_WORD_FORWARD:
case LFUN_WORD_RIGHT_SELECT:
case LFUN_WORD_RIGHT:
case LFUN_LINE_END_SELECT:
case LFUN_LINE_END:
cur.selHandle(cmd.action == LFUN_WORD_FORWARD_SELECT ||
cmd.action == LFUN_WORD_RIGHT_SELECT ||
cmd.action == LFUN_LINE_END_SELECT);
cur.macroModeClose();
cur.clearTargetX();

View File

@ -620,10 +620,13 @@ void InsetMathNest::doDispatch(Cursor & cur, FuncRequest & cmd)
case LFUN_LINE_BEGIN:
case LFUN_WORD_BACKWARD:
case LFUN_WORD_LEFT:
cur.updateFlags(Update::Decoration | Update::FitCursor);
case LFUN_LINE_BEGIN_SELECT:
case LFUN_WORD_BACKWARD_SELECT:
case LFUN_WORD_LEFT_SELECT:
cur.selHandle(cmd.action == LFUN_WORD_BACKWARD_SELECT ||
cmd.action == LFUN_WORD_LEFT_SELECT ||
cmd.action == LFUN_LINE_BEGIN_SELECT);
cur.macroModeClose();
if (cur.pos() != 0) {
@ -641,11 +644,14 @@ void InsetMathNest::doDispatch(Cursor & cur, FuncRequest & cmd)
break;
case LFUN_WORD_FORWARD:
case LFUN_WORD_RIGHT:
case LFUN_LINE_END:
cur.updateFlags(Update::Decoration | Update::FitCursor);
case LFUN_WORD_FORWARD_SELECT:
case LFUN_WORD_RIGHT_SELECT:
case LFUN_LINE_END_SELECT:
cur.selHandle(cmd.action == LFUN_WORD_FORWARD_SELECT ||
cmd.action == LFUN_WORD_RIGHT_SELECT ||
cmd.action == LFUN_LINE_END_SELECT);
cur.macroModeClose();
cur.clearTargetX();