diff options
author | Chuck Miller <shadowmil@gmail.com> | 2009-05-02 01:44:59 -0400 |
---|---|---|
committer | Chuck Miller <shadowmil@gmail.com> | 2009-05-02 01:44:59 -0400 |
commit | d40c669b3d8e11d2ddeea43cbc8d7c6a053c9da2 (patch) | |
tree | da5afbd83a9fdef41d0d53f647dc5727be2f5fcb /src/gui/chat.cpp | |
parent | 51d6f634eecae2a9e68078a7272353b8b61fd4e1 (diff) | |
download | mana-d40c669b3d8e11d2ddeea43cbc8d7c6a053c9da2.tar.gz mana-d40c669b3d8e11d2ddeea43cbc8d7c6a053c9da2.tar.bz2 mana-d40c669b3d8e11d2ddeea43cbc8d7c6a053c9da2.tar.xz mana-d40c669b3d8e11d2ddeea43cbc8d7c6a053c9da2.zip |
Changed chat window to allow downwards arrow to create a empty line
Minor: removed some debugging output no longer needed
Diffstat (limited to 'src/gui/chat.cpp')
-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 && |