From 5402e71b923712624d6df9aad6f3983ba4e44f4e Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 26 Apr 2020 20:53:56 +0300 Subject: minor code cleaning --- plugins/NewStory/src/history_log.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'plugins/NewStory/src') diff --git a/plugins/NewStory/src/history_log.cpp b/plugins/NewStory/src/history_log.cpp index 269d25ea7e..d1d0f69b36 100644 --- a/plugins/NewStory/src/history_log.cpp +++ b/plugins/NewStory/src/history_log.cpp @@ -24,7 +24,9 @@ public: bool AtBottom() override { - return false; + int totalCount = SendMessage(m_hwnd, NSM_GETCOUNT, 0, 0); + int caret = SendMessage(m_hwnd, NSM_GETCARET, 0, 0); + return caret >= totalCount - 1; } void Clear() override @@ -55,8 +57,11 @@ public: SendMessage(m_hwnd, NSM_ADDEVENTS, (LPARAM)&tmp, 0); } - void LogEvents(LOGINFO *pLog, bool) override + void LogEvents(LOGINFO *pLog, bool bAppend) override { + if (!bAppend) + Clear(); + while (pLog) { SendMessage(m_hwnd, NSM_ADDCHATEVENT, (WPARAM)m_pDlg.getChat(), (LPARAM)pLog); pLog = pLog->prev; -- cgit v1.2.3