Huw Davies : riched20: Use row ptrs in the EM_GETLINELENGTH handler.
Alexandre Julliard
julliard at winehq.org
Tue Nov 3 15:55:53 CST 2020
Module: wine
Branch: master
Commit: cfdfe51785733e1e8c8f8ce9f65099a2cd053058
URL: https://source.winehq.org/git/wine.git/?a=commit;h=cfdfe51785733e1e8c8f8ce9f65099a2cd053058
Author: Huw Davies <huw at codeweavers.com>
Date: Tue Nov 3 08:44:40 2020 +0000
riched20: Use row ptrs in the EM_GETLINELENGTH handler.
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/riched20/editor.c | 25 +++++++++----------------
1 file changed, 9 insertions(+), 16 deletions(-)
diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c
index 66f6bd5e114..2bb1fbbe1e9 100644
--- a/dlls/riched20/editor.c
+++ b/dlls/riched20/editor.c
@@ -4341,8 +4341,8 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
}
case EM_LINELENGTH:
{
- ME_DisplayItem *item, *item_end;
- int nChars = 0, nThisLineOfs = 0, nNextLineOfs = 0;
+ ME_Row *row;
+ int start_ofs, end_ofs;
ME_Cursor cursor;
if (wParam > ME_GetTextLength(editor))
@@ -4353,20 +4353,13 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
return 0;
}
cursor_from_char_ofs( editor, wParam, &cursor );
- item = ME_RowStart( cursor.pRun );
- nThisLineOfs = run_char_ofs( &ME_FindItemFwd( item, diRun )->member.run, 0 );
- item_end = ME_FindItemFwd(item, diStartRowOrParagraphOrEnd);
- if (item_end->type == diStartRow)
- nNextLineOfs = run_char_ofs( &ME_FindItemFwd( item_end, diRun )->member.run, 0 );
- else
- {
- ME_DisplayItem *endRun = ME_FindItemBack(item_end, diRun);
- assert(endRun && endRun->member.run.nFlags & MERF_ENDPARA);
- nNextLineOfs = run_char_ofs( &endRun->member.run, 0 );
- }
- nChars = nNextLineOfs - nThisLineOfs;
- TRACE("EM_LINELENGTH(%ld)==%d\n", wParam, nChars);
- return nChars;
+ row = row_from_cursor( &cursor );
+ row_first_cursor( row, &cursor );
+ start_ofs = ME_GetCursorOfs( &cursor );
+ row_end_cursor( row, &cursor, FALSE );
+ end_ofs = ME_GetCursorOfs( &cursor );
+ TRACE( "EM_LINELENGTH(%ld)==%d\n", wParam, end_ofs - start_ofs );
+ return end_ofs - start_ofs;
}
case EM_EXLIMITTEXT:
{
More information about the wine-cvs
mailing list