summaryrefslogtreecommitdiff
path: root/plugins/Scriver
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2017-08-25 16:46:30 +0300
committerGeorge Hazan <ghazan@miranda.im>2017-08-25 16:46:30 +0300
commitcd4e21415d7f87e9c749eeb7749b832cfb79b69d (patch)
tree3405c6c2da5366f8c76c02261ae1ea2f22f0d9eb /plugins/Scriver
parentdfcfd2d4f53590faf29f3192eab235ffcace6bf2 (diff)
fixes a problem with log scroling in Scriver
Diffstat (limited to 'plugins/Scriver')
-rw-r--r--plugins/Scriver/src/chat_window.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/plugins/Scriver/src/chat_window.cpp b/plugins/Scriver/src/chat_window.cpp
index 23209b616d..87e7c52d51 100644
--- a/plugins/Scriver/src/chat_window.cpp
+++ b/plugins/Scriver/src/chat_window.cpp
@@ -411,10 +411,15 @@ void CChatRoomDlg::RedrawLog()
void CChatRoomDlg::ScrollToBottom()
{
if (GetWindowLongPtr(m_log.GetHwnd(), GWL_STYLE) & WS_VSCROLL) {
- int len = GetWindowTextLength(m_log.GetHwnd()) - 1;
- m_log.SendMsg(EM_SETSEL, len, len);
-
- PostMessage(m_log.GetHwnd(), WM_VSCROLL, MAKEWPARAM(SB_BOTTOM, 0), 0);
+ SCROLLINFO si = { sizeof(si) };
+ si.fMask = SIF_PAGE | SIF_RANGE | SIF_POS;
+ if (GetScrollInfo(m_log.GetHwnd(), SB_VERT, &si)) {
+ si.fMask = SIF_POS;
+ si.nPos = si.nMax - si.nPage + 1;
+ SetScrollInfo(m_log.GetHwnd(), SB_VERT, &si, TRUE);
+
+ PostMessage(m_log.GetHwnd(), WM_VSCROLL, MAKEWPARAM(SB_BOTTOM, 0), 0);
+ }
}
}