Module: wine Branch: master Commit: 7eb683772931f749cf27fa54d54003214923970d URL: http://source.winehq.org/git/wine.git/?a=commit;h=7eb683772931f749cf27fa54d5...
Author: Huw Davies huw@codeweavers.com Date: Tue Oct 4 13:07:34 2016 +0100
riched20: Allow selecting to the start / end when using the up / down arrow keys.
Signed-off-by: Huw Davies huw@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/riched20/caret.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-)
diff --git a/dlls/riched20/caret.c b/dlls/riched20/caret.c index b137c5f..74239af 100644 --- a/dlls/riched20/caret.c +++ b/dlls/riched20/caret.c @@ -1237,7 +1237,7 @@ static int ME_GetXForArrow(ME_TextEditor *editor, ME_Cursor *pCursor)
static void -ME_MoveCursorLines(ME_TextEditor *editor, ME_Cursor *pCursor, int nRelOfs) +ME_MoveCursorLines(ME_TextEditor *editor, ME_Cursor *pCursor, int nRelOfs, BOOL extend) { ME_DisplayItem *pRun = pCursor->pRun; ME_DisplayItem *pOldPara = pCursor->pPara; @@ -1255,8 +1255,12 @@ ME_MoveCursorLines(ME_TextEditor *editor, ME_Cursor *pCursor, int nRelOfs) assert(pItem); /* start of the previous row */ pItem = ME_FindItemBack(pItem, diStartRow); - if (!pItem) - return; /* row not found - ignore */ + if (!pItem) /* row not found */ + { + if (extend) + ME_SetCursorToStart(editor, pCursor); + return; + } pNewPara = ME_GetParagraph(pItem); if (pOldPara->member.para.nFlags & MEPF_ROWEND || (pOldPara->member.para.pCell && @@ -1282,8 +1286,12 @@ ME_MoveCursorLines(ME_TextEditor *editor, ME_Cursor *pCursor, int nRelOfs) { /* start of the next row */ pItem = ME_FindItemFwd(pRun, diStartRow); - if (!pItem) - return; /* row not found - ignore */ + if (!pItem) /* row not found */ + { + if (extend) + ME_SetCursorToEnd(editor, pCursor, TRUE); + return; + } pNewPara = ME_GetParagraph(pItem); if (pOldPara->member.para.nFlags & MEPF_ROWSTART || (pOldPara->member.para.pCell && @@ -1558,10 +1566,10 @@ ME_ArrowKey(ME_TextEditor *editor, int nVKey, BOOL extend, BOOL ctrl) success = ME_MoveCursorChars(editor, &tmp_curs, +1, extend); break; case VK_UP: - ME_MoveCursorLines(editor, &tmp_curs, -1); + ME_MoveCursorLines(editor, &tmp_curs, -1, extend); break; case VK_DOWN: - ME_MoveCursorLines(editor, &tmp_curs, +1); + ME_MoveCursorLines(editor, &tmp_curs, +1, extend); break; case VK_PRIOR: ME_ArrowPageUp(editor, &tmp_curs);