X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Fchat.cpp;h=2d29d39da77fe1b87381607b392ee920a7732e45;hb=dfe00abc5addd66dbf840d7e826690291f4afd93;hp=0466b6e263e082929e959fa39d1b5277847997dd;hpb=206f0764225de4eeb3b2cef119e22df8005e5d60;p=dragonfireclient.git diff --git a/src/chat.cpp b/src/chat.cpp index 0466b6e26..2d29d39da 100644 --- a/src/chat.cpp +++ b/src/chat.cpp @@ -83,7 +83,7 @@ u32 ChatBuffer::getScrollback() const const ChatLine& ChatBuffer::getLine(u32 index) const { - assert(index < getLineCount()); + assert(index < getLineCount()); // pre-condition return m_unformatted[index]; } @@ -107,7 +107,8 @@ void ChatBuffer::deleteOldest(u32 count) // keep m_formatted in sync if (del_formatted < m_formatted.size()) { - assert(m_formatted[del_formatted].first); + + sanity_check(m_formatted[del_formatted].first); ++del_formatted; while (del_formatted < m_formatted.size() && !m_formatted[del_formatted].first) @@ -407,6 +408,15 @@ void ChatPrompt::input(wchar_t ch) m_nick_completion_end = 0; } +void ChatPrompt::input(const std::wstring &str) +{ + m_line.insert(m_cursor, str); + m_cursor += str.size(); + clampView(); + m_nick_completion_start = 0; + m_nick_completion_end = 0; +} + std::wstring ChatPrompt::submit() { std::wstring line = m_line; @@ -765,5 +775,5 @@ void ChatBackend::scrollPageDown() void ChatBackend::scrollPageUp() { - m_console_buffer.scroll(-m_console_buffer.getRows()); + m_console_buffer.scroll(-(s32)m_console_buffer.getRows()); }