Commit 53959eb7 authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

riched20: Use helpers in the cursor to start/end functions.

parent 87c4d217
......@@ -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;
}
......
......@@ -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;
......
......@@ -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 */
......
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