[PATCH 4/7] riched20: Allow selecting to the start / end when using the up / down arrow keys.
Huw Davies
huw at codeweavers.com
Tue Oct 4 07:07:34 CDT 2016
Signed-off-by: Huw Davies <huw at codeweavers.com>
---
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);
--
2.8.2
More information about the wine-patches
mailing list