From 8f6bdca20ccb5f13af018eccf80733c4cdc44e1b Mon Sep 17 00:00:00 2001 From: tznind Date: Thu, 30 Mar 2023 03:03:47 +0100 Subject: [PATCH] xmldoc and whitespace fixes --- Terminal.Gui/Core/Autocomplete/AppendAutocomplete.cs | 8 ++++---- Terminal.Gui/Core/Autocomplete/AutocompleteBase.cs | 8 ++++---- Terminal.Gui/Core/Autocomplete/IAutocomplete.cs | 2 +- .../Core/Autocomplete/ISuggestionGenerator.cs | 11 ++++++----- Terminal.Gui/Core/Autocomplete/PopupAutocomplete.cs | 4 ++-- .../Autocomplete/SingleWordSuggestionGenerator.cs | 9 ++++----- Terminal.Gui/Core/Autocomplete/Suggestion.cs | 2 +- Terminal.Gui/Views/TextField.cs | 2 +- Terminal.Gui/Views/TextView.cs | 2 +- 9 files changed, 24 insertions(+), 24 deletions(-) diff --git a/Terminal.Gui/Core/Autocomplete/AppendAutocomplete.cs b/Terminal.Gui/Core/Autocomplete/AppendAutocomplete.cs index 64fdf30ab..7fc18f3c4 100644 --- a/Terminal.Gui/Core/Autocomplete/AppendAutocomplete.cs +++ b/Terminal.Gui/Core/Autocomplete/AppendAutocomplete.cs @@ -18,7 +18,7 @@ namespace Terminal.Gui { public override void ClearSuggestions () { - base.ClearSuggestions(); + base.ClearSuggestions (); textField.SetNeedsDisplay (); } @@ -76,7 +76,7 @@ namespace Terminal.Gui { var insert = this.Suggestions.ElementAt (this.SelectedIdx); var newText = textField.Text.ToString (); - newText = newText.Substring(0,newText.Length - insert.Remove); + newText = newText.Substring (0, newText.Length - insert.Remove); newText += insert.Replacement; textField.Text = newText; @@ -118,7 +118,7 @@ namespace Terminal.Gui { /// private bool MakingSuggestion () { - return Suggestions.Any() && this.SelectedIdx != -1 && textField.HasFocus && this.CursorIsAtEnd (); + return Suggestions.Any () && this.SelectedIdx != -1 && textField.HasFocus && this.CursorIsAtEnd (); } private bool CycleSuggestion (int direction) @@ -130,7 +130,7 @@ namespace Terminal.Gui { this.SelectedIdx = (this.SelectedIdx + direction) % this.Suggestions.Count; if (this.SelectedIdx < 0) { - this.SelectedIdx = this.Suggestions.Count() - 1; + this.SelectedIdx = this.Suggestions.Count () - 1; } textField.SetNeedsDisplay (); return true; diff --git a/Terminal.Gui/Core/Autocomplete/AutocompleteBase.cs b/Terminal.Gui/Core/Autocomplete/AutocompleteBase.cs index 6eb16286a..b9787b199 100644 --- a/Terminal.Gui/Core/Autocomplete/AutocompleteBase.cs +++ b/Terminal.Gui/Core/Autocomplete/AutocompleteBase.cs @@ -8,13 +8,13 @@ using Rune = System.Rune; namespace Terminal.Gui { public abstract class AutocompleteBase : IAutocomplete { - + /// public abstract View HostControl { get; set; } /// public bool PopupInsideContainer { get; set; } - - public ISuggestionGenerator SuggestionGenerator {get;set;} = new SingleWordSuggestionGenerator(); + + public ISuggestionGenerator SuggestionGenerator { get; set; } = new SingleWordSuggestionGenerator (); /// public virtual int MaxWidth { get; set; } = 10; @@ -67,7 +67,7 @@ namespace Terminal.Gui { /// public virtual void GenerateSuggestions (List currentLine, int idx) { - Suggestions = SuggestionGenerator.GenerateSuggestions(currentLine, idx).ToList().AsReadOnly(); + Suggestions = SuggestionGenerator.GenerateSuggestions (currentLine, idx).ToList ().AsReadOnly (); EnsureSelectedIdxIsValid (); } diff --git a/Terminal.Gui/Core/Autocomplete/IAutocomplete.cs b/Terminal.Gui/Core/Autocomplete/IAutocomplete.cs index 9cdf73e46..7c5e303af 100644 --- a/Terminal.Gui/Core/Autocomplete/IAutocomplete.cs +++ b/Terminal.Gui/Core/Autocomplete/IAutocomplete.cs @@ -100,7 +100,7 @@ namespace Terminal.Gui { /// void ClearSuggestions (); - ISuggestionGenerator SuggestionGenerator {get;set;} + ISuggestionGenerator SuggestionGenerator { get; set; } /// diff --git a/Terminal.Gui/Core/Autocomplete/ISuggestionGenerator.cs b/Terminal.Gui/Core/Autocomplete/ISuggestionGenerator.cs index f537c874c..b2eee350f 100644 --- a/Terminal.Gui/Core/Autocomplete/ISuggestionGenerator.cs +++ b/Terminal.Gui/Core/Autocomplete/ISuggestionGenerator.cs @@ -2,14 +2,15 @@ using Rune = System.Rune; namespace Terminal.Gui { - public interface ISuggestionGenerator - { + /// + /// Generates autocomplete based on a given cursor location within a string + /// + public interface ISuggestionGenerator { /// - /// Populates with all strings in that - /// match with the current cursor position/text in the . + /// Generates autocomplete based on a given cursor location + /// within a /// - /// The column offset. Current (zero - default), left (negative), right (positive). IEnumerable GenerateSuggestions (List currentLine, int idx); bool IsWordChar (Rune rune); diff --git a/Terminal.Gui/Core/Autocomplete/PopupAutocomplete.cs b/Terminal.Gui/Core/Autocomplete/PopupAutocomplete.cs index 091301075..896b6d96f 100644 --- a/Terminal.Gui/Core/Autocomplete/PopupAutocomplete.cs +++ b/Terminal.Gui/Core/Autocomplete/PopupAutocomplete.cs @@ -408,7 +408,7 @@ namespace Terminal.Gui { /// - /// Completes the autocomplete selection process. Called when user hits the . + /// Completes the autocomplete selection process. Called when user hits the . /// /// protected bool Select () @@ -456,7 +456,7 @@ namespace Terminal.Gui { protected abstract void InsertText (string accepted); /// - /// Closes the Autocomplete context menu if it is showing and + /// Closes the Autocomplete context menu if it is showing and /// protected void Close () { diff --git a/Terminal.Gui/Core/Autocomplete/SingleWordSuggestionGenerator.cs b/Terminal.Gui/Core/Autocomplete/SingleWordSuggestionGenerator.cs index 656d2f1d0..a9a116bad 100644 --- a/Terminal.Gui/Core/Autocomplete/SingleWordSuggestionGenerator.cs +++ b/Terminal.Gui/Core/Autocomplete/SingleWordSuggestionGenerator.cs @@ -5,8 +5,7 @@ using System.Text; using Rune = System.Rune; namespace Terminal.Gui { - public class SingleWordSuggestionGenerator : ISuggestionGenerator - { + public class SingleWordSuggestionGenerator : ISuggestionGenerator { /// /// The full set of all strings that can be suggested. /// @@ -17,18 +16,18 @@ namespace Terminal.Gui { { // if there is nothing to pick from if (AllSuggestions.Count == 0) { - return Enumerable.Empty(); + return Enumerable.Empty (); } var currentWord = IdxToWord (currentLine, idx); if (string.IsNullOrWhiteSpace (currentWord)) { - return Enumerable.Empty(); + return Enumerable.Empty (); } else { return AllSuggestions.Where (o => o.StartsWith (currentWord, StringComparison.CurrentCultureIgnoreCase) && !o.Equals (currentWord, StringComparison.CurrentCultureIgnoreCase) - ).Select(o=>new Suggestion(currentWord.Length,o)) + ).Select (o => new Suggestion (currentWord.Length, o)) .ToList ().AsReadOnly (); } diff --git a/Terminal.Gui/Core/Autocomplete/Suggestion.cs b/Terminal.Gui/Core/Autocomplete/Suggestion.cs index e27c1628e..1314f0364 100644 --- a/Terminal.Gui/Core/Autocomplete/Suggestion.cs +++ b/Terminal.Gui/Core/Autocomplete/Suggestion.cs @@ -14,7 +14,7 @@ /// this would be the same as but may vary in advanced /// use cases (e.g. Title= "ctor", Replacement = "MyClass()\n{\n}") /// - public string Title {get;} + public string Title { get; } /// /// The replacement text that will be added diff --git a/Terminal.Gui/Views/TextField.cs b/Terminal.Gui/Views/TextField.cs index a286ba880..9e083a064 100644 --- a/Terminal.Gui/Views/TextField.cs +++ b/Terminal.Gui/Views/TextField.cs @@ -272,7 +272,7 @@ namespace Terminal.Gui { /// /// Provides autocomplete context menu based on suggestions at the current cursor - /// position. Populate to enable this feature. + /// position. Configure to enable this feature. /// public IAutocomplete Autocomplete { get; set; } = new TextFieldAutocomplete (); diff --git a/Terminal.Gui/Views/TextView.cs b/Terminal.Gui/Views/TextView.cs index f0935b76f..a9823b349 100644 --- a/Terminal.Gui/Views/TextView.cs +++ b/Terminal.Gui/Views/TextView.cs @@ -1146,7 +1146,7 @@ namespace Terminal.Gui { /// /// Provides autocomplete context menu based on suggestions at the current cursor - /// position. Populate to enable this feature + /// position. Configure to enable this feature /// public IAutocomplete Autocomplete { get; protected set; } = new TextViewAutocomplete ();