1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 22:27:35 +00:00

Shell: Tab completion now gives suggestions

Pushing the TAB key in the shell now prints suggestions to terminal.
This makes it easier to the user to actually see what files are
available before executing the command they currently have typed.
This commit is contained in:
Jesse Buhagiar 2019-12-13 19:36:15 +11:00 committed by Andreas Kling
parent 3809da4abb
commit cdb00530f8
2 changed files with 79 additions and 10 deletions

View file

@ -25,14 +25,16 @@ private:
void insert(const String&);
void insert(const char);
void cut_mismatching_chars(String& completion, const String& other, size_t start_compare);
void tab_complete_first_token(const String&);
void tab_complete_other_token(String&);
Vector<String> tab_complete_first_token(const String&);
Vector<String> tab_complete_other_token(String&);
void vt_save_cursor();
void vt_restore_cursor();
void vt_clear_to_end_of_line();
Vector<char, 1024> m_buffer;
size_t m_cursor { 0 };
int m_times_tab_pressed { 0 };
int m_num_columns { 0 };
// FIXME: This should be something more take_first()-friendly.
Vector<String> m_history;