summaryrefslogtreecommitdiff
path: root/src/chat.cpp
diff options
context:
space:
mode:
authorEsteban I. Ruiz Moreno <exio4.com@gmail.com>2013-06-02 21:16:32 -0300
committerShadowNinja <shadowninja@minetest.net>2016-03-02 23:23:31 -0500
commiteffa24737d6997dc40508533635accca3ed099e9 (patch)
treed8155991eada7cab1123ec48af7c1e7c539464ff /src/chat.cpp
parentda97969c9b72ea1752efb741663b727c0225795a (diff)
downloadminetest-effa24737d6997dc40508533635accca3ed099e9.tar.gz
minetest-effa24737d6997dc40508533635accca3ed099e9.tar.bz2
minetest-effa24737d6997dc40508533635accca3ed099e9.zip
Use the console instead of a dedicated window when pressing keymap_chat/cmd
keymap_console opens a full window for chat history browsing.
Diffstat (limited to 'src/chat.cpp')
-rw-r--r--src/chat.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/chat.cpp b/src/chat.cpp
index 50391d39b..d8cf3efd9 100644
--- a/src/chat.cpp
+++ b/src/chat.cpp
@@ -417,20 +417,18 @@ void ChatPrompt::input(const std::wstring &str)
m_nick_completion_end = 0;
}
-std::wstring ChatPrompt::submit()
+void ChatPrompt::addToHistory(std::wstring line)
{
- std::wstring line = m_line;
- m_line.clear();
if (!line.empty())
m_history.push_back(line);
if (m_history.size() > m_history_limit)
m_history.erase(m_history.begin());
m_history_index = m_history.size();
- m_view = 0;
- m_cursor = 0;
- m_nick_completion_start = 0;
- m_nick_completion_end = 0;
- return line;
+}
+
+std::wstring ChatPrompt::getLine()
+{
+ return m_line;
}
void ChatPrompt::clear()
@@ -442,13 +440,15 @@ void ChatPrompt::clear()
m_nick_completion_end = 0;
}
-void ChatPrompt::replace(std::wstring line)
+std::wstring ChatPrompt::replace(std::wstring line)
{
+ std::wstring old_line = m_line;
m_line = line;
m_view = m_cursor = line.size();
clampView();
m_nick_completion_start = 0;
m_nick_completion_end = 0;
+ return old_line;
}
void ChatPrompt::historyPrev()