From fa0525b8bf4e093a7816aac4fb35129c6b90b354 Mon Sep 17 00:00:00 2001 From: AnotherTest Date: Sun, 12 Apr 2020 22:24:21 +0430 Subject: [PATCH] LibLine: Autocomplete single suggestions `cd /h` -> `cd /home/`, pressing tab after that would descend into `/home/' and show `/home/anon/` --- Libraries/LibLine/Editor.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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; }