Module: wine Branch: master Commit: a490e155dcec13903a04a4c7122d6149e949e1bd URL: http://source.winehq.org/git/wine.git/?a=commit;h=a490e155dcec13903a04a4c712...
Author: Dylan Smith dylan.ah.smith@gmail.com Date: Fri Feb 6 01:09:30 2009 -0500
richedit: Simplified the character length delete protection.
The value for nMaxChars can be found easier by using ME_GetTextLength.
---
dlls/riched20/caret.c | 10 ++-------- 1 files changed, 2 insertions(+), 8 deletions(-)
diff --git a/dlls/riched20/caret.c b/dlls/riched20/caret.c index cdd8f79..7bdd0a7 100644 --- a/dlls/riched20/caret.c +++ b/dlls/riched20/caret.c @@ -273,14 +273,8 @@ BOOL ME_InternalDeleteText(ME_TextEditor *editor, int nOfs, int nChars, int totalChars = nChars; ME_DisplayItem *start_para;
- { - /* Prevent deletion past last end of paragraph run. */ - ME_DisplayItem *pTextEnd = editor->pBuffer->pLast; - int nMaxChars = pTextEnd->member.para.prev_para->member.para.nCharOfs; - nMaxChars += ME_FindItemBack(pTextEnd, diRun)->member.run.nCharOfs; - nMaxChars -= nOfs; - nChars = min(nChars, nMaxChars); - } + /* Prevent deletion past last end of paragraph run. */ + nChars = min(nChars, ME_GetTextLength(editor) - nOfs);
ME_CursorFromCharOfs(editor, nOfs, &c); start_para = ME_GetParagraph(c.pRun);