From: chenjiangyi chenjiangyi@uniontech.com
Description: When flags does not include DT_CALCRECT, since len is calculated in the middle, it will be reduced to zero. Resulting in the length of the processed string that is finally returned to zero and the non-processing string length is unchanged. But some application taking the non-processing string length to zero as the loop end condition.
Log:
Signed-off-by: chenjiangyi chenjiangyi@uniontech.com Change-Id: Icc0f250f5f4faba1bee8326fc911a4fc9cd7c012 --- dlls/user32/text.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/dlls/user32/text.c b/dlls/user32/text.c index 1896627c893..8bc393e3664 100644 --- a/dlls/user32/text.c +++ b/dlls/user32/text.c @@ -1021,10 +1021,13 @@ INT WINAPI DrawTextExW( HDC hdc, LPWSTR str, INT i_count, } len -= len_seg; str += len_seg; + if (dtp) dtp->uiLengthDrawn += len_seg; + if (len) { assert ((flags & DT_EXPANDTABS) && *str == TAB); len--; str++; + if (dtp) dtp->uiLengthDrawn++; xseg += ((size.cx/tabwidth)+1)*tabwidth; if (prefix_offset != -1) { @@ -1044,15 +1047,18 @@ INT WINAPI DrawTextExW( HDC hdc, LPWSTR str, INT i_count, } } } - else if (size.cx > max_width) - max_width = size.cx; + else + { + if (dtp) dtp->uiLengthDrawn += len; + + if (size.cx > max_width) + max_width = size.cx; + }
if (invert_y) y -= lh; else y += lh; - if (dtp) - dtp->uiLengthDrawn += len; } while (strPtr && !last_line);