From ad1c3c748f30deb825418e967170e6db21bd1d63 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Tue, 7 May 2019 02:50:15 +0200 Subject: Shell: Allow browsing history with up/down arrow keys. --- Shell/LineEditor.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'Shell/LineEditor.h') diff --git a/Shell/LineEditor.h b/Shell/LineEditor.h index e5668ff349..60d0e643b0 100644 --- a/Shell/LineEditor.h +++ b/Shell/LineEditor.h @@ -14,10 +14,21 @@ public: const Vector& history() const { return m_history; } private: + void clear_line(); + void append(const String&); + Vector m_buffer; int m_cursor { 0 }; // FIXME: This should be something more take_first()-friendly. Vector m_history; + int m_history_cursor { 0 }; int m_history_capacity { 100 }; + + enum class InputState { + Free, + ExpectBracket, + ExpectFinal, + }; + InputState m_state { InputState::Free }; }; -- cgit v1.2.3