riched20: Use row helpers for Home/End key handling.

Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Huw Davies 2020-10-26 08:46:41 +00:00 committed by Alexandre Julliard
parent aaf29c7991
commit f45408b24a
1 changed files with 6 additions and 17 deletions

View File

@ -1375,19 +1375,11 @@ static void ME_ArrowPageDown(ME_TextEditor *editor, ME_Cursor *pCursor)
assert(pCursor->pRun->type == diRun); assert(pCursor->pRun->type == diRun);
} }
static void ME_ArrowHome(ME_TextEditor *editor, ME_Cursor *pCursor) static void ME_ArrowHome( ME_TextEditor *editor, ME_Cursor *cursor )
{ {
ME_DisplayItem *pRow = ME_FindItemBack(pCursor->pRun, diStartRow); ME_Row *row = row_from_cursor( cursor );
if (pRow) {
ME_DisplayItem *pRun;
pRun = ME_FindItemFwd(pRow, diRun); row_first_cursor( row, cursor );
if (pRun) {
pCursor->pRun = pRun;
assert(pCursor->pPara == ME_GetParagraph(pRun));
pCursor->nOffset = 0;
}
}
} }
static void ME_ArrowCtrlHome(ME_TextEditor *editor, ME_Cursor *pCursor) static void ME_ArrowCtrlHome(ME_TextEditor *editor, ME_Cursor *pCursor)
@ -1395,14 +1387,11 @@ static void ME_ArrowCtrlHome(ME_TextEditor *editor, ME_Cursor *pCursor)
ME_SetCursorToStart(editor, pCursor); ME_SetCursorToStart(editor, pCursor);
} }
static void ME_ArrowEnd(ME_TextEditor *editor, ME_Cursor *pCursor) static void ME_ArrowEnd( ME_TextEditor *editor, ME_Cursor *cursor )
{ {
ME_DisplayItem *pRow; ME_Row *row = row_from_cursor( cursor );
pRow = ME_FindItemFwd(pCursor->pRun, diStartRowOrParagraphOrEnd); row_end_cursor( row, cursor, FALSE );
assert(pRow);
pCursor->pRun = ME_FindItemBack(pRow, diRun);
pCursor->nOffset = (pRow->type == diStartRow) ? pCursor->pRun->member.run.len : 0;
} }
static void ME_ArrowCtrlEnd(ME_TextEditor *editor, ME_Cursor *pCursor) static void ME_ArrowCtrlEnd(ME_TextEditor *editor, ME_Cursor *pCursor)