X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Fchat.h;h=0b98e4d3c0507118b6485a70754998ad36ba128b;hb=707c8c1e95d8db2d84909e7957b4dc9138e05599;hp=40d9b771de7b8d7268a2964865109225c5d22f93;hpb=792e013eaf4a572364457b96f6f9c07dafe6fe9a;p=minetest.git diff --git a/src/chat.h b/src/chat.h index 40d9b771d..0b98e4d3c 100644 --- a/src/chat.h +++ b/src/chat.h @@ -77,7 +77,7 @@ class ChatBuffer // Append chat line // Removes oldest chat line if scrollback size is reached - void addLine(std::wstring name, std::wstring text); + void addLine(const std::wstring &name, const std::wstring &text); // Remove all chat lines void clear(); @@ -94,8 +94,6 @@ class ChatBuffer // Delete lines older than maxAge. void deleteByAge(f32 maxAge); - // Get number of columns, 0 if reformat has not been called yet. - u32 getColumns() const; // Get number of rows, 0 if reformat has not been called yet. u32 getRows() const; // Update console size and reformat all formatted lines. @@ -153,7 +151,7 @@ class ChatPrompt void input(const std::wstring &str); // Add a string to the history - void addToHistory(std::wstring line); + void addToHistory(const std::wstring &line); // Get current line std::wstring getLine() const { return m_line; } @@ -165,7 +163,7 @@ class ChatPrompt void clear(); // Replace the current line with the given text - std::wstring replace(std::wstring line); + std::wstring replace(const std::wstring &line); // Select previous command from history void historyPrev(); @@ -256,7 +254,7 @@ class ChatBackend ~ChatBackend() = default; // Add chat message - void addMessage(std::wstring name, std::wstring text); + void addMessage(const std::wstring &name, std::wstring text); // Parse and add unparsed chat message void addUnparsedMessage(std::wstring line); @@ -265,7 +263,7 @@ class ChatBackend // Get the recent messages buffer ChatBuffer& getRecentBuffer(); // Concatenate all recent messages - EnrichedString getRecentChat(); + EnrichedString getRecentChat() const; // Get the console prompt ChatPrompt& getPrompt(); @@ -285,7 +283,7 @@ class ChatBackend // Resize recent buffer based on settings void applySettings(); - + private: ChatBuffer m_console_buffer; ChatBuffer m_recent_buffer;