summaryrefslogtreecommitdiff
path: root/src/gui/chat.cpp
diff options
context:
space:
mode:
authorChuck Miller <shadowmil@gmail.com>2009-05-02 01:44:59 -0400
committerChuck Miller <shadowmil@gmail.com>2009-05-02 01:44:59 -0400
commitd40c669b3d8e11d2ddeea43cbc8d7c6a053c9da2 (patch)
treeda5afbd83a9fdef41d0d53f647dc5727be2f5fcb /src/gui/chat.cpp
parent51d6f634eecae2a9e68078a7272353b8b61fd4e1 (diff)
downloadmana-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.cpp25
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 &&