Further autocompletion fixes

Refactor code as splitting is now useless
This commit is contained in:
ORelio 2015-07-23 21:39:41 +02:00
parent c88d150976
commit 80b44228f8

View file

@ -172,15 +172,11 @@ namespace MinecraftClient
case ConsoleKey.Tab: case ConsoleKey.Tab:
if (autocomplete_engine != null && buffer.Length > 0) if (autocomplete_engine != null && buffer.Length > 0)
{ {
string[] tmp = buffer.Split(' '); string word_autocomplete = autocomplete_engine.AutoComplete(buffer);
if (tmp.Length > 0) if (!String.IsNullOrEmpty(word_autocomplete) && word_autocomplete != buffer)
{ {
string word_autocomplete = autocomplete_engine.AutoComplete(buffer); while (buffer.Length > 0 && buffer[buffer.Length - 1] != ' ') { RemoveOneChar(); }
if (!String.IsNullOrEmpty(word_autocomplete) && word_autocomplete != buffer) 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; break;