diff options
author | George Hazan <ghazan@miranda.im> | 2017-08-16 16:16:54 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2017-08-16 16:16:54 +0300 |
commit | 5a6d4105c284fadf2306ebe6a83f4fe760d7dfb1 (patch) | |
tree | 9d3b0247e808b95c416873c330620eec539711cc | |
parent | d8fe65f78ea4f440a53069b43a08ab0000986d56 (diff) |
fixes #886 (Scriver: group chat does not start at the bottom)
-rw-r--r-- | plugins/Scriver/src/chat_window.cpp | 20 | ||||
-rw-r--r-- | src/core/stdmsg/src/chat_window.cpp | 20 |
2 files changed, 10 insertions, 30 deletions
diff --git a/plugins/Scriver/src/chat_window.cpp b/plugins/Scriver/src/chat_window.cpp index 551abc982b..23209b616d 100644 --- a/plugins/Scriver/src/chat_window.cpp +++ b/plugins/Scriver/src/chat_window.cpp @@ -410,22 +410,12 @@ void CChatRoomDlg::RedrawLog() void CChatRoomDlg::ScrollToBottom()
{
- if ((GetWindowLongPtr(m_log.GetHwnd(), GWL_STYLE) & WS_VSCROLL) == 0)
- return;
-
- SCROLLINFO sci = { 0 };
- sci.cbSize = sizeof(sci);
- sci.fMask = SIF_PAGE | SIF_RANGE;
- GetScrollInfo(m_log.GetHwnd(), SB_VERT, &sci);
-
- sci.fMask = SIF_POS;
- sci.nPos = sci.nMax - sci.nPage + 1;
- SetScrollInfo(m_log.GetHwnd(), SB_VERT, &sci, TRUE);
+ if (GetWindowLongPtr(m_log.GetHwnd(), GWL_STYLE) & WS_VSCROLL) {
+ int len = GetWindowTextLength(m_log.GetHwnd()) - 1;
+ m_log.SendMsg(EM_SETSEL, len, len);
- CHARRANGE sel;
- sel.cpMin = sel.cpMax = m_log.GetRichTextLength();
- m_log.SendMsg(EM_EXSETSEL, 0, (LPARAM)&sel);
- PostMessage(m_log.GetHwnd(), WM_VSCROLL, MAKEWPARAM(SB_BOTTOM, 0), 0);
+ PostMessage(m_log.GetHwnd(), WM_VSCROLL, MAKEWPARAM(SB_BOTTOM, 0), 0);
+ }
}
void CChatRoomDlg::ShowFilterMenu()
diff --git a/src/core/stdmsg/src/chat_window.cpp b/src/core/stdmsg/src/chat_window.cpp index adee9649c9..aa91f6d397 100644 --- a/src/core/stdmsg/src/chat_window.cpp +++ b/src/core/stdmsg/src/chat_window.cpp @@ -252,22 +252,12 @@ void CChatRoomDlg::RedrawLog() void CChatRoomDlg::ScrollToBottom() { - if ((GetWindowLongPtr(m_log.GetHwnd(), GWL_STYLE) & WS_VSCROLL) == 0) - return; - - CHARRANGE sel; - SCROLLINFO scroll = {}; - scroll.cbSize = sizeof(scroll); - scroll.fMask = SIF_PAGE | SIF_RANGE; - GetScrollInfo(m_log.GetHwnd(), SB_VERT, &scroll); + if (GetWindowLongPtr(m_log.GetHwnd(), GWL_STYLE) & WS_VSCROLL) { + int len = GetWindowTextLength(m_log.GetHwnd()) - 1; + m_log.SendMsg(EM_SETSEL, len, len); - scroll.fMask = SIF_POS; - scroll.nPos = scroll.nMax - scroll.nPage + 1; - SetScrollInfo(m_log.GetHwnd(), SB_VERT, &scroll, TRUE); - - sel.cpMin = sel.cpMax = m_log.GetRichTextLength(); - m_log.SendMsg(EM_EXSETSEL, 0, (LPARAM)&sel); - PostMessage(m_log.GetHwnd(), WM_VSCROLL, MAKEWPARAM(SB_BOTTOM, 0), 0); + PostMessage(m_log.GetHwnd(), WM_VSCROLL, MAKEWPARAM(SB_BOTTOM, 0), 0); + } } void CChatRoomDlg::ShowFilterMenu() |