summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2024-01-18 18:51:39 +0300
committerGeorge Hazan <george.hazan@gmail.com>2024-01-18 18:51:39 +0300
commit01894b3f4774f6fcb40c7799b51b61c073d9222f (patch)
treea0b0dcc1f43dc595e6d2954947d2fdf8c8c18ff0
parentec7ad35b1285d445aa9ae1a22fb1b583a62761eb (diff)
fixes #4131 (NewStory: если водить мышкой поверх сообщения, которое редактируется, появляются глитчи)
-rw-r--r--libs/mTextControl/src/FormattedTextDraw.cpp2
-rw-r--r--plugins/NewStory/src/history_control.cpp8
2 files changed, 6 insertions, 4 deletions
diff --git a/libs/mTextControl/src/FormattedTextDraw.cpp b/libs/mTextControl/src/FormattedTextDraw.cpp
index 49fcf74b8f..1fda38a677 100644
--- a/libs/mTextControl/src/FormattedTextDraw.cpp
+++ b/libs/mTextControl/src/FormattedTextDraw.cpp
@@ -300,7 +300,7 @@ void CFormattedTextDraw::TxInvalidateRect(LPCRECT, BOOL bRedraw)
{
if (m_hwndParent) {
TextControlData *data = (TextControlData *)GetWindowLongPtr(m_hwndParent, GWLP_USERDATA);
- if (!data->m_bInsideDraw)
+ if (!data || !data->m_bInsideDraw)
::InvalidateRect(m_hwndParent, NULL, bRedraw);
}
}
diff --git a/plugins/NewStory/src/history_control.cpp b/plugins/NewStory/src/history_control.cpp
index 295a49a4e2..2e7f799833 100644
--- a/plugins/NewStory/src/history_control.cpp
+++ b/plugins/NewStory/src/history_control.cpp
@@ -247,6 +247,7 @@ void NewstoryListData::BeginEditItem()
SendMessage(hwndEditBox, EM_SETMARGINS, EC_RIGHTMARGIN, 100);
ShowWindow(hwndEditBox, SW_SHOW);
SetFocus(hwndEditBox);
+ SetForegroundWindow(hwndEditBox);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -1133,9 +1134,10 @@ LRESULT CALLBACK NewstoryListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
int height = rc.bottom - rc.top;
int width = rc.right - rc.left;
int top = data->scrollTopPixel;
- idx = data->scrollTopItem;
- while ((top < height) && (idx < data->totalCount))
- top += data->PaintItem(hdc, data->LoadItem(idx++), top, width, true);
+
+ for (idx = data->scrollTopItem; top < height && idx < data->totalCount; idx++)
+ top += data->PaintItem(hdc, data->LoadItem(idx), top, width, !data->hwndEditBox || data->caret != idx);
+
data->cachedMaxDrawnItem = idx;
if (top <= height) {