mirror of
https://github.com/ddnet/ddnet.git
synced 2024-09-20 09:34:19 +00:00
parent
e8b8a3c60a
commit
ed8a0b5eee
|
@ -149,6 +149,11 @@ void CGameConsole::CInstance::OnInput(IInput::CEvent Event)
|
|||
{
|
||||
m_Input.SetCursorOffset(m_Input.GetLength());
|
||||
}
|
||||
else if(m_pGameConsole->Input()->KeyIsPressed(KEY_LCTRL) && m_pGameConsole->Input()->KeyPress(KEY_U))
|
||||
{
|
||||
m_Input.DeleteFromCursor();
|
||||
Handled = true;
|
||||
}
|
||||
|
||||
if(Event.m_Flags&IInput::FLAG_PRESS)
|
||||
{
|
||||
|
|
|
@ -142,6 +142,13 @@ bool CLineInput::Manipulate(IInput::CEvent Event, char *pStr, int StrMaxSize, in
|
|||
return Changes;
|
||||
}
|
||||
|
||||
void CLineInput::DeleteFromCursor()
|
||||
{
|
||||
char aBuf[MAX_SIZE];
|
||||
str_copy(aBuf, &m_Str[m_CursorPos], sizeof(aBuf));
|
||||
Set(aBuf); SetCursorOffset(0);
|
||||
}
|
||||
|
||||
void CLineInput::ProcessInput(IInput::CEvent e)
|
||||
{
|
||||
Manipulate(e, m_Str, MAX_SIZE, MAX_CHARS, &m_Len, &m_CursorPos, &m_NumChars);
|
||||
|
|
|
@ -41,6 +41,7 @@ public:
|
|||
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; }
|
||||
void DeleteFromCursor();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue