[PATCH 4/5] riched20: Use row helpers for Home/End key handling.

Huw Davies huw at codeweavers.com
Mon Oct 26 03:46:41 CDT 2020


Signed-off-by: Huw Davies <huw at codeweavers.com>
---
 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)
-- 
2.23.0




More information about the wine-devel mailing list