diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2020-05-20 06:24:09 +0300 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2020-05-20 06:24:09 +0300 |
| commit | ed0c073eae5358b509c68e3051c489bd25be30c9 (patch) | |
| tree | 2dd9f25649fbb6357791b39f5c3cedb415f8f2c9 /Software/Visual_Studio/Tango.Console/ConsoleTextBox.cs | |
| parent | b40bfa0f652ec194f2c4d05ae02f0a9c420b50fc (diff) | |
| download | Tango-ed0c073eae5358b509c68e3051c489bd25be30c9.tar.gz Tango-ed0c073eae5358b509c68e3051c489bd25be30c9.zip | |
Several fixes and improvements after first real test against PPC.
Diffstat (limited to 'Software/Visual_Studio/Tango.Console/ConsoleTextBox.cs')
| -rw-r--r-- | Software/Visual_Studio/Tango.Console/ConsoleTextBox.cs | 37 |
1 files changed, 23 insertions, 14 deletions
diff --git a/Software/Visual_Studio/Tango.Console/ConsoleTextBox.cs b/Software/Visual_Studio/Tango.Console/ConsoleTextBox.cs index d2d20b629..f6fa40b13 100644 --- a/Software/Visual_Studio/Tango.Console/ConsoleTextBox.cs +++ b/Software/Visual_Studio/Tango.Console/ConsoleTextBox.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.Diagnostics; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -197,29 +198,37 @@ namespace Tango.Console { base.OnTextChanged(e); - if (CaretIndex == Text.Length) + try { - String lastWord = Text.Split(' ').LastOrDefault(); - lastWord?.Trim(); - - if (Suggestions != null) + if (CaretIndex == Text.Length) { - FilteredSuggestions = Suggestions.Where(x => (lastWord.IsNotNullOrEmpty() && x.Name.ToLower().StartsWith(lastWord.ToLower())) || Text.EndsWith(" ")).OrderBy(x => x.Name).Take(MaxSuggestions).ToList(); + String lastWord = Text.Split(' ').LastOrDefault(); + lastWord?.Trim(); - if (Text.Contains(" ")) + if (Suggestions != null) { - FilteredSuggestions = FilteredSuggestions.Where(x => x.Type != ConsoleSuggestionType.Command).ToList(); - } + FilteredSuggestions = Suggestions.Where(x => (lastWord.IsNotNullOrEmpty() && x.Name.ToLower().StartsWith(lastWord.ToLower())) || Text.EndsWith(" ")).OrderBy(x => x.Name).Take(MaxSuggestions).ToList(); + + if (Text.Contains(" ")) + { + FilteredSuggestions = FilteredSuggestions.Where(x => x.Type != ConsoleSuggestionType.Command).ToList(); + } - IsSuggestionsOpened = FilteredSuggestions.Count > 0; + IsSuggestionsOpened = FilteredSuggestions.Count > 0; + _popup.IsOpen = false; + _popup.IsOpen = FilteredSuggestions.Count > 0 && SelectedSuggestion != null; + } + } + else + { + IsSuggestionsOpened = false; _popup.IsOpen = false; - _popup.IsOpen = FilteredSuggestions.Count > 0 && SelectedSuggestion != null; } } - else + catch (Exception ex) { - IsSuggestionsOpened = false; - _popup.IsOpen = false; + Debug.WriteLine(ex); + Debugger.Break(); } } |
