richedit: Count graphics towards line width.

Dylan Smith dylan.ah.smith at gmail.com
Tue Mar 10 18:01:09 CDT 2009


Images that are inserted into richedit controls store a space for the
text, since that is the character returned when getting the plain text
from the control.

When calculating the width of a line, the space character is skipped,
but images should not be skipped.  This can be seen by inserting an
image into wordpad on a line by it's own, then centering the line.  The
image will start from the center rather than being centered in the
control.
---
 dlls/riched20/wrap.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
-------------- next part --------------
diff --git a/dlls/riched20/wrap.c b/dlls/riched20/wrap.c
index 54c90eb..579f33a 100644
--- a/dlls/riched20/wrap.c
+++ b/dlls/riched20/wrap.c
@@ -115,7 +115,8 @@ static void ME_InsertRowStart(ME_WrapContext *wc, const ME_DisplayItem *pEnd)
           WCHAR *text = p->member.run.strText->szData + len - 1;
 
           assert (len);
-          while (len && *(text--) == ' ')
+          if (~p->member.run.nFlags & MERF_GRAPHICS)
+            while (len && *(text--) == ' ')
               len--;
           if (len)
           {


More information about the wine-patches mailing list