Dylan Smith : richedit: Made sure the caret position is stored when moving up/down.
Alexandre Julliard
julliard at winehq.org
Mon Jul 7 09:19:05 CDT 2008
Module: wine
Branch: master
Commit: db95d69f992a1618e3f407a810b74fd6f8eaffaa
URL: http://source.winehq.org/git/wine.git/?a=commit;h=db95d69f992a1618e3f407a810b74fd6f8eaffaa
Author: Dylan Smith <dylan.ah.smith at gmail.com>
Date: Fri Jul 4 15:30:51 2008 -0400
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.
---
dlls/riched20/caret.c | 1 -
dlls/riched20/editor.c | 9 +++++++--
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/dlls/riched20/caret.c b/dlls/riched20/caret.c
index ebf6c56..4a1a8a4 100644
--- a/dlls/riched20/caret.c
+++ b/dlls/riched20/caret.c
@@ -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;
diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c
index 28850f9..dedc59e 100644
--- a/dlls/riched20/editor.c
+++ b/dlls/riched20/editor.c
@@ -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')
More information about the wine-cvs
mailing list