Signed-off-by: Huw Davies <huw(a)codeweavers.com>
---
dlls/riched20/caret.c | 4 +-
dlls/riched20/editor.c | 47 +++++++++++------------
dlls/riched20/editor.h | 4 +-
dlls/riched20/richole.c | 84 ++++++++++++++++++++++-------------------
dlls/riched20/run.c | 66 +++++++++++---------------------
dlls/riched20/txtsrv.c | 2 +-
dlls/riched20/undo.c | 12 +++---
7 files changed, 103 insertions(+), 116 deletions(-)
diff --git a/dlls/riched20/caret.c b/dlls/riched20/caret.c
index c5fa51894e8..d66dd57383b 100644
--- a/dlls/riched20/caret.c
+++ b/dlls/riched20/caret.c
@@ -201,7 +201,7 @@ int set_selection_cursors(ME_TextEditor *editor, int from, int to)
return len;
}
- ME_CursorFromCharOfs(editor, from, &editor->pCursors[1]);
+ cursor_from_char_ofs( editor, from, &editor->pCursors[1] );
editor->pCursors[0] = editor->pCursors[1];
ME_MoveCursorChars(editor, &editor->pCursors[0], to - from, FALSE);
/* Selection is not allowed in the middle of an end paragraph run. */
@@ -326,7 +326,7 @@ BOOL ME_InternalDeleteText(ME_TextEditor *editor, ME_Cursor *start,
while(nChars > 0)
{
ME_Run *run;
- ME_CursorFromCharOfs(editor, nOfs+nChars, &c);
+ cursor_from_char_ofs( editor, nOfs + nChars, &c );
if (!c.nOffset &&
nOfs+nChars == (c.pRun->member.run.nCharOfs
+ c.pPara->member.para.nCharOfs))
diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c
index a144137baa1..30441658311 100644
--- a/dlls/riched20/editor.c
+++ b/dlls/riched20/editor.c
@@ -1788,7 +1788,7 @@ static LRESULT ME_StreamIn(ME_TextEditor *editor, DWORD format, EDITSTREAM *stre
/* put the cursor at the top */
if (!(format & SFF_SELECTION))
set_selection_cursors(editor, 0, 0);
- ME_CursorFromCharOfs(editor, from, &start);
+ cursor_from_char_ofs( editor, from, &start );
ME_UpdateLinkAttribute(editor, &start, to - from);
}
@@ -1917,12 +1917,11 @@ ME_FindText(ME_TextEditor *editor, DWORD flags, const CHARRANGE *chrg, const WCH
/* If possible, find the character before where the search starts */
if ((flags & FR_WHOLEWORD) && nMin)
{
- ME_CursorFromCharOfs(editor, nMin - 1, &cursor);
+ cursor_from_char_ofs( editor, nMin - 1, &cursor );
wLastChar = *get_text( &cursor.pRun->member.run, cursor.nOffset );
ME_MoveCursorChars(editor, &cursor, 1, FALSE);
- } else {
- ME_CursorFromCharOfs(editor, nMin, &cursor);
}
+ else cursor_from_char_ofs( editor, nMin, &cursor );
while (cursor.pRun && ME_GetCursorOfs(&cursor) + nLen <= nMax)
{
@@ -1993,12 +1992,11 @@ ME_FindText(ME_TextEditor *editor, DWORD flags, const CHARRANGE *chrg, const WCH
/* If possible, find the character after where the search ends */
if ((flags & FR_WHOLEWORD) && nMax < nTextLen - 1)
{
- ME_CursorFromCharOfs(editor, nMax + 1, &cursor);
+ cursor_from_char_ofs( editor, nMax + 1, &cursor );
wLastChar = *get_text( &cursor.pRun->member.run, cursor.nOffset );
ME_MoveCursorChars(editor, &cursor, -1, FALSE);
- } else {
- ME_CursorFromCharOfs(editor, nMax, &cursor);
}
+ else cursor_from_char_ofs( editor, nMax, &cursor );
while (cursor.pRun && ME_GetCursorOfs(&cursor) - nLen >= nMin)
{
@@ -3009,7 +3007,7 @@ static LONG ME_GetSelectionType(ME_TextEditor *editor)
{
ME_Cursor cursor;
- ME_CursorFromCharOfs(editor, start + i, &cursor);
+ cursor_from_char_ofs( editor, start + i, &cursor );
if (cursor.pRun->member.run.reobj)
object_count++;
else
@@ -4205,7 +4203,7 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
nEnd = textlength;
if (nStart >= nEnd) return 0;
- ME_CursorFromCharOfs(editor, nStart, &start);
+ cursor_from_char_ofs( editor, nStart, &start );
return ME_GetTextRange(editor, rng->lpstrText, &start, nEnd - nStart, unicode);
}
case EM_GETLINE:
@@ -4313,7 +4311,7 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
{
ME_DisplayItem *item, *item_end;
int nChars = 0, nThisLineOfs = 0, nNextLineOfs = 0;
- ME_DisplayItem *para, *run;
+ ME_Cursor cursor;
if (wParam > ME_GetTextLength(editor))
return 0;
@@ -4322,19 +4320,20 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
FIXME("EM_LINELENGTH: returning number of unselected characters on lines with selection unsupported.\n");
return 0;
}
- ME_RunOfsFromCharOfs(editor, wParam, ¶, &run, NULL);
- item = ME_RowStart(run);
- nThisLineOfs = ME_CharOfsFromRunOfs(editor, para, ME_FindItemFwd(item, diRun), 0);
+ cursor_from_char_ofs( editor, wParam, &cursor );
+ item = ME_RowStart( cursor.pRun );
+ nThisLineOfs = ME_CharOfsFromRunOfs( editor, cursor.pPara, ME_FindItemFwd( item, diRun ), 0 );
item_end = ME_FindItemFwd(item, diStartRowOrParagraphOrEnd);
- if (item_end->type == diStartRow) {
- nNextLineOfs = ME_CharOfsFromRunOfs(editor, para, ME_FindItemFwd(item_end, diRun), 0);
- } else {
+ if (item_end->type == diStartRow)
+ nNextLineOfs = ME_CharOfsFromRunOfs(editor, cursor.pPara, ME_FindItemFwd( item_end, diRun ), 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;
}
nChars = nNextLineOfs - nThisLineOfs;
- TRACE("EM_LINELENGTH(%ld)==%d\n",wParam, nChars);
+ TRACE("EM_LINELENGTH(%ld)==%d\n", wParam, nChars);
return nChars;
}
case EM_EXLIMITTEXT:
@@ -4424,8 +4423,8 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
}
case EM_POSFROMCHAR:
{
- ME_DisplayItem *pPara, *pRun;
- int nCharOfs, nOffset, nLength;
+ ME_Cursor cursor;
+ int nCharOfs, nLength;
POINTL pt = {0,0};
nCharOfs = wParam;
@@ -4436,11 +4435,11 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
nCharOfs = min(nCharOfs, nLength);
nCharOfs = max(nCharOfs, 0);
- ME_RunOfsFromCharOfs(editor, nCharOfs, &pPara, &pRun, &nOffset);
- assert(pRun->type == diRun);
- pt.y = pRun->member.run.pt.y;
- pt.x = pRun->member.run.pt.x + ME_PointFromChar(editor, &pRun->member.run, nOffset, TRUE);
- pt.y += pPara->member.para.pt.y + editor->rcFormat.top;
+ cursor_from_char_ofs( editor, nCharOfs, &cursor );
+ pt.y = cursor.pRun->member.run.pt.y;
+ pt.x = cursor.pRun->member.run.pt.x +
+ ME_PointFromChar( editor, &cursor.pRun->member.run, cursor.nOffset, TRUE );
+ pt.y += cursor.pPara->member.para.pt.y + editor->rcFormat.top;
pt.x += editor->rcFormat.left;
pt.x -= editor->horz_si.nPos;
diff --git a/dlls/riched20/editor.h b/dlls/riched20/editor.h
index 1a9f3fd6fb0..163be9c8179 100644
--- a/dlls/riched20/editor.h
+++ b/dlls/riched20/editor.h
@@ -118,6 +118,8 @@ ME_DisplayItem *ME_FindRowWithNumber(ME_TextEditor *editor, int nRow) DECLSPEC_H
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;
+
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;
@@ -138,8 +140,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;
-void ME_CursorFromCharOfs(ME_TextEditor *editor, int nCharOfs, ME_Cursor *pCursor) DECLSPEC_HIDDEN;
-void ME_RunOfsFromCharOfs(ME_TextEditor *editor, int nCharOfs, ME_DisplayItem **ppPara, ME_DisplayItem **ppRun, int *pOfs) 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;
diff --git a/dlls/riched20/richole.c b/dlls/riched20/richole.c
index 47d8442d5ce..923984e96b1 100644
--- a/dlls/riched20/richole.c
+++ b/dlls/riched20/richole.c
@@ -444,7 +444,7 @@ static HRESULT get_textfont_prop_for_pos(const IRichEditOleImpl *reole, int pos,
fmt.cbSize = sizeof(fmt);
fmt.dwMask = textfont_prop_masks[propid][0];
- ME_CursorFromCharOfs(reole->editor, pos, &from);
+ cursor_from_char_ofs( reole->editor, pos, &from );
to = from;
ME_MoveCursorChars(reole->editor, &to, 1, FALSE);
ME_GetCharFormat(reole->editor, &from, &to, &fmt);
@@ -662,7 +662,8 @@ static void textrange_set_font(ITextRange *range, ITextFont *font)
fmt.wWeight = value;
}
- if (fmt.dwMask) {
+ if (fmt.dwMask)
+ {
const IRichEditOleImpl *reole = get_range_reole(range);
ME_Cursor from, to;
LONG start, end;
@@ -670,8 +671,8 @@ static void textrange_set_font(ITextRange *range, ITextFont *font)
ITextRange_GetStart(range, &start);
ITextRange_GetEnd(range, &end);
- ME_CursorFromCharOfs(reole->editor, start, &from);
- ME_CursorFromCharOfs(reole->editor, end, &to);
+ cursor_from_char_ofs( reole->editor, start, &from );
+ cursor_from_char_ofs( reole->editor, end, &to );
ME_SetCharFormat(reole->editor, &from, &to, &fmt);
}
}
@@ -828,8 +829,8 @@ static HRESULT set_textfont_prop(ITextFontImpl *font, enum textfont_prop_id prop
ITextRange_GetStart(font->range, &start);
ITextRange_GetEnd(font->range, &end);
- ME_CursorFromCharOfs(reole->editor, start, &from);
- ME_CursorFromCharOfs(reole->editor, end, &to);
+ cursor_from_char_ofs( reole->editor, start, &from );
+ cursor_from_char_ofs( reole->editor, end, &to );
ME_SetCharFormat(reole->editor, &from, &to, &fmt);
return S_OK;
@@ -1349,12 +1350,15 @@ IRichEditOle_fnGetClipboardData(IRichEditOle *me, CHARRANGE *lpchrg,
TRACE("(%p,%p,%d)\n",This, lpchrg, reco);
if(!lplpdataobj)
return E_INVALIDARG;
- if(!lpchrg) {
+ if(!lpchrg)
+ {
int nFrom, nTo, nStartCur = ME_GetSelectionOfs(This->editor, &nFrom, &nTo);
start = This->editor->pCursors[nStartCur];
nChars = nTo - nFrom;
- } else {
- ME_CursorFromCharOfs(This->editor, lpchrg->cpMin, &start);
+ }
+ else
+ {
+ cursor_from_char_ofs( This->editor, lpchrg->cpMin, &start );
nChars = lpchrg->cpMax - lpchrg->cpMin;
}
return ME_GetDataObject(This->editor, &start, nChars, lplpdataobj);
@@ -1385,7 +1389,7 @@ IRichEditOle_fnGetObject(IRichEditOle *me, LONG iob,
ME_Cursor cursor;
TRACE("character offset: %d\n", lpreobject->cp);
- ME_CursorFromCharOfs(This->editor, lpreobject->cp, &cursor);
+ cursor_from_char_ofs( This->editor, lpreobject->cp, &cursor );
if (!cursor.pRun->member.run.reobj)
return E_INVALIDARG;
else
@@ -1647,8 +1651,8 @@ static HRESULT WINAPI ITextRange_fnGetText(ITextRange *me, BSTR *str)
}
editor = This->child.reole->editor;
- ME_CursorFromCharOfs(editor, This->start, &start);
- ME_CursorFromCharOfs(editor, This->end, &end);
+ cursor_from_char_ofs( editor, This->start, &start );
+ cursor_from_char_ofs( editor, This->end, &end );
length = This->end - This->start;
*str = SysAllocStringLen(NULL, length);
@@ -1676,12 +1680,14 @@ static HRESULT WINAPI ITextRange_fnSetText(ITextRange *me, BSTR str)
editor = This->child.reole->editor;
/* delete only where's something to delete */
- if (This->start != This->end) {
- ME_CursorFromCharOfs(editor, This->start, &cursor);
+ if (This->start != This->end)
+ {
+ cursor_from_char_ofs( editor, This->start, &cursor );
ME_InternalDeleteText(editor, &cursor, This->end - This->start, FALSE);
}
- if (!str || !*str) {
+ if (!str || !*str)
+ {
/* will update this range as well */
textranges_update_ranges(This->child.reole, This->start, This->end, RANGE_UPDATE_DELETE);
return S_OK;
@@ -1690,7 +1696,7 @@ static HRESULT WINAPI ITextRange_fnSetText(ITextRange *me, BSTR str)
/* it's safer not to rely on stored BSTR length */
len = lstrlenW(str);
cursor = editor->pCursors[0];
- ME_CursorFromCharOfs(editor, This->start, &editor->pCursors[0]);
+ cursor_from_char_ofs( editor, This->start, &editor->pCursors[0] );
style = ME_GetInsertStyle(editor, 0);
ME_InsertTextFromCursor(editor, 0, str, len, style);
ME_ReleaseStyle(style);
@@ -1729,7 +1735,7 @@ static HRESULT WINAPI ITextRange_fnGetChar(ITextRange *me, LONG *pch)
return E_INVALIDARG;
editor = This->child.reole->editor;
- ME_CursorFromCharOfs(editor, This->start, &cursor);
+ cursor_from_char_ofs( editor, This->start, &cursor );
return range_GetChar(editor, &cursor, pch);
}
@@ -2213,18 +2219,16 @@ static HRESULT textrange_endof(ITextRange *range, ME_TextEditor *editor, LONG un
{
moved = 0;
new_end = old_end;
- if (old_end == 0) {
+ if (old_end == 0)
+ {
ME_Cursor cursor;
- ME_CursorFromCharOfs(editor, old_end, &cursor);
+ cursor_from_char_ofs( editor, old_end, &cursor );
moved = ME_MoveCursorChars(editor, &cursor, 1, TRUE);
new_end = old_end + moved;
- } else {
- if (extend == tomMove) {
- if (old_start != old_end) {
- moved = 1;
- }
- }
}
+ else if (extend == tomMove && old_start != old_end)
+ moved = 1;
+
ITextRange_SetEnd(range, new_end);
if (extend == tomMove)
ITextRange_SetStart(range, new_end);
@@ -2275,32 +2279,36 @@ static HRESULT textrange_move(ITextRange *range, ME_TextEditor *editor, LONG uni
{
ME_Cursor cursor;
- if (count > 0) {
- ME_CursorFromCharOfs(editor, old_end, &cursor);
+ if (count > 0)
+ {
+ cursor_from_char_ofs( editor, old_end, &cursor );
move_by = count;
if (old_start != old_end)
--move_by;
- } else {
- ME_CursorFromCharOfs(editor, old_start, &cursor);
+ }
+ else
+ {
+ cursor_from_char_ofs( editor, old_start, &cursor );
move_by = count;
if (old_start != old_end)
++move_by;
}
moved = ME_MoveCursorChars(editor, &cursor, move_by, FALSE);
- if (count > 0) {
+ if (count > 0)
+ {
new_end = old_end + moved;
new_start = new_end;
if (old_start != old_end)
++moved;
- } else {
+ }
+ else
+ {
new_start = old_start + moved;
new_end = new_start;
if (old_start != old_end)
--moved;
}
- if (delta) {
- *delta = moved;
- }
+ if (delta) *delta = moved;
break;
}
default:
@@ -2348,7 +2356,7 @@ static HRESULT textrange_movestart(ITextRange *range, ME_TextEditor *editor, LON
ME_Cursor cursor;
LONG moved;
- ME_CursorFromCharOfs(editor, old_start, &cursor);
+ cursor_from_char_ofs( editor, old_start, &cursor );
moved = ME_MoveCursorChars(editor, &cursor, count, FALSE);
new_start = old_start + moved;
new_end = old_end;
@@ -2404,7 +2412,7 @@ static HRESULT textrange_moveend(ITextRange *range, ME_TextEditor *editor, LONG
ME_Cursor cursor;
LONG moved;
- ME_CursorFromCharOfs(editor, old_end, &cursor);
+ cursor_from_char_ofs( editor, old_end, &cursor );
moved = ME_MoveCursorChars(editor, &cursor, count, TRUE);
new_start = old_start;
new_end = old_end + moved;
@@ -2700,11 +2708,11 @@ static HRESULT WINAPI ITextRange_fnScrollIntoView(ITextRange *me, LONG value)
switch (value)
{
case tomStart:
- ME_CursorFromCharOfs(editor, This->start, &cursor);
+ cursor_from_char_ofs( editor, This->start, &cursor );
ME_GetCursorCoordinates(editor, &cursor, &x, &y, &height);
break;
case tomEnd:
- ME_CursorFromCharOfs(editor, This->end, &cursor);
+ cursor_from_char_ofs( editor, This->end, &cursor );
ME_GetCursorCoordinates(editor, &cursor, &x, &y, &height);
break;
default:
diff --git a/dlls/riched20/run.c b/dlls/riched20/run.c
index 75195e343ed..92d0721247c 100644
--- a/dlls/riched20/run.c
+++ b/dlls/riched20/run.c
@@ -202,58 +202,38 @@ int ME_CharOfsFromRunOfs(ME_TextEditor *editor, const ME_DisplayItem *pPara,
}
/******************************************************************************
- * ME_CursorFromCharOfs
+ * cursor_from_char_ofs
*
* Converts a character offset (relative to the start of the document) to
* a cursor structure (which contains a run and a position relative to that
* run).
*/
-void ME_CursorFromCharOfs(ME_TextEditor *editor, int nCharOfs, ME_Cursor *pCursor)
+void cursor_from_char_ofs( ME_TextEditor *editor, int char_ofs, ME_Cursor *cursor )
{
- ME_RunOfsFromCharOfs(editor, nCharOfs, &pCursor->pPara,
- &pCursor->pRun, &pCursor->nOffset);
-}
+ ME_Paragraph *para;
+ ME_Run *run;
-/******************************************************************************
- * ME_RunOfsFromCharOfs
- *
- * Find a run and relative character offset given an absolute character offset
- * (absolute offset being an offset relative to the start of the document).
- * Kind of a "global to local" offset conversion.
- */
-void ME_RunOfsFromCharOfs(ME_TextEditor *editor,
- int nCharOfs,
- ME_DisplayItem **ppPara,
- ME_DisplayItem **ppRun,
- int *pOfs)
-{
- ME_DisplayItem *item, *next_item;
+ char_ofs = min( max( char_ofs, 0 ), ME_GetTextLength( editor ) );
- nCharOfs = max(nCharOfs, 0);
- nCharOfs = min(nCharOfs, ME_GetTextLength(editor));
+ /* Find the paragraph at the offset. */
+ for (para = editor_first_para( editor );
+ para_next( para )->nCharOfs <= char_ofs;
+ para = para_next( para ))
+ ;
- /* Find the paragraph at the offset. */
- next_item = editor->pBuffer->pFirst->member.para.next_para;
- do {
- item = next_item;
- next_item = item->member.para.next_para;
- } while (next_item->member.para.nCharOfs <= nCharOfs);
- assert(item->type == diParagraph);
- nCharOfs -= item->member.para.nCharOfs;
- if (ppPara) *ppPara = item;
-
- /* Find the run at the offset. */
- next_item = ME_FindItemFwd(item, diRun);
- do {
- item = next_item;
- next_item = ME_FindItemFwd(item, diRunOrParagraphOrEnd);
- } while (next_item->type == diRun &&
- next_item->member.run.nCharOfs <= nCharOfs);
- assert(item->type == diRun);
- nCharOfs -= item->member.run.nCharOfs;
-
- if (ppRun) *ppRun = item;
- if (pOfs) *pOfs = nCharOfs;
+ char_ofs -= para->nCharOfs;
+
+ /* Find the run at the offset. */
+ for (run = para_first_run( para );
+ run_next( run ) && run_next( run )->nCharOfs <= char_ofs;
+ run = run_next( run ))
+ ;
+
+ char_ofs -= run->nCharOfs;
+
+ cursor->pPara = para_get_di( para );
+ cursor->pRun = run_get_di( run );
+ cursor->nOffset = char_ofs;
}
/******************************************************************************
diff --git a/dlls/riched20/txtsrv.c b/dlls/riched20/txtsrv.c
index 622d8519285..3fd4ae540c5 100644
--- a/dlls/riched20/txtsrv.c
+++ b/dlls/riched20/txtsrv.c
@@ -269,7 +269,7 @@ DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxGetText(ITextServices *iface, BST
if (bstr == NULL)
return E_OUTOFMEMORY;
- ME_CursorFromCharOfs(This->editor, 0, &start);
+ cursor_from_char_ofs( This->editor, 0, &start );
ME_GetTextW(This->editor, bstr, length, &start, INT_MAX, FALSE, FALSE);
*pbstrText = bstr;
} else {
diff --git a/dlls/riched20/undo.c b/dlls/riched20/undo.c
index 1f5c7ae4cd6..3f3fd48bebd 100644
--- a/dlls/riched20/undo.c
+++ b/dlls/riched20/undo.c
@@ -336,7 +336,7 @@ static void ME_PlayUndoItem(ME_TextEditor *editor, struct undo_item *undo)
{
ME_Cursor tmp;
ME_DisplayItem *para;
- ME_CursorFromCharOfs(editor, undo->u.set_para_fmt.pos, &tmp);
+ cursor_from_char_ofs( editor, undo->u.set_para_fmt.pos, &tmp );
para = ME_FindItemBack(tmp.pRun, diParagraph);
add_undo_set_para_fmt( editor, ¶->member.para );
para->member.para.fmt = undo->u.set_para_fmt.fmt;
@@ -347,7 +347,7 @@ static void ME_PlayUndoItem(ME_TextEditor *editor, struct undo_item *undo)
case undo_set_char_fmt:
{
ME_Cursor start, end;
- ME_CursorFromCharOfs(editor, undo->u.set_char_fmt.pos, &start);
+ cursor_from_char_ofs( editor, undo->u.set_char_fmt.pos, &start );
end = start;
ME_MoveCursorChars(editor, &end, undo->u.set_char_fmt.len, FALSE);
ME_SetCharFormat(editor, &start, &end, &undo->u.set_char_fmt.fmt);
@@ -356,7 +356,7 @@ static void ME_PlayUndoItem(ME_TextEditor *editor, struct undo_item *undo)
case undo_insert_run:
{
ME_Cursor tmp;
- ME_CursorFromCharOfs(editor, undo->u.insert_run.pos, &tmp);
+ cursor_from_char_ofs( editor, undo->u.insert_run.pos, &tmp );
run_insert( editor, &tmp, undo->u.insert_run.style,
undo->u.insert_run.str, undo->u.insert_run.len,
undo->u.insert_run.flags );
@@ -365,14 +365,14 @@ static void ME_PlayUndoItem(ME_TextEditor *editor, struct undo_item *undo)
case undo_delete_run:
{
ME_Cursor tmp;
- ME_CursorFromCharOfs(editor, undo->u.delete_run.pos, &tmp);
+ cursor_from_char_ofs( editor, undo->u.delete_run.pos, &tmp );
ME_InternalDeleteText(editor, &tmp, undo->u.delete_run.len, TRUE);
break;
}
case undo_join_paras:
{
ME_Cursor tmp;
- ME_CursorFromCharOfs(editor, undo->u.join_paras.pos, &tmp);
+ cursor_from_char_ofs( editor, undo->u.join_paras.pos, &tmp );
ME_JoinParagraphs(editor, tmp.pPara, TRUE);
break;
}
@@ -383,7 +383,7 @@ static void ME_PlayUndoItem(ME_TextEditor *editor, struct undo_item *undo)
BOOL bFixRowStart;
int paraFlags = undo->u.split_para.flags & (MEPF_ROWSTART|MEPF_CELL|MEPF_ROWEND);
- ME_CursorFromCharOfs(editor, undo->u.split_para.pos, &tmp);
+ cursor_from_char_ofs( editor, undo->u.split_para.pos, &tmp );
if (tmp.nOffset) run_split( editor, &tmp );
this_para = tmp.pPara;
bFixRowStart = this_para->member.para.nFlags & MEPF_ROWSTART;
--
2.23.0