Commit cfdfe517 authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

riched20: Use row ptrs in the EM_GETLINELENGTH handler.

parent bfa143a2
...@@ -4341,8 +4341,8 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam, ...@@ -4341,8 +4341,8 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
} }
case EM_LINELENGTH: case EM_LINELENGTH:
{ {
ME_DisplayItem *item, *item_end; ME_Row *row;
int nChars = 0, nThisLineOfs = 0, nNextLineOfs = 0; int start_ofs, end_ofs;
ME_Cursor cursor; ME_Cursor cursor;
if (wParam > ME_GetTextLength(editor)) if (wParam > ME_GetTextLength(editor))
...@@ -4353,20 +4353,13 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam, ...@@ -4353,20 +4353,13 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
return 0; return 0;
} }
cursor_from_char_ofs( editor, wParam, &cursor ); cursor_from_char_ofs( editor, wParam, &cursor );
item = ME_RowStart( cursor.pRun ); row = row_from_cursor( &cursor );
nThisLineOfs = run_char_ofs( &ME_FindItemFwd( item, diRun )->member.run, 0 ); row_first_cursor( row, &cursor );
item_end = ME_FindItemFwd(item, diStartRowOrParagraphOrEnd); start_ofs = ME_GetCursorOfs( &cursor );
if (item_end->type == diStartRow) row_end_cursor( row, &cursor, FALSE );
nNextLineOfs = run_char_ofs( &ME_FindItemFwd( item_end, diRun )->member.run, 0 ); end_ofs = ME_GetCursorOfs( &cursor );
else TRACE( "EM_LINELENGTH(%ld)==%d\n", wParam, end_ofs - start_ofs );
{ return end_ofs - start_ofs;
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;
} }
case EM_EXLIMITTEXT: case EM_EXLIMITTEXT:
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment