Commit db95d69f authored by Dylan Smith's avatar Dylan Smith Committed by Alexandre Julliard

richedit: Made sure the caret position is stored when moving up/down.

The caret's x position is stored in ME_TextEditor.nUDArrowX so that when the caret is moved up or down, it will stay along the same horizontal position, or at the end of a line. Unfortunately, the value stored in nUDArrowX was being unconditionally discarded in ME_ArrowKey, preventing it from serving its purpose.
parent 2f1c7b16
......@@ -1349,7 +1349,6 @@ ME_ArrowKey(ME_TextEditor *editor, int nVKey, BOOL extend, BOOL ctrl)
BOOL success = FALSE;
ME_CheckCharOffsets(editor);
editor->nUDArrowX = -1;
switch(nVKey) {
case VK_LEFT:
editor->bCaretAtEnd = 0;
......
......@@ -1542,10 +1542,12 @@ ME_KeyDown(ME_TextEditor *editor, WORD nKey)
{
case VK_LEFT:
case VK_RIGHT:
case VK_UP:
case VK_DOWN:
case VK_HOME:
case VK_END:
editor->nUDArrowX = -1;
/* fall through */
case VK_UP:
case VK_DOWN:
case VK_PRIOR:
case VK_NEXT:
ME_CommitUndo(editor); /* End coalesced undos for typed characters */
......@@ -1553,6 +1555,7 @@ ME_KeyDown(ME_TextEditor *editor, WORD nKey)
return TRUE;
case VK_BACK:
case VK_DELETE:
editor->nUDArrowX = -1;
/* FIXME backspace and delete aren't the same, they act different wrt paragraph style of the merged paragraph */
if (GetWindowLongW(editor->hWnd, GWL_STYLE) & ES_READONLY)
return FALSE;
......@@ -1583,6 +1586,8 @@ ME_KeyDown(ME_TextEditor *editor, WORD nKey)
return TRUE;
default:
if (nKey != VK_SHIFT && nKey != VK_CONTROL && nKey && nKey != VK_MENU)
editor->nUDArrowX = -1;
if (ctrl_is_down)
{
if (nKey == 'W')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment