summaryrefslogtreecommitdiff
path: root/Shell/LineEditor.h
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-05-07 02:50:15 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-05-07 02:50:15 +0200
commitad1c3c748f30deb825418e967170e6db21bd1d63 (patch)
treed66e87d1603b64dbda239dd06fa4d8ecea4a04c1 /Shell/LineEditor.h
parent16a5a76445ca960ae640e7ea998a4969de4d3526 (diff)
downloadserenity-ad1c3c748f30deb825418e967170e6db21bd1d63.zip
Shell: Allow browsing history with up/down arrow keys.
Diffstat (limited to 'Shell/LineEditor.h')
-rw-r--r--Shell/LineEditor.h11
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 };
};