Commit 0b01b40a authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

riched20: Return a run ptr from the run splitting function.

parent 90bb4fe3
......@@ -607,7 +607,9 @@ void ME_InsertTextFromCursor(ME_TextEditor *editor, int nCursor,
/* handle special \r\r\n sequence (richedit 2.x and higher only) */
WCHAR space = ' ';
ME_InternalInsertTextFromCursor(editor, nCursor, &space, 1, style, 0);
} else {
}
else
{
const WCHAR cr = '\r', *eol_str = str;
if (!editor->bEmulateVersion10)
......@@ -625,7 +627,7 @@ void ME_InsertTextFromCursor(ME_TextEditor *editor, int nCursor,
}
else
{
if (p->nOffset) ME_SplitRunSimple(editor, p);
if (p->nOffset) run_split( editor, p );
run = &p->pRun->member.run;
}
......
......@@ -132,7 +132,7 @@ int ME_PointFromCharContext(ME_Context *c, ME_Run *pRun, int nOffset, BOOL visua
int ME_PointFromChar(ME_TextEditor *editor, ME_Run *pRun, int nOffset, BOOL visual_order) DECLSPEC_HIDDEN;
BOOL ME_CanJoinRuns(const ME_Run *run1, const ME_Run *run2) DECLSPEC_HIDDEN;
void run_join( ME_TextEditor *editor, ME_Run *run ) DECLSPEC_HIDDEN;
ME_DisplayItem *ME_SplitRunSimple(ME_TextEditor *editor, ME_Cursor *cursor) DECLSPEC_HIDDEN;
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;
......
......@@ -268,12 +268,12 @@ void run_join( ME_TextEditor *editor, ME_Run *run )
}
/******************************************************************************
* ME_SplitRunSimple
* run_split
*
* Does the most basic job of splitting a run into two - it does not
* update the positions and extents.
*/
ME_DisplayItem *ME_SplitRunSimple( ME_TextEditor *editor, ME_Cursor *cursor )
ME_Run *run_split( ME_TextEditor *editor, ME_Cursor *cursor )
{
ME_Run *run = &cursor->pRun->member.run, *new_run;
int i;
......@@ -303,7 +303,7 @@ ME_DisplayItem *ME_SplitRunSimple( ME_TextEditor *editor, ME_Cursor *cursor )
}
}
para_mark_rewrap( editor, run->para );
return run_get_di( run );
return run;
}
/******************************************************************************
......@@ -359,7 +359,7 @@ ME_InsertRunAtCursor(ME_TextEditor *editor, ME_Cursor *cursor, ME_Style *style,
}
else
{
ME_SplitRunSimple( editor, cursor );
run_split( editor, cursor );
insert_before = cursor->pRun;
}
}
......@@ -756,12 +756,12 @@ void ME_SetCharFormat(ME_TextEditor *editor, ME_Cursor *start, ME_Cursor *end, C
start_run = ME_FindItemFwd( start->pRun, diRun );
else if (start->nOffset)
{
/* SplitRunSimple may or may not update the cursors, depending on whether they
/* run_split() may or may not update the cursors, depending on whether they
* are selection cursors, but we need to make sure they are valid. */
int split_offset = start->nOffset;
ME_DisplayItem *split_run = ME_SplitRunSimple(editor, start);
ME_Run *split_run = run_split( editor, start );
start_run = start->pRun;
if (end && end->pRun == split_run)
if (end && &end->pRun->member.run == split_run)
{
end->pRun = start->pRun;
end->nOffset -= split_offset;
......@@ -774,7 +774,7 @@ void ME_SetCharFormat(ME_TextEditor *editor, ME_Cursor *start, ME_Cursor *end, C
end_run = ME_FindItemFwd( end->pRun, diRun );
else
{
if (end->nOffset) ME_SplitRunSimple(editor, end);
if (end->nOffset) run_split( editor, end );
end_run = end->pRun;
}
}
......
......@@ -66,8 +66,8 @@ static ME_DisplayItem* ME_InsertEndParaFromCursor(ME_TextEditor *editor,
ME_Style *pStyle = ME_GetInsertStyle(editor, nCursor);
ME_DisplayItem *tp;
ME_Cursor* cursor = &editor->pCursors[nCursor];
if (cursor->nOffset)
ME_SplitRunSimple(editor, cursor);
if (cursor->nOffset) run_split( editor, cursor );
tp = ME_SplitParagraph(editor, cursor->pRun, pStyle, eol_str, eol_len, paraFlags);
ME_ReleaseStyle(pStyle);
......
......@@ -383,9 +383,9 @@ static void ME_PlayUndoItem(ME_TextEditor *editor, struct undo_item *undo)
ME_DisplayItem *this_para, *new_para;
BOOL bFixRowStart;
int paraFlags = undo->u.split_para.flags & (MEPF_ROWSTART|MEPF_CELL|MEPF_ROWEND);
ME_CursorFromCharOfs(editor, undo->u.split_para.pos, &tmp);
if (tmp.nOffset)
ME_SplitRunSimple(editor, &tmp);
if (tmp.nOffset) run_split( editor, &tmp );
this_para = tmp.pPara;
bFixRowStart = this_para->member.para.nFlags & MEPF_ROWSTART;
if (bFixRowStart)
......
......@@ -139,7 +139,7 @@ static ME_Run *split_run_extents( ME_WrapContext *wc, ME_Run *run, int nVChar )
TRACE("Before split: %s(%d, %d)\n", debugstr_run( run ),
run->pt.x, run->pt.y);
ME_SplitRunSimple(editor, &cursor);
run_split( editor, &cursor );
run2 = &cursor.pRun->member.run;
run2->script_analysis = run->script_analysis;
......@@ -776,7 +776,7 @@ static HRESULT itemize_para( ME_Context *c, ME_Paragraph *para )
if (run->nCharOfs + run->len > items[cur_item+1].iCharPos)
{
ME_Cursor cursor = {para_get_di( para ), run_get_di( run ), items[cur_item+1].iCharPos - run->nCharOfs};
ME_SplitRunSimple( c->editor, &cursor );
run_split( c->editor, &cursor );
}
}
......
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