mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 01:57:45 +00:00
Shell: Allow browsing history with up/down arrow keys.
This commit is contained in:
parent
16a5a76445
commit
ad1c3c748f
2 changed files with 78 additions and 4 deletions
|
@ -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 };
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue