diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/chat.cpp | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp index 9930fe06..a830f556 100644 --- a/src/gui/chat.cpp +++ b/src/gui/chat.cpp @@ -359,20 +359,27 @@ void ChatWindow::scroll(int amount) void ChatWindow::keyPressed(gcn::KeyEvent &event) { - if (event.getKey().getValue() == Key::DOWN && - mCurHist != mHistory.end()) + if (event.getKey().getValue() == Key::DOWN) { - // Move forward through the history - HistoryIterator prevHist = mCurHist++; - if (mCurHist != mHistory.end()) { - mChatInput->setText(*mCurHist); - mChatInput->setCaretPosition(mChatInput->getText().length()); + // Move forward through the history + HistoryIterator prevHist = mCurHist++; + + if (mCurHist != mHistory.end()) + { + mChatInput->setText(*mCurHist); + mChatInput->setCaretPosition(mChatInput->getText().length()); + } + else + { + mChatInput->setText(""); + mCurHist = prevHist; + } } - else + else if (mChatInput->getText() != "") { - mCurHist = prevHist; + mChatInput->setText(""); } } else if (event.getKey().getValue() == Key::UP && |