The format rect is recalculated for each font change. MoveEnd &
MoveHome improved.
diff --git a/controls/edit.c b/controls/edit.c
index c90ac11..9c39b44 100644
--- a/controls/edit.c
+++ b/controls/edit.c
@@ -1463,8 +1463,9 @@
BOOL after_wrap = FALSE;
INT e;
+ /* Pass a high value in x to make sure of receiving the en of the line */
if (es->style & ES_MULTILINE)
- e = EDIT_CharFromPos(wnd, es, 0x7fffffff,
+ e = EDIT_CharFromPos(wnd, es, 0x3fffffff,
HIWORD(EDIT_EM_PosFromChar(wnd, es, es->selection_end, es->flags & EF_AFTER_WRAP)), &after_wrap);
else
e = lstrlenA(es->text);
@@ -1507,8 +1508,9 @@
{
INT e;
+ /* Pass the x_offset in x to make sure of receiving the first position of the line */
if (es->style & ES_MULTILINE)
- e = EDIT_CharFromPos(wnd, es, 0x80000000,
+ e = EDIT_CharFromPos(wnd, es, -es->x_offset,
HIWORD(EDIT_EM_PosFromChar(wnd, es, es->selection_end, es->flags & EF_AFTER_WRAP)), NULL);
else
e = 0;
@@ -3665,7 +3667,6 @@
BOOL rev = es->bEnableState &&
((es->flags & EF_FOCUSED) ||
(es->style & ES_NOHIDESEL));
-
if (es->flags & EF_UPDATE)
EDIT_NOTIFY_PARENT(wnd, EN_UPDATE, "EN_UPDATE");
@@ -3800,6 +3801,7 @@
TEXTMETRICA tm;
HDC dc;
HFONT old_font = 0;
+ RECT r;
es->font = font;
dc = GetDC(wnd->hwndSelf);
@@ -3814,13 +3816,14 @@
if (font && (TWEAK_WineLook > WIN31_LOOK))
EDIT_EM_SetMargins(wnd, es, EC_LEFTMARGIN | EC_RIGHTMARGIN,
EC_USEFONTINFO, EC_USEFONTINFO);
+
+ /* Force the recalculation of the format rect for each font change */
+ GetClientRect(wnd->hwndSelf, &r);
+ EDIT_SetRectNP(wnd, es, &r);
+
if (es->style & ES_MULTILINE)
EDIT_BuildLineDefs_ML(wnd, es);
- else {
- RECT r;
- GetClientRect(wnd->hwndSelf, &r);
- EDIT_SetRectNP(wnd, es, &r);
- }
+
if (redraw)
InvalidateRect(wnd->hwndSelf, NULL, TRUE);
if (es->flags & EF_FOCUSED) {