Signed-off-by: Huw Davies huw@codeweavers.com --- dlls/riched20/editor.c | 6 +++--- dlls/riched20/editor.h | 2 +- dlls/riched20/run.c | 13 +++++-------- 3 files changed, 9 insertions(+), 12 deletions(-)
diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c index 30441658311..d9bcea84f74 100644 --- a/dlls/riched20/editor.c +++ b/dlls/riched20/editor.c @@ -4322,15 +4322,15 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam, } cursor_from_char_ofs( editor, wParam, &cursor ); item = ME_RowStart( cursor.pRun ); - nThisLineOfs = ME_CharOfsFromRunOfs( editor, cursor.pPara, ME_FindItemFwd( item, diRun ), 0 ); + nThisLineOfs = run_char_ofs( &ME_FindItemFwd( item, diRun )->member.run, 0 ); item_end = ME_FindItemFwd(item, diStartRowOrParagraphOrEnd); if (item_end->type == diStartRow) - nNextLineOfs = ME_CharOfsFromRunOfs(editor, cursor.pPara, ME_FindItemFwd( item_end, diRun ), 0); + 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 = item_end->member.para.nCharOfs - endRun->member.run.len; + nNextLineOfs = run_char_ofs( &endRun->member.run, 0 ); } nChars = nNextLineOfs - nThisLineOfs; TRACE("EM_LINELENGTH(%ld)==%d\n", wParam, nChars); diff --git a/dlls/riched20/editor.h b/dlls/riched20/editor.h index 163be9c8179..0503a671ea1 100644 --- a/dlls/riched20/editor.h +++ b/dlls/riched20/editor.h @@ -120,6 +120,7 @@ int ME_RowNumberFromCharOfs(ME_TextEditor *editor, int nOfs) DECLSPEC_HIDDEN; /* run.c */ void cursor_from_char_ofs( ME_TextEditor *editor, int char_ofs, ME_Cursor *cursor ) DECLSPEC_HIDDEN;
+int run_char_ofs( ME_Run *run, int ofs ) DECLSPEC_HIDDEN; ME_Run *run_create( ME_Style *s, int nFlags ) DECLSPEC_HIDDEN; ME_Run *run_insert( ME_TextEditor *editor, ME_Cursor *cursor, ME_Style *style, const WCHAR *str, int len, int flags ) DECLSPEC_HIDDEN; @@ -140,7 +141,6 @@ ME_Run *run_split( ME_TextEditor *editor, ME_Cursor *cursor ) DECLSPEC_HIDDEN; void ME_UpdateRunFlags(ME_TextEditor *editor, ME_Run *run) DECLSPEC_HIDDEN; SIZE ME_GetRunSizeCommon(ME_Context *c, const ME_Paragraph *para, ME_Run *run, int nLen, int startx, int *pAscent, int *pDescent) DECLSPEC_HIDDEN; -int ME_CharOfsFromRunOfs(ME_TextEditor *editor, const ME_DisplayItem *pPara, const ME_DisplayItem *pRun, int nOfs) DECLSPEC_HIDDEN; void ME_SkipAndPropagateCharOffset(ME_DisplayItem *p, int shift) DECLSPEC_HIDDEN; void ME_SetCharFormat(ME_TextEditor *editor, ME_Cursor *start, ME_Cursor *end, CHARFORMAT2W *pFmt) DECLSPEC_HIDDEN; void ME_SetSelectionCharFormat(ME_TextEditor *editor, CHARFORMAT2W *pFmt) DECLSPEC_HIDDEN; diff --git a/dlls/riched20/run.c b/dlls/riched20/run.c index 92d0721247c..22a5db8610b 100644 --- a/dlls/riched20/run.c +++ b/dlls/riched20/run.c @@ -187,18 +187,15 @@ void ME_CheckCharOffsets(ME_TextEditor *editor) }
/****************************************************************************** - * ME_CharOfsFromRunOfs + * run_char_ofs * - * Converts a character position relative to the start of the run, to a + * Converts a character position relative to the start of the run to a * character position relative to the start of the document. - * Kind of a "local to global" offset conversion. */ -int ME_CharOfsFromRunOfs(ME_TextEditor *editor, const ME_DisplayItem *pPara, - const ME_DisplayItem *pRun, int nOfs) + +int run_char_ofs( ME_Run *run, int ofs ) { - assert(pRun && pRun->type == diRun); - assert(pPara && pPara->type == diParagraph); - return pPara->member.para.nCharOfs + pRun->member.run.nCharOfs + nOfs; + return run->para->nCharOfs + run->nCharOfs + ofs; }
/******************************************************************************