diff options
author | AnotherTest <ali.mpfard@gmail.com> | 2020-04-12 22:24:21 +0430 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-04-13 00:49:24 +0200 |
commit | fa0525b8bf4e093a7816aac4fb35129c6b90b354 (patch) | |
tree | dabfc15e9b09369a94ad8bad38fe8e40efddc637 /Libraries/LibLine | |
parent | d3e735f279097965a8948da922ddd0864f2fec81 (diff) | |
download | serenity-fa0525b8bf4e093a7816aac4fb35129c6b90b354.zip |
LibLine: Autocomplete single suggestions
`cd /h<tab>` -> `cd /home/`, pressing tab after that would
descend into `/home/' and show `/home/anon/`
Diffstat (limited to 'Libraries/LibLine')
-rw-r--r-- | Libraries/LibLine/Editor.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/Libraries/LibLine/Editor.cpp b/Libraries/LibLine/Editor.cpp index d01d8addd5..dde601ad22 100644 --- a/Libraries/LibLine/Editor.cpp +++ b/Libraries/LibLine/Editor.cpp @@ -382,7 +382,15 @@ String Editor::get_line(const String& prompt) } reposition_cursor(); } - + if (m_suggestions.size() < 2) { + // we have none, or just one suggestion + // we should just commit that and continue + // after it, as if it were auto-completed + suggest(0, 0); + m_last_shown_suggestion = String::empty(); + m_suggestions.clear(); + m_times_tab_pressed = 0; + } continue; } |