Module: wine Branch: master Commit: db3991257fdb7137f9b0fab5e2a52a183828ff84 URL: http://source.winehq.org/git/wine.git/?a=commit;h=db3991257fdb7137f9b0fab5e2...
Author: Dylan Smith dylan.ah.smith@gmail.com Date: Thu Jul 10 10:17:43 2008 -0400
richedit: Handle overflow of only spaces on first line of paragraph.
The uncommon case that this patch handles is enough whitespace being on the first line of a paragraph to cause it to wrap. In this case the first non-space character will be wrapped onto the next line.
---
dlls/riched20/wrap.c | 15 +++++++++++++-- 1 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/dlls/riched20/wrap.c b/dlls/riched20/wrap.c index 614c6ac..90dca83 100644 --- a/dlls/riched20/wrap.c +++ b/dlls/riched20/wrap.c @@ -358,8 +358,19 @@ static ME_DisplayItem *ME_WrapHandleRun(ME_WrapContext *wc, ME_DisplayItem *p) pp = ME_SplitByBacktracking(wc, p, loc); if (pp == wc->pRowStart) { - /* we have a row that starts with spaces, or a single large character - * which we cannot split. */ + if (run->nFlags & MERF_STARTWHITE) + { + /* we had only spaces so far, so we must be on the first line of the + * paragraph, since no other lines of the paragraph start with spaces. */ + assert(!wc->nRow); + /* The lines will only contain spaces, and the rest of the run will + * overflow onto the next line. */ + wc->bOverflown = TRUE; + return p; + } + /* Couldn't split the first run, possible because we have a large font + * with a single character that caused an overflow. + */ wc->pt.x += run->nWidth; return p->next; }