diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-05-07 02:50:15 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-05-07 02:50:15 +0200 |
commit | ad1c3c748f30deb825418e967170e6db21bd1d63 (patch) | |
tree | d66e87d1603b64dbda239dd06fa4d8ecea4a04c1 /Shell/LineEditor.h | |
parent | 16a5a76445ca960ae640e7ea998a4969de4d3526 (diff) | |
download | serenity-ad1c3c748f30deb825418e967170e6db21bd1d63.zip |
Shell: Allow browsing history with up/down arrow keys.
Diffstat (limited to 'Shell/LineEditor.h')
-rw-r--r-- | Shell/LineEditor.h | 11 |
1 files changed, 11 insertions, 0 deletions
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<String>& history() const { return m_history; } private: + void clear_line(); + void append(const String&); + Vector<char, 1024> m_buffer; int m_cursor { 0 }; // FIXME: This should be something more take_first()-friendly. Vector<String> m_history; + int m_history_cursor { 0 }; int m_history_capacity { 100 }; + + enum class InputState { + Free, + ExpectBracket, + ExpectFinal, + }; + InputState m_state { InputState::Free }; }; |