From d40c669b3d8e11d2ddeea43cbc8d7c6a053c9da2 Mon Sep 17 00:00:00 2001 From: Chuck Miller Date: Sat, 2 May 2009 01:44:59 -0400 Subject: Changed chat window to allow downwards arrow to create a empty line Minor: removed some debugging output no longer needed --- src/gui/chat.cpp | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'src/gui/chat.cpp') 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 && -- cgit v1.2.3-70-g09d2