From 298df55a6fc0eefc70b7bfd13a4c59c91c60e7b5 Mon Sep 17 00:00:00 2001 From: Toni Solarin-Sodara Date: Wed, 15 Feb 2017 11:09:10 +0100 Subject: [PATCH 1/2] Fix autocomplete reset --- src/ReadLine/KeyHandler.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/ReadLine/KeyHandler.cs b/src/ReadLine/KeyHandler.cs index 17aac09..ef48d67 100644 --- a/src/ReadLine/KeyHandler.cs +++ b/src/ReadLine/KeyHandler.cs @@ -162,6 +162,12 @@ private void NextHistory() } } + private void ResetAutoComplete() + { + _completions = null; + _completionsIdx = 0; + } + public string Text { get @@ -242,7 +248,7 @@ public void Handle(ConsoleKeyInfo keyInfo) // If in auto complete mode and Tab wasn't pressed if (IsInAutoCompleteMode() && _keyInfo.Key != ConsoleKey.Tab) - _completions = null; + ResetAutoComplete(); Action action; _keyActions.TryGetValue(BuildKeyInput(), out action); From 5a0642b7480475a899789bc0becc7cbb00cd2815 Mon Sep 17 00:00:00 2001 From: Toni Solarin-Sodara Date: Wed, 15 Feb 2017 11:09:21 +0100 Subject: [PATCH 2/2] Update demo program --- src/ReadLine.Demo/Program.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ReadLine.Demo/Program.cs b/src/ReadLine.Demo/Program.cs index a30ea83..8678b59 100755 --- a/src/ReadLine.Demo/Program.cs +++ b/src/ReadLine.Demo/Program.cs @@ -15,7 +15,7 @@ public static void Main(string[] args) ReadLine.AutoCompletionHandler = (t, s) => { - if (t.StartsWith("git")) + if (t.StartsWith("git ")) return new string[] { "init", "clone", "pull", "push" }; else return null;