mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
m_DisplayStr -> m_aDisplayStr
This commit is contained in:
parent
f953a9850e
commit
2c1dfb3684
|
@ -60,17 +60,17 @@ void CLineInput::SetRange(const char *pString, int Begin, int End)
|
|||
|
||||
void CLineInput::Editing(const char *pString, int Cursor)
|
||||
{
|
||||
str_copy(m_DisplayStr, m_aStr, sizeof(m_DisplayStr));
|
||||
str_copy(m_aDisplayStr, m_aStr, sizeof(m_aDisplayStr));
|
||||
char aEditingText[IInput::INPUT_TEXT_SIZE + 2];
|
||||
str_format(aEditingText, sizeof(aEditingText), "[%s]", pString);
|
||||
int NewTextLen = str_length(aEditingText);
|
||||
int CharsLeft = (int)sizeof(m_DisplayStr) - str_length(m_DisplayStr) - 1;
|
||||
int CharsLeft = (int)sizeof(m_aDisplayStr) - str_length(m_aDisplayStr) - 1;
|
||||
int FillCharLen = NewTextLen < CharsLeft ? NewTextLen : CharsLeft;
|
||||
for(int i = str_length(m_DisplayStr) - 1; i >= m_CursorPos; i--)
|
||||
m_DisplayStr[i + FillCharLen] = m_DisplayStr[i];
|
||||
for(int i = str_length(m_aDisplayStr) - 1; i >= m_CursorPos; i--)
|
||||
m_aDisplayStr[i + FillCharLen] = m_aDisplayStr[i];
|
||||
for(int i = 0; i < FillCharLen; i++)
|
||||
m_DisplayStr[m_CursorPos + i] = aEditingText[i];
|
||||
m_FakeLen = str_length(m_DisplayStr);
|
||||
m_aDisplayStr[m_CursorPos + i] = aEditingText[i];
|
||||
m_FakeLen = str_length(m_aDisplayStr);
|
||||
m_FakeCursorPos = m_CursorPos + Cursor + 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ class CLineInput
|
|||
int m_CursorPos;
|
||||
int m_NumChars;
|
||||
|
||||
char m_DisplayStr[MAX_SIZE + IInput::INPUT_TEXT_SIZE + 2];
|
||||
char m_aDisplayStr[MAX_SIZE + IInput::INPUT_TEXT_SIZE + 2];
|
||||
int m_FakeLen;
|
||||
int m_FakeCursorPos;
|
||||
|
||||
|
@ -48,7 +48,7 @@ public:
|
|||
void SetRange(const char *pString, int Begin, int End);
|
||||
void Insert(const char *pString, int Begin);
|
||||
void Append(const char *pString);
|
||||
const char *GetString(bool Editing = false) const { return Editing ? m_DisplayStr : m_aStr; }
|
||||
const char *GetString(bool Editing = false) const { return Editing ? m_aDisplayStr : m_aStr; }
|
||||
int GetLength(bool Editing = false) const { return Editing ? m_FakeLen : m_Len; }
|
||||
int GetCursorOffset(bool Editing = false) const { return Editing ? m_FakeCursorPos : m_CursorPos; }
|
||||
void SetCursorOffset(int Offset) { m_CursorPos = Offset > m_Len ? m_Len : Offset < 0 ? 0 : Offset; }
|
||||
|
|
Loading…
Reference in a new issue