richedit: Simplified the character length delete protection.
The value for nMaxChars can be found easier by using ME_GetTextLength.
This commit is contained in:
parent
1f3fd357db
commit
a490e155dc
|
@ -273,14 +273,8 @@ BOOL ME_InternalDeleteText(ME_TextEditor *editor, int nOfs, int nChars,
|
||||||
int totalChars = nChars;
|
int totalChars = nChars;
|
||||||
ME_DisplayItem *start_para;
|
ME_DisplayItem *start_para;
|
||||||
|
|
||||||
{
|
|
||||||
/* Prevent deletion past last end of paragraph run. */
|
/* Prevent deletion past last end of paragraph run. */
|
||||||
ME_DisplayItem *pTextEnd = editor->pBuffer->pLast;
|
nChars = min(nChars, ME_GetTextLength(editor) - nOfs);
|
||||||
int nMaxChars = pTextEnd->member.para.prev_para->member.para.nCharOfs;
|
|
||||||
nMaxChars += ME_FindItemBack(pTextEnd, diRun)->member.run.nCharOfs;
|
|
||||||
nMaxChars -= nOfs;
|
|
||||||
nChars = min(nChars, nMaxChars);
|
|
||||||
}
|
|
||||||
|
|
||||||
ME_CursorFromCharOfs(editor, nOfs, &c);
|
ME_CursorFromCharOfs(editor, nOfs, &c);
|
||||||
start_para = ME_GetParagraph(c.pRun);
|
start_para = ME_GetParagraph(c.pRun);
|
||||||
|
|
Loading…
Reference in New Issue