Signed-off-by: Huw Davies huw@codeweavers.com --- dlls/riched20/caret.c | 8 ++++---- dlls/riched20/editor.c | 6 ++++++ dlls/riched20/editor.h | 1 + 3 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/dlls/riched20/caret.c b/dlls/riched20/caret.c index 22da616731f..eb7ad7f1899 100644 --- a/dlls/riched20/caret.c +++ b/dlls/riched20/caret.c @@ -26,15 +26,15 @@ WINE_DEFAULT_DEBUG_CHANNEL(richedit);
void ME_SetCursorToStart(ME_TextEditor *editor, ME_Cursor *cursor) { - cursor->pPara = editor->pBuffer->pFirst->member.para.next_para; - cursor->pRun = ME_FindItemFwd(cursor->pPara, diRun); + cursor->pPara = para_get_di( editor_first_para( editor ) ); + cursor->pRun = run_get_di( para_first_run( &cursor->pPara->member.para ) ); cursor->nOffset = 0; }
static void ME_SetCursorToEnd(ME_TextEditor *editor, ME_Cursor *cursor, BOOL final_eop) { - cursor->pPara = editor->pBuffer->pLast->member.para.prev_para; - cursor->pRun = ME_FindItemBack(editor->pBuffer->pLast, diRun); + cursor->pPara = para_get_di( para_prev( editor_end_para( editor ) ) ); + cursor->pRun = run_get_di( para_end_run( &cursor->pPara->member.para ) ); cursor->nOffset = final_eop ? cursor->pRun->member.run.len : 0; }
diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c index e988eb9a014..51a6e33aef4 100644 --- a/dlls/riched20/editor.c +++ b/dlls/riched20/editor.c @@ -285,6 +285,12 @@ ME_Paragraph *editor_first_para( ME_TextEditor *editor ) return para_next( &editor->pBuffer->pFirst->member.para ); }
+/* Note, returns the diTextEnd sentinel paragraph */ +ME_Paragraph *editor_end_para( ME_TextEditor *editor ) +{ + return &editor->pBuffer->pLast->member.para; +} + static LRESULT ME_StreamInText(ME_TextEditor *editor, DWORD dwFormat, ME_InStream *stream, ME_Style *style) { WCHAR *pText; diff --git a/dlls/riched20/editor.h b/dlls/riched20/editor.h index 4412a574262..c79fa0e18f0 100644 --- a/dlls/riched20/editor.h +++ b/dlls/riched20/editor.h @@ -273,6 +273,7 @@ void ME_ReplaceSel(ME_TextEditor *editor, BOOL can_undo, const WCHAR *str, int l int set_selection( ME_TextEditor *editor, int to, int from ) DECLSPEC_HIDDEN; HRESULT editor_copy_or_cut( ME_TextEditor *editor, BOOL cut, ME_Cursor *start, int count, IDataObject **data_out ) DECLSPEC_HIDDEN; +ME_Paragraph *editor_end_para( ME_TextEditor *editor ) DECLSPEC_HIDDEN; ME_Paragraph *editor_first_para( ME_TextEditor *editor ) DECLSPEC_HIDDEN;
/* table.c */