diff options
Diffstat (limited to 'src/chat.cpp')
-rw-r--r-- | src/chat.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/chat.cpp b/src/chat.cpp index 162622abe..d8b577aab 100644 --- a/src/chat.cpp +++ b/src/chat.cpp @@ -50,6 +50,8 @@ ChatBuffer::ChatBuffer(u32 scrollback): void ChatBuffer::addLine(const std::wstring &name, const std::wstring &text) { + m_lines_modified = true; + ChatLine line(name, text); m_unformatted.push_back(line); @@ -72,6 +74,7 @@ void ChatBuffer::clear() m_unformatted.clear(); m_formatted.clear(); m_scroll = 0; + m_lines_modified = true; } u32 ChatBuffer::getLineCount() const @@ -99,14 +102,11 @@ void ChatBuffer::deleteOldest(u32 count) u32 del_unformatted = 0; u32 del_formatted = 0; - while (count > 0 && del_unformatted < m_unformatted.size()) - { + while (count > 0 && del_unformatted < m_unformatted.size()) { ++del_unformatted; // keep m_formatted in sync - if (del_formatted < m_formatted.size()) - { - + if (del_formatted < m_formatted.size()) { sanity_check(m_formatted[del_formatted].first); ++del_formatted; while (del_formatted < m_formatted.size() && @@ -120,6 +120,9 @@ void ChatBuffer::deleteOldest(u32 count) m_unformatted.erase(m_unformatted.begin(), m_unformatted.begin() + del_unformatted); m_formatted.erase(m_formatted.begin(), m_formatted.begin() + del_formatted); + if (del_unformatted > 0) + m_lines_modified = true; + if (at_bottom) m_scroll = getBottomScrollPos(); else |