From 80b44228f8dce06d636f18c9b40f539cfc85995f Mon Sep 17 00:00:00 2001 From: ORelio Date: Thu, 23 Jul 2015 21:39:41 +0200 Subject: [PATCH] Further autocompletion fixes Refactor code as splitting is now useless --- MinecraftClient/ConsoleIO.cs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/MinecraftClient/ConsoleIO.cs b/MinecraftClient/ConsoleIO.cs index 1272de20..34bb7a35 100644 --- a/MinecraftClient/ConsoleIO.cs +++ b/MinecraftClient/ConsoleIO.cs @@ -172,15 +172,11 @@ namespace MinecraftClient case ConsoleKey.Tab: if (autocomplete_engine != null && buffer.Length > 0) { - string[] tmp = buffer.Split(' '); - if (tmp.Length > 0) + string word_autocomplete = autocomplete_engine.AutoComplete(buffer); + if (!String.IsNullOrEmpty(word_autocomplete) && word_autocomplete != buffer) { - string word_autocomplete = autocomplete_engine.AutoComplete(buffer); - if (!String.IsNullOrEmpty(word_autocomplete) && word_autocomplete != buffer) - { - while (buffer.Length > 0 && buffer[buffer.Length - 1] != ' ') { RemoveOneChar(); } - foreach (char c in word_autocomplete) { AddChar(c); } - } + while (buffer.Length > 0 && buffer[buffer.Length - 1] != ' ') { RemoveOneChar(); } + foreach (char c in word_autocomplete) { AddChar(c); } } } break;