aboutsummaryrefslogtreecommitdiff
path: root/src/chat.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/chat.h')
-rw-r--r--src/chat.h43
1 files changed, 19 insertions, 24 deletions
diff --git a/src/chat.h b/src/chat.h
index 9fe910cc9..f84ece206 100644
--- a/src/chat.h
+++ b/src/chat.h
@@ -38,13 +38,15 @@ struct ChatLine
// message text
EnrichedString text;
- ChatLine(const std::wstring &a_name, const std::wstring &a_text) :
- name(a_name), text(a_text)
+ ChatLine(const std::wstring &a_name, const std::wstring &a_text):
+ name(a_name),
+ text(a_text)
{
}
- ChatLine(const EnrichedString &a_name, const EnrichedString &a_text) :
- name(a_name), text(a_text)
+ ChatLine(const EnrichedString &a_name, const EnrichedString &a_text):
+ name(a_name),
+ text(a_text)
{
}
};
@@ -56,7 +58,7 @@ struct ChatFormattedFragment
// starting column
u32 column;
// formatting
- // u8 bold:1;
+ //u8 bold:1;
};
struct ChatFormattedLine
@@ -83,7 +85,7 @@ public:
// Get number of lines currently in buffer.
u32 getLineCount() const;
// Get reference to i-th chat line.
- const ChatLine &getLine(u32 index) const;
+ const ChatLine& getLine(u32 index) const;
// Increase each chat line's age by dtime.
void step(f32 dtime);
@@ -100,7 +102,7 @@ public:
void reformat(u32 cols, u32 rows);
// Get formatted line for a given row (0 is top of screen).
// Only valid after reformat has been called at least once
- const ChatFormattedLine &getFormattedLine(u32 row) const;
+ const ChatFormattedLine& getFormattedLine(u32 row) const;
// Scrolling in formatted buffer (relative)
// positive rows == scroll up, negative rows == scroll down
void scroll(s32 rows);
@@ -114,11 +116,10 @@ public:
// Format a chat line for the given number of columns.
// Appends the formatted lines to the destination array and
// returns the number of formatted lines.
- u32 formatChatLine(const ChatLine &line, u32 cols,
- std::vector<ChatFormattedLine> &destination) const;
+ u32 formatChatLine(const ChatLine& line, u32 cols,
+ std::vector<ChatFormattedLine>& destination) const;
void resize(u32 scrollback);
-
protected:
s32 getTopScrollPos() const;
s32 getBottomScrollPos() const;
@@ -158,10 +159,7 @@ public:
std::wstring getLine() const { return m_line; }
// Get section of line that is currently selected
- std::wstring getSelection() const
- {
- return m_line.substr(m_cursor, m_cursor_len);
- }
+ std::wstring getSelection() const { return m_line.substr(m_cursor, m_cursor_len); }
// Clear the current line
void clear();
@@ -175,7 +173,7 @@ public:
void historyNext();
// Nick completion
- void nickCompletion(const std::list<std::string> &names, bool backwards);
+ void nickCompletion(const std::list<std::string>& names, bool backwards);
// Update console size and reformat the visible portion of the prompt
void reformat(u32 cols);
@@ -187,23 +185,20 @@ public:
s32 getCursorLength() const { return m_cursor_len; }
// Cursor operations
- enum CursorOp
- {
+ enum CursorOp {
CURSOROP_MOVE,
CURSOROP_SELECT,
CURSOROP_DELETE
};
// Cursor operation direction
- enum CursorOpDir
- {
+ enum CursorOpDir {
CURSOROP_DIR_LEFT,
CURSOROP_DIR_RIGHT
};
// Cursor operation scope
- enum CursorOpScope
- {
+ enum CursorOpScope {
CURSOROP_SCOPE_CHARACTER,
CURSOROP_SCOPE_WORD,
CURSOROP_SCOPE_LINE,
@@ -266,13 +261,13 @@ public:
void addUnparsedMessage(std::wstring line);
// Get the console buffer
- ChatBuffer &getConsoleBuffer();
+ ChatBuffer& getConsoleBuffer();
// Get the recent messages buffer
- ChatBuffer &getRecentBuffer();
+ ChatBuffer& getRecentBuffer();
// Concatenate all recent messages
EnrichedString getRecentChat() const;
// Get the console prompt
- ChatPrompt &getPrompt();
+ ChatPrompt& getPrompt();
// Reformat all buffers
void reformat(u32 cols, u32 rows);