From 4c7b65db8c2f2673a10495c558fce46b8b685346 Mon Sep 17 00:00:00 2001
From: Huw Davies <huw@codeweavers.com>
Date: Tue, 11 Nov 2003 00:26:53 +0000
Subject: [PATCH] We need to invalidate the replaced text region before calling
 EM_ScrollCaret as this may call ScrollWindow.  Previously newly added lines
 were not displayed if the edit needed to scroll.

---
 controls/edit.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/controls/edit.c b/controls/edit.c
index d1f02e25824..e95929977cf 100644
--- a/controls/edit.c
+++ b/controls/edit.c
@@ -2981,18 +2981,19 @@ static void EDIT_EM_ReplaceSel(EDITSTATE *es, BOOL can_undo, LPCWSTR lpsz_replac
 	EDIT_EM_SetSel(es, s, s, FALSE);
 	es->flags |= EF_MODIFIED;
 	if (send_update) es->flags |= EF_UPDATE;
-	EDIT_EM_ScrollCaret(es);
-
-	/* force scroll info update */
-	EDIT_UpdateScrollInfo(es);
-
 	if (hrgn)
 	{
 		EDIT_UpdateTextRegion(es, hrgn, TRUE);
 		DeleteObject(hrgn);
 	}
 	else
-	EDIT_UpdateText(es, NULL, TRUE);
+            EDIT_UpdateText(es, NULL, TRUE);
+
+	EDIT_EM_ScrollCaret(es);
+
+	/* force scroll info update */
+	EDIT_UpdateScrollInfo(es);
+
 
 	if(es->flags & EF_UPDATE)
 	{
-- 
GitLab