Module: wine Branch: master Commit: f45408b24ac6745b9a917f82abeb42d9ec530112 URL: https://source.winehq.org/git/wine.git/?a=commit;h=f45408b24ac6745b9a917f82a...
Author: Huw Davies huw@codeweavers.com Date: Mon Oct 26 08:46:41 2020 +0000
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
---
dlls/riched20/caret.c | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-)
diff --git a/dlls/riched20/caret.c b/dlls/riched20/caret.c index 650c065dbe0..49ae1b2769a 100644 --- a/dlls/riched20/caret.c +++ b/dlls/riched20/caret.c @@ -1375,19 +1375,11 @@ static void ME_ArrowPageDown(ME_TextEditor *editor, ME_Cursor *pCursor) 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); - if (pRow) { - ME_DisplayItem *pRun; - - pRun = ME_FindItemFwd(pRow, diRun); - if (pRun) { - pCursor->pRun = pRun; - assert(pCursor->pPara == ME_GetParagraph(pRun)); - pCursor->nOffset = 0; - } - } + ME_Row *row = row_from_cursor( cursor ); + + row_first_cursor( row, cursor ); }
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); }
-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); - assert(pRow); - pCursor->pRun = ME_FindItemBack(pRow, diRun); - pCursor->nOffset = (pRow->type == diStartRow) ? pCursor->pRun->member.run.len : 0; + row_end_cursor( row, cursor, FALSE ); }
static void ME_ArrowCtrlEnd(ME_TextEditor *editor, ME_Cursor *pCursor)