From cd4e21415d7f87e9c749eeb7749b832cfb79b69d Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 25 Aug 2017 16:46:30 +0300 Subject: fixes a problem with log scroling in Scriver --- plugins/Scriver/src/chat_window.cpp | 13 +++++++++---- 1 file 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); + } } } -- cgit v1.2.3