diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4c3d374d..997aff92 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -53,7 +53,7 @@ Any new code should also have reasonable unit test coverage. ## Contributing process ### Get buyoff or find open community issues or features - * Through GitHub, or through the [GitHub discussions](https://github.com/spectreconsole/spectre.console/discussions) (preferred), + * Through GitHub, or through the [GitHub discussions](https://github.com/FRACerqueira/PromptPlus/discussions) (preferred), you talk about a feature you would like to see (or a bug), and why it should be in PromptPlus. * If approved through the GitHub discussions, ensure an accompanying GitHub issue is created with information and a link back to the discussion. @@ -105,7 +105,7 @@ Submitting PR: and issues that you are resolving. This is a tremendous help for us in evaluation and acceptance. * Once the pull request is in, please do not delete the branch or close the pull request (unless something is wrong with it). - * One of the Spectre.Console team members, or one of the maintainers, will evaluate it within a + * One of the PromptPlus team members, or one of the maintainers, will evaluate it within a reasonable time period (which is to say usually within 1-3 weeks). Some things get evaluated faster or fast tracked. We are human and we have active lives outside of open source so don't fret if you haven't seen any activity on your pull request within a month or two. @@ -146,7 +146,7 @@ The only reasons a pull request should be closed and resubmitted are as follows: Then the old branch is closed with a note on the newer branch this supersedes #github_number. ## Other general information -If you reformat code or hit core functionality without an approval from a person on the Spectre.Console Team, +If you reformat code or hit core functionality without an approval from a person on the PromptPlus Team, it's likely that no matter how awesome it looks afterwards, it will probably not get accepted. Reformatting code makes it harder for us to evaluate exactly what was changed. @@ -158,4 +158,4 @@ Harder for us roughly translates to a longer SLA for your pull request. ## Acknowledgement This contribution guide was taken from the [Chocolatey project](https://chocolatey.org/) -with permission and was edited to follow Spectre.Console's conventions and processes. \ No newline at end of file +with permission and was edited to follow PromptPlus's conventions and processes. \ No newline at end of file diff --git a/LICENSE.md b/LICENSE.md index 9f6524db..9b3b29c2 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -18,4 +18,10 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file +SOFTWARE. + +PromptPlus includes code from other software related under the MIT license: + +- Spectre.Console, Copyright (c) 2020 Patrik Svensson, Phil Scott, Nils Andresen. For licensing see /LICENSE/LICENSE-SpectreConsole.md +- Sharprompt, Copyright (c) 2019 shibayan. For licensing see /LICENSE/LICENSE-Sharprompt.md +- xmldoc2md, Copyright (c) 2022 Charles de Vandière. For licensing see /LICENSE/LICENSE-xmldoc2md.md \ No newline at end of file diff --git a/LICENSE/LICENSE-FIGlet.md b/LICENSE/LICENSE-FIGlet.md new file mode 100644 index 00000000..421691be --- /dev/null +++ b/LICENSE/LICENSE-FIGlet.md @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2014 Philippe AURIOU + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/LICENSE/LICENSE-Sharprompt.md b/LICENSE/LICENSE-Sharprompt.md new file mode 100644 index 00000000..a326872e --- /dev/null +++ b/LICENSE/LICENSE-Sharprompt.md @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 shibayan + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/LICENSE/LICENSE-SpectreConsole.md b/LICENSE/LICENSE-SpectreConsole.md new file mode 100644 index 00000000..b4691f0a --- /dev/null +++ b/LICENSE/LICENSE-SpectreConsole.md @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) 2020 Patrik Svensson, Phil Scott, Nils Andresen + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/LICENSE/LICENSE-xmldoc2md.md b/LICENSE/LICENSE-xmldoc2md.md new file mode 100644 index 00000000..c0bfcaf1 --- /dev/null +++ b/LICENSE/LICENSE-xmldoc2md.md @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 Charles de Vandière + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/PromptPlus.sln b/PromptPlus.sln index 5aa080c1..8db1fe77 100644 --- a/PromptPlus.sln +++ b/PromptPlus.sln @@ -21,7 +21,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InputOverwriteDefaultFromSa EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InputWithHistorySamples", "Samples\InputWithHistorySamples\InputWithHistorySamples.csproj", "{18B14A8D-ECC9-459D-B6DD-E1DB0B41F6CF}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InputWithSugestionSamples", "Samples\InputWithSugestionSamples\InputWithSugestionSamples.csproj", "{2F6D86EC-48C3-4D7C-B5B3-BC2782F37316}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InputWithSuggestionSamples", "Samples\InputWithSuggestionSamples\InputWithSuggestionSamples.csproj", "{2F6D86EC-48C3-4D7C-B5B3-BC2782F37316}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InputSecretSamples", "Samples\InputSecretSamples\InputSecretSamples.csproj", "{637CFEA4-42A1-4B90-B825-FB63C79DE7D8}" EndProject @@ -102,7 +102,19 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CalendarSamples", "Samples\ EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PipelineSamples", "Samples\PipelineSamples\PipelineSamples.csproj", "{184F90B1-EBF2-4D34-88B3-9D7A252CB2B4}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AlternateScreenSamples", "Samples\AlternateScreenSamples\AlternateScreenSamples.csproj", "{83BB7962-34D7-4F51-8856-94BDC7B68A64}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AlternateScreenSamples", "Samples\AlternateScreenSamples\AlternateScreenSamples.csproj", "{83BB7962-34D7-4F51-8856-94BDC7B68A64}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Licenses", "Licenses", "{ADBB4294-4DC0-43FC-A57A-4C2F9BDB68A8}" + ProjectSection(SolutionItems) = preProject + LICENSE\LICENSE-FIGlet.md = LICENSE\LICENSE-FIGlet.md + LICENSE\LICENSE-Sharprompt.md = LICENSE\LICENSE-Sharprompt.md + LICENSE\LICENSE-SpectreConsole.md = LICENSE\LICENSE-SpectreConsole.md + LICENSE\LICENSE-xmldoc2md.md = LICENSE\LICENSE-xmldoc2md.md + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Template", "Template", "{0468C89D-43EE-4B08-96BB-FDDA42033AA5}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PromptPlusTemplate", "Template\PromptPlusTemplate\PromptPlusTemplate.csproj", "{E713CD59-5AB5-40AA-80B3-436D0C6511DA}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -357,6 +369,12 @@ Global {83BB7962-34D7-4F51-8856-94BDC7B68A64}.local|Any CPU.Build.0 = Debug|Any CPU {83BB7962-34D7-4F51-8856-94BDC7B68A64}.Release|Any CPU.ActiveCfg = Release|Any CPU {83BB7962-34D7-4F51-8856-94BDC7B68A64}.Release|Any CPU.Build.0 = Release|Any CPU + {E713CD59-5AB5-40AA-80B3-436D0C6511DA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E713CD59-5AB5-40AA-80B3-436D0C6511DA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E713CD59-5AB5-40AA-80B3-436D0C6511DA}.local|Any CPU.ActiveCfg = Debug|Any CPU + {E713CD59-5AB5-40AA-80B3-436D0C6511DA}.local|Any CPU.Build.0 = Debug|Any CPU + {E713CD59-5AB5-40AA-80B3-436D0C6511DA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E713CD59-5AB5-40AA-80B3-436D0C6511DA}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -401,6 +419,7 @@ Global {248BA41C-17EF-42E3-A9B4-17FF7FA1311B} = {F85DFC6B-0BBA-4B8D-BBF7-8FE175FE165C} {184F90B1-EBF2-4D34-88B3-9D7A252CB2B4} = {F85DFC6B-0BBA-4B8D-BBF7-8FE175FE165C} {83BB7962-34D7-4F51-8856-94BDC7B68A64} = {F85DFC6B-0BBA-4B8D-BBF7-8FE175FE165C} + {E713CD59-5AB5-40AA-80B3-436D0C6511DA} = {0468C89D-43EE-4B08-96BB-FDDA42033AA5} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {2E883401-DEB0-496F-A6BC-8AA0F44BC5B9} diff --git a/README.md b/README.md index 1628ea25..89a7b459 100644 --- a/README.md +++ b/README.md @@ -6,9 +6,9 @@ [![Downloads](https://img.shields.io/nuget/dt/PromptPlus)](https://www.nuget.org/packages/PromptPlus/) -**Interactive command-line toolkit for .Net core with powerful controls and commands to create professional console applications.** +**Interactive command-line toolkit for .NET Core with powerful controls and commands to create professional console applications.** -**PromptPlus** was developed in c# with the **netstandard2.1**, **.Net 6** and **.Net 7** target frameworks. +**PromptPlus** was developed in C# with the **netstandard2.1**, **.NET 6** and **.NET 7** target frameworks. **[Visit the official page for more documentation of PromptPlus](https://fracerqueira.github.io/PromptPlus)** ## Table of Contents @@ -26,39 +26,68 @@ - [Keypress Extensions Emacs](#keypress-extensions-emacs) - [Validators](#validators) - [Supported Platforms](#supported-platforms) -- [Inspiration Notes](#inspiration-notes) - [Code of Conduct](#code-of-conduct) - [Contributing](#contributing) +- [Credits](#credits) - [License](#license) - [API Reference](https://fracerqueira.github.io/PromptPlus/apis/apis.html) -## Whats news in V4.0.4 +## What's new in V4.0.5 + +- Added new global propety 'ExtraExceptionInfo' to write extra console exception info +- Added new global propety 'DisableToggleTooltip' to disable toggle Tooltip +- Added new global propety 'ShowOnlyExistingPagination' to disable Page information when pagination not exists +- Added new Method DisableToggleTooltip(bool value) to overwrite default DisableToggleTooltip in control +- Added new Method ShowOnlyExistingPagination(bool value) to overwrite default Overwrite default Show pagination only if exists in control +- Added new item to Enum FilterMode : 'Disabled'. This item disable filter feature in coletions +- Improved to not show text prompt when text value is null or empty +- Improved terminal mode detection (for Windows 11 Versions) +- Rebuilt FIGlet to MIT License +- Fixed credits (MIT License Copyright) +- Fixed bug PromptPlus not restore StyleSchema when ResetColor +- Fixed Spell checking (Breaking Changes) + - SugestionInput to SuggestionInput + - Controls: MaskEdit/AddTolist/Input + - SugestionOutput to SuggestionOutput + - Controls: MaskEdit/AddTolist/Input + - MaxLenght to MaxLength + - Controls: AutoComplete/AddTolist/Input + - StyleControls.Sugestion to StyleControls.Suggestion + - StyleSchemaExtensions.Sugestion to StyleSchemaExtensions.Suggestion + - PromptPlusException.Plataform to PromptPlusException.Platform + +**Special thanks to [ividyon](https://github.com/ividyon) for spell checking corrections, all documentation, fixed credits (MIT License Copyright) and wrong method/property names** + +## What's new in V4.0.4 + - Fixed bug PromptPlus not restore terminal original setting when shutdown application - Fixed bug Autocomplete does not change result when backspace is pressed during search - Added Property CurrentBuffer in console drive to return Current Buffer running (Primary/Secondary) -- Added SwapBuffer command to swith Primary/Secondar buffer (Valid only When console 'ansi' suported) +- Added SwapBuffer command to switch Primary/Secondary buffer (Valid only When console 'ansi' supported) - Renamed 'AlternateScreen' to 'RunOnBuffer'. Now executes a custom action on TargetBuffer and returns to CurrentBuffer - Refactored console drivers initialization, control options initialization - Added auto create Environment 'PromptPlusConvertCodePage' to custom automate convert codepage to unicode-codepage - Default value is = '850;65001' -## Whats news in V4.0.3 +## What's new in V4.0.3 + - New control to switch Alternate screen - Fixed bug Console does not change foreground/background color correctly - Fixed bug Control ProgressBar - - Not show gradient when setted ProgressBarType.Fill + - Not show gradient when set ProgressBarType.Fill - Improve testability of result classes/struct (Internal to public) -## Whats news in V4.0.2 +## What's new in V4.0.2 + - New Control Pipeline - PromptPlus.Pipeline(T startvalue) - Changed WaitControl to take context value in tasks and return context in result - - There are small break-chages + - There are small break-changes - Add Answer key check equals "Yes"/"No" using config values - IsYesResponseKey(this ConsoleKeyInfo keyinfo) - IsNoResponseKey(this ConsoleKeyInfo keyinfo) -## Whats news in V4.0.X +## What's new in V4.0.X ### Newest controls and color improvement and layout @@ -73,7 +102,7 @@ ## Features [**Top**](#table-of-contents) -**All features have IntelliSense. The PromptPlus have more 20 controls with many features like: filters, validators, history, sugestions, spinner(19 embeding type and plus custom yours!), colors and styles for control-elements** : +**All features have IntelliSense. PromptPlus has more than 20 controls with many features like: filters, validators, history, suggestions, spinner(19 embedding type and plus custom yours!), colors and styles for control-elements** : - Banner Ascii - Input text / Secret / AutoComplete with spinner - MaskEdit Generic / Only Date / Only Time / DateTime / Number / Currency @@ -96,12 +125,12 @@ **All controls** have the same organization (see in action: [**Controls Snapshot**](#controls-snapshot)): - input/filter (except Masked input) using **[GNU Readline](https://en.wikipedia.org/wiki/GNU_Readline) Emacs keyboard shortcuts**. - Prompt, description and data entry (ever) -- Extra actions per stage : OnStartControl/OnInputRender/OnTryAcceptInput/OnFinishControl (ever) +- Extra actions per stage: OnStartControl/OnInputRender/OnTryAcceptInput/OnFinishControl (ever) - Tooltips (ever and configurable) - Filter by Contains / StartsWith (configurable) (depends on the control) -- Collection subset items and interations (depends on the control) +- Collection subset items and iterations (depends on the control) - Page information and page-size(depends on the control) -- Spinner animmation (depends on the control) +- Spinner animation (depends on the control) - Error message (depends on the control and validators) PromptPlus driver console **Supports 4/8/24-bit colors** in the terminal with **auto-detection** of the current terminal's capabilities. @@ -109,8 +138,7 @@ PromptPlus driver console **Supports 4/8/24-bit colors** in the terminal with * ## Migrate Version [**Top**](#table-of-contents) -Until version 3 the console engine was based on a model from another project that has several serious problems that cause exceptions during execution in addition to increasing the complexity of the code for correct rendering... -**PromptPlus v4** has been **completely rebuilt** for a better experience, with significant improvements with new controls and more developer power. The console driver now supports better rendering, with the ability to detect terminal capabilities and allow for 24-bit color, text overflow strategies based on terminal size, and left and right margins for a nicer layout. +Until version 3 the console engine was based on a model from another project. **PromptPlus v4** has been **completely rebuilt** for a better experience, with significant improvements with new controls and more developer power. The console driver now supports better rendering, with the ability to detect terminal capabilities and allow for 24-bit color, text overflow strategies based on terminal size, and left and right margins for a nicer layout. **The Controls have been revised to be more responsive, allow color styles in many of their elements**, and adapt to the terminal size even with resizing. For migrate V3.3 to V4.0 [**see this link**](https://fracerqueira.github.io/PromptPlus/migrateversion.html). @@ -118,7 +146,7 @@ For migrate V3.3 to V4.0 [**see this link**](https://fracerqueira.github.io/Prom ## Console Engine [**Top**](#table-of-contents) -The console driver have the ability to detect terminal capabilities and allow for **24-bit color and text overflow strategies** based on terminal size, and left and right margins for a nicer layout and automatic color conversion. +The console driver has the ability to detect terminal capabilities and allow for **24-bit color and text overflow strategies** based on terminal size, and left and right margins for a nicer layout and automatic color conversion. The new engine detects support ansi commands and adjust output for this functionality respecting OS differences , terminal mode and Windows console mode. The Colors are automatically adjusted to the capacity of the terminal. This automatic adjustment may slightly modify the final color when converting to a lower bit resolution. ### Sample Output detect (ConsoleFeaturesSamples) @@ -130,7 +158,7 @@ The new engine detects support ansi commands and adjust output for this function ### Sample color capacity (ConsoleFeaturesSamples) -**_Note: This layout and code was inspired by the excellent project:spectreconsole, having the same color palette_** +**_Note: This layout and code were based (code copy and adaptation) on the excellent project: spectrum console, having the same color palette_** ![](./docs/images/consolecolorcapacity.gif) @@ -158,7 +186,7 @@ dotnet run --project [name of sample] ## Controls Snapshot -For each snapshot, the title is **name of projet** sample in folder **samples** +For each snapshot, the title is **name of project** sample in folder **samples** ### Pipeline @@ -186,7 +214,7 @@ For each snapshot, the title is **name of projet** sample in folder **samples** ![](./docs/images/inputsample3.gif) -[**Top**](#table-of-contents) | [InputWithSugestionSamples](https://github.com/FRACerqueira/PromptPlus/tree/main/Samples/InputWithSugestionSamples) +[**Top**](#table-of-contents) | [InputWithSuggestionSamples](https://github.com/FRACerqueira/PromptPlus/tree/main/Samples/InputWithSuggestionSamples) ![](./docs/images/inputsample4.gif) @@ -391,7 +419,7 @@ if (!in1.IsAborted) PromptPlus applies the language/culture **only when running controls**. The language/culture of the application is **not affected**. If language/culture is not informed, the application's language/culture will be used with fallback to en-US. -All messages are affected when changed language/culture. PromptPlus has languages embeded: +All messages are affected when changed language/culture. PromptPlus has languages embedded: - en-US (Default) - pt-BR @@ -407,7 +435,7 @@ To use a non-embedded language/culture: PromptPlus is in accordance with informal standard [**NO COLOR**](https://no-color.org/). when there is the environment variable "no_color" the colors are disabled. -PromptPlus also has commands for coloring parts of the text using **direct console, styles and Over elememnts of controls**. +PromptPlus also has commands for coloring parts of the text using **direct console, styles and Over elements of controls**. Promptplus uses the **same default colors and engine(softly modified)** as the third party project: spectreconsole. For more details [visit the **official page**](https://fracerqueira.github.io/PromptPlus/#colors) or see the samples in folder **Samples** @@ -466,14 +494,6 @@ PromptPlus.WriteLine($"Your input: {name.Value}!"); - macOS - Terminal.app -## Inspiration notes -[**Top**](#table-of-contents) - -- FIGlet was inspired by the work of [FIGlet.Net](https://github.com/WenceyWang/FIGlet.Net). -- The colors and some of its dependencies were inspired by the work of [spectreconsole](https://spectreconsole.net/). -- The API Reference was inspired by the work of [xmldoc2md (Fork with improvements)](https://github.com/FRACerqueira/xmldoc2md). -- The EastAsianWidth and base-control was inspired by the work of [Sharprompt](https://github.com/shibayan/Sharprompt) - ## Code of Conduct [**Top**](#table-of-contents) @@ -484,9 +504,24 @@ For more information see the [Code of Conduct](CODE_OF_CONDUCT.md). See the [Contributing guide](CONTRIBUTING.md) for developer documentation. +## Credits +[**Top**](#table-of-contents) + +PromptPlus includes code from other software released under the **MIT license**: + +- [Spectre.Console](https://spectreconsole.net/), Copyright (c) 2020 Patrik Svensson, Phil Scott, Nils Andresen. +- [Sharprompt](https://github.com/shibayan/Sharprompt), Copyright (c) 2019 shibayan. +- [xmldoc2md](https://github.com/FRACerqueira/xmldoc2md), Copyright (c) 2022 Charles de Vandière. +- [FIGlet](https://github.com/auriou/FIGlet), Copyright (c) 2014 Philippe AURIOU + ## License [**Top**](#table-of-contents) Copyright 2021 @ Fernando Cerqueira -PromptPlus project is licensed under the the MIT license. For more information see [License](LICENSE.md). \ No newline at end of file +PromptPlus is licensed under the MIT license. For more information see [LICENSE](LICENSE.md). + +* For Spectre.Console licensing information, see [LICENSE-SpectreConsole](LICENSE/LICENSE-SpectreConsole.md). +* For Sharprompt licensing information, see [LICENSE-Sharprompt](LICENSE/LICENSE-Sharprompt.md). +* For xmldoc2md licensing information, see [LICENSE-xmldoc2md](LICENSE/LICENSE-xmldoc2md.md). +* For FIGlet licensing information, see [LICENSE-FIGlet](LICENSE/LICENSE-FIGlet.md). \ No newline at end of file diff --git a/Samples/AddToListSamples/Program.cs b/Samples/AddToListSamples/Program.cs index 498c7451..19f5a97c 100644 --- a/Samples/AddToListSamples/Program.cs +++ b/Samples/AddToListSamples/Program.cs @@ -1,4 +1,9 @@ -using System.Globalization; +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + +using System.Globalization; using PPlus; namespace AddToListSamples @@ -36,13 +41,13 @@ static void Main(string[] args) .Run(); - PromptPlus.DoubleDash("For other features below see - input/Select samples (same behaviour)"); + PromptPlus.DoubleDash("For other features below see - input/Select samples (same behavior)"); PromptPlus.WriteLine(". [yellow]ChangeDescription[/] - InputBasicSamples"); PromptPlus.WriteLine(". [yellow]AddValidators[/] - InputWithValidatorSamples"); - PromptPlus.WriteLine(". [yellow]MaxLenght[/] - InputBasicSamples"); + PromptPlus.WriteLine(". [yellow]MaxLength[/] - InputBasicSamples"); PromptPlus.WriteLine(". [yellow]AcceptInput[/] - InputBasicSamples"); PromptPlus.WriteLine(". [yellow]InputToCase[/] - InputBasicSamples"); - PromptPlus.WriteLine(". [yellow]SuggestionHandler[/] - InputWithSugestionSamples"); + PromptPlus.WriteLine(". [yellow]SuggestionHandler[/] - InputWithSuggestionSamples"); PromptPlus.WriteLine(". [yellow]Interaction[/] - SelectBasicSamples"); PromptPlus.WriteLine(". [yellow]PageSize[/] - SelectBasicSamples"); PromptPlus.WriteLines(2); diff --git a/Samples/AddtoMaskEditListSamples/Program.cs b/Samples/AddtoMaskEditListSamples/Program.cs index ceec753f..9c488fff 100644 --- a/Samples/AddtoMaskEditListSamples/Program.cs +++ b/Samples/AddtoMaskEditListSamples/Program.cs @@ -1,4 +1,9 @@ -using System.Globalization; +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + +using System.Globalization; using PPlus; namespace AddtoMaskEditListSamples @@ -42,13 +47,13 @@ static void Main(string[] args) .Default("XYZ 232") .Run(); - PromptPlus.DoubleDash("[yellow]For other features to maskededit see - MaskEdit samples (same behaviour)[/]"); - PromptPlus.DoubleDash("For other features below see - input/Select samples (same behaviour)"); + PromptPlus.DoubleDash("[yellow]For other features to maskededit see - MaskEdit samples (same behavior)[/]"); + PromptPlus.DoubleDash("For other features below see - input/Select samples (same behavior)"); PromptPlus.WriteLine(". [yellow]ChangeDescription[/] - InputBasicSamples"); PromptPlus.WriteLine(". [yellow]AddValidators[/] - InputWithValidatorSamples"); - PromptPlus.WriteLine(". [yellow]MaxLenght[/] - InputBasicSamples"); + PromptPlus.WriteLine(". [yellow]MaxLength[/] - InputBasicSamples"); PromptPlus.WriteLine(". [yellow]InputToCase[/] - InputBasicSamples"); - PromptPlus.WriteLine(". [yellow]SuggestionHandler[/] - InputWithSugestionSamples"); + PromptPlus.WriteLine(". [yellow]SuggestionHandler[/] - InputWithSuggestionSamples"); PromptPlus.WriteLine(". [yellow]Interaction[/] - SelectBasicSamples"); PromptPlus.WriteLine(". [yellow]PageSize[/] - SelectBasicSamples"); PromptPlus.WriteLines(2); diff --git a/Samples/AlternateScreenSamples/Program.cs b/Samples/AlternateScreenSamples/Program.cs index 80fd0f2b..c62ab8ab 100644 --- a/Samples/AlternateScreenSamples/Program.cs +++ b/Samples/AlternateScreenSamples/Program.cs @@ -1,4 +1,9 @@ -using PPlus; +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + +using PPlus; using PPlus.Controls; namespace AlternateScreenSamples @@ -10,7 +15,7 @@ static void Main(string[] args) PromptPlus.DoubleDash($"PromptPlus AlternateScreen"); PromptPlus.SetCursorPosition(0,PromptPlus.CursorTop+1); - PromptPlus.KeyPress("Press any key to Swith secondary screen", cfg => + PromptPlus.KeyPress("Press any key to Switch secondary screen", cfg => { cfg.ShowTooltip(false); }) @@ -22,7 +27,7 @@ static void Main(string[] args) { PromptPlus.WriteLine("This text run in secondary screen"); PromptPlus.WriteLines(2); - PromptPlus.KeyPress("Press any key to Swith primary screen", cfg => + PromptPlus.KeyPress("Press any key to Switch primary screen", cfg => { cfg.ShowTooltip(false); }) diff --git a/Samples/AutoCompleteSamples/Program.cs b/Samples/AutoCompleteSamples/Program.cs index b1c0f9e2..6c0c25f3 100644 --- a/Samples/AutoCompleteSamples/Program.cs +++ b/Samples/AutoCompleteSamples/Program.cs @@ -1,4 +1,9 @@ -using System.Globalization; +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + +using System.Globalization; using PPlus; using PPlus.Controls; @@ -36,11 +41,11 @@ static void Main() .MinimumPrefixLength(1) .Run(); - PromptPlus.DoubleDash("For other features below see - input samples (same behaviour)"); + PromptPlus.DoubleDash("For other features below see - input samples (same behavior)"); PromptPlus.WriteLine(". [yellow]ChangeDescription[/] - InputBasicSamples"); PromptPlus.WriteLine(". [yellow]ValidateOnDemand[/] - InputWithValidatorSamples"); PromptPlus.WriteLine(". [yellow]AddValidators[/] - InputWithValidatorSamples"); - PromptPlus.WriteLine(". [yellow]MaxLenght[/] - InputBasicSamples"); + PromptPlus.WriteLine(". [yellow]MaxLength[/] - InputBasicSamples"); PromptPlus.WriteLine(". [yellow]AcceptInput[/] - InputBasicSamples"); PromptPlus.WriteLine(". [yellow]InputToCase[/] - InputBasicSamples"); PromptPlus.WriteLine(". [yellow]OverwriteDefaultFrom[/] - InputOverwriteDefaultFromSamples"); diff --git a/Samples/BannerSamples/Program.cs b/Samples/BannerSamples/Program.cs index 0c2841ee..1d600ae3 100644 --- a/Samples/BannerSamples/Program.cs +++ b/Samples/BannerSamples/Program.cs @@ -1,4 +1,9 @@ -// See https://aka.ms/new-console-template for more information +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + + using PPlus; using PPlus.Controls; @@ -21,7 +26,6 @@ PromptPlus .Banner("StarWars") .LoadFont("starwars.flf") - .FIGletWidth(CharacterWidth.Smush) .Run(Color.Blue); PromptPlus.WriteLines(2); diff --git a/Samples/BrowserMultSelectSamples/Program.cs b/Samples/BrowserMultSelectSamples/Program.cs index 407bd286..d647e0ab 100644 --- a/Samples/BrowserMultSelectSamples/Program.cs +++ b/Samples/BrowserMultSelectSamples/Program.cs @@ -1,4 +1,9 @@ -using PPlus; +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + +using PPlus; using PPlus.Controls; namespace BrowserMultSelectSamples @@ -47,13 +52,13 @@ static void Main(string[] args) .Run(); PromptPlus.DoubleDash("Control:BrowserMultiSelect - DisabledRecursiveExpand usage"); - PromptPlus.BrowserMultiSelect("Browser", "expandall has same behaviour expand when used DisabledRecursiveExpand.") + PromptPlus.BrowserMultiSelect("Browser", "expandall has same behavior expand when used DisabledRecursiveExpand.") .Root(new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory).Root.FullName, true) .DisabledRecursiveExpand() .Run(); PromptPlus.DoubleDash("Control:BrowserMultiSelect - AcceptHiddenAttributes/AcceptSystemAttributes usage"); - PromptPlus.BrowserMultiSelect("Browser", "expandall has same behaviour expand when used DisabledRecursiveExpand.") + PromptPlus.BrowserMultiSelect("Browser", "expandall has same behavior expand when used DisabledRecursiveExpand.") .Root(new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory).Root.FullName, false) .DisabledRecursiveExpand() .AcceptHiddenAttributes(true) diff --git a/Samples/BrowserSamples/Program.cs b/Samples/BrowserSamples/Program.cs index 479ae120..15bab90b 100644 --- a/Samples/BrowserSamples/Program.cs +++ b/Samples/BrowserSamples/Program.cs @@ -1,4 +1,9 @@ -using System.Globalization; +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + +using System.Globalization; using PPlus; using PPlus.Controls; @@ -42,13 +47,13 @@ static void Main(string[] args) .Run(); PromptPlus.DoubleDash("Control:Browser - DisabledRecursiveExpand usage"); - PromptPlus.Browser("Browser", "expand-all has same behaviour expand when used DisabledRecursiveExpand.") + PromptPlus.Browser("Browser", "expand-all has same behavior expand when used DisabledRecursiveExpand.") .Root(new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory).Root.FullName, false) .DisabledRecursiveExpand() .Run(); PromptPlus.DoubleDash("Control:Browser - AcceptHiddenAttributes/AcceptSystemAttributes usage"); - PromptPlus.Browser("Browser", "expandall has same behaviour expand when used DisabledRecursiveExpand.") + PromptPlus.Browser("Browser", "expandall has same behavior expand when used DisabledRecursiveExpand.") .Root(new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory).Root.FullName, false) .DisabledRecursiveExpand() .AcceptHiddenAttributes(true) diff --git a/Samples/CalendarSamples/Program.cs b/Samples/CalendarSamples/Program.cs index f1945fe9..5d1054a0 100644 --- a/Samples/CalendarSamples/Program.cs +++ b/Samples/CalendarSamples/Program.cs @@ -1,4 +1,8 @@ -// See https://aka.ms/new-console-template for more information +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + using System.Globalization; using PPlus; using PPlus.Controls; @@ -120,7 +124,7 @@ new ItemCalendar(DateTime.Now.AddDays(2))) .Run(); -PromptPlus.DoubleDash("For other features below see - input samples (same behaviour)"); +PromptPlus.DoubleDash("For other features below see - input samples (same behavior)"); PromptPlus.WriteLine(". [yellow]ChangeDescription[/] - InputBasicSamples"); PromptPlus.WriteLine(". [yellow]AddValidators[/] - InputWithValidatorSamples"); PromptPlus.WriteLine(". [yellow]OverwriteDefaultFrom[/] - InputOverwriteDefaultFromSamples"); diff --git a/Samples/ChartSamples/Program.cs b/Samples/ChartSamples/Program.cs index 99d36a12..e15ce944 100644 --- a/Samples/ChartSamples/Program.cs +++ b/Samples/ChartSamples/Program.cs @@ -1,4 +1,9 @@ -using System.Globalization; +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + +using System.Globalization; using PPlus; using PPlus.Controls; diff --git a/Samples/ConfirmSamples/Program.cs b/Samples/ConfirmSamples/Program.cs index 9a11c4a6..fb14cb35 100644 --- a/Samples/ConfirmSamples/Program.cs +++ b/Samples/ConfirmSamples/Program.cs @@ -1,4 +1,8 @@ -// See https://aka.ms/new-console-template for more information +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + using System.Globalization; using PPlus; diff --git a/Samples/ConsoleFeaturesSamples/Program.cs b/Samples/ConsoleFeaturesSamples/Program.cs index 6110a163..9c91c8e3 100644 --- a/Samples/ConsoleFeaturesSamples/Program.cs +++ b/Samples/ConsoleFeaturesSamples/Program.cs @@ -1,4 +1,9 @@ -// See https://aka.ms/new-console-template for more information +// *************************************************************************************** +// MIT LICENCE +// Copyright 2020 Patrik Svensson, Phil Scott, Nils Andresen. +// https://spectreconsole.net +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** using PPlus; using PPlus.Controls; diff --git a/Samples/InputBasicSamples/Program.cs b/Samples/InputBasicSamples/Program.cs index c774e892..35290d89 100644 --- a/Samples/InputBasicSamples/Program.cs +++ b/Samples/InputBasicSamples/Program.cs @@ -1,4 +1,9 @@ -// See https://aka.ms/new-console-template for more information +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + + using System.Globalization; using PPlus; using PPlus.Controls; @@ -25,10 +30,10 @@ .Input("Input [blue]sample2[/]", "with [yellow]description[/]") .Run(); -PromptPlus.DoubleDash("Control input - with MaxLenght"); +PromptPlus.DoubleDash("Control input - with MaxLength"); PromptPlus - .Input("Input sample3", "My MaxLenght is 5") - .MaxLenght(5) + .Input("Input sample3", "My MaxLength is 5") + .MaxLength(5) .Run(); PromptPlus.DoubleDash("Control:Input - with CaseOptions"); @@ -60,7 +65,7 @@ .Input("Input sample8", "Dynamically change the description using a user role") .ChangeDescription((inputvalue) => { - var aux = $"Input [yellow]lenght[/] is {(inputvalue ?? string.Empty).Length}"; + var aux = $"Input [yellow]length[/] is {(inputvalue ?? string.Empty).Length}"; return aux; }) .Run(); diff --git a/Samples/InputOverwriteDefaultFromSamples/Program.cs b/Samples/InputOverwriteDefaultFromSamples/Program.cs index add64e28..0696ace1 100644 --- a/Samples/InputOverwriteDefaultFromSamples/Program.cs +++ b/Samples/InputOverwriteDefaultFromSamples/Program.cs @@ -1,4 +1,9 @@ -// See https://aka.ms/new-console-template for more information +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + + using System.Globalization; using PPlus; diff --git a/Samples/InputSecretSamples/Program.cs b/Samples/InputSecretSamples/Program.cs index 0e04668b..8b33b89a 100644 --- a/Samples/InputSecretSamples/Program.cs +++ b/Samples/InputSecretSamples/Program.cs @@ -1,4 +1,8 @@ -// See https://aka.ms/new-console-template for more information +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + using System.Globalization; using PPlus; using PPlus.Controls; diff --git a/Samples/InputWithHistorySamples/Program.cs b/Samples/InputWithHistorySamples/Program.cs index 898cd2ef..37826242 100644 --- a/Samples/InputWithHistorySamples/Program.cs +++ b/Samples/InputWithHistorySamples/Program.cs @@ -1,4 +1,8 @@ -// See https://aka.ms/new-console-template for more information +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + using System.Globalization; using PPlus; diff --git a/Samples/InputWithSugestionSamples/Program.cs b/Samples/InputWithSugestionSamples/Program.cs deleted file mode 100644 index cfd95a4b..00000000 --- a/Samples/InputWithSugestionSamples/Program.cs +++ /dev/null @@ -1,41 +0,0 @@ -// See https://aka.ms/new-console-template for more information -using System.Globalization; -using PPlus; -using PPlus.Controls; - -PromptPlus.WriteLine("Hello, World!"); -//Ensure ValueResult Culture for all controls -PromptPlus.Config.DefaultCulture = new CultureInfo("en-us"); - -SugestionOutput SugestionInputSample(SugestionInput arg) -{ - var result = new SugestionOutput(); - if (arg.Text.StartsWith("s", StringComparison.CurrentCultureIgnoreCase)) - { - result.Add("sugestion 1"); - result.Add("sugestion 2"); - result.Add("sugestion 3"); - } - else - { - result.Add("other sugestion 1"); - result.Add("other sugestion 2"); - result.Add("other sugestion 3"); - } - return result; -} - -PromptPlus.DoubleDash("Control:Input - with sugestions."); -var in1 = PromptPlus - .Input("Input sample", "input with sugestions.") - .SuggestionHandler(SugestionInputSample) - .Run(); - -if (!in1.IsAborted) -{ - PromptPlus.WriteLine($"You input is {in1.Value}"); -} - -PromptPlus.WriteLines(2); -PromptPlus.KeyPress("End Sample!, Press any key", cfg => cfg.ShowTooltip(false)) - .Run(); \ No newline at end of file diff --git a/Samples/InputWithSugestionSamples/InputWithSugestionSamples.csproj b/Samples/InputWithSuggestionSamples/InputWithSuggestionSamples.csproj similarity index 100% rename from Samples/InputWithSugestionSamples/InputWithSugestionSamples.csproj rename to Samples/InputWithSuggestionSamples/InputWithSuggestionSamples.csproj diff --git a/Samples/InputWithSuggestionSamples/Program.cs b/Samples/InputWithSuggestionSamples/Program.cs new file mode 100644 index 00000000..9abe3eea --- /dev/null +++ b/Samples/InputWithSuggestionSamples/Program.cs @@ -0,0 +1,45 @@ +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + +using System.Globalization; +using PPlus; +using PPlus.Controls; + +PromptPlus.WriteLine("Hello, World!"); +//Ensure ValueResult Culture for all controls +PromptPlus.Config.DefaultCulture = new CultureInfo("en-us"); + +SuggestionOutput SuggestionInputSample(SuggestionInput arg) +{ + var result = new SuggestionOutput(); + if (arg.Text.StartsWith("s", StringComparison.CurrentCultureIgnoreCase)) + { + result.Add("suggestion 1"); + result.Add("suggestion 2"); + result.Add("suggestion 3"); + } + else + { + result.Add("other suggestion 1"); + result.Add("other suggestion 2"); + result.Add("other suggestion 3"); + } + return result; +} + +PromptPlus.DoubleDash("Control:Input - with suggestions."); +var in1 = PromptPlus + .Input("Input sample", "input with suggestions.") + .SuggestionHandler(SuggestionInputSample) + .Run(); + +if (!in1.IsAborted) +{ + PromptPlus.WriteLine($"You input is {in1.Value}"); +} + +PromptPlus.WriteLines(2); +PromptPlus.KeyPress("End Sample!, Press any key", cfg => cfg.ShowTooltip(false)) + .Run(); \ No newline at end of file diff --git a/Samples/InputWithValidatorSamples/Program.cs b/Samples/InputWithValidatorSamples/Program.cs index b1689245..08c93dbf 100644 --- a/Samples/InputWithValidatorSamples/Program.cs +++ b/Samples/InputWithValidatorSamples/Program.cs @@ -1,4 +1,8 @@ -// See https://aka.ms/new-console-template for more information +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + using System.ComponentModel.DataAnnotations; using System.Globalization; using PPlus; @@ -21,10 +25,10 @@ static void Main() //Ensure ValueResult Culture for all controls PromptPlus.Config.DefaultCulture = new CultureInfo("en-us"); - PromptPlus.DoubleDash("Control:Input - with MaxLenght and validator"); + PromptPlus.DoubleDash("Control:Input - with MaxLength and validator"); var in1 = PromptPlus - .Input("Input sample1", "My MaxLenght is 5 and MinLenght is 2") - .MaxLenght(5) + .Input("Input sample1", "My MaxLength is 5 and MinLength is 2") + .MaxLength(5) .AddValidators(PromptValidators.MinLength(2)) .Run(); @@ -35,8 +39,8 @@ static void Main() PromptPlus.DoubleDash("Control:Input - with ValidateOnDemand - Execute validators foreach input"); PromptPlus - .Input("Input sample1", "My MaxLenght is 5 and MinLenght is 2") - .MaxLenght(5) + .Input("Input sample1", "My MaxLength is 5 and MinLength is 2") + .MaxLength(5) .AddValidators(PromptValidators.MinLength(2)) .ValidateOnDemand() .Run(); diff --git a/Samples/KeyPressSamples/Program.cs b/Samples/KeyPressSamples/Program.cs index b3717135..0f572ff4 100644 --- a/Samples/KeyPressSamples/Program.cs +++ b/Samples/KeyPressSamples/Program.cs @@ -1,4 +1,8 @@ -// See https://aka.ms/new-console-template for more information +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + using System.Globalization; using PPlus; using PPlus.Controls; diff --git a/Samples/MaskEditCurrencyTypeSamples/Program.cs b/Samples/MaskEditCurrencyTypeSamples/Program.cs index 1358c053..8f85d6f7 100644 --- a/Samples/MaskEditCurrencyTypeSamples/Program.cs +++ b/Samples/MaskEditCurrencyTypeSamples/Program.cs @@ -1,4 +1,9 @@ -using System.Globalization; +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + +using System.Globalization; using PPlus; using PPlus.Controls; @@ -47,7 +52,7 @@ static void Main(string[] args) .Run(); - PromptPlus.DoubleDash("For other features below see - input samples (same behaviour)"); + PromptPlus.DoubleDash("For other features below see - input samples (same behavior)"); PromptPlus.WriteLine(". [yellow]ChangeDescription[/] - InputBasicSamples"); PromptPlus.WriteLine(". [yellow]ValidateOnDemand[/] - InputWithValidatorSamples"); PromptPlus.WriteLine(". [yellow]AddValidators[/] - InputWithValidatorSamples"); @@ -55,7 +60,7 @@ static void Main(string[] args) PromptPlus.WriteLine(". [yellow]OverwriteDefaultFrom[/] - InputOverwriteDefaultFromSamples"); PromptPlus.WriteLine(". [yellow]Default[/] - InputBasicSamples"); PromptPlus.WriteLine(". [yellow]DefaultIfEmpty[/] - InputBasicSamples"); - PromptPlus.WriteLine(". [yellow]SuggestionHandler[/] - InputWithSugestionSamples"); + PromptPlus.WriteLine(". [yellow]SuggestionHandler[/] - InputWithSuggestionSamples"); PromptPlus.WriteLine(". [yellow]HistoryEnabled[/] - InputWithHistorySamples"); PromptPlus.WriteLine(". [yellow]HistoryMinimumPrefixLength[/] - InputWithHistorySamples"); PromptPlus.WriteLine(". [yellow]HistoryTimeout[/] - InputWithHistorySamples"); diff --git a/Samples/MaskEditDateTimeTypeSamples/Program.cs b/Samples/MaskEditDateTimeTypeSamples/Program.cs index 92d30a31..8efef7c3 100644 --- a/Samples/MaskEditDateTimeTypeSamples/Program.cs +++ b/Samples/MaskEditDateTimeTypeSamples/Program.cs @@ -1,4 +1,9 @@ -using System.Globalization; +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + +using System.Globalization; using PPlus; using PPlus.Controls; @@ -91,7 +96,7 @@ static void Main(string[] args) .AcceptEmptyValue() .Run(); - PromptPlus.DoubleDash("For other features below see - input samples (same behaviour)"); + PromptPlus.DoubleDash("For other features below see - input samples (same behavior)"); PromptPlus.WriteLine(". [yellow]ChangeDescription[/] - InputBasicSamples"); PromptPlus.WriteLine(". [yellow]ValidateOnDemand[/] - InputWithValidatorSamples"); PromptPlus.WriteLine(". [yellow]AddValidators[/] - InputWithValidatorSamples"); @@ -99,7 +104,7 @@ static void Main(string[] args) PromptPlus.WriteLine(". [yellow]OverwriteDefaultFrom[/] - InputOverwriteDefaultFromSamples"); PromptPlus.WriteLine(". [yellow]Default[/] - InputBasicSamples"); PromptPlus.WriteLine(". [yellow]DefaultIfEmpty[/] - InputBasicSamples"); - PromptPlus.WriteLine(". [yellow]SuggestionHandler[/] - InputWithSugestionSamples"); + PromptPlus.WriteLine(". [yellow]SuggestionHandler[/] - InputWithSuggestionSamples"); PromptPlus.WriteLine(". [yellow]HistoryEnabled[/] - InputWithHistorySamples"); PromptPlus.WriteLine(". [yellow]HistoryMinimumPrefixLength[/] - InputWithHistorySamples"); PromptPlus.WriteLine(". [yellow]HistoryTimeout[/] - InputWithHistorySamples"); diff --git a/Samples/MaskEditDateTypeSamples/Program.cs b/Samples/MaskEditDateTypeSamples/Program.cs index 4107f672..781b8ba2 100644 --- a/Samples/MaskEditDateTypeSamples/Program.cs +++ b/Samples/MaskEditDateTypeSamples/Program.cs @@ -1,4 +1,9 @@ -using System.Globalization; +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + +using System.Globalization; using PPlus; using PPlus.Controls; @@ -86,7 +91,7 @@ static void Main(string[] args) .AcceptEmptyValue() .Run(); - PromptPlus.DoubleDash("For other features below see - input samples (same behaviour)"); + PromptPlus.DoubleDash("For other features below see - input samples (same behavior)"); PromptPlus.WriteLine(". [yellow]ChangeDescription[/] - InputBasicSamples"); PromptPlus.WriteLine(". [yellow]ValidateOnDemand[/] - InputWithValidatorSamples"); PromptPlus.WriteLine(". [yellow]AddValidators[/] - InputWithValidatorSamples"); @@ -94,7 +99,7 @@ static void Main(string[] args) PromptPlus.WriteLine(". [yellow]OverwriteDefaultFrom[/] - InputOverwriteDefaultFromSamples"); PromptPlus.WriteLine(". [yellow]Default[/] - InputBasicSamples"); PromptPlus.WriteLine(". [yellow]DefaultIfEmpty[/] - InputBasicSamples"); - PromptPlus.WriteLine(". [yellow]SuggestionHandler[/] - InputWithSugestionSamples"); + PromptPlus.WriteLine(". [yellow]SuggestionHandler[/] - InputWithSuggestionSamples"); PromptPlus.WriteLine(". [yellow]HistoryEnabled[/] - InputWithHistorySamples"); PromptPlus.WriteLine(". [yellow]HistoryMinimumPrefixLength[/] - InputWithHistorySamples"); PromptPlus.WriteLine(". [yellow]HistoryTimeout[/] - InputWithHistorySamples"); diff --git a/Samples/MaskEditGenericSamples/Program.cs b/Samples/MaskEditGenericSamples/Program.cs index 72b0a128..28fed70d 100644 --- a/Samples/MaskEditGenericSamples/Program.cs +++ b/Samples/MaskEditGenericSamples/Program.cs @@ -1,4 +1,9 @@ -using PPlus; +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + +using PPlus; namespace MaskEditGenericSamples { @@ -34,7 +39,7 @@ static void Main(string[] args) .TypeTipStyle(Style.Default.Foreground(Color.Aqua)) .Run(); - PromptPlus.DoubleDash("For other features below see - input samples (same behaviour)"); + PromptPlus.DoubleDash("For other features below see - input samples (same behavior)"); PromptPlus.WriteLine(". [yellow]ChangeDescription[/] - InputBasicSamples"); PromptPlus.WriteLine(". [yellow]ValidateOnDemand[/] - InputWithValidatorSamples"); PromptPlus.WriteLine(". [yellow]AddValidators[/] - InputWithValidatorSamples"); @@ -42,7 +47,7 @@ static void Main(string[] args) PromptPlus.WriteLine(". [yellow]OverwriteDefaultFrom[/] - InputOverwriteDefaultFromSamples"); PromptPlus.WriteLine(". [yellow]Default[/] - InputBasicSamples"); PromptPlus.WriteLine(". [yellow]DefaultIfEmpty[/] - InputBasicSamples"); - PromptPlus.WriteLine(". [yellow]SuggestionHandler[/] - InputWithSugestionSamples"); + PromptPlus.WriteLine(". [yellow]SuggestionHandler[/] - InputWithSuggestionSamples"); PromptPlus.WriteLine(". [yellow]HistoryEnabled[/] - InputWithHistorySamples"); PromptPlus.WriteLine(". [yellow]HistoryMinimumPrefixLength[/] - InputWithHistorySamples"); PromptPlus.WriteLine(". [yellow]HistoryTimeout[/] - InputWithHistorySamples"); diff --git a/Samples/MaskEditNumberTypeSamples/Program.cs b/Samples/MaskEditNumberTypeSamples/Program.cs index 3c8d5af4..3cdb71bc 100644 --- a/Samples/MaskEditNumberTypeSamples/Program.cs +++ b/Samples/MaskEditNumberTypeSamples/Program.cs @@ -1,4 +1,9 @@ -using System.Globalization; +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + +using System.Globalization; using PPlus; using PPlus.Controls; @@ -47,7 +52,7 @@ static void Main(string[] args) .Run(); - PromptPlus.DoubleDash("For other features below see - input samples (same behaviour)"); + PromptPlus.DoubleDash("For other features below see - input samples (same behavior)"); PromptPlus.WriteLine(". [yellow]ChangeDescription[/] - InputBasicSamples"); PromptPlus.WriteLine(". [yellow]ValidateOnDemand[/] - InputWithValidatorSamples"); PromptPlus.WriteLine(". [yellow]AddValidators[/] - InputWithValidatorSamples"); @@ -55,7 +60,7 @@ static void Main(string[] args) PromptPlus.WriteLine(". [yellow]OverwriteDefaultFrom[/] - InputOverwriteDefaultFromSamples"); PromptPlus.WriteLine(". [yellow]Default[/] - InputBasicSamples"); PromptPlus.WriteLine(". [yellow]DefaultIfEmpty[/] - InputBasicSamples"); - PromptPlus.WriteLine(". [yellow]SuggestionHandler[/] - InputWithSugestionSamples"); + PromptPlus.WriteLine(". [yellow]SuggestionHandler[/] - InputWithSuggestionSamples"); PromptPlus.WriteLine(". [yellow]HistoryEnabled[/] - InputWithHistorySamples"); PromptPlus.WriteLine(". [yellow]HistoryMinimumPrefixLength[/] - InputWithHistorySamples"); PromptPlus.WriteLine(". [yellow]HistoryTimeout[/] - InputWithHistorySamples"); diff --git a/Samples/MaskEditTimeTypeSamples/Program.cs b/Samples/MaskEditTimeTypeSamples/Program.cs index 2ae07da0..fbce847f 100644 --- a/Samples/MaskEditTimeTypeSamples/Program.cs +++ b/Samples/MaskEditTimeTypeSamples/Program.cs @@ -1,4 +1,9 @@ -using System.Globalization; +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + +using System.Globalization; using PPlus; using PPlus.Controls; @@ -90,7 +95,7 @@ static void Main(string[] args) .AcceptEmptyValue() .Run(); - PromptPlus.DoubleDash("For other features below see - input samples (same behaviour)"); + PromptPlus.DoubleDash("For other features below see - input samples (same behavior)"); PromptPlus.WriteLine(". [yellow]ChangeDescription[/] - InputBasicSamples"); PromptPlus.WriteLine(". [yellow]ValidateOnDemand[/] - InputWithValidatorSamples"); PromptPlus.WriteLine(". [yellow]AddValidators[/] - InputWithValidatorSamples"); @@ -98,7 +103,7 @@ static void Main(string[] args) PromptPlus.WriteLine(". [yellow]OverwriteDefaultFrom[/] - InputOverwriteDefaultFromSamples"); PromptPlus.WriteLine(". [yellow]Default[/] - InputBasicSamples"); PromptPlus.WriteLine(". [yellow]DefaultIfEmpty[/] - InputBasicSamples"); - PromptPlus.WriteLine(". [yellow]SuggestionHandler[/] - InputWithSugestionSamples"); + PromptPlus.WriteLine(". [yellow]SuggestionHandler[/] - InputWithSuggestionSamples"); PromptPlus.WriteLine(". [yellow]HistoryEnabled[/] - InputWithHistorySamples"); PromptPlus.WriteLine(". [yellow]HistoryMinimumPrefixLength[/] - InputWithHistorySamples"); PromptPlus.WriteLine(". [yellow]HistoryTimeout[/] - InputWithHistorySamples"); diff --git a/Samples/MultiSelectBasicSamples/Program.cs b/Samples/MultiSelectBasicSamples/Program.cs index dcf7607e..db0690e5 100644 --- a/Samples/MultiSelectBasicSamples/Program.cs +++ b/Samples/MultiSelectBasicSamples/Program.cs @@ -1,4 +1,9 @@ -using System.ComponentModel.DataAnnotations; +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + +using System.ComponentModel.DataAnnotations; using System.Globalization; using PPlus; using PPlus.Controls; @@ -73,7 +78,7 @@ static void Main(string[] args) { foreach (var item in multsel.Value) { - PromptPlus.WriteLine($"You seleted item is {item}"); + PromptPlus.WriteLine($"You selected item is {item}"); } } @@ -92,7 +97,7 @@ static void Main(string[] args) { foreach (var item in multsel.Value) { - PromptPlus.WriteLine($"You seleted item is {item}"); + PromptPlus.WriteLine($"You selected item is {item}"); } } @@ -102,8 +107,8 @@ static void Main(string[] args) .FilterType(FilterMode.StartsWith) .Run(); - PromptPlus.DoubleDash("Control:MultiSelect - Diabled Item/seleted item"); - PromptPlus.MultiSelect("Which cities would you like to visit?", "London is disabled,Seattle disabled and seleted,Tokyo is started selected") + PromptPlus.DoubleDash("Control:MultiSelect - Diabled Item/selected item"); + PromptPlus.MultiSelect("Which cities would you like to visit?", "London is disabled,Seattle disabled and selected,Tokyo is started selected") .AddItem("Seattle",true,true) .AddItem("London", true) .AddItem("Tokyo",false,true) @@ -149,7 +154,7 @@ static void Main(string[] args) .Range(2,3) .Run(); - PromptPlus.DoubleDash("For other basic features below see - input samples (same behaviour)"); + PromptPlus.DoubleDash("For other basic features below see - input samples (same behavior)"); PromptPlus.WriteLine(". [yellow]ChangeDescription[/] - InputBasicSamples"); PromptPlus.WriteLine(". [yellow]OverwriteDefaultFrom[/] - InputOverwriteDefaultFromSamples"); PromptPlus.WriteLines(2); diff --git a/Samples/MultiSelectUserScopeSamples/Program.cs b/Samples/MultiSelectUserScopeSamples/Program.cs index 73217b52..a60d1aa7 100644 --- a/Samples/MultiSelectUserScopeSamples/Program.cs +++ b/Samples/MultiSelectUserScopeSamples/Program.cs @@ -1,4 +1,9 @@ -using System.ComponentModel.DataAnnotations; +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + +using System.ComponentModel.DataAnnotations; using System.Globalization; using PPlus; using PPlus.Controls; @@ -28,7 +33,7 @@ internal class MyClass public string MyText { get; set; } public string MyDesc { get; set; } public bool IsDisabled { get; set; } - public bool IsSeleted { get; set; } + public bool IsSelected { get; set; } public bool IsHide { get; set; } } @@ -45,14 +50,14 @@ static void Main(string[] args) PromptPlus.DoubleDash("Control:MultiSelect - Using class with AdderScope and OrderBy"); var sel = PromptPlus.MultiSelect("MultiSelect") - .AddItems(_datasample.Where(x => x.IsSeleted), selected: true) - .AddItems(_datasample.Where(x => !x.IsSeleted)) + .AddItems(_datasample.Where(x => x.IsSelected), selected: true) + .AddItems(_datasample.Where(x => !x.IsSelected)) .AddItemsTo(AdderScope.Disable, _datasample.Where(x => x.IsDisabled).ToArray()) .AddItemsTo(AdderScope.Remove, _datasample.Where(x => x.IsHide).ToArray()) .TextSelector(x => x.MyText) .EqualItems((item1, item2) => item1.Id == item2.Id) .ChangeDescription(x => x.MyDesc) - .AddDefault(_datasample.Where(x => x.IsSeleted).ToArray()) + .AddDefault(_datasample.Where(x => x.IsSelected).ToArray()) .OrderBy((item) => item.Id) .Run(); @@ -70,12 +75,12 @@ private static IEnumerable LoadData() { var aux = new List { - new MyClass { Id = 4, MyText = "Text4", MyDesc="Text4 for id=4", IsDisabled = false, IsHide = false , IsSeleted = true}, + new MyClass { Id = 4, MyText = "Text4", MyDesc="Text4 for id=4", IsDisabled = false, IsHide = false , IsSelected = true}, new MyClass { Id = 5, MyText = "Text5", MyDesc="Text5 for id=5", IsDisabled = false, IsHide = false }, new MyClass { Id = 6, MyText = "Text6", MyDesc="Text6 for id=6", IsDisabled = false, IsHide = true }, new MyClass { Id = 1, MyText = "Text1", MyDesc="Text1 for id=1", IsDisabled = false, IsHide = false }, new MyClass { Id = 0, MyText = "Text1", MyDesc="Text1 for id=0", IsDisabled = false, IsHide = false }, - new MyClass { Id = 2, MyText = "Text2", MyDesc="Text2 for id=2", IsDisabled = true, IsSeleted = true }, + new MyClass { Id = 2, MyText = "Text2", MyDesc="Text2 for id=2", IsDisabled = true, IsSelected = true }, new MyClass { Id = 3, MyText = "Text3", MyDesc="Text3 for id=3", IsDisabled = true, IsHide = false } }; return aux; diff --git a/Samples/MultiSelectUserTypeSamples/Program.cs b/Samples/MultiSelectUserTypeSamples/Program.cs index 6a012e5c..5bf5403c 100644 --- a/Samples/MultiSelectUserTypeSamples/Program.cs +++ b/Samples/MultiSelectUserTypeSamples/Program.cs @@ -1,4 +1,9 @@ -using System.Globalization; +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + +using System.Globalization; using PPlus; namespace MultiSelectUserTypeSamples diff --git a/Samples/PipelineSamples/Program.cs b/Samples/PipelineSamples/Program.cs index c2cbda26..2154b17d 100644 --- a/Samples/PipelineSamples/Program.cs +++ b/Samples/PipelineSamples/Program.cs @@ -1,4 +1,9 @@ -using System.Globalization; +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + +using System.Globalization; using PPlus; namespace PipelineSamples diff --git a/Samples/ProgressBarSamples/Program.cs b/Samples/ProgressBarSamples/Program.cs index 801bf33d..796621ba 100644 --- a/Samples/ProgressBarSamples/Program.cs +++ b/Samples/ProgressBarSamples/Program.cs @@ -1,4 +1,9 @@ -using System.Globalization; +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + +using System.Globalization; using PPlus; using PPlus.Controls; diff --git a/Samples/SelectBasicSamples/Program.cs b/Samples/SelectBasicSamples/Program.cs index d5c8e19a..0635b87f 100644 --- a/Samples/SelectBasicSamples/Program.cs +++ b/Samples/SelectBasicSamples/Program.cs @@ -1,4 +1,9 @@ -using System.ComponentModel.DataAnnotations; +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + +using System.ComponentModel.DataAnnotations; using System.Globalization; using PPlus; using PPlus.Controls; @@ -53,7 +58,7 @@ static void Main(string[] args) if (!sel.IsAborted) { - PromptPlus.WriteLine($"You seleted item is {sel.Value}"); + PromptPlus.WriteLine($"You selected item is {sel.Value}"); } PromptPlus.DoubleDash("Control:Select - PageSize"); @@ -100,7 +105,7 @@ static void Main(string[] args) .Run(); if (!sel1.IsAborted) { - PromptPlus.WriteLine($"You seleted item is {sel1.Value}"); + PromptPlus.WriteLine($"You selected item is {sel1.Value}"); } PromptPlus.DoubleDash("Control:Select - Using Interaction"); @@ -112,7 +117,7 @@ static void Main(string[] args) .Run(); - PromptPlus.DoubleDash("For other basic features below see - input samples (same behaviour)"); + PromptPlus.DoubleDash("For other basic features below see - input samples (same behavior)"); PromptPlus.WriteLine(". [yellow]ChangeDescription[/] - InputBasicSamples"); PromptPlus.WriteLine(". [yellow]OverwriteDefaultFrom[/] - InputOverwriteDefaultFromSamples"); PromptPlus.WriteLine(". [yellow]Default[/] - InputBasicSamples"); diff --git a/Samples/SelectUserScopeSamples/Program.cs b/Samples/SelectUserScopeSamples/Program.cs index f4e5f681..d3f627e2 100644 --- a/Samples/SelectUserScopeSamples/Program.cs +++ b/Samples/SelectUserScopeSamples/Program.cs @@ -1,4 +1,9 @@ -using System.ComponentModel.DataAnnotations; +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + +using System.ComponentModel.DataAnnotations; using System.Globalization; using PPlus; using PPlus.Controls; diff --git a/Samples/SelectUserTypeSamples/Program.cs b/Samples/SelectUserTypeSamples/Program.cs index 4c4c800e..3b02dcef 100644 --- a/Samples/SelectUserTypeSamples/Program.cs +++ b/Samples/SelectUserTypeSamples/Program.cs @@ -1,4 +1,9 @@ -using System.Globalization; +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + +using System.Globalization; using PPlus; namespace SelectUserTypeSamples diff --git a/Samples/SliderNumberLeftRightModeSamples/Program.cs b/Samples/SliderNumberLeftRightModeSamples/Program.cs index e366c7af..937295d0 100644 --- a/Samples/SliderNumberLeftRightModeSamples/Program.cs +++ b/Samples/SliderNumberLeftRightModeSamples/Program.cs @@ -1,4 +1,9 @@ -using System.Globalization; +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + +using System.Globalization; using PPlus; using PPlus.Controls; @@ -25,7 +30,7 @@ static void Main(string[] args) .Run(); if (!sdl.IsAborted) { - PromptPlus.WriteLine($"You seleted is {sdl.Value}"); + PromptPlus.WriteLine($"You selected is {sdl.Value}"); } PromptPlus.DoubleDash($"Control:SliderNumber {cult} - normal usage"); @@ -121,7 +126,7 @@ static void Main(string[] args) - PromptPlus.DoubleDash("For other basic features below see - input samples (same behaviour)"); + PromptPlus.DoubleDash("For other basic features below see - input samples (same behavior)"); PromptPlus.WriteLine(". [yellow]ChangeDescription[/] - InputBasicSamples"); PromptPlus.WriteLine(". [yellow]OverwriteDefaultFrom[/] - InputOverwriteDefaultFromSamples"); PromptPlus.WriteLines(2); diff --git a/Samples/SliderNumberUpDownModeSamples/Program.cs b/Samples/SliderNumberUpDownModeSamples/Program.cs index 2439ca42..e0e0d089 100644 --- a/Samples/SliderNumberUpDownModeSamples/Program.cs +++ b/Samples/SliderNumberUpDownModeSamples/Program.cs @@ -1,4 +1,9 @@ -using System.Globalization; +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + +using System.Globalization; using PPlus; using PPlus.Controls; @@ -26,7 +31,7 @@ static void Main(string[] args) .Run(); if (!sdl.IsAborted) { - PromptPlus.WriteLine($"You seleted is {sdl.Value}"); + PromptPlus.WriteLine($"You selected is {sdl.Value}"); } PromptPlus.DoubleDash($"Control:SliderNumber {cult} - normal usage"); @@ -52,7 +57,7 @@ static void Main(string[] args) .LargeStep(1) .Run(); - PromptPlus.DoubleDash("For other basic features below see - input samples (same behaviour)"); + PromptPlus.DoubleDash("For other basic features below see - input samples (same behavior)"); PromptPlus.WriteLine(". [yellow]ChangeDescription[/] - InputBasicSamples"); PromptPlus.WriteLine(". [yellow]OverwriteDefaultFrom[/] - InputOverwriteDefaultFromSamples"); PromptPlus.WriteLines(2); diff --git a/Samples/SliderSwitchSamples/Program.cs b/Samples/SliderSwitchSamples/Program.cs index 8aeafa9d..2ddd325d 100644 --- a/Samples/SliderSwitchSamples/Program.cs +++ b/Samples/SliderSwitchSamples/Program.cs @@ -1,4 +1,9 @@ -using System.Globalization; +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + +using System.Globalization; using PPlus; using PPlus.Controls; @@ -51,7 +56,7 @@ static void Main(string[] args) .Default(true) .Run(); - PromptPlus.DoubleDash("For other basic features below see - input samples (same behaviour)"); + PromptPlus.DoubleDash("For other basic features below see - input samples (same behavior)"); PromptPlus.WriteLine(". [yellow]ChangeDescription[/] - InputBasicSamples"); PromptPlus.WriteLine(". [yellow]OverwriteDefaultFrom[/] - InputOverwriteDefaultFromSamples"); PromptPlus.WriteLines(2); diff --git a/Samples/MultiSelectBasicSamples/Properties/launchSettings.json b/Samples/SliderSwitchSamples/Properties/launchSettings.json similarity index 100% rename from Samples/MultiSelectBasicSamples/Properties/launchSettings.json rename to Samples/SliderSwitchSamples/Properties/launchSettings.json diff --git a/Samples/TreeViewMultiSelectSamples/Program.cs b/Samples/TreeViewMultiSelectSamples/Program.cs index 93cefcaa..728cbee7 100644 --- a/Samples/TreeViewMultiSelectSamples/Program.cs +++ b/Samples/TreeViewMultiSelectSamples/Program.cs @@ -1,4 +1,9 @@ -using System.Globalization; +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + +using System.Globalization; using PPlus; using PPlus.Controls; diff --git a/Samples/TreeViewSamples/Program.cs b/Samples/TreeViewSamples/Program.cs index 747a3f17..467ee630 100644 --- a/Samples/TreeViewSamples/Program.cs +++ b/Samples/TreeViewSamples/Program.cs @@ -1,4 +1,9 @@ -using System.Globalization; +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + +using System.Globalization; using PPlus; using PPlus.Controls; diff --git a/Samples/WaitTasksSamples/Program.cs b/Samples/WaitTasksSamples/Program.cs index 7c6619a9..6067fc08 100644 --- a/Samples/WaitTasksSamples/Program.cs +++ b/Samples/WaitTasksSamples/Program.cs @@ -1,4 +1,9 @@ -using System.Globalization; +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + +using System.Globalization; using PPlus; using PPlus.Controls; diff --git a/Samples/WaitTimerSamples/Program.cs b/Samples/WaitTimerSamples/Program.cs index 03c58361..bd413455 100644 --- a/Samples/WaitTimerSamples/Program.cs +++ b/Samples/WaitTimerSamples/Program.cs @@ -1,4 +1,9 @@ -using System.Globalization; +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + +using System.Globalization; using PPlus; using PPlus.Controls; diff --git a/Src/Controls/AddtoList/IControlList.cs b/Src/Controls/AddtoList/IControlList.cs index 1b836e38..59506ab0 100644 --- a/Src/Controls/AddtoList/IControlList.cs +++ b/Src/Controls/AddtoList/IControlList.cs @@ -48,15 +48,15 @@ public interface IControlList : IPromptControls> IControlList AcceptInput(Func value); /// - /// MaxLenght of input text. + /// MaxLength of input text. /// - /// Lenght + /// Length /// - IControlList MaxLenght(ushort value); + IControlList MaxLength(ushort value); /// /// Add a validator to accept sucessfull finish of control. - ///
Tip: see to validators embeding
+ ///
Tip: see to validators embedding
///
/// the function validator. /// @@ -72,9 +72,9 @@ public interface IControlList : IPromptControls> /// /// Add Suggestion Handler feature /// - /// function to apply suggestions. and + /// function to apply suggestions. and /// - IControlList SuggestionHandler(Func value); + IControlList SuggestionHandler(Func value); /// /// Add item to list diff --git a/Src/Controls/AddtoList/IControlMaskEditList.cs b/Src/Controls/AddtoList/IControlMaskEditList.cs index caad48e2..c4a30d32 100644 --- a/Src/Controls/AddtoList/IControlMaskEditList.cs +++ b/Src/Controls/AddtoList/IControlMaskEditList.cs @@ -36,7 +36,7 @@ public interface IControlMaskEditList : IPromptControls /// Overwrite to region tip type input. ///
Default Foreground : 'ConsoleColor.Yellow'
- ///
Default Background : same Console Background when setted
+ ///
Default Background : same Console Background when set
///
/// Style /// @@ -45,7 +45,7 @@ public interface IControlMaskEditList : IPromptControls /// Overwrite to region neggative input. ///
Default Foreground : 'StyleControls.Answer'
- ///
Default Background : same Console Background when setted
+ ///
Default Background : same Console Background when set
/// /// Style /// @@ -54,7 +54,7 @@ public interface IControlMaskEditList : IPromptControls /// Overwrite to region positive input. ///
Default Foreground : 'StyleControls.Answer'
- ///
Default Background : Same Console Background when setted
+ ///
Default Background : Same Console Background when set
/// /// Style /// @@ -130,12 +130,12 @@ public interface IControlMaskEditList : IPromptControls - /// Defines integer lenght, decimal lenght and accept signl. + /// Defines integer length, decimal length and accept signl. ///
Valid only for type MaskedType.Number or Currency, otherwise this set will be ignored.
///
This set is Requeried for these types.
/// - /// integer lenght - /// decimal lenght + /// integer length + /// decimal length /// True accept signal; otherwise, no. /// IControlMaskEditList AmmoutPositions(int intvalue, int decimalvalue, bool acceptSignal); @@ -156,7 +156,7 @@ public interface IControlMaskEditList : IPromptControls /// Add a validator to accept sucessfull finish of control. - ///
Tip: see to validators embeding
+ ///
Tip: see to validators embedding
/// /// the function validator. /// @@ -179,9 +179,9 @@ public interface IControlMaskEditList : IPromptControls /// Add Suggestion Handler feature /// - /// function to apply suggestions. and + /// function to apply suggestions. and /// - IControlMaskEditList SuggestionHandler(Func value); + IControlMaskEditList SuggestionHandler(Func value); /// /// Accept empty value diff --git a/Src/Controls/AddtoList/ListControl.cs b/Src/Controls/AddtoList/ListControl.cs index 428f7c90..d85db6c4 100644 --- a/Src/Controls/AddtoList/ListControl.cs +++ b/Src/Controls/AddtoList/ListControl.cs @@ -19,7 +19,7 @@ internal class ListControl : BaseControl>, IControlList private Paginator _localpaginator; private bool _isInAutoCompleteMode; private int _completionsIndex = -1; - private SugestionOutput? _completions = null; + private SuggestionOutput? _completions = null; private int _editingItem = -1; public ListControl(IConsoleControl console, ListOptions options) : base(console, options) { @@ -75,7 +75,7 @@ public override string InitControl(CancellationToken cancellationToken) (item) => !item.Immutable); _localpaginator.UnSelected(); - _inputBuffer = new(_options.InputToCase, _options.AcceptInput, _options.MaxLenght); + _inputBuffer = new(_options.InputToCase, _options.AcceptInput, _options.MaxLength); if (!string.IsNullOrEmpty(_options.DefaultValue)) { _inputBuffer.LoadPrintable(_options.DefaultValue); @@ -128,15 +128,15 @@ public IControlList Config(Action context) } - public IControlList SuggestionHandler(Func value) + public IControlList SuggestionHandler(Func value) { _options.SuggestionHandler = value; return this; } - public IControlList MaxLenght(ushort value) + public IControlList MaxLength(ushort value) { - _options.MaxLenght = value; + _options.MaxLength = value; return this; } @@ -232,7 +232,7 @@ public override void InputTemplate(ScreenBuffer screenBuffer) if (_isInAutoCompleteMode) { var answer = FinishResult; - screenBuffer.WriteSugestion(_options, answer); + screenBuffer.WriteSuggestion(_options, answer); screenBuffer.SaveCursor(); } else @@ -276,7 +276,10 @@ public override void InputTemplate(ScreenBuffer screenBuffer) } if (_localpaginator.Count > 0) { - screenBuffer.WriteLinePagination(_options, _localpaginator.PaginationMessage()); + if (!_options.OptShowOnlyExistingPagination || _localpaginator.PageCount > 1) + { + screenBuffer.WriteLinePagination(_options, _localpaginator.PaginationMessage()); + } } } @@ -336,13 +339,13 @@ public override ResultPrompt> TryResult(CancellationToken ca } _editingItem = -1; } - //edit Item seleted + //edit Item selected else if (_options.EditItemPress.Equals(keyInfo.Value) && _editingItem < 0 && _localpaginator.SelectedIndex >= 0) { _inputBuffer.Clear().LoadPrintable(_localpaginator.SelectedItem.Text); _editingItem = _localpaginator.SelectedIndex; } - //remove Item seleted + //remove Item selected else if (_options.RemoveItemPress.Equals(keyInfo.Value) && _localpaginator.SelectedIndex >= 0) { if (_localpaginator.SelectedItem.Immutable) @@ -404,7 +407,7 @@ public override ResultPrompt> TryResult(CancellationToken ca } else { - if (_options.Items.Count(x => x.Text.Equals(aux, StringComparison.InvariantCultureIgnoreCase)) > 0) + if (_options.Items.Any(x => x.Text.Equals(aux, StringComparison.InvariantCultureIgnoreCase))) { SetError(Messages.ListItemAlreadyexists); break; @@ -435,7 +438,7 @@ public override ResultPrompt> TryResult(CancellationToken ca if (!_options.AllowDuplicate) { var aux = _inputBuffer.ToString(); - if (_options.Items.Count(x => x.Text.Equals(aux, StringComparison.InvariantCultureIgnoreCase)) > 0) + if (_options.Items.Any(x => x.Text.Equals(aux, StringComparison.InvariantCultureIgnoreCase))) { SetError(Messages.ListItemAlreadyexists); break; @@ -464,13 +467,13 @@ public override ResultPrompt> TryResult(CancellationToken ca _editingItem = -1; break; } - //apply sugestion and not edit + //apply suggestion and not edit else if (_editingItem < 0 && _options.SuggestionHandler != null && (keyInfo.Value.IsPressTabKey() || keyInfo.Value.IsPressShiftTabKey())) { if (!_isInAutoCompleteMode) { - _completions = _options.SuggestionHandler.Invoke(new SugestionInput(_inputBuffer.ToString(), _options.OptContext)); - if (_completions.HasValue && _completions.Value.Sugestions.Count > 0) + _completions = _options.SuggestionHandler.Invoke(new SuggestionInput(_inputBuffer.ToString(), _options.OptContext)); + if (_completions.HasValue && _completions.Value.Suggestions.Count > 0) { _completionsIndex = -1; _isInAutoCompleteMode = true; @@ -483,7 +486,7 @@ public override ResultPrompt> TryResult(CancellationToken ca } ExecuteAutoComplete(keyInfo.Value.IsPressShiftTabKey()); } - //cancel sugestion + //cancel suggestion else if (_options.SuggestionHandler != null && _isInAutoCompleteMode && keyInfo.Value.IsPressEscKey()) { _isInAutoCompleteMode = false; @@ -557,14 +560,14 @@ private bool ExecuteAutoComplete(bool Previus) { NextCompletions(); } - _inputBuffer.Clear().LoadPrintable(_completions.Value.Sugestions[_completionsIndex]); + _inputBuffer.Clear().LoadPrintable(_completions.Value.Suggestions[_completionsIndex]); return true; } private void NextCompletions() { _completionsIndex++; - if (_completionsIndex > _completions.Value.Sugestions.Count - 1) + if (_completionsIndex > _completions.Value.Suggestions.Count - 1) { _completionsIndex = 0; } @@ -575,7 +578,7 @@ private void PreviusCompletions() _completionsIndex--; if (_completionsIndex < 0) { - _completionsIndex = _completions.Value.Sugestions.Count - 1; + _completionsIndex = _completions.Value.Suggestions.Count - 1; } } diff --git a/Src/Controls/AddtoList/ListOptions.cs b/Src/Controls/AddtoList/ListOptions.cs index 5f9ac1ca..b37ae475 100644 --- a/Src/Controls/AddtoList/ListOptions.cs +++ b/Src/Controls/AddtoList/ListOptions.cs @@ -28,9 +28,9 @@ internal ListOptions(StyleSchema styleSchema, ConfigControls config, IConsoleCon public HotKey EditItemPress { get; set; } public CaseOptions InputToCase { get; set; } = CaseOptions.Any; public Func? AcceptInput { get; set; } - public ushort MaxLenght { get; set; } = ushort.MaxValue; + public ushort MaxLength { get; set; } = ushort.MaxValue; public IList> Validators { get; } = new List>(); - public Func? SuggestionHandler { get; set; } + public Func? SuggestionHandler { get; set; } public IList Items { get; set; } = new List(); public bool AllowDuplicate { get; set; } public int PageSize { get; set; } diff --git a/Src/Controls/AddtoList/MaskEditListControl.cs b/Src/Controls/AddtoList/MaskEditListControl.cs index ee348a4c..092227d0 100644 --- a/Src/Controls/AddtoList/MaskEditListControl.cs +++ b/Src/Controls/AddtoList/MaskEditListControl.cs @@ -20,7 +20,7 @@ internal class MaskEditListControl : BaseControl>, ICo private Paginator _localpaginator; private bool _isInAutoCompleteMode; private int _completionsIndex = -1; - private SugestionOutput? _completions = null; + private SuggestionOutput? _completions = null; private int _editingItem = -1; public MaskEditListControl(IConsoleControl console, MaskEditListOptions options) : base(console, options) { @@ -314,7 +314,7 @@ public IControlMaskEditList Range(int minvalue, int? maxvalue = null) return this; } - public IControlMaskEditList SuggestionHandler(Func value) + public IControlMaskEditList SuggestionHandler(Func value) { _options.SuggestionHandler = value; return this; @@ -334,7 +334,7 @@ public override void InputTemplate(ScreenBuffer screenBuffer) if (_isInAutoCompleteMode) { var answer = FinishResult; - screenBuffer.WriteSugestion(_options, answer); + screenBuffer.WriteSuggestion(_options, answer); screenBuffer.SaveCursor(); } else @@ -387,7 +387,10 @@ public override void InputTemplate(ScreenBuffer screenBuffer) } if (_localpaginator.Count > 0) { - screenBuffer.WriteLinePagination(_options, _localpaginator.PaginationMessage()); + if (!_options.OptShowOnlyExistingPagination || _localpaginator.PageCount > 1) + { + screenBuffer.WriteLinePagination(_options, _localpaginator.PaginationMessage()); + } } } @@ -496,13 +499,13 @@ public override ResultPrompt> TryResult(CancellationTo } _editingItem = -1; } - //edit Item seleted + //edit Item selected else if (_options.EditItemPress.Equals(keyInfo.Value) && _editingItem < 0 && _localpaginator.SelectedIndex >= 0) { _inputBuffer.Clear().Load(_inputBuffer.RemoveMask(_localpaginator.SelectedItem.Text,true)); _editingItem = _localpaginator.SelectedIndex; } - //remove Item seleted + //remove Item selected else if (_options.RemoveItemPress.Equals(keyInfo.Value) && _localpaginator.SelectedIndex >= 0) { if (_localpaginator.SelectedItem.Immutable) @@ -564,7 +567,7 @@ public override ResultPrompt> TryResult(CancellationTo } else { - if (_options.Items.Count(x => x.Text.Equals(aux, StringComparison.InvariantCultureIgnoreCase)) > 0) + if (_options.Items.Any(x => x.Text.Equals(aux, StringComparison.InvariantCultureIgnoreCase))) { SetError(Messages.ListItemAlreadyexists); break; @@ -595,7 +598,7 @@ public override ResultPrompt> TryResult(CancellationTo if (!_options.AllowDuplicate) { var aux = _inputBuffer.ToMasked(); - if (_options.Items.Count(x => x.Text.Equals(aux, StringComparison.InvariantCultureIgnoreCase)) > 0) + if (_options.Items.Any(x => x.Text.Equals(aux, StringComparison.InvariantCultureIgnoreCase))) { SetError(Messages.ListItemAlreadyexists); break; @@ -646,13 +649,13 @@ public override ResultPrompt> TryResult(CancellationTo _editingItem = -1; break; } - //apply sugestion and not edit + //apply suggestion and not edit else if (_editingItem < 0 && _options.SuggestionHandler != null && (keyInfo.Value.IsPressTabKey() || keyInfo.Value.IsPressShiftTabKey())) { if (!_isInAutoCompleteMode) { - _completions = _options.SuggestionHandler.Invoke(new SugestionInput(_inputBuffer.ToMasked(), _options.OptContext)); - if (_completions.HasValue && _completions.Value.Sugestions.Count > 0) + _completions = _options.SuggestionHandler.Invoke(new SuggestionInput(_inputBuffer.ToMasked(), _options.OptContext)); + if (_completions.HasValue && _completions.Value.Suggestions.Count > 0) { _completionsIndex = -1; _isInAutoCompleteMode = true; @@ -665,7 +668,7 @@ public override ResultPrompt> TryResult(CancellationTo } ExecuteAutoComplete(keyInfo.Value.IsPressShiftTabKey()); } - //cancel sugestion + //cancel suggestion else if (_options.SuggestionHandler != null && _isInAutoCompleteMode && keyInfo.Value.IsPressEscKey()) { _isInAutoCompleteMode = false; @@ -769,14 +772,14 @@ private bool ExecuteAutoComplete(bool Previus) { NextCompletions(); } - _inputBuffer.Clear().Load(_inputBuffer.RemoveMask(_completions.Value.Sugestions[_completionsIndex],true)); + _inputBuffer.Clear().Load(_inputBuffer.RemoveMask(_completions.Value.Suggestions[_completionsIndex],true)); return true; } private void NextCompletions() { _completionsIndex++; - if (_completionsIndex > _completions.Value.Sugestions.Count - 1) + if (_completionsIndex > _completions.Value.Suggestions.Count - 1) { _completionsIndex = 0; } @@ -787,7 +790,7 @@ private void PreviusCompletions() _completionsIndex--; if (_completionsIndex < 0) { - _completionsIndex = _completions.Value.Sugestions.Count - 1; + _completionsIndex = _completions.Value.Suggestions.Count - 1; } } diff --git a/Src/Controls/AddtoList/ScreenBufferList.cs b/Src/Controls/AddtoList/ScreenBufferList.cs index 2bb11fcd..aa75811c 100644 --- a/Src/Controls/AddtoList/ScreenBufferList.cs +++ b/Src/Controls/AddtoList/ScreenBufferList.cs @@ -44,8 +44,8 @@ private static string DefaultToolTipList(ListOptions baseOptions, bool isInAutoC { return string.Format("{0}, {1}\n{2}, {3}", string.Format(Messages.TooltipToggle, baseOptions.Config.TooltipKeyPress), - Messages.TooltipSugestionEsc, - Messages.TooltipSugestionToggle, + Messages.TooltipSuggestionEsc, + Messages.TooltipSuggestionToggle, Messages.TooltipEnterPressList); } else @@ -57,7 +57,7 @@ private static string DefaultToolTipList(ListOptions baseOptions, bool isInAutoC return string.Format("{0}, {1}, {2}\n{3}, {4}", string.Format(Messages.TooltipToggle, baseOptions.Config.TooltipKeyPress), Messages.TooltipAbortEdit, - Messages.TooltipSugestionToggle, + Messages.TooltipSuggestionToggle, string.Format(Messages.TooltipRemoveItem, baseOptions.RemoveItemPress), Messages.TooltipEnterPressList); } @@ -70,7 +70,7 @@ private static string DefaultToolTipList(ListOptions baseOptions, bool isInAutoC return string.Format("{0}, {1}, {2}, {3}, {4}\n{5}, {6}", string.Format(Messages.TooltipToggle, baseOptions.Config.TooltipKeyPress), string.Format(Messages.TooltipCancelEsc, baseOptions.Config.AbortKeyPress), - Messages.TooltipSugestionToggle, + Messages.TooltipSuggestionToggle, string.Format(Messages.TooltipEditItem, baseOptions.EditItemPress), string.Format(Messages.TooltipRemoveItem, baseOptions.RemoveItemPress), Messages.TooltipPages, @@ -81,7 +81,7 @@ private static string DefaultToolTipList(ListOptions baseOptions, bool isInAutoC return string.Format("{0}, {1}, {2},\n{3}, {4}", string.Format(Messages.TooltipToggle, baseOptions.Config.TooltipKeyPress), string.Format(Messages.TooltipCancelEsc, baseOptions.Config.AbortKeyPress), - Messages.TooltipSugestionToggle, + Messages.TooltipSuggestionToggle, Messages.TooltipPages, Messages.TooltipEnterPressList); } @@ -92,7 +92,7 @@ private static string DefaultToolTipList(ListOptions baseOptions, bool isInAutoC { return string.Format("{0}, {1}, {2}, {3}\n{4}, {5}", string.Format(Messages.TooltipToggle, baseOptions.Config.TooltipKeyPress), - Messages.TooltipSugestionToggle, + Messages.TooltipSuggestionToggle, string.Format(Messages.TooltipEditItem, baseOptions.EditItemPress), string.Format(Messages.TooltipRemoveItem, baseOptions.RemoveItemPress), Messages.TooltipPages, @@ -102,7 +102,7 @@ private static string DefaultToolTipList(ListOptions baseOptions, bool isInAutoC { return string.Format("{0}, {1}\n{2}, {3}", string.Format(Messages.TooltipToggle, baseOptions.Config.TooltipKeyPress), - Messages.TooltipSugestionToggle, + Messages.TooltipSuggestionToggle, Messages.TooltipPages, Messages.TooltipEnterPressList); } diff --git a/Src/Controls/AddtoList/ScreenBufferMaskEditList.cs b/Src/Controls/AddtoList/ScreenBufferMaskEditList.cs index d28c693c..7bebbc38 100644 --- a/Src/Controls/AddtoList/ScreenBufferMaskEditList.cs +++ b/Src/Controls/AddtoList/ScreenBufferMaskEditList.cs @@ -92,8 +92,8 @@ private static string DefaultToolTipMaskEditList(MaskEditListOptions baseOptions { return string.Format("{0}, {1}\n{2}, {3}", string.Format(Messages.TooltipToggle, baseOptions.Config.TooltipKeyPress), - Messages.TooltipSugestionEsc, - Messages.TooltipSugestionToggle, + Messages.TooltipSuggestionEsc, + Messages.TooltipSuggestionToggle, Messages.TooltipEnterPressList); } else @@ -112,7 +112,7 @@ private static string DefaultToolTipMaskEditList(MaskEditListOptions baseOptions return string.Format("{0}, {1}, {2}, {3}\n{4}, {5}", string.Format(Messages.TooltipToggle, baseOptions.Config.TooltipKeyPress), Messages.TooltipAbortEdit, - Messages.TooltipSugestionToggle, + Messages.TooltipSuggestionToggle, string.Format(Messages.TooltipRemoveItem, baseOptions.RemoveItemPress), Messages.TooltipEnterPressList, string.Format(Messages.MaskEditJump, aux)); @@ -131,7 +131,7 @@ private static string DefaultToolTipMaskEditList(MaskEditListOptions baseOptions return string.Format("{0}, {1}, {2}, {3}\n{4}, {5}", string.Format(Messages.TooltipToggle, baseOptions.Config.TooltipKeyPress), Messages.TooltipAbortEdit, - Messages.TooltipSugestionToggle, + Messages.TooltipSuggestionToggle, string.Format(Messages.TooltipRemoveItem, baseOptions.RemoveItemPress), Messages.TooltipEnterPressList, string.Format(Messages.MaskEditJump, aux)); @@ -141,7 +141,7 @@ private static string DefaultToolTipMaskEditList(MaskEditListOptions baseOptions return string.Format("{0}, {1}, {2}\n{3}, {4}", string.Format(Messages.TooltipToggle, baseOptions.Config.TooltipKeyPress), Messages.TooltipAbortEdit, - Messages.TooltipSugestionToggle, + Messages.TooltipSuggestionToggle, string.Format(Messages.TooltipRemoveItem, baseOptions.RemoveItemPress), Messages.TooltipEnterPressList); } @@ -162,7 +162,7 @@ private static string DefaultToolTipMaskEditList(MaskEditListOptions baseOptions return string.Format("{0}, {1}, {2}, {3}, {4}\n{5}, {6}, {7}", string.Format(Messages.TooltipToggle, baseOptions.Config.TooltipKeyPress), string.Format(Messages.TooltipCancelEsc, baseOptions.Config.AbortKeyPress), - Messages.TooltipSugestionToggle, + Messages.TooltipSuggestionToggle, string.Format(Messages.TooltipEditItem, baseOptions.EditItemPress), string.Format(Messages.TooltipRemoveItem, baseOptions.RemoveItemPress), Messages.TooltipPages, @@ -183,7 +183,7 @@ private static string DefaultToolTipMaskEditList(MaskEditListOptions baseOptions return string.Format("{0}, {1}, {2}, {3}, {4}\n{5}, {6}, {7}", string.Format(Messages.TooltipToggle, baseOptions.Config.TooltipKeyPress), string.Format(Messages.TooltipCancelEsc, baseOptions.Config.AbortKeyPress), - Messages.TooltipSugestionToggle, + Messages.TooltipSuggestionToggle, string.Format(Messages.TooltipEditItem, baseOptions.EditItemPress), string.Format(Messages.TooltipRemoveItem, baseOptions.RemoveItemPress), Messages.TooltipPages, @@ -202,7 +202,7 @@ private static string DefaultToolTipMaskEditList(MaskEditListOptions baseOptions return string.Format("{0}, {1}, {2}, {3}, {4}\n{5}, {6}, {7}", string.Format(Messages.TooltipToggle, baseOptions.Config.TooltipKeyPress), string.Format(Messages.TooltipCancelEsc, baseOptions.Config.AbortKeyPress), - Messages.TooltipSugestionToggle, + Messages.TooltipSuggestionToggle, string.Format(Messages.TooltipEditItem, baseOptions.EditItemPress), string.Format(Messages.TooltipRemoveItem, baseOptions.RemoveItemPress), Messages.TooltipPages, @@ -223,7 +223,7 @@ private static string DefaultToolTipMaskEditList(MaskEditListOptions baseOptions return string.Format("{0}, {1}, {2}, {3}, {4}\n{5}, {6}, {7}", string.Format(Messages.TooltipToggle, baseOptions.Config.TooltipKeyPress), string.Format(Messages.TooltipCancelEsc, baseOptions.Config.AbortKeyPress), - Messages.TooltipSugestionToggle, + Messages.TooltipSuggestionToggle, string.Format(Messages.TooltipEditItem, baseOptions.EditItemPress), string.Format(Messages.TooltipRemoveItem, baseOptions.RemoveItemPress), Messages.TooltipPages, @@ -235,7 +235,7 @@ private static string DefaultToolTipMaskEditList(MaskEditListOptions baseOptions return string.Format("{0}, {1}, {2}, {3}, {4}\n{5}, {6}", string.Format(Messages.TooltipToggle, baseOptions.Config.TooltipKeyPress), string.Format(Messages.TooltipCancelEsc, baseOptions.Config.AbortKeyPress), - Messages.TooltipSugestionToggle, + Messages.TooltipSuggestionToggle, string.Format(Messages.TooltipEditItem, baseOptions.EditItemPress), string.Format(Messages.TooltipRemoveItem, baseOptions.RemoveItemPress), Messages.TooltipPages, @@ -255,7 +255,7 @@ private static string DefaultToolTipMaskEditList(MaskEditListOptions baseOptions return string.Format("{0}, {1}, {2},\n{3}, {4}, {5}", string.Format(Messages.TooltipToggle, baseOptions.Config.TooltipKeyPress), string.Format(Messages.TooltipCancelEsc, baseOptions.Config.AbortKeyPress), - Messages.TooltipSugestionToggle, + Messages.TooltipSuggestionToggle, Messages.TooltipPages, string.Format(Messages.MaskEditJump, aux), Messages.TooltipEnterPressList); @@ -274,7 +274,7 @@ private static string DefaultToolTipMaskEditList(MaskEditListOptions baseOptions return string.Format("{0}, {1}, {2},\n{3}, {4}, {5}", string.Format(Messages.TooltipToggle, baseOptions.Config.TooltipKeyPress), string.Format(Messages.TooltipCancelEsc, baseOptions.Config.AbortKeyPress), - Messages.TooltipSugestionToggle, + Messages.TooltipSuggestionToggle, Messages.TooltipPages, string.Format(Messages.MaskEditJump, aux), Messages.TooltipEnterPressList); @@ -284,7 +284,7 @@ private static string DefaultToolTipMaskEditList(MaskEditListOptions baseOptions return string.Format("{0}, {1}, {2},\n{3}, {4}", string.Format(Messages.TooltipToggle, baseOptions.Config.TooltipKeyPress), string.Format(Messages.TooltipCancelEsc, baseOptions.Config.AbortKeyPress), - Messages.TooltipSugestionToggle, + Messages.TooltipSuggestionToggle, Messages.TooltipPages, Messages.TooltipEnterPressList); } @@ -303,7 +303,7 @@ private static string DefaultToolTipMaskEditList(MaskEditListOptions baseOptions } return string.Format("{0}, {1}, {2}, {3}\n{4}, {5}, {6}", string.Format(Messages.TooltipToggle, baseOptions.Config.TooltipKeyPress), - Messages.TooltipSugestionToggle, + Messages.TooltipSuggestionToggle, string.Format(Messages.TooltipEditItem, baseOptions.EditItemPress), string.Format(Messages.TooltipRemoveItem, baseOptions.RemoveItemPress), Messages.TooltipPages, @@ -323,7 +323,7 @@ private static string DefaultToolTipMaskEditList(MaskEditListOptions baseOptions } return string.Format("{0}, {1}, {2}, {3}\n{4}, {5}, {6}", string.Format(Messages.TooltipToggle, baseOptions.Config.TooltipKeyPress), - Messages.TooltipSugestionToggle, + Messages.TooltipSuggestionToggle, string.Format(Messages.TooltipEditItem, baseOptions.EditItemPress), string.Format(Messages.TooltipRemoveItem, baseOptions.RemoveItemPress), Messages.TooltipPages, @@ -334,7 +334,7 @@ private static string DefaultToolTipMaskEditList(MaskEditListOptions baseOptions { return string.Format("{0}, {1}, {2}, {3}\n{4}, {5}", string.Format(Messages.TooltipToggle, baseOptions.Config.TooltipKeyPress), - Messages.TooltipSugestionToggle, + Messages.TooltipSuggestionToggle, string.Format(Messages.TooltipEditItem, baseOptions.EditItemPress), string.Format(Messages.TooltipRemoveItem, baseOptions.RemoveItemPress), Messages.TooltipPages, @@ -352,7 +352,7 @@ private static string DefaultToolTipMaskEditList(MaskEditListOptions baseOptions } return string.Format("{0}, {1}\n{2}, {3}, {4}", string.Format(Messages.TooltipToggle, baseOptions.Config.TooltipKeyPress), - Messages.TooltipSugestionToggle, + Messages.TooltipSuggestionToggle, Messages.TooltipPages, string.Format(Messages.MaskEditJump, aux), Messages.TooltipEnterPressList); @@ -370,7 +370,7 @@ private static string DefaultToolTipMaskEditList(MaskEditListOptions baseOptions } return string.Format("{0}, {1}\n{2}, {3}, {4}", string.Format(Messages.TooltipToggle, baseOptions.Config.TooltipKeyPress), - Messages.TooltipSugestionToggle, + Messages.TooltipSuggestionToggle, Messages.TooltipPages, string.Format(Messages.MaskEditJump, aux), Messages.TooltipEnterPressList); @@ -379,7 +379,7 @@ private static string DefaultToolTipMaskEditList(MaskEditListOptions baseOptions { return string.Format("{0}, {1}\n{2}, {3}", string.Format(Messages.TooltipToggle, baseOptions.Config.TooltipKeyPress), - Messages.TooltipSugestionToggle, + Messages.TooltipSuggestionToggle, Messages.TooltipPages, Messages.TooltipEnterPressList); } diff --git a/Src/Controls/Banner/BannerControl.cs b/Src/Controls/Banner/BannerControl.cs index c835065d..8d493c66 100644 --- a/Src/Controls/Banner/BannerControl.cs +++ b/Src/Controls/Banner/BannerControl.cs @@ -1,14 +1,11 @@ // *************************************************************************************** // MIT LICENCE // The maintenance and evolution is maintained by the PromptPlus project under MIT license -// This code was based on work from https://github.com/WenceyWang/FIGlet.Net // *************************************************************************************** -using PPlus.FIGlet; -using System; +using PPlus.FIGletCore; using System.IO; using System.Linq; -using System.Text; namespace PPlus.Controls { @@ -28,87 +25,12 @@ public BannerControl(ConfigControls config, IConsoleControl console, string valu Text = value; _console = console; _config = config; + Font = new FigletFont(); } public string Text { get; private set; } - public FIGletFont Font { get; private set; } = FIGletFont.Default; - public CharacterWidth CharacterWidth { get; private set; } = CharacterWidth.Fitted; - private string[] _result; - private int Height => Font?.Height ?? 0; - - [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0056:Use index operator", Justification = "")] - [System.Diagnostics.CodeAnalysis.SuppressMessage("Performance", "CA1846:Prefer 'AsSpan' over 'Substring'", Justification = "")] - public void InitAsciiArt() - { - if (string.IsNullOrEmpty(Text)) - { - return; - } - Text = Text.Replace(Environment.NewLine, ""); - - _result = new string[Font.Height]; - - switch (CharacterWidth) - { - case CharacterWidth.Full: - { - for (var currentLine = 0; currentLine < Height; currentLine++) - { - var lineBuilder = new StringBuilder(); - foreach (var currentChar in Text) - { - lineBuilder.Append(Font.GetCharacter(currentChar, currentLine)); - lineBuilder.Append(' '); - } - _result[currentLine] = lineBuilder.ToString(); - } - break; - } - case CharacterWidth.Fitted: - { - for (var currentLine = 0; currentLine < Height; currentLine++) - { - var lineBuilder = new StringBuilder(); - foreach (var currentChar in Text) - { - lineBuilder.Append(Font.GetCharacter(currentChar, currentLine)); - } - _result[currentLine] = lineBuilder.ToString(); - } - break; - } - case CharacterWidth.Smush: - { - for (var currentLine = 0; currentLine < Height; currentLine++) - { - var lineBuilder = new StringBuilder(); - lineBuilder.Append(Font.GetCharacter(Text[0], currentLine)); - var lastChar = Text[0]; - for (var currentCharIndex = 1; currentCharIndex < Text.Length; currentCharIndex++) - { - var currentChar = Text[currentCharIndex]; - var currentCharacterLine = Font.GetCharacter(currentChar, currentLine); - if (lastChar != ' ' && currentChar != ' ') - { - if (lineBuilder[lineBuilder.Length - 1] == ' ') - { - lineBuilder[lineBuilder.Length - 1] = currentCharacterLine[0]; - } - lineBuilder.Append(currentCharacterLine.Substring(1)); - } - else - { - lineBuilder.Append(currentCharacterLine); - } - lastChar = currentChar; - } - _result[currentLine] = lineBuilder.ToString(); - } - break; - } - } - } + public FigletFont Font { get; private set; } public IBannerControl LoadFont(Stream value) { @@ -116,26 +38,20 @@ public IBannerControl LoadFont(Stream value) { throw new PromptPlusException("BannerControl.LoadFont is null"); } - Font = new FIGletFont(value); + Font = new FigletFont(value); return this; } public IBannerControl LoadFont(string value) { - FIGletFont result; - using (var fso = File.Open(value, FileMode.Open)) + if (value == null) { - result = new FIGletFont(fso); + throw new PromptPlusException("BannerControl.LoadFont is null"); } - Font = result; + Font = new FigletFont(value); return this; } - public IBannerControl FIGletWidth(CharacterWidth value) - { - CharacterWidth = value; - return this; - } public void Run(Color? color = null, BannerDashOptions bannerDash = BannerDashOptions.None) { @@ -144,9 +60,9 @@ public void Run(Color? color = null, BannerDashOptions bannerDash = BannerDashOp { localcorlor = color.Value; } - InitAsciiArt(); + var result = Font.ToAsciiArt(Text); var max = 0; - foreach (var item in _result.Where(x => max < x.Length)) + foreach (var item in result.Where(x => max < x.Length)) { max = item.Length; } @@ -195,7 +111,7 @@ public void Run(Color? color = null, BannerDashOptions bannerDash = BannerDashOp _console.WriteLine(new string(dach.Value, max), Style.Default.Foreground(localcorlor).Overflow(Overflow.Crop)); } } - foreach (var item in _result) + foreach (var item in result) { _console.WriteLine(item, Style.Default.Foreground(localcorlor).Overflow(Overflow.Crop)); } diff --git a/Src/Controls/Banner/CharacterWidth.cs b/Src/Controls/Banner/CharacterWidth.cs deleted file mode 100644 index eef65545..00000000 --- a/Src/Controls/Banner/CharacterWidth.cs +++ /dev/null @@ -1,27 +0,0 @@ -// *************************************************************************************** -// MIT LICENCE -// The maintenance and evolution is maintained by the PromptPlus project under MIT license -// *************************************************************************************** - -namespace PPlus.Controls -{ - /// - /// Represents a Width Ascii banner. - /// - public enum CharacterWidth - { - /// - /// Smush Width - /// - Smush, - /// - /// Fitted Width - /// - Fitted, - /// - /// Full Width - /// - Full - } - -} diff --git a/Src/Controls/Banner/FIGlet/FigletFont.cs b/Src/Controls/Banner/FIGlet/FigletFont.cs deleted file mode 100644 index 323e9550..00000000 --- a/Src/Controls/Banner/FIGlet/FigletFont.cs +++ /dev/null @@ -1,154 +0,0 @@ -// *************************************************************************************** -// MIT LICENCE -// The maintenance and evolution is maintained by the PromptPlus project under MIT license -// This code was based on work from https://github.com/WenceyWang/FIGlet.Net -// *************************************************************************************** - -using System; -using System.IO; -using System.Linq; -using System.Reflection; -using System.Text; - - -namespace PPlus.FIGlet -{ - - internal class FIGletFont - { - public string Signature { get; } - - public char HardBlank { get; } - - public int Height { get; } - - public int BaseLine { get; } - - public int MaxLength { get; } - - public int OldType { get; } - - public int CommentLines { get; } - - public int PrintDirection { get; } - - public int FullType { get; } - - public int CodeTagCount { get; } - - public string[][] Lines { get; } - - public string Commit { get; } - - public static FIGletFont Default - { - get - { - lock (s_lockFont) - { - FIGletFont defaultFont = null; - s_lockFont?.TryGetTarget(out defaultFont); - if (defaultFont == null) - { - Stream stream = null; - try - { - stream = typeof(FIGletFont).GetTypeInfo(). - Assembly.GetManifestResourceStream("PPlus.Controls.Banner.FIGlet.Fonts.standard.flf"); - defaultFont = new FIGletFont(stream); - s_lockFont.SetTarget(defaultFont); - } - finally - { - stream?.Dispose(); - } - } - return defaultFont; - } - } - } - - public FIGletFont(Stream fontStream) - { - using var reader = new StreamReader(fontStream); - var configs = reader.ReadLine()?.Split(' '); - if (configs == null || (!configs[0].StartsWith(@"flf2a"))) - { - throw new PromptPlusException($"FIGletFont {nameof(fontStream)} missing signature"); - } - - Signature = @"flf2a"; - HardBlank = configs[0].Last(); - try - { - Height = Convert.ToInt32(TryGetMember(configs, 1)); - BaseLine = Convert.ToInt32(TryGetMember(configs, 2)); - MaxLength = Convert.ToInt32(TryGetMember(configs, 3)); - OldType = Convert.ToInt32(TryGetMember(configs, 4)); - CommentLines = Convert.ToInt32(TryGetMember(configs, 5)); - PrintDirection = Convert.ToInt32(TryGetMember(configs, 6)); - FullType = Convert.ToInt32(TryGetMember(configs, 7)); - CodeTagCount = Convert.ToInt32(TryGetMember(configs, 8)); - } - catch (IndexOutOfRangeException) - { - } - - var commentBuilder = new StringBuilder(); - for (var lineCount = 0; lineCount < CommentLines; lineCount++) - { - commentBuilder.AppendLine(reader.ReadLine()); - } - - Commit = commentBuilder.ToString(); - Lines = new string[256][]; - var currentChar = 32; - while (!reader.EndOfStream) - { - var currentLine = reader.ReadLine() ?? string.Empty; - if (int.TryParse(currentLine, out var charIndex)) - { - currentChar = charIndex; - } - Lines[currentChar] = new string[Height]; - var currentLineIndex = 0; - while (currentLineIndex < Height) - { - Lines[currentChar][currentLineIndex] = currentLine.TrimEnd('@').Replace(HardBlank, ' '); - if (currentLine.EndsWith(@"@@")) - { - break; - } - currentLine = reader.ReadLine() ?? string.Empty; - currentLineIndex++; - } - currentChar++; - } - } - - private static readonly WeakReference s_lockFont = new(null); - - private static T TryGetMember(T[] array, int index) - { - if (index < array.Length) - { - return array[index]; - } - return default; - } - - public string GetCharacter(char sourceChar, int line) - { - if (line < 0 || line >= Height) - { - throw new PromptPlusException($"FIGletFont Range invalid at line {line}"); - } - if (Lines[Convert.ToInt16(sourceChar)] == null) - { - return string.Empty; - } - return Lines[Convert.ToInt16(sourceChar)][line]; - } - } - -} diff --git a/Src/Controls/Banner/FIGlet/IFIGlet.cs b/Src/Controls/Banner/FIGlet/IFIGlet.cs deleted file mode 100644 index 91339062..00000000 --- a/Src/Controls/Banner/FIGlet/IFIGlet.cs +++ /dev/null @@ -1,35 +0,0 @@ -// *************************************************************************************** -// MIT LICENCE -// The maintenance and evolution is maintained by the PromptPlus project under MIT license -// This code was based on work from https://github.com/WenceyWang/FIGlet.Net -// *************************************************************************************** - -using PPlus.Controls; -using System.IO; - -namespace PPlus.FIGlet -{ - internal interface IFIGlet - { - /// - /// Load font for AsciiArt(FIGlet) - /// - /// Full path to file font - /// - IFIGlet LoadFont(string value); - - /// - /// Load font for AsciiArt(FIGlet) - /// - /// for font - /// - IFIGlet LoadFont(Stream value); - - /// - /// Set for AsciiArt(FIGlet) - /// - /// Enum value - /// - IFIGlet FIGletWidth(CharacterWidth value); - } -} diff --git a/Src/Controls/Banner/FIGletCore/FigletFont.cs b/Src/Controls/Banner/FIGletCore/FigletFont.cs new file mode 100644 index 00000000..3288adbe --- /dev/null +++ b/Src/Controls/Banner/FIGletCore/FigletFont.cs @@ -0,0 +1,146 @@ +// *************************************************************************************** +// MIT LICENCE +// Copyright (c) 2014 Philippe AURIOU +// https://github.com/auriou/FIGlet +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Text.RegularExpressions; + +namespace PPlus.FIGletCore +{ + internal class FigletFont + { + public string Signature { get; private set; } + public string HardBlank { get; private set; } + public int Height { get; private set; } + public int BaseLine { get; private set; } + public int MaxLenght { get; private set; } + public int OldLayout { get; private set; } + public int CommentLines { get; private set; } + public int PrintDirection { get; private set; } + public int FullLayout { get; private set; } + public int CodeTagCount { get; private set; } + public List Lines { get; private set; } + + public FigletFont(string flfFontFile) + { + LoadFont(flfFontFile); + } + + public FigletFont(Stream flfFontstream) + { + LoadFont(flfFontstream); + } + + public FigletFont() + { + using Stream stream = typeof(FigletFont).GetTypeInfo().Assembly.GetManifestResourceStream("PPlus.Controls.Banner.FIGletCore.standard.flf")!; + LoadLines(ReadStreamFont(stream)); + } + + public string[] ToAsciiArt(string strText) + { + var res = new List(); + for (int i = 1; i <= Height; i++) + { + var resline = new StringBuilder(); + foreach (var car in strText) + { + resline.Append(GetCharacter(car, i)); + } + res.Add(resline.ToString()); + } + return res.ToArray(); + } + + private string GetCharacter(char car, int line) + { + var start = CommentLines + ((Convert.ToInt32(car) - 32) * Height); + var temp = Lines[start + line]; + var lineending = temp[^1]; + var rx = new Regex(@"\" + lineending + "{1,2}$"); + temp = rx.Replace(temp, ""); + return temp.Replace(HardBlank, " "); + } + + private void LoadLines(List fontLines) + { + Lines = fontLines; + var configString = Lines.First(); + var configArray = configString.Split(' '); + Signature = configArray.First().Remove(configArray.First().Length - 1); + if (Signature != "flf2a") + { + throw new PromptPlusException($"FIGletFont missing signature"); + } + HardBlank = configArray.First().Last().ToString(); + Height = GetIntValue(configArray, 1); + BaseLine = GetIntValue(configArray, 2); + MaxLenght = GetIntValue(configArray, 3); + OldLayout = GetIntValue(configArray, 4); + CommentLines = GetIntValue(configArray, 5); + PrintDirection = GetIntValue(configArray, 6); + FullLayout = GetIntValue(configArray, 7); + CodeTagCount = GetIntValue(configArray, 8); + } + + private void LoadFont(string flfFontFile) + { + try + { + using var fso = File.Open(flfFontFile, FileMode.Open); + LoadLines(ReadStreamFont(fso)); + } + catch (Exception ex) + { + throw new PromptPlusException($"FIGletFont Error load {flfFontFile}",ex); + } + } + + private void LoadFont(Stream fontStream) + { + try + { + LoadLines(ReadStreamFont(fontStream)); + } + catch (Exception ex) + { + throw new PromptPlusException($"FIGletFont Error load from stream", ex); + } + } + + private static int GetIntValue(string[] arrayStrings, int posi) + { + if (arrayStrings.Length <= posi) + { + return 0; + } + if (int.TryParse(arrayStrings[posi], out var val)) + { + return val; + } + return 0; + } + + private static List ReadStreamFont(Stream fontStream) + { + var _fontData = new List(); + using (var reader = new StreamReader(fontStream)) + { + while (!reader.EndOfStream) + { + _fontData.Add(reader.ReadLine()); + } + } + return _fontData; + } + } +} + diff --git a/Src/Controls/Banner/FIGlet/Fonts/standard.flf b/Src/Controls/Banner/FIGletCore/standard.flf similarity index 100% rename from Src/Controls/Banner/FIGlet/Fonts/standard.flf rename to Src/Controls/Banner/FIGletCore/standard.flf diff --git a/Src/Controls/Banner/IBanner.cs b/Src/Controls/Banner/IBanner.cs index 6bd6d2dd..cd8e2aba 100644 --- a/Src/Controls/Banner/IBanner.cs +++ b/Src/Controls/Banner/IBanner.cs @@ -26,13 +26,6 @@ public interface IBannerControl /// IBannerControl LoadFont(Stream value); - /// - /// Set for the banner - /// - /// CharacterWidth - /// - IBannerControl FIGletWidth(CharacterWidth value); - /// /// Execute this control and show banner. /// diff --git a/Src/Controls/BaseOptions.cs b/Src/Controls/BaseOptions.cs index 8feb07fb..2f95a821 100644 --- a/Src/Controls/BaseOptions.cs +++ b/Src/Controls/BaseOptions.cs @@ -33,6 +33,8 @@ internal BaseOptions(StyleSchema styleSchema, ConfigControls config, IConsoleCon OptHideAfterFinish = config.HideAfterFinish; OptHideOnAbort = config.HideOnAbort; OptEnabledAbortKey = config.EnabledAbortKey; + OptDisableChangeTooltip = config.DisableToggleTooltip; + OptShowOnlyExistingPagination = config.ShowOnlyExistingPagination; } internal StyleSchema OptStyleSchema { get; } @@ -41,6 +43,8 @@ internal BaseOptions(StyleSchema styleSchema, ConfigControls config, IConsoleCon internal string OptPrompt { get; set; } = string.Empty; internal string OptDescription { get; set; } = string.Empty; internal bool OptShowTooltip { get; set; } + internal bool OptDisableChangeTooltip { get; set; } + internal bool OptShowOnlyExistingPagination { get; set; } internal Dictionary> OptUserActions { get; private set; } = new(); internal string OptToolTip { get; private set; } = string.Empty; @@ -65,6 +69,20 @@ public IPromptConfig ShowTooltip(bool value) return this; } + /// + public IPromptConfig ShowOnlyExistingPagination(bool value) + { + OptShowOnlyExistingPagination = value; + return this; + } + + /// + public IPromptConfig DisableToggleTooltip(bool value) + { + OptDisableChangeTooltip = value; + return this; + } + /// public IPromptConfig HideAfterFinish(bool value) { diff --git a/Src/Controls/Calendar/CalendarControl.cs b/Src/Controls/Calendar/CalendarControl.cs index 7b7f279b..bdd9e101 100644 --- a/Src/Controls/Calendar/CalendarControl.cs +++ b/Src/Controls/Calendar/CalendarControl.cs @@ -900,7 +900,7 @@ private void WriteTooltip(ScreenBuffer screenBuffer) screenBuffer.AddBuffer(string.Format("{0}, {1}, {2}\n{3} {4}", string.Format(Messages.TooltipToggle, _options.Config.TooltipKeyPress), string.Format(Messages.TooltipCancelEsc, _options.Config.AbortKeyPress), - Messages.SelectFisnishEnter, + Messages.SelectFinishEnter, Messages.TooltipPagesNotes, string.Format(Messages.TooltipToggleNotes,_options.SwitchNotes)), _options.OptStyleSchema.Tooltips()); } @@ -908,7 +908,7 @@ private void WriteTooltip(ScreenBuffer screenBuffer) { screenBuffer.AddBuffer(string.Format("{0}, {1}\n{2}, {3}", string.Format(Messages.TooltipToggle, _options.Config.TooltipKeyPress), - Messages.SelectFisnishEnter, + Messages.SelectFinishEnter, Messages.TooltipPagesNotes, string.Format(Messages.TooltipToggleNotes, _options.SwitchNotes)), _options.OptStyleSchema.Tooltips()); } @@ -928,7 +928,7 @@ private void WriteTooltip(ScreenBuffer screenBuffer) screenBuffer.AddBuffer(string.Format("{0}, {1}, {2}, {3}\n{4}", string.Format(Messages.TooltipToggle, _options.Config.TooltipKeyPress), string.Format(Messages.TooltipCancelEsc, _options.Config.AbortKeyPress), - Messages.SelectFisnishEnter, + Messages.SelectFinishEnter, string.Format(Messages.TooltipToggleNotes, _options.SwitchNotes), $"{linedays}, {lineweek}"), _options.OptStyleSchema.Tooltips()); } @@ -937,7 +937,7 @@ private void WriteTooltip(ScreenBuffer screenBuffer) screenBuffer.AddBuffer(string.Format("{0}, {1}\n{2}, {3}", string.Format(Messages.TooltipToggle, _options.Config.TooltipKeyPress), string.Format(Messages.TooltipCancelEsc, _options.Config.AbortKeyPress), - Messages.SelectFisnishEnter, + Messages.SelectFinishEnter, string.Format(Messages.TooltipToggleNotes, _options.SwitchNotes)), _options.OptStyleSchema.Tooltips()); } } @@ -947,7 +947,7 @@ private void WriteTooltip(ScreenBuffer screenBuffer) { screenBuffer.AddBuffer(string.Format("{0}, {1}, {2}\n{3}", string.Format(Messages.TooltipToggle, _options.Config.TooltipKeyPress), - Messages.SelectFisnishEnter, + Messages.SelectFinishEnter, string.Format(Messages.TooltipToggleNotes, _options.SwitchNotes), $"{linedays}, {lineweek}"), _options.OptStyleSchema.Tooltips()); } @@ -955,7 +955,7 @@ private void WriteTooltip(ScreenBuffer screenBuffer) { screenBuffer.AddBuffer(string.Format("{0}, {1}, {2}", string.Format(Messages.TooltipToggle, _options.Config.TooltipKeyPress), - Messages.SelectFisnishEnter, + Messages.SelectFinishEnter, string.Format(Messages.TooltipToggleNotes, _options.SwitchNotes)), _options.OptStyleSchema.Tooltips()); } } @@ -1579,7 +1579,7 @@ private void WriteNotes(ScreenBuffer screenBuffer) screenBuffer.WriteLineNotSelector(_options, item); } } - if (_localpaginator.PageCount > 1) + if (!_options.OptShowOnlyExistingPagination || _localpaginator.PageCount > 1) { screenBuffer.WriteLinePagination(_options, _localpaginator.PaginationMessage()); } diff --git a/Src/Controls/Calendar/IControlCalendar.cs b/Src/Controls/Calendar/IControlCalendar.cs index 9108e5f9..c60564c1 100644 --- a/Src/Controls/Calendar/IControlCalendar.cs +++ b/Src/Controls/Calendar/IControlCalendar.cs @@ -60,7 +60,7 @@ public interface IControlCalendar : IPromptControls /// /// /// - /// Policy to next/previous valid date if seleted date is invalid + /// Policy to next/previous valid date if selected date is invalid /// /// IControlCalendar Default(DateTime value, PolicyInvalidDate policy = PolicyInvalidDate.NextDate); @@ -114,7 +114,7 @@ public interface IControlCalendar : IPromptControls /// /// Add a validator to accept sucessfull finish of control. - ///
Tip: see to validators embeding
+ ///
Tip: see to validators embedding
///
/// the function validator. /// diff --git a/Src/Controls/Chart/ChartBarControl.cs b/Src/Controls/Chart/ChartBarControl.cs index 3c7a7b43..3e4e8735 100644 --- a/Src/Controls/Chart/ChartBarControl.cs +++ b/Src/Controls/Chart/ChartBarControl.cs @@ -277,7 +277,7 @@ public override void InputTemplate(ScreenBuffer screenBuffer) if (!_options.HideInfoOrder) { screenBuffer.AddBuffer(' ', Style.Default, true); - screenBuffer.AddBuffer(string.Format(Messages.TooltipOrder, TextOrder(_options.CurrentOrder)), _options.OrderStyle); + screenBuffer.AddBuffer(string.Format(Messages.TooltipOrder, ChartBarControl.TextOrder(_options.CurrentOrder)), _options.OrderStyle); } } @@ -434,7 +434,7 @@ public override ResultPrompt TryResult(CancellationToken cancellationToken return new ResultPrompt(true,abort,!endinput,notrender); } - private string TextOrder(ChartOrder value) + private static string TextOrder(ChartOrder value) { return value switch { @@ -477,7 +477,7 @@ private void ShowInitialChart(ScreenBuffer screenBuffer) { screenBuffer.AddBuffer(new string(' ', _options.PadLeft), Style.Default, true); } - screenBuffer.AddBuffer(string.Format(Messages.TooltipOrder, TextOrder(_options.CurrentOrder)), _options.OrderStyle); + screenBuffer.AddBuffer(string.Format(Messages.TooltipOrder, ChartBarControl.TextOrder(_options.CurrentOrder)), _options.OrderStyle); screenBuffer.NewLine(); } } @@ -585,7 +585,7 @@ private void WriteStandBar(ScreenBuffer screenBuffer,ChartBarType barType,int in inipos = 0; } } - var maxlenghtlabel = _options.Labels.Max(x => x.Label.Length); + var maxlengthlabel = _options.Labels.Max(x => x.Label.Length); char charbarOn = ' '; switch (barType) { @@ -650,7 +650,7 @@ private void WriteStandBar(ScreenBuffer screenBuffer,ChartBarType barType,int in } else { - screenBuffer.AddBuffer(item.Label.PadRight(maxlenghtlabel) , _options.LabelStyle); + screenBuffer.AddBuffer(item.Label.PadRight(maxlengthlabel) , _options.LabelStyle); screenBuffer.AddBuffer(": ",Style.Default, false, false); screenBuffer.AddBuffer(new string(charbarOn, tkt), OnStyle, false, true); } @@ -765,7 +765,7 @@ private void WriteLegends(ScreenBuffer screenBuffer,int inipos) } } - var maxlenghtlabel = _options.Labels.Max(x => x.Label.Length); + var maxlengthlabel = _options.Labels.Max(x => x.Label.Length); foreach (var item in _options.Labels.Skip(inipos).Take(pagesize)) { @@ -775,7 +775,7 @@ private void WriteLegends(ScreenBuffer screenBuffer,int inipos) screenBuffer.AddBuffer(new string(' ', _options.PadLeft),Style.Default, false, false); } screenBuffer.AddBuffer("â–  ", Style.Default.Foreground(item.ColorBar.Value), false, false); - screenBuffer.AddBuffer($"{item.Label.PadRight(maxlenghtlabel)}", _options.LabelStyle); + screenBuffer.AddBuffer($"{item.Label.PadRight(maxlengthlabel)}", _options.LabelStyle); if (_options.ShowLegendValue || _options.ShowLegendPercent) { screenBuffer.AddBuffer(": ", Style.Default, false, false); @@ -814,26 +814,15 @@ private void WriteLegends(ScreenBuffer screenBuffer,int inipos) private void ChangeOrder() { //order items - switch (_options.CurrentOrder) + _options.Labels = _options.CurrentOrder switch { - case ChartOrder.None: - _options.Labels = _options.Labels.OrderBy(x => x.Id).ToList(); - break; - case ChartOrder.Highest: - _options.Labels = _options.Labels.OrderByDescending(x => x.Value).ToList(); - break; - case ChartOrder.Smallest: - _options.Labels = _options.Labels.OrderBy(x => x.Value).ToList(); - break; - case ChartOrder.LabelAsc: - _options.Labels = _options.Labels.OrderBy(x => x.Label).ToList(); - break; - case ChartOrder.LabelDec: - _options.Labels = _options.Labels.OrderByDescending(x => x.Label).ToList(); - break; - default: - throw new PromptPlusException($"ChartOrder {_options.Order} Not implemented"); - } + ChartOrder.None => _options.Labels.OrderBy(x => x.Id).ToList(), + ChartOrder.Highest => _options.Labels.OrderByDescending(x => x.Value).ToList(), + ChartOrder.Smallest => _options.Labels.OrderBy(x => x.Value).ToList(), + ChartOrder.LabelAsc => _options.Labels.OrderBy(x => x.Label).ToList(), + ChartOrder.LabelDec => _options.Labels.OrderByDescending(x => x.Label).ToList(), + _ => throw new PromptPlusException($"ChartOrder {_options.Order} Not implemented"), + }; var auxpaginginfo = new List<(int id, int page)>(); var page = 0; var index = 0; @@ -870,7 +859,7 @@ private void WritePageInfo(ScreenBuffer screenBuffer) screenBuffer.AddBuffer(string.Format("{0}, {1}, {2}\n{3}, {4}, {5}", string.Format(Messages.TooltipToggle, _options.Config.TooltipKeyPress), string.Format(Messages.TooltipCancelEsc, _options.Config.AbortKeyPress), - Messages.InputFisnishEnter, + Messages.InputFinishEnter, string.Format(Messages.TooltipChartSwitchType, _options.SwitchType), string.Format(Messages.TooltipChartSwitchLegend, _options.SwitchLegend), string.Format(Messages.TooltipChartSwitchOrder,_options.SwitchOrder)), _options.OptStyleSchema.Tooltips()); @@ -880,7 +869,7 @@ private void WritePageInfo(ScreenBuffer screenBuffer) screenBuffer.AddBuffer(string.Format("{0}, {1}, {2}\n{3}, {4}", string.Format(Messages.TooltipToggle, _options.Config.TooltipKeyPress), string.Format(Messages.TooltipCancelEsc, _options.Config.AbortKeyPress), - Messages.InputFisnishEnter, + Messages.InputFinishEnter, string.Format(Messages.TooltipChartSwitchType, _options.SwitchType), string.Format(Messages.TooltipChartSwitchLegend, _options.SwitchLegend)), _options.OptStyleSchema.Tooltips()); } @@ -892,7 +881,7 @@ private void WritePageInfo(ScreenBuffer screenBuffer) screenBuffer.AddBuffer(string.Format("{0}, {1}, {2}, {3}\n{4}, {5}, {6}", string.Format(Messages.TooltipToggle, _options.Config.TooltipKeyPress), string.Format(Messages.TooltipCancelEsc, _options.Config.AbortKeyPress), - Messages.InputFisnishEnter, + Messages.InputFinishEnter, defaultcharttip, string.Format(Messages.TooltipChartSwitchType, _options.SwitchType), string.Format(Messages.TooltipChartSwitchLegend, _options.SwitchLegend), @@ -903,7 +892,7 @@ private void WritePageInfo(ScreenBuffer screenBuffer) screenBuffer.AddBuffer(string.Format("{0}, {1}, {2}, {3}\n{4}, {5}", string.Format(Messages.TooltipToggle, _options.Config.TooltipKeyPress), string.Format(Messages.TooltipCancelEsc, _options.Config.AbortKeyPress), - Messages.InputFisnishEnter, + Messages.InputFinishEnter, defaultcharttip, string.Format(Messages.TooltipChartSwitchType, _options.SwitchType), string.Format(Messages.TooltipChartSwitchLegend, _options.SwitchLegend)), _options.OptStyleSchema.Tooltips()); @@ -920,7 +909,7 @@ private void WritePageInfo(ScreenBuffer screenBuffer) screenBuffer.AddBuffer(string.Format("{0}, {1}, {2}, {3}, {4}", string.Format(Messages.TooltipToggle, _options.Config.TooltipKeyPress), string.Format(Messages.TooltipCancelEsc, _options.Config.AbortKeyPress), - Messages.InputFisnishEnter, + Messages.InputFinishEnter, string.Format(Messages.TooltipChartSwitchType, _options.SwitchType), string.Format(Messages.TooltipChartSwitchOrder, _options.SwitchOrder)), _options.OptStyleSchema.Tooltips()); } @@ -929,7 +918,7 @@ private void WritePageInfo(ScreenBuffer screenBuffer) screenBuffer.AddBuffer(string.Format("{0}, {1}, {2}, {3}", string.Format(Messages.TooltipToggle, _options.Config.TooltipKeyPress), string.Format(Messages.TooltipCancelEsc, _options.Config.AbortKeyPress), - Messages.InputFisnishEnter, + Messages.InputFinishEnter, string.Format(Messages.TooltipChartSwitchType, _options.SwitchType)), _options.OptStyleSchema.Tooltips()); } } @@ -940,7 +929,7 @@ private void WritePageInfo(ScreenBuffer screenBuffer) screenBuffer.AddBuffer(string.Format("{0}, {1}, {2}\n{3}, {4}, {5}", string.Format(Messages.TooltipToggle, _options.Config.TooltipKeyPress), string.Format(Messages.TooltipCancelEsc, _options.Config.AbortKeyPress), - Messages.InputFisnishEnter, + Messages.InputFinishEnter, defaultcharttip, string.Format(Messages.TooltipChartSwitchType, _options.SwitchType), string.Format(Messages.TooltipChartSwitchOrder, _options.SwitchOrder)), _options.OptStyleSchema.Tooltips()); @@ -950,7 +939,7 @@ private void WritePageInfo(ScreenBuffer screenBuffer) screenBuffer.AddBuffer(string.Format("{0}, {1}, {2}\n{3}, {4}", string.Format(Messages.TooltipToggle, _options.Config.TooltipKeyPress), string.Format(Messages.TooltipCancelEsc, _options.Config.AbortKeyPress), - Messages.InputFisnishEnter, + Messages.InputFinishEnter, defaultcharttip, string.Format(Messages.TooltipChartSwitchType, _options.SwitchType)), _options.OptStyleSchema.Tooltips()); } @@ -965,7 +954,7 @@ private void WritePageInfo(ScreenBuffer screenBuffer) screenBuffer.AddBuffer(string.Format("{0}, {1}, {2}\n{3}, {4}", string.Format(Messages.TooltipToggle, _options.Config.TooltipKeyPress), string.Format(Messages.TooltipCancelEsc, _options.Config.AbortKeyPress), - Messages.InputFisnishEnter, + Messages.InputFinishEnter, string.Format(Messages.TooltipChartSwitchLegend, _options.SwitchLegend), string.Format(Messages.TooltipChartSwitchOrder, _options.SwitchOrder)), _options.OptStyleSchema.Tooltips()); } @@ -974,7 +963,7 @@ private void WritePageInfo(ScreenBuffer screenBuffer) screenBuffer.AddBuffer(string.Format("{0}, {1}, {2}, {3}", string.Format(Messages.TooltipToggle, _options.Config.TooltipKeyPress), string.Format(Messages.TooltipCancelEsc, _options.Config.AbortKeyPress), - Messages.InputFisnishEnter, + Messages.InputFinishEnter, string.Format(Messages.TooltipChartSwitchLegend, _options.SwitchLegend)), _options.OptStyleSchema.Tooltips()); } } @@ -985,7 +974,7 @@ private void WritePageInfo(ScreenBuffer screenBuffer) screenBuffer.AddBuffer(string.Format("{0}, {1}, {2}\n{3}, {4}, {5}", string.Format(Messages.TooltipToggle, _options.Config.TooltipKeyPress), string.Format(Messages.TooltipCancelEsc, _options.Config.AbortKeyPress), - Messages.InputFisnishEnter, + Messages.InputFinishEnter, defaultcharttip, string.Format(Messages.TooltipChartSwitchLegend, _options.SwitchLegend), string.Format(Messages.TooltipChartSwitchOrder, _options.SwitchOrder)), _options.OptStyleSchema.Tooltips()); @@ -995,7 +984,7 @@ private void WritePageInfo(ScreenBuffer screenBuffer) screenBuffer.AddBuffer(string.Format("{0}, {1}, {2}\n{3}, {4}", string.Format(Messages.TooltipToggle, _options.Config.TooltipKeyPress), string.Format(Messages.TooltipCancelEsc, _options.Config.AbortKeyPress), - Messages.InputFisnishEnter, + Messages.InputFinishEnter, defaultcharttip, string.Format(Messages.TooltipChartSwitchLegend, _options.SwitchLegend)), _options.OptStyleSchema.Tooltips()); } @@ -1010,7 +999,7 @@ private void WritePageInfo(ScreenBuffer screenBuffer) screenBuffer.AddBuffer(string.Format("{0}, {1}, {2}, {3}", string.Format(Messages.TooltipToggle, _options.Config.TooltipKeyPress), string.Format(Messages.TooltipCancelEsc, _options.Config.AbortKeyPress), - Messages.InputFisnishEnter, + Messages.InputFinishEnter, string.Format(Messages.TooltipChartSwitchOrder, _options.SwitchOrder)), _options.OptStyleSchema.Tooltips()); } else @@ -1018,7 +1007,7 @@ private void WritePageInfo(ScreenBuffer screenBuffer) screenBuffer.AddBuffer(string.Format("{0}, {1}, {2}", string.Format(Messages.TooltipToggle, _options.Config.TooltipKeyPress), string.Format(Messages.TooltipCancelEsc, _options.Config.AbortKeyPress), - Messages.InputFisnishEnter), _options.OptStyleSchema.Tooltips()); + Messages.InputFinishEnter), _options.OptStyleSchema.Tooltips()); } } else @@ -1028,7 +1017,7 @@ private void WritePageInfo(ScreenBuffer screenBuffer) screenBuffer.AddBuffer(string.Format("{0}, {1}, {2}, {3}, {4}", string.Format(Messages.TooltipToggle, _options.Config.TooltipKeyPress), string.Format(Messages.TooltipCancelEsc, _options.Config.AbortKeyPress), - Messages.InputFisnishEnter, + Messages.InputFinishEnter, defaultcharttip, string.Format(Messages.TooltipChartSwitchOrder, _options.SwitchOrder)), _options.OptStyleSchema.Tooltips()); } @@ -1037,7 +1026,7 @@ private void WritePageInfo(ScreenBuffer screenBuffer) screenBuffer.AddBuffer(string.Format("{0}, {1}, {2}, {3}", string.Format(Messages.TooltipToggle, _options.Config.TooltipKeyPress), string.Format(Messages.TooltipCancelEsc, _options.Config.AbortKeyPress), - Messages.InputFisnishEnter, + Messages.InputFinishEnter, defaultcharttip), _options.OptStyleSchema.Tooltips()); } } @@ -1053,7 +1042,7 @@ private void WritePageInfo(ScreenBuffer screenBuffer) { screenBuffer.AddBuffer(string.Format("{0}, {1}, {2}\n{3}, {4}", string.Format(Messages.TooltipToggle, _options.Config.TooltipKeyPress), - Messages.InputFisnishEnter, + Messages.InputFinishEnter, string.Format(Messages.TooltipChartSwitchType, _options.SwitchType), string.Format(Messages.TooltipChartSwitchLegend, _options.SwitchLegend), string.Format(Messages.TooltipChartSwitchOrder, _options.SwitchOrder)), _options.OptStyleSchema.Tooltips()); @@ -1062,7 +1051,7 @@ private void WritePageInfo(ScreenBuffer screenBuffer) { screenBuffer.AddBuffer(string.Format("{0}, {1}, {2}, {3}", string.Format(Messages.TooltipToggle, _options.Config.TooltipKeyPress), - Messages.InputFisnishEnter, + Messages.InputFinishEnter, string.Format(Messages.TooltipChartSwitchType, _options.SwitchType), string.Format(Messages.TooltipChartSwitchLegend, _options.SwitchLegend)), _options.OptStyleSchema.Tooltips()); } @@ -1073,7 +1062,7 @@ private void WritePageInfo(ScreenBuffer screenBuffer) { screenBuffer.AddBuffer(string.Format("{0}, {1}, {2}\n{3}, {4}, {5}", string.Format(Messages.TooltipToggle, _options.Config.TooltipKeyPress), - Messages.InputFisnishEnter, + Messages.InputFinishEnter, defaultcharttip, string.Format(Messages.TooltipChartSwitchType, _options.SwitchType), string.Format(Messages.TooltipChartSwitchLegend, _options.SwitchLegend), @@ -1083,7 +1072,7 @@ private void WritePageInfo(ScreenBuffer screenBuffer) { screenBuffer.AddBuffer(string.Format("{0}, {1}, {2}\n{3}, {4}", string.Format(Messages.TooltipToggle, _options.Config.TooltipKeyPress), - Messages.InputFisnishEnter, + Messages.InputFinishEnter, defaultcharttip, string.Format(Messages.TooltipChartSwitchType, _options.SwitchType), string.Format(Messages.TooltipChartSwitchLegend, _options.SwitchLegend)), _options.OptStyleSchema.Tooltips()); @@ -1098,7 +1087,7 @@ private void WritePageInfo(ScreenBuffer screenBuffer) { screenBuffer.AddBuffer(string.Format("{0}, {1}, {2}, {3}", string.Format(Messages.TooltipToggle, _options.Config.TooltipKeyPress), - Messages.InputFisnishEnter, + Messages.InputFinishEnter, string.Format(Messages.TooltipChartSwitchType, _options.SwitchType), string.Format(Messages.TooltipChartSwitchOrder, _options.SwitchOrder)), _options.OptStyleSchema.Tooltips()); } @@ -1106,7 +1095,7 @@ private void WritePageInfo(ScreenBuffer screenBuffer) { screenBuffer.AddBuffer(string.Format("{0}, {1}, {2}", string.Format(Messages.TooltipToggle, _options.Config.TooltipKeyPress), - Messages.InputFisnishEnter, + Messages.InputFinishEnter, string.Format(Messages.TooltipChartSwitchType, _options.SwitchType)), _options.OptStyleSchema.Tooltips()); } } @@ -1116,7 +1105,7 @@ private void WritePageInfo(ScreenBuffer screenBuffer) { screenBuffer.AddBuffer(string.Format("{0}, {1}, {2}\n{3}, {4}", string.Format(Messages.TooltipToggle, _options.Config.TooltipKeyPress), - Messages.InputFisnishEnter, + Messages.InputFinishEnter, defaultcharttip, string.Format(Messages.TooltipChartSwitchType, _options.SwitchType), string.Format(Messages.TooltipChartSwitchOrder, _options.SwitchOrder)), _options.OptStyleSchema.Tooltips()); @@ -1125,7 +1114,7 @@ private void WritePageInfo(ScreenBuffer screenBuffer) { screenBuffer.AddBuffer(string.Format("{0}, {1}, {2}, {3}", string.Format(Messages.TooltipToggle, _options.Config.TooltipKeyPress), - Messages.InputFisnishEnter, + Messages.InputFinishEnter, defaultcharttip, string.Format(Messages.TooltipChartSwitchType, _options.SwitchType)), _options.OptStyleSchema.Tooltips()); } @@ -1139,7 +1128,7 @@ private void WritePageInfo(ScreenBuffer screenBuffer) { screenBuffer.AddBuffer(string.Format("{0}, {1}, {2}, {3}", string.Format(Messages.TooltipToggle, _options.Config.TooltipKeyPress), - Messages.InputFisnishEnter, + Messages.InputFinishEnter, string.Format(Messages.TooltipChartSwitchLegend, _options.SwitchLegend), string.Format(Messages.TooltipChartSwitchOrder, _options.SwitchOrder)), _options.OptStyleSchema.Tooltips()); } @@ -1147,7 +1136,7 @@ private void WritePageInfo(ScreenBuffer screenBuffer) { screenBuffer.AddBuffer(string.Format("{0}, {1}, {2}", string.Format(Messages.TooltipToggle, _options.Config.TooltipKeyPress), - Messages.InputFisnishEnter, + Messages.InputFinishEnter, string.Format(Messages.TooltipChartSwitchLegend, _options.SwitchLegend)), _options.OptStyleSchema.Tooltips()); } } @@ -1157,7 +1146,7 @@ private void WritePageInfo(ScreenBuffer screenBuffer) { screenBuffer.AddBuffer(string.Format("{0}, {1}, {2}\n{3}, {4}", string.Format(Messages.TooltipToggle, _options.Config.TooltipKeyPress), - Messages.InputFisnishEnter, + Messages.InputFinishEnter, defaultcharttip, string.Format(Messages.TooltipChartSwitchLegend, _options.SwitchLegend), string.Format(Messages.TooltipChartSwitchOrder, _options.SwitchOrder)), _options.OptStyleSchema.Tooltips()); @@ -1166,7 +1155,7 @@ private void WritePageInfo(ScreenBuffer screenBuffer) { screenBuffer.AddBuffer(string.Format("{0}, {1}, {2}, {3}", string.Format(Messages.TooltipToggle, _options.Config.TooltipKeyPress), - Messages.InputFisnishEnter, + Messages.InputFinishEnter, defaultcharttip, string.Format(Messages.TooltipChartSwitchLegend, _options.SwitchLegend)), _options.OptStyleSchema.Tooltips()); } @@ -1178,13 +1167,13 @@ private void WritePageInfo(ScreenBuffer screenBuffer) { screenBuffer.AddBuffer(string.Format("{0}, {1}", string.Format(Messages.TooltipToggle, _options.Config.TooltipKeyPress), - Messages.InputFisnishEnter), _options.OptStyleSchema.Tooltips()); + Messages.InputFinishEnter), _options.OptStyleSchema.Tooltips()); } else { screenBuffer.AddBuffer(string.Format("{0}, {1}, {2}", string.Format(Messages.TooltipToggle, _options.Config.TooltipKeyPress), - Messages.InputFisnishEnter, + Messages.InputFinishEnter, defaultcharttip), _options.OptStyleSchema.Tooltips()); } } diff --git a/Src/Controls/ConfigControls.cs b/Src/Controls/ConfigControls.cs index 6133779c..564fec78 100644 --- a/Src/Controls/ConfigControls.cs +++ b/Src/Controls/ConfigControls.cs @@ -84,7 +84,7 @@ public CultureInfo DefaultCulture /// /// Get/Set Page Size from colletions. - ///
Default value : 10. If value less than 1 internal sette to 1.
+ ///
Default value : 10. If value less than 1 internal set to 1.
///
public int PageSize { @@ -104,7 +104,7 @@ public int PageSize /// /// Get/Set Minimum Prefix Length. - ///
Default value : 3.If value less than 0 internal sette to 0.
+ ///
Default value : 3.If value less than 0 internal set to 0.
///
public int CompletionMinimumPrefixLength { @@ -123,7 +123,7 @@ public int CompletionMinimumPrefixLength /// /// Get/Set Interval in mileseconds to wait start Completion funcion. - ///
Default value : 1000. If value less than 10 internal sette to 10.
+ ///
Default value : 1000. If value less than 10 internal set to 10.
///
public int CompletionWaitToStart { @@ -142,7 +142,7 @@ public int CompletionWaitToStart /// /// Get/Set Completion Max Items to return. - ///
Default value : 1000. If value less than 1 internal sette to 1.
+ ///
Default value : 1000. If value less than 1 internal set to 1.
///
public int CompletionMaxCount { @@ -164,13 +164,26 @@ public int CompletionMaxCount public TimeSpan HistoryTimeout { get; set; } = FileHistory.DefaultHistoryTimeout; /// - /// Get/Set enabled show Tooltip for all controls. + /// Get/Set enable show Tooltip for all controls at startup. ///
Default value : true
///
public bool ShowTooltip { get; set; } = true; /// - /// Get/Set enabled abortKey(ESC) for all controls. + /// Get/Set Disable toggle Tooltip for all controls at startup. + ///
Default value : false
+ ///
+ public bool DisableToggleTooltip { get; set; } + + + /// + /// Get/Set Show pagination only if exists + ///
Default value : false
+ ///
+ public bool ShowOnlyExistingPagination { get; set; } + + /// + /// Get/Set enable abortKey(ESC) for all controls. ///
Default value : true
///
public bool EnabledAbortKey { get; set; } = true; @@ -264,7 +277,7 @@ public char? NoChar /// Get/Set to show/hide Tooltip. ///
Default value : '[F1]'
/// - public HotKey TooltipKeyPress => HotKey.TooltipDefault; + public HotKey TooltipKeyPress { get; set; } = HotKey.TooltipDefault; /// /// Get/Set to toggle password view. diff --git a/Src/Controls/FilterMode.cs b/Src/Controls/FilterMode.cs index 11028568..a35baa9a 100644 --- a/Src/Controls/FilterMode.cs +++ b/Src/Controls/FilterMode.cs @@ -17,6 +17,10 @@ public enum FilterMode /// /// Filter with start with text /// - StartsWith + StartsWith, + /// + /// Disabled Filter feature + /// + Disabled } } diff --git a/Src/Controls/IPromptConfig.cs b/Src/Controls/IPromptConfig.cs index bc9c3859..1cfe7448 100644 --- a/Src/Controls/IPromptConfig.cs +++ b/Src/Controls/IPromptConfig.cs @@ -26,6 +26,21 @@ public interface IPromptConfig /// IPromptConfig ShowTooltip(bool value); + + /// + /// Overwrite default Show pagination only if exists + /// + /// value + /// + IPromptConfig ShowOnlyExistingPagination(bool value); + + /// + /// Overwrite default DisableToggleTooltip of control + /// + /// value + /// + IPromptConfig DisableToggleTooltip(bool value); + /// /// Overwrite default Clear render area of control after finished /// diff --git a/Src/Controls/Input/AutoCompleteControl.cs b/Src/Controls/Input/AutoCompleteControl.cs index 6a38b668..240b7d6e 100644 --- a/Src/Controls/Input/AutoCompleteControl.cs +++ b/Src/Controls/Input/AutoCompleteControl.cs @@ -71,7 +71,7 @@ public override string InitControl(CancellationToken cancellationToken) LoadDefaultHistory(); } - _inputBuffer = new(_options.InputToCase, _options.AcceptInput, _options.MaxLenght); + _inputBuffer = new(_options.InputToCase, _options.AcceptInput, _options.MaxLength); if (!string.IsNullOrEmpty(_defaultHistoric)) { @@ -223,9 +223,9 @@ public IControlAutoComplete AcceptInput(Func value) return this; } - public IControlAutoComplete MaxLenght(ushort value) + public IControlAutoComplete MaxLength(ushort value) { - _options.MaxLenght = value; + _options.MaxLength = value; return this; } diff --git a/Src/Controls/Input/AutoCompleteOptions.cs b/Src/Controls/Input/AutoCompleteOptions.cs index 43033c75..9eb8671e 100644 --- a/Src/Controls/Input/AutoCompleteOptions.cs +++ b/Src/Controls/Input/AutoCompleteOptions.cs @@ -1,4 +1,9 @@ -using PPlus.Controls.Objects; +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + +using PPlus.Controls.Objects; using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; @@ -35,12 +40,12 @@ internal AutoCompleteOptions(StyleSchema styleSchema, ConfigControls config, ICo public TimeSpan TimeoutOverwriteDefault { get; set; } public CaseOptions InputToCase { get; set; } = CaseOptions.Any; public Func? AcceptInput { get; set; } - public ushort MaxLenght { get; set; } = ushort.MaxValue; + public ushort MaxLength { get; set; } = ushort.MaxValue; public string DefaultEmptyValue { get; set; } public string DefaultValue { get; set; } public IList> Validators { get; } = new List>(); public bool ValidateOnDemand { get; set; } public Func ChangeDescription { get; set; } - public Func? SuggestionHandler { get; set; } + public Func? SuggestionHandler { get; set; } } } diff --git a/Src/Controls/Input/IControlAutoComplete.cs b/Src/Controls/Input/IControlAutoComplete.cs index 254531ef..598a15d2 100644 --- a/Src/Controls/Input/IControlAutoComplete.cs +++ b/Src/Controls/Input/IControlAutoComplete.cs @@ -1,4 +1,9 @@ -using System; +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + +using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Threading; @@ -25,14 +30,14 @@ public interface IControlAutoComplete: IPromptControls /// /// The /// Style of spinner. - /// Number of mileseconds foreach interation of spinner. Valid only to SpinnersType.custom, otherwise will be ignored + /// Number of mileseconds foreach iteration of spinner. Valid only to SpinnersType.custom, otherwise will be ignored /// IEnumerable values for custom spinner. Valid only to SpinnersType.custom, otherwise will be ignored /// IControlAutoComplete Spinner(SpinnersType spinnersType, Style? SpinnerStyle = null, int? speedAnimation = null, IEnumerable? customspinner = null); /// /// Number minimum of chars to accept autocomplete - ///
Default value : 3. If value less than 0 internal sette to 0.
+ ///
Default value : 3. If value less than 0 internal set to 0.
///
/// Number of chars /// @@ -40,7 +45,7 @@ public interface IControlAutoComplete: IPromptControls /// /// Number of mileseconds to wait before to start function autocomplete - ///
Default value : 1000. If value less than 10 internal sette to 10.
+ ///
Default value : 1000. If value less than 10 internal set to 10.
///
/// Number of mileseconds /// @@ -101,15 +106,15 @@ public interface IControlAutoComplete: IPromptControls IControlAutoComplete AcceptInput(Func value); /// - /// MaxLenght of input text. + /// MaxLength of input text. /// - /// Lenght + /// Length /// - IControlAutoComplete MaxLenght(ushort value); + IControlAutoComplete MaxLength(ushort value); /// /// Add a validator to accept sucessfull finish of control. - ///
Tip: see to validators embeding
+ ///
Tip: see to validators embedding
///
/// the function validator. /// diff --git a/Src/Controls/Input/IControlInput.cs b/Src/Controls/Input/IControlInput.cs index 4f504ad4..6fb7d6a2 100644 --- a/Src/Controls/Input/IControlInput.cs +++ b/Src/Controls/Input/IControlInput.cs @@ -53,11 +53,11 @@ public interface IControlInput : IPromptControls IControlInput AcceptInput(Func value); /// - /// MaxLenght of input text. + /// MaxLength of input text. /// - /// Lenght + /// Length /// - IControlInput MaxLenght(ushort value); + IControlInput MaxLength(ushort value); /// /// The input is a secret. the input text is masked to '#' (default value) @@ -75,7 +75,7 @@ public interface IControlInput : IPromptControls /// /// Add a validator to accept sucessfull finish of control. - ///
Tip: see to validators embeding
+ ///
Tip: see to validators embedding
///
/// the function validator. /// @@ -105,9 +105,9 @@ public interface IControlInput : IPromptControls /// /// Add Suggestion Handler feature /// - /// function to apply suggestions. and + /// function to apply suggestions. and /// - IControlInput SuggestionHandler(Func value); + IControlInput SuggestionHandler(Func value); /// /// Minimum chars to enabled history feature. Default value is 0. diff --git a/Src/Controls/Input/IControlMaskEdit.cs b/Src/Controls/Input/IControlMaskEdit.cs index 54ea81c6..5b8ed5b5 100644 --- a/Src/Controls/Input/IControlMaskEdit.cs +++ b/Src/Controls/Input/IControlMaskEdit.cs @@ -18,7 +18,7 @@ public interface IControlMaskEdit : IPromptControls /// /// Overwrite to region tip type input. ///
Default Foreground : 'ConsoleColor.Yellow'
- ///
Default Background : same Console Background when setted
+ ///
Default Background : same Console Background when set
///
/// Style /// @@ -28,7 +28,7 @@ public interface IControlMaskEdit : IPromptControls /// /// Overwrite to region neggative input. ///
Default Foreground : 'StyleControls.Answer'
- ///
Default Background : Same Console Background when setted
+ ///
Default Background : Same Console Background when set
///
/// Style /// @@ -37,7 +37,7 @@ public interface IControlMaskEdit : IPromptControls /// /// Overwrite to region positive input. ///
Default Foreground : 'StyleControls.Answer'
- ///
Default Background : Same Console Background when setted
+ ///
Default Background : Same Console Background when set
///
/// Style /// @@ -127,12 +127,12 @@ public interface IControlMaskEdit : IPromptControls IControlMaskEdit FormatTime(FormatTime value); /// - /// Defines integer lenght, decimal lenght and accept signl. + /// Defines integer length, decimal length and accept signl. ///
Valid only for type MaskedType.Number or Currency, otherwise this set will be ignored.
///
This set is Requeried for these types.
///
- /// integer lenght - /// decimal lenght + /// integer length + /// decimal length /// True accept signal; otherwise, no. /// IControlMaskEdit AmmoutPositions(int intvalue, int decimalvalue, bool acceptSignal); @@ -168,7 +168,7 @@ public interface IControlMaskEdit : IPromptControls /// /// Add a validator to accept sucessfull finish of control. - ///
Tip: see to validators embeding
+ ///
Tip: see to validators embedding
///
/// the function validator. /// @@ -198,9 +198,9 @@ public interface IControlMaskEdit : IPromptControls /// /// Add Suggestion (with mask!) Handler feature /// - /// function to apply suggestions. and + /// function to apply suggestions. and /// - IControlMaskEdit SuggestionHandler(Func value); + IControlMaskEdit SuggestionHandler(Func value); /// /// Minimum chars (without mask!) to enabled history feature. diff --git a/Src/Controls/Input/InputControl.cs b/Src/Controls/Input/InputControl.cs index 5a2e83e0..24c3a28e 100644 --- a/Src/Controls/Input/InputControl.cs +++ b/Src/Controls/Input/InputControl.cs @@ -22,7 +22,7 @@ internal class InputControl : BaseControl, IControlInput private string _originalText = string.Empty; private bool _isInAutoCompleteMode; private int _completionsIndex = -1; - private SugestionOutput? _completions = null; + private SuggestionOutput? _completions = null; private string _defaultHistoric = null; @@ -33,6 +33,11 @@ public InputControl(IConsoleControl console, InputOptions options) : base(consol public override string InitControl(CancellationToken cancellationToken) { + if (_options.FilterType == FilterMode.Disabled && _options.HistoryMinimumPrefixLength > 0) + { + throw new PromptPlusException("HistoryMinimumPrefixLength mustbe zero when FilterType is Disabled"); + } + if (_options.IsSecret) { _options.SuggestionHandler = null; @@ -51,7 +56,7 @@ public override string InitControl(CancellationToken cancellationToken) LoadDefaultHistory(); } - _inputBuffer = new(_options.InputToCase, _options.AcceptInput, _options.MaxLenght); + _inputBuffer = new(_options.InputToCase, _options.AcceptInput, _options.MaxLength); if (!string.IsNullOrEmpty(_defaultHistoric)) { @@ -179,12 +184,12 @@ public IControlInput EnabledViewSecret(HotKey? hotkeypress = null) _options.EnabledViewSecret = true; if (hotkeypress.HasValue) { - _options.SwithView = hotkeypress.Value; + _options.SwitchView = hotkeypress.Value; } return this; } - public IControlInput SuggestionHandler(Func value) + public IControlInput SuggestionHandler(Func value) { _options.SuggestionHandler = value; return this; @@ -196,9 +201,9 @@ public IControlInput ValidateOnDemand(bool value = true) return this; } - public IControlInput MaxLenght(ushort value) + public IControlInput MaxLength(ushort value) { - _options.MaxLenght = value; + _options.MaxLength = value; return this; } @@ -244,7 +249,7 @@ public override void InputTemplate(ScreenBuffer screenBuffer) if (_isInAutoCompleteMode || _options.ShowingHistory) { var answer = FinishResult; - screenBuffer.WriteSugestion(_options, answer); + screenBuffer.WriteSuggestion(_options, answer); screenBuffer.SaveCursor(); } else @@ -282,9 +287,9 @@ public override void InputTemplate(ScreenBuffer screenBuffer) screenBuffer.WriteLineNotSelector(_options, value); } } - if (_localpaginator.PageCount > 1) + if (!_options.OptShowOnlyExistingPagination || _localpaginator.PageCount > 1) { - screenBuffer.WriteLinePagination(_options,_localpaginator.PaginationMessage()); + screenBuffer.WriteLinePagination(_options, _localpaginator.PaginationMessage()); } } } @@ -315,7 +320,7 @@ public override ResultPrompt TryResult(CancellationToken cancellationTok endinput = true; break; } - if (_options.IsSecret && _options.EnabledViewSecret && _options.SwithView.Equals(keyInfo.Value)) + if (_options.IsSecret && _options.EnabledViewSecret && _options.SwitchView.Equals(keyInfo.Value)) { _passwordvisible = !_passwordvisible; continue; @@ -346,13 +351,13 @@ public override ResultPrompt TryResult(CancellationToken cancellationTok endinput = true; break; } - //apply sugestion + //apply suggestion else if (_options.SuggestionHandler != null && (keyInfo.Value.IsPressTabKey() || keyInfo.Value.IsPressShiftTabKey())) { if (!_isInAutoCompleteMode) { - _completions = _options.SuggestionHandler.Invoke(new SugestionInput(_inputBuffer.ToString(), _options.OptContext)); - if (_completions.HasValue && _completions.Value.Sugestions.Count > 0) + _completions = _options.SuggestionHandler.Invoke(new SuggestionInput(_inputBuffer.ToString(), _options.OptContext)); + if (_completions.HasValue && _completions.Value.Suggestions.Count > 0) { _completionsIndex = -1; _options.ShowingHistory = false; @@ -366,7 +371,7 @@ public override ResultPrompt TryResult(CancellationToken cancellationTok } ExecuteAutoComplete(keyInfo.Value.IsPressShiftTabKey()); } - //cancel sugestion + //cancel suggestion else if (_options.SuggestionHandler != null && _isInAutoCompleteMode && keyInfo.Value.IsPressEscKey()) { _isInAutoCompleteMode = false; @@ -473,8 +478,12 @@ private IEnumerable GetItemHistory(FilterMode filterMode) return _itemsHistory.Where(x => x.History.Contains(_inputBuffer.ToString(), StringComparison.InvariantCultureIgnoreCase) && DateTime.Now < new DateTime(x.TimeOutTicks)); } - return _itemsHistory.Where(x => x.History.StartsWith(_inputBuffer.ToString(), StringComparison.InvariantCultureIgnoreCase) + else if (filterMode == FilterMode.StartsWith) + { + return _itemsHistory.Where(x => x.History.StartsWith(_inputBuffer.ToString(), StringComparison.InvariantCultureIgnoreCase) && DateTime.Now < new DateTime(x.TimeOutTicks)); + } + return _itemsHistory.Where(x => DateTime.Now < new DateTime(x.TimeOutTicks)); } private void ClearMode() @@ -500,14 +509,14 @@ private bool ExecuteAutoComplete(bool Previus) { NextCompletions(); } - _inputBuffer.Clear().LoadPrintable(_completions.Value.Sugestions[_completionsIndex]); + _inputBuffer.Clear().LoadPrintable(_completions.Value.Suggestions[_completionsIndex]); return true; } private void NextCompletions() { _completionsIndex++; - if (_completionsIndex > _completions.Value.Sugestions.Count - 1) + if (_completionsIndex > _completions.Value.Suggestions.Count - 1) { _completionsIndex = 0; } @@ -518,7 +527,7 @@ private void PreviusCompletions() _completionsIndex--; if (_completionsIndex < 0) { - _completionsIndex = _completions.Value.Sugestions.Count - 1; + _completionsIndex = _completions.Value.Suggestions.Count - 1; } } diff --git a/Src/Controls/Input/InputOptions.cs b/Src/Controls/Input/InputOptions.cs index 809f6d5a..fe65dc2b 100644 --- a/Src/Controls/Input/InputOptions.cs +++ b/Src/Controls/Input/InputOptions.cs @@ -19,7 +19,7 @@ private InputOptions() : base(null, null, null, true) internal InputOptions(StyleSchema styleSchema, ConfigControls config, IConsoleControl console, bool showcursor) : base(styleSchema, config, console, showcursor) { TimeoutOverwriteDefault = config.HistoryTimeout; - SwithView = config.PasswordViewPress; + SwitchView = config.PasswordViewPress; SecretChar = config.SecretChar.Value; HistoryPageSize = config.PageSize; HistoryTimeout = config.HistoryTimeout; @@ -29,10 +29,10 @@ internal InputOptions(StyleSchema styleSchema, ConfigControls config, IConsoleCo public string? OverwriteDefaultFrom { get; set; } = null; public TimeSpan TimeoutOverwriteDefault { get; set; } public bool EnabledViewSecret { get; set; } - public HotKey SwithView { get; set; } + public HotKey SwitchView { get; set; } public CaseOptions InputToCase { get; set; } = CaseOptions.Any; public Func? AcceptInput { get; set; } - public ushort MaxLenght { get; set; } = ushort.MaxValue; + public ushort MaxLength { get; set; } = ushort.MaxValue; public char SecretChar { get; set; } public bool IsSecret { get; set; } public string DefaultEmptyValue { get; set; } @@ -45,7 +45,7 @@ internal InputOptions(StyleSchema styleSchema, ConfigControls config, IConsoleCo public byte HistoryMaxItems { get; set; } = byte.MaxValue; public TimeSpan HistoryTimeout { get; set; } public string? HistoryFileName { get; set; } - public Func? SuggestionHandler { get; set; } + public Func? SuggestionHandler { get; set; } public bool ShowingHistory { get; set; } public bool HistoryEnabled => !string.IsNullOrEmpty(HistoryFileName); diff --git a/Src/Controls/Input/MaskEditControl.cs b/Src/Controls/Input/MaskEditControl.cs index b2211365..54700bb9 100644 --- a/Src/Controls/Input/MaskEditControl.cs +++ b/Src/Controls/Input/MaskEditControl.cs @@ -22,7 +22,7 @@ internal class MaskEditControl : BaseControl, IControlMaskEdit private string _originalText = string.Empty; private bool _isInAutoCompleteMode; private int _completionsIndex = -1; - private SugestionOutput? _completions = null; + private SuggestionOutput? _completions = null; private string _defaultHistoric = null; @@ -33,6 +33,11 @@ public MaskEditControl(IConsoleControl console, MaskEditOptions options) : base( public override string InitControl(CancellationToken cancellationToken) { + if (_options.FilterType == FilterMode.Disabled && _options.HistoryMinimumPrefixLength > 0) + { + throw new PromptPlusException("HistoryMinimumPrefixLength mustbe zero when FilterType is Disabled"); + } + if (_options.CurrentCulture == null) { _options.CurrentCulture = _options.Config.AppCulture; @@ -188,7 +193,7 @@ public IControlMaskEdit Default(string value) return this; } - public IControlMaskEdit SuggestionHandler(Func value) + public IControlMaskEdit SuggestionHandler(Func value) { _options.SuggestionHandler = value; return this; @@ -338,7 +343,7 @@ public override void InputTemplate(ScreenBuffer screenBuffer) screenBuffer.WritePrompt(_options, ""); if (_isInAutoCompleteMode || _options.ShowingHistory) { - screenBuffer.WriteSugestion(_options, _inputBuffer.ToMasked()); + screenBuffer.WriteSuggestion(_options, _inputBuffer.ToMasked()); screenBuffer.SaveCursor(); } else @@ -374,7 +379,7 @@ public override void InputTemplate(ScreenBuffer screenBuffer) screenBuffer.WriteLineNotSelector(_options, value); } } - if (_localpaginator.PageCount > 1) + if (!_options.OptShowOnlyExistingPagination || _localpaginator.PageCount > 1) { screenBuffer.WriteLinePagination(_options, _localpaginator.PaginationMessage()); } @@ -414,13 +419,13 @@ public override ResultPrompt TryResult(CancellationToken cancellat { keyInfo = keyInfo.Value.ToCase(_options.InputToCase); } - //apply sugestion + //apply suggestion if (_options.SuggestionHandler != null && (keyInfo.Value.IsPressTabKey() || keyInfo.Value.IsPressShiftTabKey())) { if (!_isInAutoCompleteMode) { - _completions = _options.SuggestionHandler.Invoke(new SugestionInput(_inputBuffer.ToString(), _options.OptContext)); - if (_completions.HasValue && _completions.Value.Sugestions.Count > 0) + _completions = _options.SuggestionHandler.Invoke(new SuggestionInput(_inputBuffer.ToString(), _options.OptContext)); + if (_completions.HasValue && _completions.Value.Suggestions.Count > 0) { _completionsIndex = -1; _options.ShowingHistory = false; @@ -434,7 +439,7 @@ public override ResultPrompt TryResult(CancellationToken cancellat } ExecuteAutoComplete(keyInfo.Value.IsPressShiftTabKey()); } - //cancel sugestion + //cancel suggestion else if (_options.SuggestionHandler != null && _isInAutoCompleteMode && keyInfo.Value.IsPressEscKey()) { _inputBuffer.Clear().Load(_originalText); @@ -693,14 +698,14 @@ private bool ExecuteAutoComplete(bool Previus) } _inputBuffer .Clear() - .Load(_inputBuffer.RemoveMask(_completions.Value.Sugestions[_completionsIndex],true)); + .Load(_inputBuffer.RemoveMask(_completions.Value.Suggestions[_completionsIndex],true)); return true; } private void NextCompletions() { _completionsIndex++; - if (_completionsIndex > _completions.Value.Sugestions.Count - 1) + if (_completionsIndex > _completions.Value.Suggestions.Count - 1) { _completionsIndex = 0; } @@ -711,7 +716,7 @@ private void PreviusCompletions() _completionsIndex--; if (_completionsIndex < 0) { - _completionsIndex = _completions.Value.Sugestions.Count - 1; + _completionsIndex = _completions.Value.Suggestions.Count - 1; } } @@ -724,9 +729,13 @@ private IEnumerable GetItemHistory(FilterMode filterMode) .Contains(_inputBuffer.RemoveMask(_inputBuffer.ToMasked(), true), StringComparison.InvariantCultureIgnoreCase) && DateTime.Now < new DateTime(x.TimeOutTicks)); } - return _itemsHistory.Where(x => _inputBuffer.RemoveMask(x.History, true) + else if (filterMode == FilterMode.StartsWith) + { + return _itemsHistory.Where(x => _inputBuffer.RemoveMask(x.History, true) .StartsWith(_inputBuffer.RemoveMask(_inputBuffer.ToMasked(), true), StringComparison.InvariantCultureIgnoreCase) && DateTime.Now < new DateTime(x.TimeOutTicks)); + } + return _itemsHistory.Where(x => DateTime.Now < new DateTime(x.TimeOutTicks)); } private void LoadHistory() diff --git a/Src/Controls/Input/MaskEditOptions.cs b/Src/Controls/Input/MaskEditOptions.cs index ba368042..dcc793f4 100644 --- a/Src/Controls/Input/MaskEditOptions.cs +++ b/Src/Controls/Input/MaskEditOptions.cs @@ -21,7 +21,7 @@ private MaskEditOptions() : base(null, null, null, true) internal MaskEditOptions(StyleSchema styleSchema, ConfigControls config, IConsoleControl console, bool showcursor) : base(styleSchema, config, console, showcursor) { TimeoutOverwriteDefault = config.HistoryTimeout; - TypeTipStyle = styleSchema.Sugestion(); + TypeTipStyle = styleSchema.Suggestion(); PositiveStyle = styleSchema.Answer(); NegativeStyle = styleSchema.Answer(); HistoryPageSize = config.PageSize; @@ -58,7 +58,7 @@ internal MaskEditOptions(StyleSchema styleSchema, ConfigControls config, IConsol public byte HistoryMaxItems { get; set; } = byte.MaxValue; public TimeSpan HistoryTimeout { get; set; } public string? HistoryFileName { get; set; } - public Func? SuggestionHandler { get; set; } + public Func? SuggestionHandler { get; set; } public bool ShowingHistory { get; set; } public bool HistoryEnabled => !string.IsNullOrEmpty(HistoryFileName); public bool DescriptionWithInputType { get; set; } diff --git a/Src/Controls/Input/ScreenBufferAutoComplete.cs b/Src/Controls/Input/ScreenBufferAutoComplete.cs index a8bedf8b..2a6db117 100644 --- a/Src/Controls/Input/ScreenBufferAutoComplete.cs +++ b/Src/Controls/Input/ScreenBufferAutoComplete.cs @@ -48,8 +48,8 @@ private static string DefaultToolTipAutoComplete(AutoCompleteOptions baseOptions { return string.Format("{0}, {1}, {2}, {3}", string.Format(Messages.TooltipToggle, baseOptions.Config.TooltipKeyPress), - Messages.TooltipSugestionEsc, - Messages.InputFisnishEnter, + Messages.TooltipSuggestionEsc, + Messages.InputFinishEnter, Messages.TooltipPages); } else @@ -59,13 +59,13 @@ private static string DefaultToolTipAutoComplete(AutoCompleteOptions baseOptions return string.Format("{0}, {1}, {2}", string.Format(Messages.TooltipToggle, baseOptions.Config.TooltipKeyPress), string.Format(Messages.TooltipCancelEsc, baseOptions.Config.AbortKeyPress), - Messages.InputFisnishEnter); + Messages.InputFinishEnter); } else { return string.Format("{0}, {1}", string.Format(Messages.TooltipToggle, baseOptions.Config.TooltipKeyPress), - Messages.InputFisnishEnter); + Messages.InputFinishEnter); } } } diff --git a/Src/Controls/Input/ScreenBufferInput.cs b/Src/Controls/Input/ScreenBufferInput.cs index ec821e8b..96663bb3 100644 --- a/Src/Controls/Input/ScreenBufferInput.cs +++ b/Src/Controls/Input/ScreenBufferInput.cs @@ -52,16 +52,16 @@ private static string DefaultToolTipInput(InputOptions baseOptions, bool isInAut { return string.Format("{0}, {1}, {2}, {3}", string.Format(Messages.TooltipToggle, baseOptions.Config.TooltipKeyPress), - string.Format(Messages.TooltipViewPassword, baseOptions.SwithView), + string.Format(Messages.TooltipViewPassword, baseOptions.SwitchView), string.Format(Messages.TooltipCancelEsc, baseOptions.Config.AbortKeyPress), - Messages.InputFisnishEnter); + Messages.InputFinishEnter); } else { return string.Format("{0}, {1}, {2}", string.Format(Messages.TooltipToggle, baseOptions.Config.TooltipKeyPress), - string.Format(Messages.TooltipViewPassword, baseOptions.SwithView), - Messages.InputFisnishEnter); + string.Format(Messages.TooltipViewPassword, baseOptions.SwitchView), + Messages.InputFinishEnter); } } else @@ -71,13 +71,13 @@ private static string DefaultToolTipInput(InputOptions baseOptions, bool isInAut return string.Format("{0}, {1}, {2}", string.Format(Messages.TooltipToggle, baseOptions.Config.TooltipKeyPress), string.Format(Messages.TooltipCancelEsc, baseOptions.Config.AbortKeyPress), - Messages.InputFisnishEnter); + Messages.InputFinishEnter); } else { return string.Format("{0}, {1}", string.Format(Messages.TooltipToggle, baseOptions.Config.TooltipKeyPress), - Messages.InputFisnishEnter); + Messages.InputFinishEnter); } } } @@ -90,7 +90,7 @@ private static string DefaultToolTipInput(InputOptions baseOptions, bool isInAut return string.Format("{0}, {1}, {2}\n{3}, {4}", string.Format(Messages.TooltipToggle, baseOptions.Config.TooltipKeyPress), Messages.TooltipHistoryEsc, - Messages.SelectFisnishEnter, + Messages.SelectFinishEnter, Messages.TooltipPages, Messages.TooltipHistoryClear); } @@ -100,10 +100,10 @@ private static string DefaultToolTipInput(InputOptions baseOptions, bool isInAut { return string.Format("{0}, {1}, {2}\n{3}, {4}", string.Format(Messages.TooltipToggle, baseOptions.Config.TooltipKeyPress), - Messages.TooltipSugestionEsc, - Messages.InputFisnishEnter, + Messages.TooltipSuggestionEsc, + Messages.InputFinishEnter, string.Format(Messages.TooltipHistoryToggle, baseOptions.HistoryMinimumPrefixLength), - Messages.TooltipSugestionToggle); + Messages.TooltipSuggestionToggle); } else { @@ -114,17 +114,17 @@ private static string DefaultToolTipInput(InputOptions baseOptions, bool isInAut return string.Format("{0}, {1}, {2}\n{3}, {4}", string.Format(Messages.TooltipToggle, baseOptions.Config.TooltipKeyPress), string.Format(Messages.TooltipCancelEsc, baseOptions.Config.AbortKeyPress), - Messages.InputFisnishEnter, + Messages.InputFinishEnter, string.Format(Messages.TooltipHistoryToggle, baseOptions.HistoryMinimumPrefixLength), - Messages.TooltipSugestionToggle); + Messages.TooltipSuggestionToggle); } else { return string.Format("{0}, {1}, {2}, {3}", string.Format(Messages.TooltipToggle, baseOptions.Config.TooltipKeyPress), - Messages.InputFisnishEnter, + Messages.InputFinishEnter, string.Format(Messages.TooltipHistoryToggle, baseOptions.HistoryMinimumPrefixLength), - Messages.TooltipSugestionToggle); + Messages.TooltipSuggestionToggle); } } else @@ -134,14 +134,14 @@ private static string DefaultToolTipInput(InputOptions baseOptions, bool isInAut return string.Format("{0}, {1}, {2}, {3}", string.Format(Messages.TooltipToggle, baseOptions.Config.TooltipKeyPress), string.Format(Messages.TooltipCancelEsc, baseOptions.Config.AbortKeyPress), - Messages.InputFisnishEnter, + Messages.InputFinishEnter, string.Format(Messages.TooltipHistoryToggle, baseOptions.HistoryMinimumPrefixLength)); } else { return string.Format("{0}, {1}, {2}", string.Format(Messages.TooltipToggle, baseOptions.Config.TooltipKeyPress), - Messages.InputFisnishEnter, + Messages.InputFinishEnter, string.Format(Messages.TooltipHistoryToggle, baseOptions.HistoryMinimumPrefixLength)); } } @@ -154,9 +154,9 @@ private static string DefaultToolTipInput(InputOptions baseOptions, bool isInAut { return string.Format("{0}, {1}, {2}, {3}", string.Format(Messages.TooltipToggle, baseOptions.Config.TooltipKeyPress), - Messages.TooltipSugestionEsc, - Messages.InputFisnishEnter, - Messages.TooltipSugestionToggle); + Messages.TooltipSuggestionEsc, + Messages.InputFinishEnter, + Messages.TooltipSuggestionToggle); } else { @@ -166,16 +166,16 @@ private static string DefaultToolTipInput(InputOptions baseOptions, bool isInAut { return string.Format("{0}, {1}, {2}, {3}", string.Format(Messages.TooltipToggle, baseOptions.Config.TooltipKeyPress), - Messages.TooltipSugestionToggle, - Messages.InputFisnishEnter, + Messages.TooltipSuggestionToggle, + Messages.InputFinishEnter, string.Format(Messages.TooltipCancelEsc, baseOptions.Config.AbortKeyPress)); } else { return string.Format("{0}, {1}, {2}", string.Format(Messages.TooltipToggle, baseOptions.Config.TooltipKeyPress), - Messages.InputFisnishEnter, - Messages.TooltipSugestionToggle); + Messages.InputFinishEnter, + Messages.TooltipSuggestionToggle); } } else @@ -185,13 +185,13 @@ private static string DefaultToolTipInput(InputOptions baseOptions, bool isInAut return string.Format("{0}, {1}, {2}", string.Format(Messages.TooltipToggle, baseOptions.Config.TooltipKeyPress), string.Format(Messages.TooltipCancelEsc, baseOptions.Config.AbortKeyPress), - Messages.InputFisnishEnter); + Messages.InputFinishEnter); } else { return string.Format("{0}, {1}", string.Format(Messages.TooltipToggle, baseOptions.Config.TooltipKeyPress), - Messages.InputFisnishEnter); + Messages.InputFinishEnter); } } } diff --git a/Src/Controls/Input/ScreenBufferMaskEdit.cs b/Src/Controls/Input/ScreenBufferMaskEdit.cs index 5a97f0dc..baf23569 100644 --- a/Src/Controls/Input/ScreenBufferMaskEdit.cs +++ b/Src/Controls/Input/ScreenBufferMaskEdit.cs @@ -104,7 +104,7 @@ private static string DefaultToolTipMaskedit(MaskEditOptions baseOptions, bool i return string.Format("{0}, {1}, {2}\n{3}, {4}", string.Format(Messages.TooltipToggle, baseOptions.Config.TooltipKeyPress), Messages.TooltipHistoryEsc, - Messages.SelectFisnishEnter, + Messages.SelectFinishEnter, Messages.TooltipPages, Messages.TooltipHistoryClear); } @@ -114,9 +114,9 @@ private static string DefaultToolTipMaskedit(MaskEditOptions baseOptions, bool i { return string.Format("{0}, {1}\n{2}, {3}", string.Format(Messages.TooltipToggle, baseOptions.Config.TooltipKeyPress), - Messages.TooltipSugestionEsc, + Messages.TooltipSuggestionEsc, string.Format(Messages.TooltipHistoryToggle, baseOptions.HistoryMinimumPrefixLength), - Messages.TooltipSugestionToggle); + Messages.TooltipSuggestionToggle); } else { @@ -135,7 +135,7 @@ private static string DefaultToolTipMaskedit(MaskEditOptions baseOptions, bool i string.Format(Messages.TooltipToggle, baseOptions.Config.TooltipKeyPress), string.Format(Messages.TooltipCancelEsc, baseOptions.Config.AbortKeyPress), string.Format(Messages.TooltipHistoryToggle, baseOptions.HistoryMinimumPrefixLength), - Messages.TooltipSugestionToggle, + Messages.TooltipSuggestionToggle, Messages.MaskEditErase, string.Format(Messages.MaskEditJump, aux)); } @@ -154,7 +154,7 @@ private static string DefaultToolTipMaskedit(MaskEditOptions baseOptions, bool i string.Format(Messages.TooltipToggle, baseOptions.Config.TooltipKeyPress), string.Format(Messages.TooltipCancelEsc, baseOptions.Config.AbortKeyPress), string.Format(Messages.TooltipHistoryToggle, baseOptions.HistoryMinimumPrefixLength), - Messages.TooltipSugestionToggle, + Messages.TooltipSuggestionToggle, Messages.MaskEditErase, string.Format(Messages.MaskEditJump, aux)); } @@ -164,7 +164,7 @@ private static string DefaultToolTipMaskedit(MaskEditOptions baseOptions, bool i string.Format(Messages.TooltipToggle, baseOptions.Config.TooltipKeyPress), string.Format(Messages.TooltipCancelEsc, baseOptions.Config.AbortKeyPress), string.Format(Messages.TooltipHistoryToggle, baseOptions.HistoryMinimumPrefixLength), - Messages.TooltipSugestionToggle, + Messages.TooltipSuggestionToggle, Messages.MaskEditErase); } } @@ -180,7 +180,7 @@ private static string DefaultToolTipMaskedit(MaskEditOptions baseOptions, bool i return string.Format("{0}, {1}, {2},\n{3}, {4}", string.Format(Messages.TooltipToggle, baseOptions.Config.TooltipKeyPress), string.Format(Messages.TooltipHistoryToggle, baseOptions.HistoryMinimumPrefixLength), - Messages.TooltipSugestionToggle, + Messages.TooltipSuggestionToggle, Messages.MaskEditErase, string.Format(Messages.MaskEditJump, aux)); } @@ -198,7 +198,7 @@ private static string DefaultToolTipMaskedit(MaskEditOptions baseOptions, bool i return string.Format("{0}, {1}, {2},\n{3}, {4}", string.Format(Messages.TooltipToggle, baseOptions.Config.TooltipKeyPress), string.Format(Messages.TooltipHistoryToggle, baseOptions.HistoryMinimumPrefixLength), - Messages.TooltipSugestionToggle, + Messages.TooltipSuggestionToggle, Messages.MaskEditErase, string.Format(Messages.MaskEditJump, aux)); } @@ -207,7 +207,7 @@ private static string DefaultToolTipMaskedit(MaskEditOptions baseOptions, bool i return string.Format("{0}, {1},\n{2}, {3}", string.Format(Messages.TooltipToggle, baseOptions.Config.TooltipKeyPress), string.Format(Messages.TooltipHistoryToggle, baseOptions.HistoryMinimumPrefixLength), - Messages.TooltipSugestionToggle, + Messages.TooltipSuggestionToggle, Messages.MaskEditErase); } } @@ -307,8 +307,8 @@ private static string DefaultToolTipMaskedit(MaskEditOptions baseOptions, bool i { return string.Format("{0}, {1}, {2}", string.Format(Messages.TooltipToggle, baseOptions.Config.TooltipKeyPress), - Messages.TooltipSugestionEsc, - Messages.TooltipSugestionToggle); + Messages.TooltipSuggestionEsc, + Messages.TooltipSuggestionToggle); } else { @@ -318,7 +318,7 @@ private static string DefaultToolTipMaskedit(MaskEditOptions baseOptions, bool i { return string.Format("{0}, {1},\n{2}, {3}", string.Format(Messages.TooltipToggle, baseOptions.Config.TooltipKeyPress), - Messages.TooltipSugestionToggle, + Messages.TooltipSuggestionToggle, string.Format(Messages.TooltipCancelEsc, baseOptions.Config.AbortKeyPress), Messages.MaskEditErase); } @@ -326,7 +326,7 @@ private static string DefaultToolTipMaskedit(MaskEditOptions baseOptions, bool i { return string.Format("{0}, {1}, {2}", string.Format(Messages.TooltipToggle, baseOptions.Config.TooltipKeyPress), - Messages.TooltipSugestionToggle, + Messages.TooltipSuggestionToggle, Messages.MaskEditErase); } } diff --git a/Src/Controls/Objects/BaseControl.cs b/Src/Controls/Objects/BaseControl.cs index 7d11b7a5..4c94b8f9 100644 --- a/Src/Controls/Objects/BaseControl.cs +++ b/Src/Controls/Objects/BaseControl.cs @@ -1,7 +1,8 @@ // *************************************************************************************** // MIT LICENCE +// Copyright (c) 2019 shibayan. +// https://github.com/shibayan/Sharprompt // The maintenance and evolution is maintained by the PromptPlus project under MIT license -// This code was based on work from https://github.com/shibayan/Sharprompt // *************************************************************************************** using System; @@ -86,6 +87,10 @@ public ResultPrompt Run(CancellationToken? stoptoken) } FinalizeControl(stoptoken.Value); } + catch (Exception ex) + { + throw new PromptPlusException(ex.Message,ex); + } finally { ConsolePlus.CursorVisible = oldcursor; @@ -178,7 +183,7 @@ public void ClearBuffer() { while (KeyAvailable) { - WaitKeypress(CancellationToken.None); + WaitKeypress(CancellationToken); } } @@ -314,7 +319,10 @@ public bool CheckTooltipKeyPress(ConsoleKeyInfo keyInfo) { if (_options.Config.TooltipKeyPress.Equals(keyInfo)) { - _options.OptShowTooltip = !_options.OptShowTooltip; + if (!_options.OptDisableChangeTooltip) + { + _options.OptShowTooltip = !_options.OptShowTooltip; + } return true; } return false; diff --git a/Src/Controls/Objects/EastAsianWidth.cs b/Src/Controls/Objects/EastAsianWidth.cs index c6b4e258..161c6c46 100644 --- a/Src/Controls/Objects/EastAsianWidth.cs +++ b/Src/Controls/Objects/EastAsianWidth.cs @@ -1,7 +1,8 @@ // *************************************************************************************** // MIT LICENCE +// Copyright (c) 2019 shibayan. +// https://github.com/shibayan/Sharprompt // The maintenance and evolution is maintained by the PromptPlus project under MIT license -// This code was based on work from https://github.com/shibayan/Sharprompt // *************************************************************************************** using System.Collections.Generic; diff --git a/Src/Controls/Objects/EmacsBuffer.cs b/Src/Controls/Objects/EmacsBuffer.cs index c8885a26..83fef5ad 100644 --- a/Src/Controls/Objects/EmacsBuffer.cs +++ b/Src/Controls/Objects/EmacsBuffer.cs @@ -62,7 +62,7 @@ public bool TryAcceptedReadlineConsoleKey(ConsoleKeyInfo keyinfo) switch (keyinfo.Key) { - //Emacs keyboard shortcut when when have any text with lenght > 1 + //Emacs keyboard shortcut when when have any text with length > 1 //Transpose the previous two characters case ConsoleKey.T when keyinfo.Modifiers == ConsoleModifiers.Control && Length > 1: { diff --git a/Src/Controls/Objects/MaskedBuffer.cs b/Src/Controls/Objects/MaskedBuffer.cs index 7f494745..89552139 100644 --- a/Src/Controls/Objects/MaskedBuffer.cs +++ b/Src/Controls/Objects/MaskedBuffer.cs @@ -573,12 +573,12 @@ internal MaskedBuffer Load(string value) return this; } - internal string RemoveMask(string value, bool skiplenght) + internal string RemoveMask(string value, bool skiplength) { SignalNumberInput = " "[0]; SignalTimeInput = string.Empty; _validSignalNumber = $"{_cultureMasked.NumberFormat.PositiveSign[0]}{_cultureMasked.NumberFormat.NegativeSign[0]}"; - return UnMaskValue(value, skiplenght); + return UnMaskValue(value, skiplength); } diff --git a/Src/Controls/Objects/Messages.cs b/Src/Controls/Objects/Messages.cs index c94a00c4..20d477b3 100644 --- a/Src/Controls/Objects/Messages.cs +++ b/Src/Controls/Objects/Messages.cs @@ -37,13 +37,13 @@ public static void UpdateCulture() SelectionInvalid = PromptPlusResources.SelectionInvalid; SelectionDisabled = PromptPlusResources.SelectionDisabled; TooltipFullPath = PromptPlusResources.TooltipFullPath; - CurrentSeleted = PromptPlusResources.CurrentSeleted; + CurrentSelected = PromptPlusResources.CurrentSelected; TooltipToggleExpandAllPress = PromptPlusResources.TooltipToggleExpandAllPress; TooltipToggleExpandPress = PromptPlusResources.TooltipToggleExpandPress; CurrentFolder = PromptPlusResources.CurrentFolder; Loading = PromptPlusResources.Loading; Task = PromptPlusResources.Task; - InputFisnishEnter = PromptPlusResources.InputFisnishEnter; + InputFinishEnter = PromptPlusResources.InputFinishEnter; ListMaxSelection = PromptPlusResources.ListMaxSelection; ListMinSelection = PromptPlusResources.ListMinSelection; TooltipEnterPressList = PromptPlusResources.TooltipEnterPressList; @@ -57,7 +57,7 @@ public static void UpdateCulture() OnValue = PromptPlusResources.OnValue; SliderNumberUpDownKeyNavigator = PromptPlusResources.SliderNumberUpDownKeyNavigator; SliderNumberLeftRightKeyNavigator = PromptPlusResources.SliderNumberLeftRightKeyNavigator; - MultiSelectFisnishEnter = PromptPlusResources.MultiSelectFisnishEnter; + MultiSelectFinishEnter = PromptPlusResources.MultiSelectFinishEnter; TooltipSelectAll = PromptPlusResources.TooltipSelectAll; TooltipInvertSelectAll = PromptPlusResources.TooltipInvertSelectAll; TooltipPressSpace = PromptPlusResources.TooltipPressSpace; @@ -94,11 +94,11 @@ public static void UpdateCulture() TooltipCancelEsc = PromptPlusResources.TooltipCancelEsc; TooltipViewPassword = PromptPlusResources.TooltipViewPassword; TooltipHistoryClear = PromptPlusResources.TooltipHistoryClear; - SelectFisnishEnter = PromptPlusResources.SelectFisnishEnter; - TooltipSugestionEsc = PromptPlusResources.TooltipSugestionEsc; + SelectFinishEnter = PromptPlusResources.SelectFinishEnter; + TooltipSuggestionEsc = PromptPlusResources.TooltipSuggestionEsc; TooltipHistoryEsc = PromptPlusResources.TooltipHistoryEsc; TooltipHistoryToggle = PromptPlusResources.TooltipHistoryToggle; - TooltipSugestionToggle = PromptPlusResources.TooltipSugestionToggle; + TooltipSuggestionToggle = PromptPlusResources.TooltipSuggestionToggle; PaginationTemplate = PromptPlusResources.PaginationTemplate; CanceledKeyRes = PromptPlusResources.CanceledKey; Pressedkey = PromptPlusResources.PressedKey; @@ -130,13 +130,13 @@ public static void UpdateCulture() public static string SelectionInvalid { get; private set; } = PromptPlusResources.SelectionInvalid; public static string SelectionDisabled { get; private set; } = PromptPlusResources.SelectionDisabled; public static string TooltipFullPath { get; private set; } = PromptPlusResources.TooltipFullPath; - public static string CurrentSeleted { get; private set; } = PromptPlusResources.CurrentSeleted; + public static string CurrentSelected { get; private set; } = PromptPlusResources.CurrentSelected; public static string TooltipToggleExpandAllPress { get; private set; } = PromptPlusResources.TooltipToggleExpandAllPress; public static string TooltipToggleExpandPress { get; private set; } = PromptPlusResources.TooltipToggleExpandPress; public static string CurrentFolder { get; private set; } = PromptPlusResources.CurrentFolder; public static string Loading { get; private set; } = PromptPlusResources.Loading; public static string Task { get; private set; } = PromptPlusResources.Task; - public static string InputFisnishEnter { get; private set; } = PromptPlusResources.InputFisnishEnter; + public static string InputFinishEnter { get; private set; } = PromptPlusResources.InputFinishEnter; public static string ListMaxSelection { get; private set; } = PromptPlusResources.ListMaxSelection; public static string ListMinSelection { get; private set; } = PromptPlusResources.ListMinSelection; public static string TooltipEnterPressList { get; private set; } = PromptPlusResources.TooltipEnterPressList; @@ -150,7 +150,7 @@ public static void UpdateCulture() public static string OnValue { get; private set; } = PromptPlusResources.OnValue; public static string SliderNumberUpDownKeyNavigator { get; private set; } = PromptPlusResources.SliderNumberUpDownKeyNavigator; public static string SliderNumberLeftRightKeyNavigator { get; private set; } = PromptPlusResources.SliderNumberLeftRightKeyNavigator; - public static string MultiSelectFisnishEnter { get; private set; } = PromptPlusResources.MultiSelectFisnishEnter; + public static string MultiSelectFinishEnter { get; private set; } = PromptPlusResources.MultiSelectFinishEnter; public static string TooltipSelectAll { get; private set; } = PromptPlusResources.TooltipSelectAll; public static string TooltipInvertSelectAll { get; private set; } = PromptPlusResources.TooltipInvertSelectAll; public static string TooltipPressSpace { get; private set; } = PromptPlusResources.TooltipPressSpace; @@ -187,11 +187,11 @@ public static void UpdateCulture() public static string TooltipCancelEsc { get; private set; } = PromptPlusResources.TooltipCancelEsc; public static string TooltipViewPassword { get; private set; } = PromptPlusResources.TooltipViewPassword; public static string TooltipHistoryClear { get; private set; } = PromptPlusResources.TooltipHistoryClear; - public static string SelectFisnishEnter { get; private set; } = PromptPlusResources.SelectFisnishEnter; - public static string TooltipSugestionEsc { get; private set; } = PromptPlusResources.TooltipSugestionEsc; + public static string SelectFinishEnter { get; private set; } = PromptPlusResources.SelectFinishEnter; + public static string TooltipSuggestionEsc { get; private set; } = PromptPlusResources.TooltipSuggestionEsc; public static string TooltipHistoryEsc { get; private set; } = PromptPlusResources.TooltipHistoryEsc; public static string TooltipHistoryToggle { get; private set; } = PromptPlusResources.TooltipHistoryToggle; - public static string TooltipSugestionToggle { get; private set; } = PromptPlusResources.TooltipSugestionToggle; + public static string TooltipSuggestionToggle { get; private set; } = PromptPlusResources.TooltipSuggestionToggle; public static string PaginationTemplate { get; private set; } = PromptPlusResources.PaginationTemplate; public static string CanceledKey => string.Format("{0} [{1}]", CanceledKeyRes, PromptPlus.Config.AbortKeyPress); public static string Pressedkey { get; private set; } = PromptPlusResources.PressedKey; diff --git a/Src/Controls/Objects/Paginator.cs b/Src/Controls/Objects/Paginator.cs index dc0981cb..17ec2eb4 100644 --- a/Src/Controls/Objects/Paginator.cs +++ b/Src/Controls/Objects/Paginator.cs @@ -1,10 +1,13 @@ // *************************************************************************************** // MIT LICENCE +// Copyright (c) 2019 shibayan. +// https://github.com/shibayan/Sharprompt // The maintenance and evolution is maintained by the PromptPlus project under MIT license // *************************************************************************************** using System; using System.Collections.Generic; +using System.ComponentModel.Design; using System.Linq; namespace PPlus.Controls.Objects @@ -52,12 +55,17 @@ private void EnsurePage() .Where(x => _textSelector(x).StartsWith(FilterTerm, StringComparison.InvariantCultureIgnoreCase)) .ToArray(); } - else + else if (_filterMode == FilterMode.Contains) { _filteredItems = _items .Where(x => _textSelector(x).Contains(FilterTerm, StringComparison.InvariantCultureIgnoreCase)) .ToArray(); } + else // Disabled + { + _filteredItems = _items.ToArray(); + } + for (var i = (_userpageSize * SelectedPage) + SelectedIndex; i < _filteredItems.Length; i++) { @@ -398,6 +406,10 @@ private void InitializeCollection() _filteredItems = _items.Where(x => _textSelector(x).Contains(FilterTerm, StringComparison.InvariantCultureIgnoreCase)) .ToArray(); } + else if (_filterMode == FilterMode.Disabled) + { + _filteredItems = _items.ToArray(); + } else { throw new PromptPlusException($"FilterMode: {_filterMode} Not Implemented"); diff --git a/Src/Controls/Objects/ScreenBufferExtensions.cs b/Src/Controls/Objects/ScreenBufferExtensions.cs index dc35578d..81123681 100644 --- a/Src/Controls/Objects/ScreenBufferExtensions.cs +++ b/Src/Controls/Objects/ScreenBufferExtensions.cs @@ -18,7 +18,12 @@ public static void WriteLinePagination(this ScreenBuffer screenBuffer,BaseOption public static void WritePrompt(this ScreenBuffer screenBuffer, BaseOptions options, string input) { - screenBuffer.AddBuffer($"{options.OptPrompt ?? string.Empty}: ", options.OptStyleSchema.Prompt()); + var prompt = options.OptPrompt ?? string.Empty; + screenBuffer.AddBuffer(prompt, options.OptStyleSchema.Prompt()); + if (!string.IsNullOrEmpty(prompt)) + { + screenBuffer.AddBuffer(": ", options.OptStyleSchema.Prompt()); + } if (!string.IsNullOrEmpty(input)) { screenBuffer.AddBuffer(input, options.OptStyleSchema.Answer(), true); @@ -33,11 +38,11 @@ public static void WriteAnswer(this ScreenBuffer screenBuffer, BaseOptions optio } } - public static void WriteSugestion(this ScreenBuffer screenBuffer, BaseOptions options, string input) + public static void WriteSuggestion(this ScreenBuffer screenBuffer, BaseOptions options, string input) { if (!string.IsNullOrEmpty(input)) { - screenBuffer.AddBuffer(input, options.OptStyleSchema.Sugestion(), true); + screenBuffer.AddBuffer(input, options.OptStyleSchema.Suggestion(), true); } } diff --git a/Src/Controls/Objects/Spinners.cs b/Src/Controls/Objects/Spinners.cs index 55efd5f5..9979f957 100644 --- a/Src/Controls/Objects/Spinners.cs +++ b/Src/Controls/Objects/Spinners.cs @@ -1,7 +1,8 @@ // ********************************************************************************************************** // MIT LICENCE +// Copyright 2020 Patrik Svensson, Phil Scott, Nils Andresen. +// https://spectreconsole.net // The maintenance and evolution is maintained by the PromptPlus project under MIT license -// This code was based on work from https://github.com/spectreconsole/spectre.console // ********************************************************************************************************** using System.Collections.Generic; @@ -112,7 +113,7 @@ public string NextFrame(CancellationToken cancellationToken) } } - public int Lenght => _frames.Count; + public int Length => _frames.Count; public int Interval => _interval; public bool IsReseted => _index == -1; public void Reset() diff --git a/Src/Controls/Objects/SpinnersData.cs b/Src/Controls/Objects/SpinnersData.cs index 4fca8178..1e0d3a6b 100644 --- a/Src/Controls/Objects/SpinnersData.cs +++ b/Src/Controls/Objects/SpinnersData.cs @@ -1,4 +1,11 @@ -using System.Collections.Generic; +// ********************************************************************************************************** +// MIT LICENCE +// Copyright 2020 Patrik Svensson, Phil Scott, Nils Andresen. +// https://spectreconsole.net +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// ********************************************************************************************************** + +using System.Collections.Generic; namespace PPlus.Controls.Objects { diff --git a/Src/Controls/ResultPrompt.cs b/Src/Controls/ResultPrompt.cs index 2d6ca454..48855351 100644 --- a/Src/Controls/ResultPrompt.cs +++ b/Src/Controls/ResultPrompt.cs @@ -9,7 +9,7 @@ namespace PPlus.Controls /// Represents The Result to Controls /// /// Typeof return - public struct ResultPrompt + public readonly struct ResultPrompt { /// /// Create a ResultPrompt diff --git a/Src/Controls/SelectColletion/IControlMultiSelect.cs b/Src/Controls/SelectColletion/IControlMultiSelect.cs index f2de5a3d..dda37ef4 100644 --- a/Src/Controls/SelectColletion/IControlMultiSelect.cs +++ b/Src/Controls/SelectColletion/IControlMultiSelect.cs @@ -47,7 +47,7 @@ public interface IControlMultiSelect : IPromptControls> IControlMultiSelect AppendGroupOnDescription(); /// - /// Add default value seleted to initial list. + /// Add default value selected to initial list. /// /// Value default /// @@ -69,7 +69,7 @@ public interface IControlMultiSelect : IPromptControls> IControlMultiSelect OrderByDescending(Expression> value); /// - /// Overwrite defaults start seleted value with last result saved on history. + /// Overwrite defaults start selected value with last result saved on history. /// /// name of file to save history /// The timeout for valid items saved. Default value is 365 days @@ -175,7 +175,7 @@ public interface IControlMultiSelect : IPromptControls> IControlMultiSelect EqualItems(Func comparer); /// - /// Defines a minimum and maximum (optional) range of items seleted in the list + /// Defines a minimum and maximum (optional) range of items selected in the list /// /// Minimum number of items /// Maximum number of items diff --git a/Src/Controls/SelectColletion/IControlSelect.cs b/Src/Controls/SelectColletion/IControlSelect.cs index c214fb17..2fe2f364 100644 --- a/Src/Controls/SelectColletion/IControlSelect.cs +++ b/Src/Controls/SelectColletion/IControlSelect.cs @@ -33,14 +33,14 @@ public interface IControlSelect : IPromptControls IControlSelect Config(Action context); /// - /// Default value seleted. + /// Default value selected. /// /// Value default /// IControlSelect Default(T value); /// - /// Overwrite defaults start seleted value with last result saved on history. + /// Overwrite defaults start selected value with last result saved on history. /// /// name of file to save history /// The timeout for valid items saved. Default value is 365 days diff --git a/Src/Controls/SelectColletion/MultiSelectControl.cs b/Src/Controls/SelectColletion/MultiSelectControl.cs index b5821b7d..1448ad83 100644 --- a/Src/Controls/SelectColletion/MultiSelectControl.cs +++ b/Src/Controls/SelectColletion/MultiSelectControl.cs @@ -39,24 +39,15 @@ public override string InitControl(CancellationToken cancellationToken) if (typeof(T).IsEnum) { - if (_options.TextSelector == null) - { - _options.TextSelector = EnumDisplay; - } + _options.TextSelector ??= EnumDisplay; AddEnum(); } else { - if (_options.TextSelector == null) - { - _options.TextSelector = (item) => item.ToString(); - } + _options.TextSelector ??= (item) => item.ToString(); } - if (_options.EqualItems == null) - { - _options.EqualItems = (item1, item2) => item1.Equals(item2); - } + _options.EqualItems ??= (item1, item2) => item1.Equals(item2); foreach (var item in _options.Items.Where(x => !x.IsGroupHeader)) { @@ -111,7 +102,7 @@ public override string InitControl(CancellationToken cancellationToken) foundmark = _options.Items.Where(x => !x.IsGroupHeader && _options.EqualItems(x.Value, item)); foreach (var itemmark in foundmark) { - if (_selectedItems.Count() <= _options.Maximum) + if (_selectedItems.Count <= _options.Maximum) { itemmark.IsCheck = true; } @@ -511,7 +502,15 @@ public override void InputTemplate(ScreenBuffer screenBuffer) } } } - screenBuffer.WriteLinePaginationMultiSelect(_options, _localpaginator.PaginationMessage(), _selectedItems.Count); + if (!_options.OptShowOnlyExistingPagination || _localpaginator.PageCount > 1) + { + screenBuffer.WriteLinePaginationMultiSelect(_options, _localpaginator.PaginationMessage(), _selectedItems.Count); + } + else + { + screenBuffer.NewLine(); + screenBuffer.AddBuffer($"{Messages.Tagged}: {_selectedItems.Count}, ", _options.OptStyleSchema.TaggedInfo(), true); + } } public override void FinishTemplate(ScreenBuffer screenBuffer, IEnumerable result, bool aborted) @@ -607,7 +606,7 @@ public override ResultPrompt> TryResult(CancellationToken cancell } else { - if (!_selectedItems.Select(x => x.Value).Any(x => x.Equals(item.Value))) + if (!_selectedItems.Select(x => x.Value).Any(x => x.Equals(item.Value))) { _selectedItems.Add(item); } @@ -723,7 +722,7 @@ public override ResultPrompt> TryResult(CancellationToken cancell } } } - else if (_filterBuffer.TryAcceptedReadlineConsoleKey(keyInfo.Value)) + else if (_options.FilterType != FilterMode.Disabled && _filterBuffer.TryAcceptedReadlineConsoleKey(keyInfo.Value)) { _localpaginator.UpdateFilter(_filterBuffer.ToString()); } diff --git a/Src/Controls/SelectColletion/ScreenBufferMultiSelect.cs b/Src/Controls/SelectColletion/ScreenBufferMultiSelect.cs index fdef6bec..5f745518 100644 --- a/Src/Controls/SelectColletion/ScreenBufferMultiSelect.cs +++ b/Src/Controls/SelectColletion/ScreenBufferMultiSelect.cs @@ -18,7 +18,7 @@ public static void WriteFilterMultiSelect(this ScreenBuffer screenBuffer, Mul { screenBuffer.WriteAnswer(options, input.Substring(0, filter.Length)); screenBuffer.SaveCursor(); - screenBuffer.WriteSugestion(options, input.Substring(filter.Length)); + screenBuffer.WriteSuggestion(options, input.Substring(filter.Length)); } else { @@ -35,7 +35,7 @@ public static void WriteFilterMultiSelect(this ScreenBuffer screenBuffer, Mul foreach (var itempart in parts) { pos++; - screenBuffer.WriteSugestion(options, itempart); + screenBuffer.WriteSuggestion(options, itempart); if (first) { first = false; @@ -196,7 +196,7 @@ private static string DefaultToolTipMultiSelect(MultiSelectOptions options return string.Format("{0}, {1}, {2}, {3}\n{4}, {5}, {6}, {7}", string.Format(Messages.TooltipToggle, options.Config.TooltipKeyPress), string.Format(Messages.TooltipCancelEsc, options.Config.AbortKeyPress), - Messages.MultiSelectFisnishEnter, + Messages.MultiSelectFinishEnter, Messages.TooltipPages, Messages.TooltipSelectFilter, Messages.TooltipPressSpace, @@ -207,7 +207,7 @@ private static string DefaultToolTipMultiSelect(MultiSelectOptions options { return string.Format("{0}, {1}, {2}\n{3}, {4}, {5}, {6}", string.Format(Messages.TooltipToggle, options.Config.TooltipKeyPress), - Messages.MultiSelectFisnishEnter, + Messages.MultiSelectFinishEnter, Messages.TooltipPages, Messages.TooltipSelectFilter, Messages.TooltipPressSpace, diff --git a/Src/Controls/SelectColletion/ScreenBufferSelect.cs b/Src/Controls/SelectColletion/ScreenBufferSelect.cs index eeb93d6d..b822c690 100644 --- a/Src/Controls/SelectColletion/ScreenBufferSelect.cs +++ b/Src/Controls/SelectColletion/ScreenBufferSelect.cs @@ -18,7 +18,7 @@ public static void WriteFilterSelect(this ScreenBuffer screenBuffer, SelectOp { screenBuffer.WriteAnswer(options, input.Substring(0, filter.Length)); screenBuffer.SaveCursor(); - screenBuffer.WriteSugestion(options, input.Substring(filter.Length)); + screenBuffer.WriteSuggestion(options, input.Substring(filter.Length)); } else { @@ -41,7 +41,7 @@ public static void WriteFilterSelect(this ScreenBuffer screenBuffer, SelectOp foreach (var itempart in parts) { pos++; - screenBuffer.WriteSugestion(options, itempart); + screenBuffer.WriteSuggestion(options, itempart); if (pos < parts.Length) { screenBuffer.WriteAnswer(options, filter.ToString()); @@ -87,7 +87,7 @@ public static void WriteEmptyFilter(this ScreenBuffer screenBuffer, BaseOptions public static void WriteLineDescriptionSelect(this ScreenBuffer screenBuffer, SelectOptions options, ItemSelect input) { var result = options.OptDescription; - if (options.DescriptionSelector != null) + if (options.DescriptionSelector != null && input != null) { result = options.DescriptionSelector.Invoke(input.Value); } @@ -124,7 +124,7 @@ private static string DefaultToolTipSelect(SelectOptions options) return string.Format("{0}, {1}, {2}\n{3}, {4}", string.Format(Messages.TooltipToggle, options.Config.TooltipKeyPress), string.Format(Messages.TooltipCancelEsc, options.Config.AbortKeyPress), - Messages.SelectFisnishEnter, + Messages.SelectFinishEnter, Messages.TooltipPages, Messages.TooltipSelectFilter); } @@ -132,7 +132,7 @@ private static string DefaultToolTipSelect(SelectOptions options) { return string.Format("{0}, {1}\n{2}, {3}", string.Format(Messages.TooltipToggle, options.Config.TooltipKeyPress), - Messages.SelectFisnishEnter, + Messages.SelectFinishEnter, Messages.TooltipPages, Messages.TooltipSelectFilter); } diff --git a/Src/Controls/SelectColletion/SelectControl.cs b/Src/Controls/SelectColletion/SelectControl.cs index 6655723c..653e6a9d 100644 --- a/Src/Controls/SelectColletion/SelectControl.cs +++ b/Src/Controls/SelectColletion/SelectControl.cs @@ -320,7 +320,10 @@ public override void InputTemplate(ScreenBuffer screenBuffer) } } } - screenBuffer.WriteLinePagination(_options, _localpaginator.PaginationMessage()); + if (!_options.OptShowOnlyExistingPagination || _localpaginator.PageCount > 1) + { + screenBuffer.WriteLinePagination(_options, _localpaginator.PaginationMessage()); + } } public override void FinishTemplate(ScreenBuffer screenBuffer, T result, bool aborted) @@ -369,7 +372,7 @@ public override ResultPrompt TryResult(CancellationToken cancellationToken) { continue; } - else if (_filterBuffer.TryAcceptedReadlineConsoleKey(keyInfo.Value)) + else if (_options.FilterType != FilterMode.Disabled && _filterBuffer.TryAcceptedReadlineConsoleKey(keyInfo.Value)) { _localpaginator.UpdateFilter(_filterBuffer.ToString()); if (_localpaginator.Count == 1 && !_localpaginator.IsUnSelected && _options.AutoSelect) diff --git a/Src/Controls/Slider/IControlSliderSwitch.cs b/Src/Controls/Slider/IControlSliderSwitch.cs index eee04d97..9a461e0e 100644 --- a/Src/Controls/Slider/IControlSliderSwitch.cs +++ b/Src/Controls/Slider/IControlSliderSwitch.cs @@ -14,7 +14,7 @@ namespace PPlus.Controls public interface IControlSliderSwitch : IPromptControls { /// - /// Default value for swith + /// Default value for switch /// /// true is 'on', otherwise 'off' /// diff --git a/Src/Controls/Slider/ScreenBufferSliderNumber.cs b/Src/Controls/Slider/ScreenBufferSliderNumber.cs index 00467448..49729fe3 100644 --- a/Src/Controls/Slider/ScreenBufferSliderNumber.cs +++ b/Src/Controls/Slider/ScreenBufferSliderNumber.cs @@ -115,7 +115,7 @@ public static void WritePromptSliderNumber(this ScreenBuffer screenBuffer, Slide screenBuffer.AddBuffer($"{options.OptPrompt}: ", options.OptStyleSchema.Prompt()); if (options.MoveKeyPress == LayoutSliderNumber.UpDown) { - screenBuffer.AddBuffer($"[{options.Minvalue},{options.Maxvalue}] ",options.OptStyleSchema.Sugestion(),true,false); + screenBuffer.AddBuffer($"[{options.Minvalue},{options.Maxvalue}] ",options.OptStyleSchema.Suggestion(),true,false); } } diff --git a/Src/Controls/Slider/SliderBarType.cs b/Src/Controls/Slider/SliderBarType.cs index 6d3524b5..f67f767a 100644 --- a/Src/Controls/Slider/SliderBarType.cs +++ b/Src/Controls/Slider/SliderBarType.cs @@ -1,4 +1,9 @@ -namespace PPlus.Controls +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + +namespace PPlus.Controls { /// /// Represents the Kinds Slider Bar diff --git a/Src/Controls/SpinnersType.cs b/Src/Controls/SpinnersType.cs index 2b75a4ae..b0d3ee81 100644 --- a/Src/Controls/SpinnersType.cs +++ b/Src/Controls/SpinnersType.cs @@ -1,7 +1,8 @@ // ********************************************************************************************************** // MIT LICENCE +// Copyright 2020 Patrik Svensson, Phil Scott, Nils Andresen. +// https://spectreconsole.net // The maintenance and evolution is maintained by the PromptPlus project under MIT license -// This code was based on work from https://github.com/sindresorhus/cli-spinners/blob/master/spinners.json // ********************************************************************************************************** namespace PPlus.Controls diff --git a/Src/Controls/StyleControls.cs b/Src/Controls/StyleControls.cs index 467b0abd..20335736 100644 --- a/Src/Controls/StyleControls.cs +++ b/Src/Controls/StyleControls.cs @@ -23,9 +23,9 @@ public enum StyleControls /// Description, /// - /// Sugestion Region + /// Suggestion Region /// - Sugestion, + Suggestion, /// /// Selected state /// diff --git a/Src/Controls/StyleSchema.cs b/Src/Controls/StyleSchema.cs index 1291004f..a39f8076 100644 --- a/Src/Controls/StyleSchema.cs +++ b/Src/Controls/StyleSchema.cs @@ -18,7 +18,7 @@ public class StyleSchema internal StyleSchema() { - _Styles = Init(); + _Styles = StyleSchema.Init(); } private StyleSchema(Dictionary newtyles) @@ -43,7 +43,7 @@ internal Style GetStyle(StyleControls styleControls) return _Styles[styleControls]; } - internal Dictionary Init() + internal static Dictionary Init() { var auxdic = new Dictionary(); var aux = Enum.GetValues(typeof(StyleControls)).Cast(); @@ -60,7 +60,7 @@ internal Dictionary Init() case StyleControls.Description: auxdic.Add(item, Style.Default.Foreground(ConsoleColor.DarkYellow)); break; - case StyleControls.Sugestion: + case StyleControls.Suggestion: auxdic.Add(item, Style.Default.Foreground(ConsoleColor.Yellow)); break; case StyleControls.Selected: @@ -125,8 +125,8 @@ internal static StyleSchema Clone(StyleSchema source) case StyleControls.Description: auxdic.Add(item, source.Description()); break; - case StyleControls.Sugestion: - auxdic.Add(item, source.Sugestion()); + case StyleControls.Suggestion: + auxdic.Add(item, source.Suggestion()); break; case StyleControls.Selected: auxdic.Add(item, source.Selected()); diff --git a/Src/Controls/StyleSchemaExtensions.cs b/Src/Controls/StyleSchemaExtensions.cs index 8c8423d0..8344a1d9 100644 --- a/Src/Controls/StyleSchemaExtensions.cs +++ b/Src/Controls/StyleSchemaExtensions.cs @@ -39,7 +39,7 @@ public static Style ApplyBackground(this StyleSchema schema, StyleControls style /// /// Get text Prompt. ///
ValueResult Foreground : 'ConsoleColor.White'
- ///
ValueResult Background : same Console Background when setted
+ ///
ValueResult Background : same Console Background when set
///
public static Style Prompt(this StyleSchema schema) { @@ -50,7 +50,7 @@ public static Style Prompt(this StyleSchema schema) /// /// Get text Chart. ///
ValueResult Foreground : 'ConsoleColor.White'
- ///
ValueResult Background : same Console Background when setted
+ ///
ValueResult Background : same Console Background when set
///
public static Style Chart(this StyleSchema schema) { @@ -70,7 +70,7 @@ public static Style Slider(this StyleSchema schema) /// /// Get text Answer. ///
ValueResult Foreground : 'ConsoleColor.Cyan'
- ///
ValueResult Background : same Console Background when setted
+ ///
ValueResult Background : same Console Background when set
///
public static Style Answer(this StyleSchema schema) { @@ -80,7 +80,7 @@ public static Style Answer(this StyleSchema schema) /// /// Get text Description. ///
ValueResult Foreground : 'ConsoleColor.DarkYellow'
- ///
ValueResult Background : same Console Background when setted
+ ///
ValueResult Background : same Console Background when set
///
public static Style Description(this StyleSchema schema) { @@ -89,20 +89,20 @@ public static Style Description(this StyleSchema schema) /// - /// Get text Sugestion. + /// Get text Suggestion. ///
ValueResult Foreground : 'ConsoleColor.Yellow'
- ///
ValueResult Background : same Console Background when setted
+ ///
ValueResult Background : same Console Background when set
///
- public static Style Sugestion(this StyleSchema schema) + public static Style Suggestion(this StyleSchema schema) { - return schema.GetStyle(StyleControls.Sugestion); + return schema.GetStyle(StyleControls.Suggestion); } /// /// Get text Selected. ///
ValueResult Foreground : 'ConsoleColor.Green'
- ///
ValueResult Background : same Console Background when setted
+ ///
ValueResult Background : same Console Background when set
///
public static Style Selected(this StyleSchema schema) { @@ -113,7 +113,7 @@ public static Style Selected(this StyleSchema schema) /// /// Get text UnSelected. ///
ValueResult Foreground : 'ConsoleColor.Gray'
- ///
ValueResult Background : same Console Background when setted
+ ///
ValueResult Background : same Console Background when set
///
public static Style UnSelected(this StyleSchema schema) { @@ -123,7 +123,7 @@ public static Style UnSelected(this StyleSchema schema) /// /// Get text Disabled. ///
ValueResult Foreground : 'ConsoleColor.DarkGray'
- ///
ValueResult Background : same Console Background when setted
+ ///
ValueResult Background : same Console Background when set
///
public static Style Disabled(this StyleSchema schema) { @@ -133,7 +133,7 @@ public static Style Disabled(this StyleSchema schema) /// /// Get text Error. ///
ValueResult Foreground : 'ConsoleColor.Red'
- ///
ValueResult Background : same Console Background when setted
+ ///
ValueResult Background : same Console Background when set
///
public static Style Error(this StyleSchema schema) { @@ -143,7 +143,7 @@ public static Style Error(this StyleSchema schema) /// /// Get text Pagination. ///
ValueResult Foreground : 'ConsoleColor.DarkGray'
- ///
ValueResult Background : same Console Background when setted
+ ///
ValueResult Background : same Console Background when set
///
public static Style Pagination(this StyleSchema schema) { @@ -153,7 +153,7 @@ public static Style Pagination(this StyleSchema schema) /// /// Get text Tagged info. ///
ValueResult Foreground : 'ConsoleColor.DarkYellow'
- ///
ValueResult Background : same Console Background when setted
+ ///
ValueResult Background : same Console Background when set
///
public static Style TaggedInfo(this StyleSchema schema) { @@ -163,7 +163,7 @@ public static Style TaggedInfo(this StyleSchema schema) /// /// Get text Tooltips. ///
ValueResult Foreground : 'ConsoleColor.DarkGray'
- ///
ValueResult Background : same Console Background when setted
+ ///
ValueResult Background : same Console Background when set
///
public static Style Tooltips(this StyleSchema schema) { diff --git a/Src/Controls/SugestionInput.cs b/Src/Controls/SugestionInput.cs index b8251b8a..fa66fc62 100644 --- a/Src/Controls/SugestionInput.cs +++ b/Src/Controls/SugestionInput.cs @@ -6,29 +6,29 @@ namespace PPlus.Controls { /// - /// Represents The Sugestion Input struct. + /// Represents The Suggestion Input struct. /// - public readonly struct SugestionInput + public readonly struct SuggestionInput { /// - /// Create a SugestionInput + /// Create a SuggestionInput /// /// /// Do not use this constructor! /// - public SugestionInput() + public SuggestionInput() { - throw new PromptPlusException("SugestionInput CTOR NotImplemented"); + throw new PromptPlusException("SuggestionInput CTOR NotImplemented"); } - internal SugestionInput(string input, object context) + internal SuggestionInput(string input, object context) { Text = input; Context = context; } /// - /// Get Sugestion Text input + /// Get Suggestion Text input /// public string Text { get; } diff --git a/Src/Controls/SugestionOutput.cs b/Src/Controls/SugestionOutput.cs index aef53e9d..c7d7637d 100644 --- a/Src/Controls/SugestionOutput.cs +++ b/Src/Controls/SugestionOutput.cs @@ -9,46 +9,46 @@ namespace PPlus.Controls { /// - /// Represents The Sugestion output struct. + /// Represents The Suggestion output struct. /// - public struct SugestionOutput + public struct SuggestionOutput { private readonly List _items; /// - /// Create a empty SugestionOutput + /// Create a empty SuggestionOutput /// - public SugestionOutput() + public SuggestionOutput() { _items = new(); } - internal SugestionOutput(IList items) + internal SuggestionOutput(IList items) { _items.AddRange(items); - Sugestions = new ReadOnlyCollection(_items); + Suggestions = new ReadOnlyCollection(_items); } /// - /// Add sugestion + /// Add suggestion /// - /// text sugestion + /// text suggestion public void Add(string value) { _items.Add(value); - Sugestions = new ReadOnlyCollection(_items); + Suggestions = new ReadOnlyCollection(_items); } /// - /// Add Enumerable sugestions + /// Add Enumerable suggestions /// - /// Enumerable text sugestions + /// Enumerable text suggestions public void AddRange(IEnumerable items) { _items.AddRange(items); - Sugestions = new ReadOnlyCollection(_items); + Suggestions = new ReadOnlyCollection(_items); } - internal ReadOnlyCollection Sugestions { get; private set; } + internal ReadOnlyCollection Suggestions { get; private set; } } } diff --git a/Src/Controls/TasksProcess/HideProgressBar.cs b/Src/Controls/TasksProcess/HideProgressBar.cs index 29f9e552..14669589 100644 --- a/Src/Controls/TasksProcess/HideProgressBar.cs +++ b/Src/Controls/TasksProcess/HideProgressBar.cs @@ -8,7 +8,7 @@ namespace PPlus.Controls { /// - /// Represents the elememt to hide on ProgressBar + /// Represents the element to hide on ProgressBar /// [Flags] public enum HideProgressBar diff --git a/Src/Controls/TasksProcess/IControlProgressBar.cs b/Src/Controls/TasksProcess/IControlProgressBar.cs index 658e182e..1f22399b 100644 --- a/Src/Controls/TasksProcess/IControlProgressBar.cs +++ b/Src/Controls/TasksProcess/IControlProgressBar.cs @@ -19,7 +19,7 @@ public interface IControlProgressBar :IPromptControls> { /// /// Hide elements in ProgressBar. Default is Show all elements - ///
For more one element use | separate (Enum Flag)
+ ///
For more one element use '|' separate (Enum Flag)
///
/// element to hide. /// @@ -68,7 +68,7 @@ public interface IControlProgressBar :IPromptControls> ///
/// The /// Style of spinner. - /// Number of mileseconds foreach interation of spinner. Valid only to SpinnersType.custom, otherwise will be ignored + /// Number of mileseconds foreach iteration of spinner. Valid only to SpinnersType.custom, otherwise will be ignored /// IEnumerable values for custom spinner. Valid only to SpinnersType.custom, otherwise will be ignored /// IControlProgressBar Spinner(SpinnersType spinnersType, Style? SpinnerStyle = null, int? speedAnimation = null, IEnumerable? customspinner = null); diff --git a/Src/Controls/TasksProcess/IControlWait.cs b/Src/Controls/TasksProcess/IControlWait.cs index f2160c5a..0e554310 100644 --- a/Src/Controls/TasksProcess/IControlWait.cs +++ b/Src/Controls/TasksProcess/IControlWait.cs @@ -72,7 +72,7 @@ public interface IControlWait : IPromptControls> ///
/// The /// Style of spinner. - /// Number of mileseconds foreach interation of spinner. Valid only to SpinnersType.custom, otherwise will be ignored + /// Number of mileseconds foreach iteration of spinner. Valid only to SpinnersType.custom, otherwise will be ignored /// IEnumerable values for custom spinner. Valid only to SpinnersType.custom, otherwise will be ignored /// IControlWait Spinner(SpinnersType spinnersType, Style? SpinnerStyle = null, int? speedAnimation = null, IEnumerable? customspinner = null); diff --git a/Src/Controls/TasksProcess/ProgressBarControl.cs b/Src/Controls/TasksProcess/ProgressBarControl.cs index 5239d413..069d3e90 100644 --- a/Src/Controls/TasksProcess/ProgressBarControl.cs +++ b/Src/Controls/TasksProcess/ProgressBarControl.cs @@ -608,11 +608,11 @@ private void WriteProgressBar(double value,string handlerdescription, (int Curso cursor = (cursor.CursorLeft, cursor.CursorTop - dif); } } - var offlenght = _options.Witdth - CurrentValueStep(value); - if (offlenght > 0) + var offlength = _options.Witdth - CurrentValueStep(value); + if (offlength > 0) { var top = ConsolePlus.CursorTop; - qtd = ConsolePlus.Write(new string(charbarOff, offlenght), Style.Default.Foreground(_options.OptStyleSchema.Slider().Background)); + qtd = ConsolePlus.Write(new string(charbarOff, offlength), Style.Default.Foreground(_options.OptStyleSchema.Slider().Background)); if (ConsolePlus.IsTerminal && top + qtd >= ConsolePlus.BufferHeight) { var dif = top + qtd - ConsolePlus.BufferHeight; diff --git a/Src/Controls/TasksProcess/WaitControl.cs b/Src/Controls/TasksProcess/WaitControl.cs index dc2c6c1b..a1d4a956 100644 --- a/Src/Controls/TasksProcess/WaitControl.cs +++ b/Src/Controls/TasksProcess/WaitControl.cs @@ -271,7 +271,7 @@ public override void FinishTemplate(ScreenBuffer screenBuffer, ResultWaitProcess } } - private void RunAllTasks(CancellationToken cancelationtoken) + private void RunAllTasks(CancellationToken cancellationtoken) { var i = 0; var timerSpinner = new Stopwatch(); @@ -295,7 +295,7 @@ private void RunAllTasks(CancellationToken cancelationtoken) { samedesc = (firstdesc == _options.States[i].Description); } - if (!cancelationtoken.IsCancellationRequested && !_event.CancelAllNextTasks) + if (!cancellationtoken.IsCancellationRequested && !_event.CancelAllNextTasks) { var act = _options.Steps[i]; using var waitHandle = new AutoResetEvent(false); @@ -310,8 +310,8 @@ private void RunAllTasks(CancellationToken cancelationtoken) tm.Start(); try { - act.Invoke(_event,cancelationtoken); - actsta = cancelationtoken.IsCancellationRequested? TaskStatus.Canceled: TaskStatus.RanToCompletion; + act.Invoke(_event,cancellationtoken); + actsta = cancellationtoken.IsCancellationRequested? TaskStatus.Canceled: TaskStatus.RanToCompletion; } catch (Exception ex) { @@ -360,8 +360,8 @@ private void RunAllTasks(CancellationToken cancelationtoken) break; } } - while (!cancelationtoken.IsCancellationRequested && currentmode == StepMode.Parallel && i < _options.Steps.Count && _options.States[i].StepMode == StepMode.Parallel); - if (cancelationtoken.IsCancellationRequested) + while (!cancellationtoken.IsCancellationRequested && currentmode == StepMode.Parallel && i < _options.Steps.Count && _options.States[i].StepMode == StepMode.Parallel); + if (cancellationtoken.IsCancellationRequested) { for (int pos = 0; i < tasks.Count; i++) { @@ -541,7 +541,7 @@ private void RunAllTasks(CancellationToken cancelationtoken) _promptlines = qtdlines; } timerSpinner.Start(); - var tkspinner = Task.Run(() => ShowSpinner(detailsElapsedTime, timerSpinner, cancelationtoken), CancellationToken.None); + var tkspinner = Task.Run(() => ShowSpinner(detailsElapsedTime, timerSpinner, cancellationtoken), CancellationToken.None); Task.WaitAll(tasks.Select(x => x.Item2).Where(x => !x.IsCompleted).ToArray(), CancellationToken.None); timerSpinner.Stop(); if (!tkspinner.IsCanceled && !tkspinner.IsCompleted) @@ -576,13 +576,13 @@ private void ClearLast() ConsolePlus.SetCursorPosition(_initialCursor.CursorLeft, _initialCursor.CursorTop); } - private void ShowSpinner(List<(int left, int top, Stopwatch sw)> elapsetm, Stopwatch timer, CancellationToken cancelationtoken) + private void ShowSpinner(List<(int left, int top, Stopwatch sw)> elapsetm, Stopwatch timer, CancellationToken cancellationtoken) { - while (timer.IsRunning && !cancelationtoken.IsCancellationRequested) + while (timer.IsRunning && !cancellationtoken.IsCancellationRequested) { var qtdlines = 0; ConsolePlus.SetCursorPosition(_spinnerCursor.CursorLeft,_spinnerCursor.CursorTop); - var spn = _options.Spinner.NextFrame(cancelationtoken); + var spn = _options.Spinner.NextFrame(cancellationtoken); var top = ConsolePlus.CursorTop; var qtd = ConsolePlus.Write($"{spn}", _options.SpinnerStyle, false); //space for ShowElapsedTime diff --git a/Src/Controls/TreeDiagram/BrowserOptions.cs b/Src/Controls/TreeDiagram/BrowserOptions.cs index 8d61ce30..2abb8e53 100644 --- a/Src/Controls/TreeDiagram/BrowserOptions.cs +++ b/Src/Controls/TreeDiagram/BrowserOptions.cs @@ -44,7 +44,7 @@ internal BrowserOptions(StyleSchema styleSchema, ConfigControls config, IConsole public List FixedSelected { get; set; } public int Minimum { get; set; } public int Maximum { get; set; } = int.MaxValue; - public Func ExpressionSeleted { get; set; } + public Func ExpressionSelected { get; set; } public Func ExpressionDisabled { get; set; } public Spinners? Spinner { get; set; } public Style SpinnerStyle { get; set; } diff --git a/Src/Controls/TreeDiagram/IControlMultiSelectBrowser.cs b/Src/Controls/TreeDiagram/IControlMultiSelectBrowser.cs index 6b8cc047..94466969 100644 --- a/Src/Controls/TreeDiagram/IControlMultiSelectBrowser.cs +++ b/Src/Controls/TreeDiagram/IControlMultiSelectBrowser.cs @@ -23,7 +23,7 @@ public interface IControlMultiSelectBrowser : IPromptControls IControlMultiSelectBrowser Range(int minvalue, int? maxvalue = null); /// - /// Default item (fullpath) seleted when started + /// Default item (fullpath) selected when started /// /// fullpath /// @@ -57,7 +57,7 @@ public interface IControlMultiSelectBrowser : IPromptControls ///
/// The /// Style of spinner. - /// Number of mileseconds foreach interation of spinner. Valid only to SpinnersType.custom, otherwise will be ignored + /// Number of mileseconds foreach iteration of spinner. Valid only to SpinnersType.custom, otherwise will be ignored /// IEnumerable values for custom spinner. Valid only to SpinnersType.custom, otherwise will be ignored /// IControlMultiSelectBrowser Spinner(SpinnersType spinnersType, Style? spinnerStyle = null, int? speedAnimation = null, IEnumerable? customspinner = null); diff --git a/Src/Controls/TreeDiagram/IControlSelectBrowser.cs b/Src/Controls/TreeDiagram/IControlSelectBrowser.cs index 924159bb..ce046a13 100644 --- a/Src/Controls/TreeDiagram/IControlSelectBrowser.cs +++ b/Src/Controls/TreeDiagram/IControlSelectBrowser.cs @@ -40,7 +40,7 @@ public interface IControlSelectBrowser : IPromptControls /// /// The /// Style of spinner. - /// Number of mileseconds foreach interation of spinner. Valid only to SpinnersType.custom, otherwise will be ignored + /// Number of mileseconds foreach iteration of spinner. Valid only to SpinnersType.custom, otherwise will be ignored /// IEnumerable values for custom spinner. Valid only to SpinnersType.custom, otherwise will be ignored /// IControlSelectBrowser Spinner(SpinnersType spinnersType, Style? spinnerStyle = null, int? speedAnimation = null, IEnumerable? customspinner = null); @@ -135,7 +135,7 @@ public interface IControlSelectBrowser : IPromptControls IControlSelectBrowser Root(string value, bool expandall = true, Func? validselect = null, Func? setdisabled = null); /// - /// Default item (fullpath) seleted when started + /// Default item (fullpath) selected when started /// /// fullpath /// diff --git a/Src/Controls/TreeDiagram/IControlTreeViewMultiSelect.cs b/Src/Controls/TreeDiagram/IControlTreeViewMultiSelect.cs index 922b024a..eae32775 100644 --- a/Src/Controls/TreeDiagram/IControlTreeViewMultiSelect.cs +++ b/Src/Controls/TreeDiagram/IControlTreeViewMultiSelect.cs @@ -125,7 +125,7 @@ public interface IControlTreeViewMultiSelect : IPromptControls IControlTreeViewMultiSelect AddNode(T Parent, T value); /// - /// Default item node seleted when started + /// Default item node selected when started /// /// value node /// diff --git a/Src/Controls/TreeDiagram/IControlTreeViewSelect.cs b/Src/Controls/TreeDiagram/IControlTreeViewSelect.cs index a3ea75ea..73adcbe2 100644 --- a/Src/Controls/TreeDiagram/IControlTreeViewSelect.cs +++ b/Src/Controls/TreeDiagram/IControlTreeViewSelect.cs @@ -89,7 +89,7 @@ public interface IControlTreeViewSelect : IPromptControls IControlTreeViewSelect AddNode(T Parent, T value); /// - /// Default item node seleted when started + /// Default item node selected when started /// /// value node /// diff --git a/Src/Controls/TreeDiagram/ItemBrowser.cs b/Src/Controls/TreeDiagram/ItemBrowser.cs index 96a7925a..04e297ec 100644 --- a/Src/Controls/TreeDiagram/ItemBrowser.cs +++ b/Src/Controls/TreeDiagram/ItemBrowser.cs @@ -32,7 +32,7 @@ public class ItemBrowser /// - /// Get Length of item. If a folder lenght represents number of item. If file lenght represents the size in bytes + /// Get Length of item. If a folder length represents number of item. If file length represents the size in bytes /// public long Length { get; internal set; } diff --git a/Src/Controls/TreeDiagram/ItemShowTreeView.cs b/Src/Controls/TreeDiagram/ItemShowTreeView.cs index 02f4aeed..4b999cb0 100644 --- a/Src/Controls/TreeDiagram/ItemShowTreeView.cs +++ b/Src/Controls/TreeDiagram/ItemShowTreeView.cs @@ -13,11 +13,11 @@ public ItemShowTreeView() TextItem = string.Empty; TextLines = string.Empty; TextFullpath = string.Empty; - TextSeleted = string.Empty; + TextSelected = string.Empty; TextSize = string.Empty; } public string TextSize { get; set; } - public string TextSeleted { get; set; } + public string TextSelected { get; set; } public string TextLines { get; set; } public string TextItem { get; set; } public string TextFullpath { get; set; } @@ -28,9 +28,9 @@ public string TextFlat { if (!string.IsNullOrEmpty(TextExpand)) { - return $"{TextLines}{TextExpand}{TextSeleted}{TextItem}{TextSize}"; + return $"{TextLines}{TextExpand}{TextSelected}{TextItem}{TextSize}"; } - return $"{TextLines}{TextSeleted}{TextItem}{TextSize}"; + return $"{TextLines}{TextSelected}{TextItem}{TextSize}"; } } } diff --git a/Src/Controls/TreeDiagram/MultiSelectBrowserControl.cs b/Src/Controls/TreeDiagram/MultiSelectBrowserControl.cs index 2d9ed8e8..504f91c3 100644 --- a/Src/Controls/TreeDiagram/MultiSelectBrowserControl.cs +++ b/Src/Controls/TreeDiagram/MultiSelectBrowserControl.cs @@ -28,14 +28,14 @@ internal class MultiSelectBrowserControl : BaseControl, IControlM private Task _taskspinner; private bool _disposed; private bool _loadFolderFinish = true; - private List<(string UniqueId, ItemBrowser value)> _seletedItems; + private List<(string UniqueId, ItemBrowser value)> _selectedItems; private bool _rootExpand = true; public MultiSelectBrowserControl(IConsoleControl console, BrowserOptions options) : base(console, options) { _options = options; _flatnodes = new(); - _seletedItems = new(); + _selectedItems = new(); } @@ -217,7 +217,7 @@ public IControlMultiSelectBrowser Root(string value,bool expandall, Func(_options.ExpressionSeleted) + _browserTreeView = new TreeView(_options.ExpressionSelected) { TextTree = (item) => item.Name }; @@ -488,7 +488,7 @@ public override void InputTemplate(ScreenBuffer screenBuffer) screenBuffer.NewLine(); if (_options.ShowCurrentFullPath) { - screenBuffer.AddBuffer($"{Messages.CurrentSeleted}: {showItem.Value.FullPath}", _options.CurrentFolderStyle, true); + screenBuffer.AddBuffer($"{Messages.CurrentSelected}: {showItem.Value.FullPath}", _options.CurrentFolderStyle, true); } else { @@ -525,8 +525,16 @@ public override void InputTemplate(ScreenBuffer screenBuffer) screenBuffer.WriteLineNotMultiSelectorBrowser(_options, item); } } - } - screenBuffer.WriteLinePaginationMultiSelect(_options, _localpaginator.PaginationMessage(),_seletedItems.Count); + } + if (!_options.OptShowOnlyExistingPagination || _localpaginator.PageCount > 1) + { + screenBuffer.WriteLinePaginationMultiSelect(_options, _localpaginator.PaginationMessage(), _selectedItems.Count); + } + else + { + screenBuffer.NewLine(); + screenBuffer.AddBuffer($"{Messages.Tagged}: {_selectedItems.Count}, ", _options.OptStyleSchema.TaggedInfo(), true); + } } public override ResultPrompt TryResult(CancellationToken cancellationToken) @@ -556,7 +564,7 @@ public override ResultPrompt TryResult(CancellationToken cancella { cancellationToken.WaitHandle.WaitOne(10); } - return new ResultPrompt(_seletedItems.Select(x => x.value).ToArray(), _lnkcts.Token.IsCancellationRequested, true, true, false); + return new ResultPrompt(_selectedItems.Select(x => x.value).ToArray(), _lnkcts.Token.IsCancellationRequested, true, true, false); } do { @@ -607,13 +615,13 @@ public override ResultPrompt TryResult(CancellationToken cancella } else { - var aux = _seletedItems.ToArray(); + var aux = _selectedItems.ToArray(); _browserTreeView.SelectAll(fnode); AddSelectAll(fnode); - if (_seletedItems.Count > _options.Maximum) + if (_selectedItems.Count > _options.Maximum) { _browserTreeView.UnSelectectAll(fnode); - _seletedItems = aux.ToList(); + _selectedItems = aux.ToList(); if (_filterBuffer.Length > 0) { _filterBuffer.Clear(); @@ -632,7 +640,7 @@ public override ResultPrompt TryResult(CancellationToken cancella } else if (keyInfo.Value.IsPressEnterKey()) { - if (_seletedItems.Count < _options.Minimum) + if (_selectedItems.Count < _options.Minimum) { _filterBuffer.Clear(); endinput = false; @@ -644,7 +652,7 @@ public override ResultPrompt TryResult(CancellationToken cancella } break; } - else if (_filterBuffer.TryAcceptedReadlineConsoleKey(keyInfo.Value)) + else if (_options.FilterType != FilterMode.Disabled && _filterBuffer.TryAcceptedReadlineConsoleKey(keyInfo.Value)) { _localpaginator.UpdateFilter(_filterBuffer.ToString()); break; @@ -778,7 +786,7 @@ public override ResultPrompt TryResult(CancellationToken cancella endinput = true; abort = true; } - else if (_seletedItems.Count > _options.Maximum) + else if (_selectedItems.Count > _options.Maximum) { _filterBuffer.Clear(); endinput = false; @@ -794,10 +802,10 @@ public override ResultPrompt TryResult(CancellationToken cancella { notrender = true; } - if (_seletedItems.Any()) + if (_selectedItems.Any()) { - FinishResult = string.Join(", ", _seletedItems.Select(x => x.value.Name)); - return new ResultPrompt(_seletedItems.Select(x => x.value).ToArray(), abort, !endinput, notrender); + FinishResult = string.Join(", ", _selectedItems.Select(x => x.value.Name)); + return new ResultPrompt(_selectedItems.Select(x => x.value).ToArray(), abort, !endinput, notrender); } return new ResultPrompt(Array.Empty(), abort, !endinput, notrender); } @@ -820,12 +828,12 @@ public override void FinalizeControl(CancellationToken cancellationToken) private void RemoveSelectAll(TreeNode node) { - var index = _seletedItems.FindIndex(x => x.UniqueId == node.UniqueId); + var index = _selectedItems.FindIndex(x => x.UniqueId == node.UniqueId); if (index >= 0) { if (!IsFixedSelect(node)) { - _seletedItems.RemoveAt(index); + _selectedItems.RemoveAt(index); } } if (node.Childrens != null) @@ -843,12 +851,12 @@ private void AddSelectAll(TreeNode node) { return; } - var index = _seletedItems.FindIndex(x => x.UniqueId == node.UniqueId); + var index = _selectedItems.FindIndex(x => x.UniqueId == node.UniqueId); if (index < 0) { if (node.IsSelected) { - _seletedItems.Add(new(node.UniqueId, node.Value)); + _selectedItems.Add(new(node.UniqueId, node.Value)); } } if (node.Childrens != null) @@ -923,7 +931,7 @@ private void FistLoadRoot(CancellationToken cancellationToken) TryLoadFolder(true, null, _options.RootFolder, _options.ExpandAll, cancellationToken); if (cancellationToken.IsCancellationRequested) { - _browserTreeView = new TreeView(_options.ExpressionSeleted) + _browserTreeView = new TreeView(_options.ExpressionSelected) { TextTree = (item) => item.Name }; @@ -955,7 +963,7 @@ private ItemShowTreeView ShowItem(TreeNode item) }; if (item.Level == 0) { - result.TextSeleted = item.IsSelected ? $" {_options.Symbol(SymbolType.Selected)} " : $" {_options.Symbol(SymbolType.NotSelect)} "; + result.TextSelected = item.IsSelected ? $" {_options.Symbol(SymbolType.Selected)} " : $" {_options.Symbol(SymbolType.NotSelect)} "; return result; } @@ -1017,7 +1025,7 @@ private ItemShowTreeView ShowItem(TreeNode item) { result.TextLines += itemaux; } - result.TextSeleted = item.IsSelected ? $" {_options.Symbol(SymbolType.Selected)} " : $" {_options.Symbol(SymbolType.NotSelect)} "; + result.TextSelected = item.IsSelected ? $" {_options.Symbol(SymbolType.Selected)} " : $" {_options.Symbol(SymbolType.NotSelect)} "; if (item.Value.IsFolder) { if (_options.ShowSize) @@ -1116,7 +1124,7 @@ private TreeNode TryLoadFolder(bool refresh, TreeNode node.IsDisabled = _options.ExpressionDisabled?.Invoke(node.Value) ?? false; if (!node.IsDisabled) { - node.IsSelected = _options.ExpressionSeleted?.Invoke(node.Value) ?? false; + node.IsSelected = _options.ExpressionSelected?.Invoke(node.Value) ?? false; } if (!node.IsSelected) { @@ -1192,7 +1200,7 @@ private TreeNode TryLoadFolder(bool refresh, TreeNode newnode.IsDisabled = _options.ExpressionDisabled?.Invoke(newnode.Value) ?? false; if (!newnode.IsDisabled) { - newnode.IsSelected = _options.ExpressionSeleted?.Invoke(newnode.Value) ?? false; + newnode.IsSelected = _options.ExpressionSelected?.Invoke(newnode.Value) ?? false; } if (!newnode.IsSelected) { @@ -1218,13 +1226,13 @@ private TreeNode TryLoadFolder(bool refresh, TreeNode } } } - node.UpdateTreeLenght(); + node.UpdateTreeLength(); return node; } private bool IsFixedSelect(TreeNode item) { - if (_options.ExpressionSeleted?.Invoke(item.Value) ?? true) + if (_options.ExpressionSelected?.Invoke(item.Value) ?? true) { return _options.FixedSelected.Any(x => x.Equals(item.Value.FullPath, StringComparison.InvariantCultureIgnoreCase)); } @@ -1235,7 +1243,7 @@ private void InitSelectedNodes() { Optional> defvalue = Optional>.s_empty; var nodeselect = _browserTreeView.Root; - _seletedItems.Clear(); + _selectedItems.Clear(); AddSelectAll(nodeselect); LoadFlatNodes(_browserTreeView.CurrentNode, false); diff --git a/Src/Controls/TreeDiagram/ScreenBufferMultiSelectBrowser.cs b/Src/Controls/TreeDiagram/ScreenBufferMultiSelectBrowser.cs index a915fee0..2dc1d2e0 100644 --- a/Src/Controls/TreeDiagram/ScreenBufferMultiSelectBrowser.cs +++ b/Src/Controls/TreeDiagram/ScreenBufferMultiSelectBrowser.cs @@ -18,7 +18,7 @@ public static void WriteFilterBrowserMultiSelect(this ScreenBuffer screenBuffer, { screenBuffer.WriteAnswer(options, input.Substring(0, filter.Length)); screenBuffer.SaveCursor(); - screenBuffer.WriteSugestion(options, input.Substring(filter.Length)); + screenBuffer.WriteSuggestion(options, input.Substring(filter.Length)); } else { @@ -35,7 +35,7 @@ public static void WriteFilterBrowserMultiSelect(this ScreenBuffer screenBuffer, foreach (var itempart in parts) { pos++; - screenBuffer.WriteSugestion(options, itempart); + screenBuffer.WriteSuggestion(options, itempart); if (first) { first = false; @@ -74,7 +74,7 @@ private static string DefaultToolTipMultiSelectBrowser(BrowserOptions options, I return string.Format("{0}, {1}, {2}, {3} \n{4}, {5}, {6}\n{7}, {8}, {9}", string.Format(Messages.TooltipToggle, options.Config.TooltipKeyPress), string.Format(Messages.TooltipCancelEsc, options.Config.AbortKeyPress), - Messages.MultiSelectFisnishEnter, + Messages.MultiSelectFinishEnter, Messages.TooltipPages, Messages.TooltipSelectFilter, Messages.TooltipPressSpace, @@ -86,7 +86,7 @@ private static string DefaultToolTipMultiSelectBrowser(BrowserOptions options, I return string.Format("{0}, {1}, {2}, {3}\n{4}, {5}, {6}, {7}", string.Format(Messages.TooltipToggle, options.Config.TooltipKeyPress), string.Format(Messages.TooltipCancelEsc, options.Config.AbortKeyPress), - Messages.MultiSelectFisnishEnter, + Messages.MultiSelectFinishEnter, Messages.TooltipPressSpace, string.Format(Messages.TooltipFullPath, options.HotKeyTooltipFullPath), Messages.TooltipPages, @@ -99,7 +99,7 @@ private static string DefaultToolTipMultiSelectBrowser(BrowserOptions options, I { return string.Format("{0}, {1}, {2} {3}\n{4}, {5}, {6}, {7}", string.Format(Messages.TooltipToggle, options.Config.TooltipKeyPress), - Messages.MultiSelectFisnishEnter, + Messages.MultiSelectFinishEnter, Messages.TooltipPages, string.Format(Messages.TooltipFullPath, options.HotKeyTooltipFullPath), Messages.TooltipSelectFilter, @@ -110,7 +110,7 @@ private static string DefaultToolTipMultiSelectBrowser(BrowserOptions options, I } return string.Format("{0}, {1}, {2}\n{3}, {4}, {5}", string.Format(Messages.TooltipToggle, options.Config.TooltipKeyPress), - Messages.MultiSelectFisnishEnter, + Messages.MultiSelectFinishEnter, Messages.TooltipPages, Messages.TooltipSelectFilter, string.Format(Messages.TooltipFullPath, options.HotKeyTooltipFullPath), @@ -140,7 +140,7 @@ public static void WriteLineMultiSelectorBrowser(this ScreenBuffer screenBuffer, screenBuffer.AddBuffer(options.Symbol(SymbolType.Selector), options.OptStyleSchema.Selected(), true); screenBuffer.AddBuffer(' ', Style.Default, true,false); screenBuffer.AddBuffer(data.MessagesNodes.TextLines, options.LineStyle, true,false); - screenBuffer.AddBuffer(data.MessagesNodes.TextSeleted, options.SelectedExpandStyle, true,false); + screenBuffer.AddBuffer(data.MessagesNodes.TextSelected, options.SelectedExpandStyle, true,false); screenBuffer.AddBuffer(data.MessagesNodes.TextExpand, options.SelectedExpandStyle, true,false); if (data.IsRoot) { @@ -166,7 +166,7 @@ public static void WriteLineNotDisabledMultiSelectorBrowser(this ScreenBuffer sc screenBuffer.AddBuffer(options.Symbol(SymbolType.Selector), options.OptStyleSchema.Selected(), true); screenBuffer.AddBuffer(' ', Style.Default, true,false); screenBuffer.AddBuffer(data.MessagesNodes.TextLines, options.LineStyle, true,false); - screenBuffer.AddBuffer(data.MessagesNodes.TextSeleted, options.OptStyleSchema.Disabled(), true,false); + screenBuffer.AddBuffer(data.MessagesNodes.TextSelected, options.OptStyleSchema.Disabled(), true,false); screenBuffer.AddBuffer(data.MessagesNodes.TextExpand, options.OptStyleSchema.Disabled(), true, false); screenBuffer.AddBuffer(data.MessagesNodes.TextItem, options.OptStyleSchema.Disabled(), true,false); screenBuffer.AddBuffer(data.MessagesNodes.TextSize, options.OptStyleSchema.Disabled(), true,false); @@ -178,7 +178,7 @@ public static void WriteLineNotMultiSelectorBrowser(this ScreenBuffer screenBuff screenBuffer.AddBuffer(' ', Style.Default, true); screenBuffer.AddBuffer(' ', Style.Default, true,false); screenBuffer.AddBuffer(data.MessagesNodes.TextLines, options.LineStyle, true,false); - screenBuffer.AddBuffer(data.MessagesNodes.TextSeleted, options.ExpandStyle, true,false); + screenBuffer.AddBuffer(data.MessagesNodes.TextSelected, options.ExpandStyle, true,false); screenBuffer.AddBuffer(data.MessagesNodes.TextExpand, options.ExpandStyle, true,false); if (data.IsRoot) { @@ -204,7 +204,7 @@ public static void WriteLineDisabledNotMultiSelectorBrowser(this ScreenBuffer sc screenBuffer.AddBuffer(' ', Style.Default, true); screenBuffer.AddBuffer(' ', Style.Default, true,false); screenBuffer.AddBuffer(data.MessagesNodes.TextLines, options.LineStyle, true,false); - screenBuffer.AddBuffer(data.MessagesNodes.TextSeleted, options.OptStyleSchema.Disabled(), true,false); + screenBuffer.AddBuffer(data.MessagesNodes.TextSelected, options.OptStyleSchema.Disabled(), true,false); screenBuffer.AddBuffer(data.MessagesNodes.TextExpand, options.OptStyleSchema.Disabled(), true,false); screenBuffer.AddBuffer(data.MessagesNodes.TextItem, options.OptStyleSchema.Disabled(), true,false); screenBuffer.AddBuffer(data.MessagesNodes.TextSize, options.OptStyleSchema.Disabled(), true,false); diff --git a/Src/Controls/TreeDiagram/ScreenBufferMultiSelectTreeView .cs b/Src/Controls/TreeDiagram/ScreenBufferMultiSelectTreeView .cs index eaa6a6d0..4fa2ca2b 100644 --- a/Src/Controls/TreeDiagram/ScreenBufferMultiSelectTreeView .cs +++ b/Src/Controls/TreeDiagram/ScreenBufferMultiSelectTreeView .cs @@ -18,7 +18,7 @@ public static void WriteFilterTreeViewMultiSelect(this ScreenBuffer screenBuf { screenBuffer.WriteAnswer(options, input.Substring(0, filter.Length)); screenBuffer.SaveCursor(); - screenBuffer.WriteSugestion(options, input.Substring(filter.Length)); + screenBuffer.WriteSuggestion(options, input.Substring(filter.Length)); } else { @@ -35,7 +35,7 @@ public static void WriteFilterTreeViewMultiSelect(this ScreenBuffer screenBuf foreach (var itempart in parts) { pos++; - screenBuffer.WriteSugestion(options, itempart); + screenBuffer.WriteSuggestion(options, itempart); if (first) { first = false; @@ -77,7 +77,7 @@ private static string DefaultToolTipDefaultToolTipTreeViewMultiSelect(TreeVie return string.Format("{0}, {1}, {2}, {3}\n{4}, {5}, {6}, {7}", string.Format(Messages.TooltipToggle, options.Config.TooltipKeyPress), string.Format(Messages.TooltipCancelEsc, options.Config.AbortKeyPress), - Messages.SelectFisnishEnter, + Messages.SelectFinishEnter, Messages.TooltipPages, Messages.TooltipSelectFilter, string.Format(Messages.TooltipFullPath, options.HotKeyFullPathNodePress), @@ -87,7 +87,7 @@ private static string DefaultToolTipDefaultToolTipTreeViewMultiSelect(TreeVie return string.Format("{0}, {1}, {2}, {3}\n{4}, {5}", string.Format(Messages.TooltipToggle, options.Config.TooltipKeyPress), string.Format(Messages.TooltipCancelEsc, options.Config.AbortKeyPress), - Messages.SelectFisnishEnter, + Messages.SelectFinishEnter, string.Format(Messages.TooltipFullPath, options.HotKeyFullPathNodePress), Messages.TooltipPages, Messages.TooltipSelectFilter); @@ -98,7 +98,7 @@ private static string DefaultToolTipDefaultToolTipTreeViewMultiSelect(TreeVie { return string.Format("{0}, {1}, {2} {3}\n{4}, {5}, {6}", string.Format(Messages.TooltipToggle, options.Config.TooltipKeyPress), - Messages.SelectFisnishEnter, + Messages.SelectFinishEnter, Messages.TooltipPages, string.Format(Messages.TooltipFullPath, options.HotKeyFullPathNodePress), Messages.TooltipSelectFilter, @@ -108,7 +108,7 @@ private static string DefaultToolTipDefaultToolTipTreeViewMultiSelect(TreeVie } return string.Format("{0}, {1}, {2}\n{3}, {4}", string.Format(Messages.TooltipToggle, options.Config.TooltipKeyPress), - Messages.SelectFisnishEnter, + Messages.SelectFinishEnter, Messages.TooltipPages, Messages.TooltipSelectFilter, string.Format(Messages.TooltipFullPath, options.HotKeyFullPathNodePress)); @@ -121,7 +121,7 @@ public static void WriteLineSelectorTreeViewMultiSelect(this ScreenBuffer scr screenBuffer.AddBuffer(options.Symbol(SymbolType.Selector), options.OptStyleSchema.Selected(), true); screenBuffer.AddBuffer(' ', Style.Default, true,false); screenBuffer.AddBuffer(data.MessagesNodes.TextLines, options.LineStyle, true,false); - screenBuffer.AddBuffer(data.MessagesNodes.TextSeleted, options.SelectedExpandStyle, true, false); + screenBuffer.AddBuffer(data.MessagesNodes.TextSelected, options.SelectedExpandStyle, true, false); screenBuffer.AddBuffer(data.MessagesNodes.TextExpand, options.SelectedExpandStyle, true, false); if (data.IsRoot) { @@ -146,7 +146,7 @@ public static void WriteLineDisabledSelectorTreeViewMultiSelect(this ScreenBu screenBuffer.AddBuffer(options.Symbol(SymbolType.Selector), options.OptStyleSchema.Selected(), true); screenBuffer.AddBuffer(' ', Style.Default, true, false); screenBuffer.AddBuffer(data.MessagesNodes.TextLines, options.LineStyle, true, false); - screenBuffer.AddBuffer(data.MessagesNodes.TextSeleted, options.OptStyleSchema.Disabled(), true,false); + screenBuffer.AddBuffer(data.MessagesNodes.TextSelected, options.OptStyleSchema.Disabled(), true,false); screenBuffer.AddBuffer(data.MessagesNodes.TextExpand, options.OptStyleSchema.Disabled(), true, false); screenBuffer.AddBuffer(data.MessagesNodes.TextItem, options.OptStyleSchema.Disabled(), true, false); } @@ -157,7 +157,7 @@ public static void WriteLineNotSelectorTreeViewMultiSelect(this ScreenBuffer screenBuffer.AddBuffer(' ', Style.Default, true); screenBuffer.AddBuffer(' ', Style.Default, true, false); screenBuffer.AddBuffer(data.MessagesNodes.TextLines, options.LineStyle, true, false); - screenBuffer.AddBuffer(data.MessagesNodes.TextSeleted, options.ExpandStyle, true, false); + screenBuffer.AddBuffer(data.MessagesNodes.TextSelected, options.ExpandStyle, true, false); screenBuffer.AddBuffer(data.MessagesNodes.TextExpand, options.ExpandStyle, true, false); if (data.IsRoot) { @@ -182,7 +182,7 @@ public static void WriteLineDisabledNotSelectorTreeViewMultiSelect(this Scree screenBuffer.AddBuffer(' ', Style.Default, true); screenBuffer.AddBuffer(' ', Style.Default, true,false); screenBuffer.AddBuffer(data.MessagesNodes.TextLines, options.LineStyle, true, false); - screenBuffer.AddBuffer(data.MessagesNodes.TextSeleted, options.OptStyleSchema.Disabled(), true, false); + screenBuffer.AddBuffer(data.MessagesNodes.TextSelected, options.OptStyleSchema.Disabled(), true, false); screenBuffer.AddBuffer(data.MessagesNodes.TextExpand, options.OptStyleSchema.Disabled(), true, false); screenBuffer.AddBuffer(data.MessagesNodes.TextItem, options.OptStyleSchema.Disabled(), true, false); } diff --git a/Src/Controls/TreeDiagram/ScreenBufferSelectBrowser.cs b/Src/Controls/TreeDiagram/ScreenBufferSelectBrowser.cs index b8cadf38..8cbc1c29 100644 --- a/Src/Controls/TreeDiagram/ScreenBufferSelectBrowser.cs +++ b/Src/Controls/TreeDiagram/ScreenBufferSelectBrowser.cs @@ -18,7 +18,7 @@ public static void WriteFilterBrowserSelect(this ScreenBuffer screenBuffer, Brow { screenBuffer.WriteAnswer(options, input.Substring(0, filter.Length)); screenBuffer.SaveCursor(); - screenBuffer.WriteSugestion(options, input.Substring(filter.Length)); + screenBuffer.WriteSuggestion(options, input.Substring(filter.Length)); } else { @@ -35,7 +35,7 @@ public static void WriteFilterBrowserSelect(this ScreenBuffer screenBuffer, Brow foreach (var itempart in parts) { pos++; - screenBuffer.WriteSugestion(options, itempart); + screenBuffer.WriteSuggestion(options, itempart); if (first) { first = false; @@ -77,7 +77,7 @@ private static string DefaultToolTipSelectBrowser(BrowserOptions options, ItemTr return string.Format("{0}, {1}, {2}, {3}\n{4}, {5}, {6}, {7}", string.Format(Messages.TooltipToggle, options.Config.TooltipKeyPress), string.Format(Messages.TooltipCancelEsc, options.Config.AbortKeyPress), - Messages.SelectFisnishEnter, + Messages.SelectFinishEnter, Messages.TooltipPages, Messages.TooltipSelectFilter, string.Format(Messages.TooltipFullPath, options.HotKeyTooltipFullPath), @@ -87,7 +87,7 @@ private static string DefaultToolTipSelectBrowser(BrowserOptions options, ItemTr return string.Format("{0}, {1}, {2}, {3}\n{4}, {5}", string.Format(Messages.TooltipToggle, options.Config.TooltipKeyPress), string.Format(Messages.TooltipCancelEsc, options.Config.AbortKeyPress), - Messages.SelectFisnishEnter, + Messages.SelectFinishEnter, string.Format(Messages.TooltipFullPath, options.HotKeyTooltipFullPath), Messages.TooltipPages, Messages.TooltipSelectFilter); @@ -98,7 +98,7 @@ private static string DefaultToolTipSelectBrowser(BrowserOptions options, ItemTr { return string.Format("{0}, {1}, {2} {3}\n{4}, {5}, {6}", string.Format(Messages.TooltipToggle, options.Config.TooltipKeyPress), - Messages.SelectFisnishEnter, + Messages.SelectFinishEnter, Messages.TooltipPages, string.Format(Messages.TooltipFullPath, options.HotKeyTooltipFullPath), Messages.TooltipSelectFilter, @@ -108,7 +108,7 @@ private static string DefaultToolTipSelectBrowser(BrowserOptions options, ItemTr } return string.Format("{0}, {1}, {2}\n{3}, {4}", string.Format(Messages.TooltipToggle, options.Config.TooltipKeyPress), - Messages.SelectFisnishEnter, + Messages.SelectFinishEnter, Messages.TooltipPages, Messages.TooltipSelectFilter, string.Format(Messages.TooltipFullPath, options.HotKeyTooltipFullPath)); diff --git a/Src/Controls/TreeDiagram/ScreenBufferSelectTreeView.cs b/Src/Controls/TreeDiagram/ScreenBufferSelectTreeView.cs index 3b41ff79..742c04e8 100644 --- a/Src/Controls/TreeDiagram/ScreenBufferSelectTreeView.cs +++ b/Src/Controls/TreeDiagram/ScreenBufferSelectTreeView.cs @@ -18,7 +18,7 @@ public static void WriteFilterTreeViewSelect(this ScreenBuffer screenBuffer, { screenBuffer.WriteAnswer(options, input.Substring(0, filter.Length)); screenBuffer.SaveCursor(); - screenBuffer.WriteSugestion(options, input.Substring(filter.Length)); + screenBuffer.WriteSuggestion(options, input.Substring(filter.Length)); } else { @@ -35,7 +35,7 @@ public static void WriteFilterTreeViewSelect(this ScreenBuffer screenBuffer, foreach (var itempart in parts) { pos++; - screenBuffer.WriteSugestion(options, itempart); + screenBuffer.WriteSuggestion(options, itempart); if (first) { first = false; @@ -77,7 +77,7 @@ private static string DefaultToolTipDefaultToolTipTreeViewSelect(TreeViewOpti return string.Format("{0}, {1}, {2}, {3}\n{4}, {5}, {6}, {7}", string.Format(Messages.TooltipToggle, options.Config.TooltipKeyPress), string.Format(Messages.TooltipCancelEsc, options.Config.AbortKeyPress), - Messages.SelectFisnishEnter, + Messages.SelectFinishEnter, Messages.TooltipPages, Messages.TooltipSelectFilter, string.Format(Messages.TooltipFullPath, options.HotKeyFullPathNodePress), @@ -87,7 +87,7 @@ private static string DefaultToolTipDefaultToolTipTreeViewSelect(TreeViewOpti return string.Format("{0}, {1}, {2}, {3}\n{4}, {5}", string.Format(Messages.TooltipToggle, options.Config.TooltipKeyPress), string.Format(Messages.TooltipCancelEsc, options.Config.AbortKeyPress), - Messages.SelectFisnishEnter, + Messages.SelectFinishEnter, string.Format(Messages.TooltipFullPath, options.HotKeyFullPathNodePress), Messages.TooltipPages, Messages.TooltipSelectFilter); @@ -98,7 +98,7 @@ private static string DefaultToolTipDefaultToolTipTreeViewSelect(TreeViewOpti { return string.Format("{0}, {1}, {2} {3}\n{4}, {5}, {6}", string.Format(Messages.TooltipToggle, options.Config.TooltipKeyPress), - Messages.SelectFisnishEnter, + Messages.SelectFinishEnter, Messages.TooltipPages, string.Format(Messages.TooltipFullPath, options.HotKeyFullPathNodePress), Messages.TooltipSelectFilter, @@ -108,7 +108,7 @@ private static string DefaultToolTipDefaultToolTipTreeViewSelect(TreeViewOpti } return string.Format("{0}, {1}, {2}\n{3}, {4}", string.Format(Messages.TooltipToggle, options.Config.TooltipKeyPress), - Messages.SelectFisnishEnter, + Messages.SelectFinishEnter, Messages.TooltipPages, Messages.TooltipSelectFilter, string.Format(Messages.TooltipFullPath, options.HotKeyFullPathNodePress)); diff --git a/Src/Controls/TreeDiagram/SelectBrowserControl.cs b/Src/Controls/TreeDiagram/SelectBrowserControl.cs index 9eb96796..2ad4546b 100644 --- a/Src/Controls/TreeDiagram/SelectBrowserControl.cs +++ b/Src/Controls/TreeDiagram/SelectBrowserControl.cs @@ -173,7 +173,7 @@ public IControlSelectBrowser PageSize(int value) public IControlSelectBrowser Root(string value, bool expandall = true, Func? validselect = null, Func? setdisabled = null) { _options.RootFolder = value; - _options.ExpressionSeleted = validselect; + _options.ExpressionSelected = validselect; _options.ExpressionDisabled = setdisabled; _options.ExpandAll = expandall; return this; @@ -310,7 +310,7 @@ public override string InitControl(CancellationToken cancellationToken) _ctsesc = new CancellationTokenSource(); _lnkcts = CancellationTokenSource.CreateLinkedTokenSource(_ctsesc.Token, cancellationToken); - _browserTreeView = new TreeView(_options.ExpressionSeleted) + _browserTreeView = new TreeView(_options.ExpressionSelected) { TextTree = (item) => item.Name }; @@ -443,7 +443,7 @@ public override void InputTemplate(ScreenBuffer screenBuffer) screenBuffer.NewLine(); if (_options.ShowCurrentFullPath) { - screenBuffer.AddBuffer($"{Messages.CurrentSeleted}: {showItem.Value.FullPath}", _options.CurrentFolderStyle, true); + screenBuffer.AddBuffer($"{Messages.CurrentSelected}: {showItem.Value.FullPath}", _options.CurrentFolderStyle, true); } else { @@ -481,7 +481,10 @@ public override void InputTemplate(ScreenBuffer screenBuffer) } } } - screenBuffer.WriteLinePagination(_options, _localpaginator.PaginationMessage()); + if (!_options.OptShowOnlyExistingPagination || _localpaginator.PageCount > 1) + { + screenBuffer.WriteLinePagination(_options, _localpaginator.PaginationMessage()); + } } public override ResultPrompt TryResult(CancellationToken cancellationToken) @@ -544,7 +547,7 @@ public override ResultPrompt TryResult(CancellationToken cancellati _localpaginator.Home(); break; } - else if (_filterBuffer.TryAcceptedReadlineConsoleKey(keyInfo.Value)) + else if (_options.FilterType != FilterMode.Disabled && _filterBuffer.TryAcceptedReadlineConsoleKey(keyInfo.Value)) { _localpaginator.UpdateFilter(_filterBuffer.ToString()); break; @@ -560,7 +563,7 @@ public override ResultPrompt TryResult(CancellationToken cancellati } else { - if (!_options.ExpressionSeleted?.Invoke(_localpaginator.SelectedItem.Value) ?? false) + if (!_options.ExpressionSelected?.Invoke(_localpaginator.SelectedItem.Value) ?? false) { SetError(Messages.SelectionInvalid); } @@ -1091,7 +1094,7 @@ private TreeNode TryLoadFolder(bool refresh, TreeNode } } } - node.UpdateTreeLenght(); + node.UpdateTreeLength(); return node; } } diff --git a/Src/Controls/TreeDiagram/TreeViewExtend.cs b/Src/Controls/TreeDiagram/TreeViewExtend.cs index d44fdcb6..1a5069e1 100644 --- a/Src/Controls/TreeDiagram/TreeViewExtend.cs +++ b/Src/Controls/TreeDiagram/TreeViewExtend.cs @@ -83,7 +83,7 @@ public static bool HasAnyNotExpand(this TreeNode node) return null; } - public static void UpdateTreeLenght(this TreeNode node) + public static void UpdateTreeLength(this TreeNode node) { var currentnode = node; while (currentnode.PrevNode != null) diff --git a/Src/Controls/TreeDiagram/TreeViewMultiSelectControl.cs b/Src/Controls/TreeDiagram/TreeViewMultiSelectControl.cs index f5a325ed..5201e6f5 100644 --- a/Src/Controls/TreeDiagram/TreeViewMultiSelectControl.cs +++ b/Src/Controls/TreeDiagram/TreeViewMultiSelectControl.cs @@ -19,13 +19,13 @@ internal class TreeViewMultiSelectControl : BaseControl, IControlTreeVie private Paginator> _localpaginator; private TreeView _browserTreeView = null; private bool _rootExpand = true; - private List<(string UniqueId, string Fullpath, T value)> _seletedItems; + private List<(string UniqueId, string Fullpath, T value)> _selectedItems; public TreeViewMultiSelectControl(IConsoleControl console, TreeViewOptions options) : base(console, options) { _options = options; _flatnodes = new(); - _seletedItems = new(); + _selectedItems = new(); } #region IControlTreeViewMultiSelect @@ -154,13 +154,13 @@ public IControlTreeViewMultiSelect PageSize(int value) public IControlTreeViewMultiSelect RootNode(T value, Func textnode, Func? validselect = null, Func? setdisabled = null, char? separatePath = null, Func uniquenode = null) { _options.TextNode = textnode ?? throw new PromptPlusException("Not have Text-Node to run"); - _options.ExpressionSeleted = validselect; + _options.ExpressionSelected = validselect; _options.ExpressionDisabled = setdisabled; var diabled = _options.ExpressionDisabled?.Invoke(value) ?? false; _options.Nodes = new TreeOption { Disabled = diabled, - Selected = !diabled && (_options.ExpressionSeleted?.Invoke(value) ?? false), + Selected = !diabled && (_options.ExpressionSelected?.Invoke(value) ?? false), Node = value }; if (separatePath.HasValue) @@ -191,7 +191,7 @@ public IControlTreeViewMultiSelect AddNode(T value) _options.Nodes.Childrens = new(); } var diabled = _options.ExpressionDisabled?.Invoke(value) ?? false; - var selected = !diabled && (_options.ExpressionSeleted?.Invoke(value) ?? false); + var selected = !diabled && (_options.ExpressionSelected?.Invoke(value) ?? false); _options.Nodes.Childrens.Add(new TreeOption { Node = value, Disabled = diabled, Selected = selected}); return this; } @@ -205,7 +205,7 @@ public IControlTreeViewMultiSelect AddNode(T parent, T value) var nodeparent = _options.FindNode(null, parent) ?? throw new PromptPlusException("Not found parent node!. Add parent node first!"); nodeparent.Childrens ??= new(); var diabled = _options.ExpressionDisabled?.Invoke(value) ?? false; - var selected = !diabled && (_options.ExpressionSeleted?.Invoke(value) ?? false); + var selected = !diabled && (_options.ExpressionSelected?.Invoke(value) ?? false); nodeparent.Childrens.Add(new TreeOption { Node = value, Disabled = diabled, Selected = selected }); return this; } @@ -289,7 +289,7 @@ public override string InitControl(CancellationToken cancellationToken) throw new PromptPlusException("FixedSelected Count > Maximum Selected"); } - _browserTreeView = new TreeView(_options.ExpressionSeleted) + _browserTreeView = new TreeView(_options.ExpressionSelected) { TextTree = _options.TextNode }; @@ -356,9 +356,9 @@ public override void InputTemplate(ScreenBuffer screenBuffer) { screenBuffer.SaveCursor(); string answer = FinishResult; - if (_seletedItems.Any()) + if (_selectedItems.Any()) { - answer = string.Join(", ", _seletedItems.Select(x => _options.TextNode(x.value))); + answer = string.Join(", ", _selectedItems.Select(x => _options.TextNode(x.value))); } screenBuffer.WriteAnswer(_options, answer); } @@ -375,7 +375,7 @@ public override void InputTemplate(ScreenBuffer screenBuffer) screenBuffer.NewLine(); if (_options.ShowCurrentFulPathNode) { - screenBuffer.AddBuffer($"{Messages.CurrentSeleted}: {showItem.MessagesNodes.TextFullpath}", _options.CurrentNodeStyle); + screenBuffer.AddBuffer($"{Messages.CurrentSelected}: {showItem.MessagesNodes.TextFullpath}", _options.CurrentNodeStyle); } else { @@ -415,7 +415,15 @@ public override void InputTemplate(ScreenBuffer screenBuffer) } } } - screenBuffer.WriteLinePaginationMultiSelect(_options, _localpaginator.PaginationMessage(), _seletedItems.Count); + if (!_options.OptShowOnlyExistingPagination || _localpaginator.PageCount > 1) + { + screenBuffer.WriteLinePaginationMultiSelect(_options, _localpaginator.PaginationMessage(), _selectedItems.Count); + } + else + { + screenBuffer.NewLine(); + screenBuffer.AddBuffer($"{Messages.Tagged}: {_selectedItems.Count}, ", _options.OptStyleSchema.TaggedInfo(), true); + } } public override ResultPrompt TryResult(CancellationToken cancellationToken) @@ -467,13 +475,13 @@ public override ResultPrompt TryResult(CancellationToken cancellationToken) } else { - var aux = _seletedItems.ToArray(); + var aux = _selectedItems.ToArray(); _browserTreeView.SelectAll(fnode); AddSelectAll(fnode); - if (_seletedItems.Count > _options.Maximum) + if (_selectedItems.Count > _options.Maximum) { _browserTreeView.UnSelectectAll(fnode); - _seletedItems = aux.ToList(); + _selectedItems = aux.ToList(); if (_filterBuffer.Length > 0) { _filterBuffer.Clear(); @@ -492,7 +500,7 @@ public override ResultPrompt TryResult(CancellationToken cancellationToken) } else if (keyInfo.Value.IsPressEnterKey()) { - if (_seletedItems.Count < _options.Minimum) + if (_selectedItems.Count < _options.Minimum) { _filterBuffer.Clear(); endinput = false; @@ -504,7 +512,7 @@ public override ResultPrompt TryResult(CancellationToken cancellationToken) } break; } - else if (_filterBuffer.TryAcceptedReadlineConsoleKey(keyInfo.Value)) + else if (_options.FilterType != FilterMode.Disabled && _filterBuffer.TryAcceptedReadlineConsoleKey(keyInfo.Value)) { _localpaginator.UpdateFilter(_filterBuffer.ToString()); break; @@ -598,7 +606,7 @@ public override ResultPrompt TryResult(CancellationToken cancellationToken) endinput = true; abort = true; } - else if (_seletedItems.Count > _options.Maximum) + else if (_selectedItems.Count > _options.Maximum) { _filterBuffer.Clear(); endinput = false; @@ -614,10 +622,10 @@ public override ResultPrompt TryResult(CancellationToken cancellationToken) { notrender = true; } - if (_seletedItems.Any()) + if (_selectedItems.Any()) { - FinishResult = string.Join(", ", _seletedItems.Select(x => _options.TextNode(x.value))); - return new ResultPrompt(_seletedItems.Select(x => x.value).ToArray(), abort, !endinput, notrender); + FinishResult = string.Join(", ", _selectedItems.Select(x => _options.TextNode(x.value))); + return new ResultPrompt(_selectedItems.Select(x => x.value).ToArray(), abort, !endinput, notrender); } return new ResultPrompt(Array.Empty(), abort, !endinput,notrender); } @@ -648,7 +656,7 @@ public override void FinalizeControl(CancellationToken cancellationToken) private bool IsFixedSelect(T item, Func uniquenode) { - if (_options.ExpressionSeleted?.Invoke(item) ?? true) + if (_options.ExpressionSelected?.Invoke(item) ?? true) { if (uniquenode == null) { @@ -803,7 +811,7 @@ private ItemShowTreeView ShowItem(TreeNode item) } if (item.Level == 0) { - result.TextSeleted = item.IsSelected ? $" {_options.Symbol(SymbolType.Selected)} " : $" {_options.Symbol(SymbolType.NotSelect)} "; + result.TextSelected = item.IsSelected ? $" {_options.Symbol(SymbolType.Selected)} " : $" {_options.Symbol(SymbolType.NotSelect)} "; return result; } @@ -861,7 +869,7 @@ private ItemShowTreeView ShowItem(TreeNode item) { auxline[auxline.Length - 1] = _options.Symbol(SymbolType.TreeLinecorner); } - result.TextSeleted = item.IsSelected ? $" {_options.Symbol(SymbolType.Selected)} " : $" {_options.Symbol(SymbolType.NotSelect)} "; + result.TextSelected = item.IsSelected ? $" {_options.Symbol(SymbolType.Selected)} " : $" {_options.Symbol(SymbolType.NotSelect)} "; foreach (var itemaux in auxline) { result.TextLines += itemaux; @@ -896,12 +904,12 @@ private string DefaultFullPath(T value) private void RemoveSelectAll(TreeNode node) { - var index = _seletedItems.FindIndex(x => x.UniqueId == node.UniqueId); + var index = _selectedItems.FindIndex(x => x.UniqueId == node.UniqueId); if (index >= 0) { if (!IsFixedSelect(node.Value, _options.UniqueNode)) { - _seletedItems.RemoveAt(index); + _selectedItems.RemoveAt(index); } } if (node.Childrens != null) @@ -915,12 +923,12 @@ private void RemoveSelectAll(TreeNode node) private void AddSelectAll(TreeNode node) { - var index = _seletedItems.FindIndex(x => x.UniqueId == node.UniqueId); + var index = _selectedItems.FindIndex(x => x.UniqueId == node.UniqueId); if (index < 0) { if (node.IsSelected) { - _seletedItems.Add(new(node.UniqueId, DefaultFullPath(node.Value), node.Value)); + _selectedItems.Add(new(node.UniqueId, DefaultFullPath(node.Value), node.Value)); } } if (node.Childrens != null) diff --git a/Src/Controls/TreeDiagram/TreeViewOptions.cs b/Src/Controls/TreeDiagram/TreeViewOptions.cs index 9d47472c..66dd455f 100644 --- a/Src/Controls/TreeDiagram/TreeViewOptions.cs +++ b/Src/Controls/TreeDiagram/TreeViewOptions.cs @@ -39,7 +39,7 @@ internal TreeViewOptions(StyleSchema styleSchema, ConfigControls config, IConsol public int Minimum { get; set; } public int Maximum { get; set; } = int.MaxValue; public List FixedSelected { get; set; } = new(); - public Func? ExpressionSeleted { get; set; } + public Func? ExpressionSelected { get; set; } public Func? ExpressionDisabled { get; set; } public bool SelectAll { get; set; } public Func SelectAllExpression { get; set; } diff --git a/Src/Controls/TreeDiagram/TreeViewSelectControl.cs b/Src/Controls/TreeDiagram/TreeViewSelectControl.cs index 32d14efc..dc130dd5 100644 --- a/Src/Controls/TreeDiagram/TreeViewSelectControl.cs +++ b/Src/Controls/TreeDiagram/TreeViewSelectControl.cs @@ -111,7 +111,7 @@ public IControlTreeViewSelect PageSize(int value) public IControlTreeViewSelect RootNode(T value, Func textnode, bool expandall = false, Func? validselect = null, Func? setdisabled = null, char? separatePath = null, Func uniquenode = null) { _options.TextNode = textnode ?? throw new PromptPlusException("Not have Text-Node to run"); - _options.ExpressionSeleted = validselect; + _options.ExpressionSelected = validselect; _options.ExpressionDisabled = setdisabled; _options.ExpandAll = expandall; var diabled = _options.ExpressionDisabled?.Invoke(value) ?? false; @@ -235,7 +235,7 @@ public override string InitControl(CancellationToken cancellationToken) throw new PromptPlusException("Not have Childrens nodes to run"); } - _browserTreeView = new TreeView(_options.ExpressionSeleted) + _browserTreeView = new TreeView(_options.ExpressionSelected) { TextTree = _options.TextNode }; @@ -306,7 +306,7 @@ public override void InputTemplate(ScreenBuffer screenBuffer) screenBuffer.NewLine(); if (_options.ShowCurrentFulPathNode) { - screenBuffer.AddBuffer($"{Messages.CurrentSeleted}: {showItem.MessagesNodes.TextFullpath}", _options.CurrentNodeStyle); + screenBuffer.AddBuffer($"{Messages.CurrentSelected}: {showItem.MessagesNodes.TextFullpath}", _options.CurrentNodeStyle); } else { @@ -346,7 +346,10 @@ public override void InputTemplate(ScreenBuffer screenBuffer) } } } - screenBuffer.WriteLinePagination(_options, _localpaginator.PaginationMessage()); + if (!_options.OptShowOnlyExistingPagination || _localpaginator.PageCount > 1) + { + screenBuffer.WriteLinePagination(_options, _localpaginator.PaginationMessage()); + } } public override ResultPrompt TryResult(CancellationToken cancellationToken) @@ -380,7 +383,7 @@ public override ResultPrompt TryResult(CancellationToken cancellationToken) { break; } - else if (_filterBuffer.TryAcceptedReadlineConsoleKey(keyInfo.Value)) + else if (_options.FilterType != FilterMode.Disabled && _filterBuffer.TryAcceptedReadlineConsoleKey(keyInfo.Value)) { _localpaginator.UpdateFilter(_filterBuffer.ToString()); break; @@ -396,7 +399,7 @@ public override ResultPrompt TryResult(CancellationToken cancellationToken) } else { - if (!_options.ExpressionSeleted?.Invoke(_localpaginator.SelectedItem.Value) ?? true) + if (!_options.ExpressionSelected?.Invoke(_localpaginator.SelectedItem.Value) ?? true) { SetError(Messages.SelectionInvalid); } diff --git a/Src/Controls/keyPress/IControlKeyPress.cs b/Src/Controls/keyPress/IControlKeyPress.cs index 7ba234e6..71bbeac0 100644 --- a/Src/Controls/keyPress/IControlKeyPress.cs +++ b/Src/Controls/keyPress/IControlKeyPress.cs @@ -43,7 +43,7 @@ public interface IControlKeyPress : IPromptControls /// /// The /// Style of spinner. - /// Number of mileseconds foreach interation of spinner. Valid only to SpinnersType.custom, otherwise will be ignored + /// Number of mileseconds foreach iteration of spinner. Valid only to SpinnersType.custom, otherwise will be ignored /// IEnumerable value for custom spinner. Valid only to SpinnersType.custom, otherwise will be ignored /// IControlKeyPress Spinner(SpinnersType spinnersType, Style? SpinnerStyle = null, int? speedAnimation = null, IEnumerable? customspinner = null); diff --git a/Src/Drivers/Ansi/AnsiBuilder.cs b/Src/Drivers/Ansi/AnsiBuilder.cs index 62d84b83..b34938ff 100644 --- a/Src/Drivers/Ansi/AnsiBuilder.cs +++ b/Src/Drivers/Ansi/AnsiBuilder.cs @@ -1,7 +1,8 @@ // *************************************************************************************** // MIT LICENCE +// Copyright 2020 Patrik Svensson, Phil Scott, Nils Andresen. +// https://spectreconsole.net // The maintenance and evolution is maintained by the PromptPlus project under MIT license -// This code was based on work from https://github.com/spectreconsole/spectre.console // *************************************************************************************** using System; diff --git a/Src/Drivers/Ansi/AnsiColorBuilder.cs b/Src/Drivers/Ansi/AnsiColorBuilder.cs index 0637f8d4..d969dab2 100644 --- a/Src/Drivers/Ansi/AnsiColorBuilder.cs +++ b/Src/Drivers/Ansi/AnsiColorBuilder.cs @@ -1,7 +1,8 @@ // *************************************************************************************** // MIT LICENCE +// Copyright 2020 Patrik Svensson, Phil Scott, Nils Andresen. +// https://spectreconsole.net // The maintenance and evolution is maintained by the PromptPlus project under MIT license -// This code was based on work from https://github.com/spectreconsole/spectre.console // *************************************************************************************** using System; diff --git a/Src/Drivers/Ansi/AnsiDetector.cs b/Src/Drivers/Ansi/AnsiDetector.cs index bca9aa0c..c006ba78 100644 --- a/Src/Drivers/Ansi/AnsiDetector.cs +++ b/Src/Drivers/Ansi/AnsiDetector.cs @@ -1,7 +1,8 @@ // *************************************************************************************** // MIT LICENCE +// Copyright 2020 Patrik Svensson, Phil Scott, Nils Andresen. +// https://spectreconsole.net // The maintenance and evolution is maintained by the PromptPlus project under MIT license -// This code was based on work from https://github.com/spectreconsole/spectre.console // *************************************************************************************** using System; diff --git a/Src/Drivers/Ansi/AnsiSequences.cs b/Src/Drivers/Ansi/AnsiSequences.cs index 2b1dc720..c38966c0 100644 --- a/Src/Drivers/Ansi/AnsiSequences.cs +++ b/Src/Drivers/Ansi/AnsiSequences.cs @@ -1,7 +1,8 @@ // *************************************************************************************** // MIT LICENCE +// Copyright 2020 Patrik Svensson, Phil Scott, Nils Andresen. +// https://spectreconsole.net // The maintenance and evolution is maintained by the PromptPlus project under MIT license -// This code was based on work from https://github.com/spectreconsole/spectre.console // *************************************************************************************** using System.Linq; diff --git a/Src/Drivers/Color.cs b/Src/Drivers/Color.cs index 472e4915..4d006d7b 100644 --- a/Src/Drivers/Color.cs +++ b/Src/Drivers/Color.cs @@ -1,7 +1,8 @@ // *************************************************************************************** // MIT LICENCE +// Copyright 2020 Patrik Svensson, Phil Scott, Nils Andresen. +// https://spectreconsole.net // The maintenance and evolution is maintained by the PromptPlus project under MIT license -// This code was based on work from https://github.com/spectreconsole/spectre.console // *************************************************************************************** using System; @@ -185,7 +186,7 @@ public static Color FromHtml(string value) { if (value == null || value.Length != 7 || !value.StartsWith("#")) { - throw new PromptPlusException("Invalid Html Color. Lenght must be equal 7 and start with #"); + throw new PromptPlusException("Invalid Html Color. Length must be equal 7 and start with #"); } int RGBint = Convert.ToInt32(value.Substring(1,6), 16); byte localRed = (byte)((RGBint >> 16) & 255); diff --git a/Src/Drivers/ColorExtensions.cs b/Src/Drivers/ColorExtensions.cs index 099ab602..df059652 100644 --- a/Src/Drivers/ColorExtensions.cs +++ b/Src/Drivers/ColorExtensions.cs @@ -1,7 +1,8 @@ // *************************************************************************************** // MIT LICENCE +// Copyright 2020 Patrik Svensson, Phil Scott, Nils Andresen. +// https://spectreconsole.net // The maintenance and evolution is maintained by the PromptPlus project under MIT license -// This code was based on work from https://github.com/spectreconsole/spectre.console // *************************************************************************************** namespace PPlus diff --git a/Src/Drivers/ColorSystem.cs b/Src/Drivers/ColorSystem.cs index ae2ee1d2..ff19ff93 100644 --- a/Src/Drivers/ColorSystem.cs +++ b/Src/Drivers/ColorSystem.cs @@ -1,7 +1,8 @@ // *************************************************************************************** // MIT LICENCE +// Copyright 2020 Patrik Svensson, Phil Scott, Nils Andresen. +// https://spectreconsole.net // The maintenance and evolution is maintained by the PromptPlus project under MIT license -// This code was based on work from https://github.com/spectreconsole/spectre.console // *************************************************************************************** namespace PPlus diff --git a/Src/Drivers/Colors/ColorPalette.cs b/Src/Drivers/Colors/ColorPalette.cs index 1363d2ef..7451b5fa 100644 --- a/Src/Drivers/Colors/ColorPalette.cs +++ b/Src/Drivers/Colors/ColorPalette.cs @@ -1,7 +1,8 @@ // *************************************************************************************** // MIT LICENCE +// Copyright 2020 Patrik Svensson, Phil Scott, Nils Andresen. +// https://spectreconsole.net // The maintenance and evolution is maintained by the PromptPlus project under MIT license -// This code was based on work from https://github.com/spectreconsole/spectre.console // *************************************************************************************** using System; diff --git a/Src/Drivers/Colors/ColorSystemDetector.cs b/Src/Drivers/Colors/ColorSystemDetector.cs index 4bf44b0c..9fc86aeb 100644 --- a/Src/Drivers/Colors/ColorSystemDetector.cs +++ b/Src/Drivers/Colors/ColorSystemDetector.cs @@ -1,7 +1,8 @@ // *************************************************************************************** // MIT LICENCE +// Copyright 2020 Patrik Svensson, Phil Scott, Nils Andresen. +// https://spectreconsole.net // The maintenance and evolution is maintained by the PromptPlus project under MIT license -// This code was based on work from https://github.com/spectreconsole/spectre.console // *************************************************************************************** using System; diff --git a/Src/Drivers/Colors/ColorTable.cs b/Src/Drivers/Colors/ColorTable.cs index e0d2349a..dff84029 100644 --- a/Src/Drivers/Colors/ColorTable.cs +++ b/Src/Drivers/Colors/ColorTable.cs @@ -1,7 +1,8 @@ // *************************************************************************************** // MIT LICENCE +// Copyright 2020 Patrik Svensson, Phil Scott, Nils Andresen. +// https://spectreconsole.net // The maintenance and evolution is maintained by the PromptPlus project under MIT license -// This code was based on work from https://github.com/spectreconsole/spectre.console // *************************************************************************************** using System; diff --git a/Src/Drivers/CursorDirection.cs b/Src/Drivers/CursorDirection.cs index 82e894c7..1b5ab69e 100644 --- a/Src/Drivers/CursorDirection.cs +++ b/Src/Drivers/CursorDirection.cs @@ -1,7 +1,8 @@ // *************************************************************************************** // MIT LICENCE +// Copyright 2020 Patrik Svensson, Phil Scott, Nils Andresen. +// https://spectreconsole.net // The maintenance and evolution is maintained by the PromptPlus project under MIT license -// This code was based on work from https://github.com/spectreconsole/spectre.console // *************************************************************************************** namespace PPlus diff --git a/Src/Drivers/DriveExtensions.cs b/Src/Drivers/DriveExtensions.cs index 420361e3..4f98d9d5 100644 --- a/Src/Drivers/DriveExtensions.cs +++ b/Src/Drivers/DriveExtensions.cs @@ -91,6 +91,11 @@ private static void CurrentDomain_ProcessExit(object? sender, EventArgs e) ResetColor(); } + /// + /// Get/set extra console exception info + /// + public static bool ExtraExceptionInfo { get; set;} + /// /// Reset all config and properties to default values /// @@ -315,7 +320,7 @@ public static ConsoleColor BackgroundColor public static void ResetColor() { _consoledrive.ResetColor(); - _styleschema.Init(); + _styleschema.UpdateBackgoundColor(_consoledrive.BackgroundColor); } /// diff --git a/Src/Drivers/Markup/MarkupToken.cs b/Src/Drivers/Markup/MarkupToken.cs index 78f9eb66..ed7ab84e 100644 --- a/Src/Drivers/Markup/MarkupToken.cs +++ b/Src/Drivers/Markup/MarkupToken.cs @@ -1,9 +1,11 @@ // *************************************************************************************** // MIT LICENCE +// Copyright 2020 Patrik Svensson, Phil Scott, Nils Andresen. +// https://spectreconsole.net // The maintenance and evolution is maintained by the PromptPlus project under MIT license -// This code was based on work from https://github.com/spectreconsole/spectre.console // *************************************************************************************** + namespace PPlus.Drivers.Markup { internal sealed class MarkupToken diff --git a/Src/Drivers/Markup/MarkupTokenKind.cs b/Src/Drivers/Markup/MarkupTokenKind.cs index b31f8de5..e93dcf9c 100644 --- a/Src/Drivers/Markup/MarkupTokenKind.cs +++ b/Src/Drivers/Markup/MarkupTokenKind.cs @@ -1,7 +1,8 @@ // *************************************************************************************** // MIT LICENCE +// Copyright 2020 Patrik Svensson, Phil Scott, Nils Andresen. +// https://spectreconsole.net // The maintenance and evolution is maintained by the PromptPlus project under MIT license -// This code was based on work from https://github.com/spectreconsole/spectre.console // *************************************************************************************** namespace PPlus.Drivers.Markup diff --git a/Src/Drivers/Markup/MarkupTokenizer.cs b/Src/Drivers/Markup/MarkupTokenizer.cs index cef266a7..c875107d 100644 --- a/Src/Drivers/Markup/MarkupTokenizer.cs +++ b/Src/Drivers/Markup/MarkupTokenizer.cs @@ -1,9 +1,11 @@ // *************************************************************************************** // MIT LICENCE +// Copyright 2020 Patrik Svensson, Phil Scott, Nils Andresen. +// https://spectreconsole.net // The maintenance and evolution is maintained by the PromptPlus project under MIT license -// This code was based on work from https://github.com/spectreconsole/spectre.console // *************************************************************************************** + using System; using System.IO; using System.Text; diff --git a/Src/Drivers/Overflow.cs b/Src/Drivers/Overflow.cs index 37b24334..675380e2 100644 --- a/Src/Drivers/Overflow.cs +++ b/Src/Drivers/Overflow.cs @@ -1,7 +1,8 @@ // *************************************************************************************** // MIT LICENCE +// Copyright 2020 Patrik Svensson, Phil Scott, Nils Andresen. +// https://spectreconsole.net // The maintenance and evolution is maintained by the PromptPlus project under MIT license -// This code was based on work from https://github.com/spectreconsole/spectre.console // *************************************************************************************** namespace PPlus diff --git a/Src/Drivers/ReadLineExtension.cs b/Src/Drivers/ReadLineExtension.cs index 6134e38b..8089db04 100644 --- a/Src/Drivers/ReadLineExtension.cs +++ b/Src/Drivers/ReadLineExtension.cs @@ -1,4 +1,9 @@ -using System; +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + +using System; using PPlus.Controls; using PPlus.Controls.Objects; @@ -12,15 +17,15 @@ public static partial class PromptPlus ///
immedy followed by a line feed. The resulting string does not
///
contain the terminating carriage return and/or line feed.
///
- /// The input Max-lenght + /// The input Max-length /// The input /// The user action after each accepted keystroke. Firt param is input text, Second param is relative cursor position of text /// /// The string input value. /// - public static string ReadLineWithEmacs(uint? maxlenght = uint.MaxValue, CaseOptions caseOptions = CaseOptions.Any, Action afteraccept = null) + public static string ReadLineWithEmacs(uint? maxlength = uint.MaxValue, CaseOptions caseOptions = CaseOptions.Any, Action afteraccept = null) { - var _inputBuffer = new EmacsBuffer(caseOptions, null,maxlenght.Value); + var _inputBuffer = new EmacsBuffer(caseOptions, null,maxlength.Value); var endinput = false; var (Left, Top) = GetCursorPosition(); do diff --git a/Src/Drivers/Segment.cs b/Src/Drivers/Segment.cs index 1a6e02e6..e3b887e0 100644 --- a/Src/Drivers/Segment.cs +++ b/Src/Drivers/Segment.cs @@ -1,7 +1,8 @@ // *************************************************************************************** // MIT LICENCE +// Copyright 2020 Patrik Svensson, Phil Scott, Nils Andresen. +// https://spectreconsole.net // The maintenance and evolution is maintained by the PromptPlus project under MIT license -// This code was based on work from https://github.com/spectreconsole/spectre.console // *************************************************************************************** using PPlus.Drivers.Markup; diff --git a/Src/Drivers/Style.cs b/Src/Drivers/Style.cs index 0249ec5b..ce438eea 100644 --- a/Src/Drivers/Style.cs +++ b/Src/Drivers/Style.cs @@ -1,7 +1,8 @@ // *************************************************************************************** // MIT LICENCE +// Copyright 2020 Patrik Svensson, Phil Scott, Nils Andresen. +// https://spectreconsole.net // The maintenance and evolution is maintained by the PromptPlus project under MIT license -// This code was based on work from https://github.com/spectreconsole/spectre.console // *************************************************************************************** using System; diff --git a/Src/Drivers/StyleExtensions.cs b/Src/Drivers/StyleExtensions.cs index f3f7ab62..ac5bf608 100644 --- a/Src/Drivers/StyleExtensions.cs +++ b/Src/Drivers/StyleExtensions.cs @@ -1,7 +1,8 @@ // *************************************************************************************** // MIT LICENCE +// Copyright 2020 Patrik Svensson, Phil Scott, Nils Andresen. +// https://spectreconsole.net // The maintenance and evolution is maintained by the PromptPlus project under MIT license -// This code was based on work from https://github.com/spectreconsole/spectre.console // *************************************************************************************** namespace PPlus diff --git a/Src/Drivers/StyleParser.cs b/Src/Drivers/StyleParser.cs index e58218e3..666f7c0c 100644 --- a/Src/Drivers/StyleParser.cs +++ b/Src/Drivers/StyleParser.cs @@ -1,7 +1,8 @@ // *************************************************************************************** // MIT LICENCE +// Copyright 2020 Patrik Svensson, Phil Scott, Nils Andresen. +// https://spectreconsole.net // The maintenance and evolution is maintained by the PromptPlus project under MIT license -// This code was based on work from https://github.com/spectreconsole/spectre.console // *************************************************************************************** using PPlus.Drivers.Colors; diff --git a/Src/Drivers/TerminalDetector.cs b/Src/Drivers/TerminalDetector.cs index 798493ca..162103c0 100644 --- a/Src/Drivers/TerminalDetector.cs +++ b/Src/Drivers/TerminalDetector.cs @@ -4,6 +4,7 @@ // *************************************************************************************** using System; +using System.Runtime.InteropServices; namespace PPlus.Drivers { @@ -11,8 +12,23 @@ internal class TerminalDetector { public static bool Detect() { + // Not Running on Windows? + if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + return true; + } try { + //windows 11 22H2 + //https://devblogs.microsoft.com/commandline/windows-terminal-is-now-the-default-in-windows-11/ + if (Environment.OSVersion.Version.Build >= 22621) + { + return true; + } + if (Environment.GetEnvironmentVariable("WT_SESSION") != null) + { + return true; + } //if Running over windows legacy console over S.O Windows BufferHeight != WindowHeight return Console.BufferHeight == Console.WindowHeight; } diff --git a/Src/Drivers/UtilExtension.cs b/Src/Drivers/UtilExtension.cs index c223abdf..a52f64cf 100644 --- a/Src/Drivers/UtilExtension.cs +++ b/Src/Drivers/UtilExtension.cs @@ -1,5 +1,7 @@ // *************************************************************************************** // MIT LICENCE +// Copyright 2020 Patrik Svensson, Phil Scott, Nils Andresen. +// https://spectreconsole.net // The maintenance and evolution is maintained by the PromptPlus project under MIT license // *************************************************************************************** diff --git a/Src/Drivers/WriteLineExtensions.cs b/Src/Drivers/WriteLineExtensions.cs index daf3d916..45540f1f 100644 --- a/Src/Drivers/WriteLineExtensions.cs +++ b/Src/Drivers/WriteLineExtensions.cs @@ -1,7 +1,6 @@ // *************************************************************************************** // MIT LICENCE // The maintenance and evolution is maintained by the PromptPlus project under MIT license -// This code was based on work from https://github.com/spectreconsole/spectre.console // *************************************************************************************** using PPlus.Drivers; diff --git a/Src/Exceptions/PromptPlusException.cs b/Src/Exceptions/PromptPlusException.cs index af5dc78b..c75a7f99 100644 --- a/Src/Exceptions/PromptPlusException.cs +++ b/Src/Exceptions/PromptPlusException.cs @@ -1,4 +1,9 @@ -using System; +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + +using System; using System.Runtime.InteropServices; namespace PPlus @@ -17,13 +22,26 @@ private PromptPlusException() : base() /// Represents an exception thrown by PromptPlus /// /// The message for exception - public PromptPlusException(string message) : base(message) + internal PromptPlusException(string message) : base(message) { - Plataform = RuntimeInformation.OSDescription; + Platform = RuntimeInformation.OSDescription; Framework = RuntimeInformation.FrameworkDescription; Version = typeof(PromptPlusException).Assembly.GetName().Version.ToString(); } + /// + /// Represents an exception thrown by PromptPlus + /// + /// The message exception + /// The inner exception + internal PromptPlusException(string message, Exception innerexception) : base(message, innerexception) + { + Platform = RuntimeInformation.OSDescription; + Framework = RuntimeInformation.FrameworkDescription; + Version = typeof(PromptPlusException).Assembly.GetName().Version.ToString(); + } + + /// /// The version of PromptPlus running /// @@ -33,8 +51,21 @@ public PromptPlusException(string message) : base(message) /// public string Framework { get; } /// - /// The Plataform running + /// The Platform running /// - public string Plataform { get; } + public string Platform { get; } + + /// + /// Write string exception + /// + /// The string exception + public override string ToString() + { + if (PromptPlus.ExtraExceptionInfo) + { + return $"{Environment.NewLine} Console/Terminal Inf.: PromptPlus Version:{Version},Framework: {Framework}, Platform{Platform}, IsLegacy: {PromptPlus.IsLegacy}, IsTerminal: {PromptPlus.IsTerminal}, IsUnicodeSupported: {PromptPlus.IsUnicodeSupported}, SupportsAnsi: {PromptPlus.SupportsAnsi},Buffers(Width/Height): {PromptPlus.BufferWidth}/{PromptPlus.BufferHeight},OutputEncoding: {PromptPlus.OutputEncoding.EncodingName},CodePage : {PromptPlus.CodePage}, PadScreen(Left/Right): {PromptPlus.PadLeft}/{PromptPlus.PadRight},Current Buffer: {PromptPlus.CurrentTargetBuffer}, ColorDepth: {PromptPlus.ColorDepth}{Environment.NewLine}{base.ToString()}"; + } + return base.ToString(); + } } } diff --git a/Src/NugetREADME.md b/Src/NugetREADME.md index 6d32043b..846a0c41 100644 --- a/Src/NugetREADME.md +++ b/Src/NugetREADME.md @@ -1,6 +1,6 @@ # **Welcome to PromptPlus** -**Interactive command-line toolkit for .Net core with powerful controls and commands to create professional console applications.** +**Interactive command-line toolkit for .NET Core with powerful controls and commands to create professional console applications.** All controls input/filter (except Masked input) using [**GNU Readline**](https://en.wikipedia.org/wiki/GNU_Readline) Emacs keyboard shortcuts. @@ -8,35 +8,65 @@ PromptPlus **Supports 4/8/24-bit colors** in the terminal with auto-detection of #### [Visit the official page for complete documentation of PromptPlus](https://fracerqueira.github.io/PromptPlus) -**PromptPlus** was developed in c# with the **netstandard2.1**, **.Net 6** and **.Net 7** target frameworks. +**PromptPlus** was developed in C# with the **netstandard2.1**, **.NET 6** and **.NET 7** target frameworks. + +## What's new in V4.0.5 + +- Added new global propety 'ExtraExceptionInfo' to write extra console exception info +- Added new global propety 'DisableToggleTooltip' to disable toggle Tooltip +- Added new global propety 'ShowOnlyExistingPagination' to disable Page information when pagination not exists +- Added new Method DisableToggleTooltip(bool value) to overwrite default DisableToggleTooltip in control +- Added new Method ShowOnlyExistingPagination(bool value) to overwrite default Overwrite default Show pagination only if exists in control +- Added new item to Enum FilterMode : 'Disabled'. This item disable filter feature in coletions +- Improved to not show text prompt when text value is null or empty +- Improved terminal mode detection (for Windows 11 Versions) +- Rebuilt FIGlet to MIT License +- Fixed credits (MIT License Copyright) +- Fixed bug PromptPlus not restore StyleSchema when ResetColor +- Fixed Spell checking (Breaking Changes) + - SugestionInput to SuggestionInput + - Controls: MaskEdit/AddTolist/Input + - SugestionOutput to SuggestionOutput + - Controls: MaskEdit/AddTolist/Input + - MaxLenght to MaxLength + - Controls: AutoComplete/AddTolist/Input + - StyleControls.Sugestion to StyleControls.Suggestion + - StyleSchemaExtensions.Sugestion to StyleSchemaExtensions.Suggestion + - PromptPlusException.Plataform to PromptPlusException.Platform + +**Special thanks to [ividyon](https://github.com/ividyon) for spell checking corrections, all documentation, fixed credits (MIT License Copyright) and wrong method/property names** + +## What's new in V4.0.4 -## Whats news in V4.0.4 - Fixed bug PromptPlus not restore terminal original setting when shutdown application - Fixed bug Autocomplete does not change result when backspace is pressed during search - Added Property CurrentBuffer in console drive to return Current Buffer running (Primary/Secondary) -- Added SwapBuffer command to swith Primary/Secondar buffer (Valid only When console 'ansi' suported) +- Added SwapBuffer command to switch Primary/Secondary buffer (Valid only When console 'ansi' supported) - Renamed 'AlternateScreen' to 'RunOnBuffer'. Now executes a custom action on TargetBuffer and returns to CurrentBuffer - Refactored console drivers initialization, control options initialization - Added auto create Environment 'PromptPlusConvertCodePage' to custom automate convert codepage to unicode-codepage - Default value is = '850;65001' -## Whats news in V4.0.3 +## What's new in V4.0.3 + - New control to switch Alternate screen - Fixed bug Console does not change foreground/background color correctly - Fixed bug Control ProgressBar - - Not show gradient when setted ProgressBarType.Fill + - Not show gradient when set ProgressBarType.Fill - Improve testability of result classes/struct (Internal to public) -## Whats news in V4.0.2 +## What's new in V4.0.2 + - New Control Pipeline - PromptPlus.Pipeline(T startvalue) - Changed WaitControl to take context value in tasks and return context in result - - There are small break-chages + - There are small break-changes - Add Answer key check equals "Yes"/"No" using config values - IsYesResponseKey(this ConsoleKeyInfo keyinfo) - IsNoResponseKey(this ConsoleKeyInfo keyinfo) -## Whats news in V4.0.X +## What's new in V4.0.X + - Fixed duplicate tooltip in calendar - New console engine - Supports 4/8/24-bit colors @@ -103,3 +133,12 @@ Copyright 2021 @ Fernando Cerqueira This project is licensed under the [MIT License](https://github.com/FRACerqueira/PromptPlus/blob/master/LICENSE) + +## **Credits** + +PromptPlus includes code from other software released under the MIT license: + +- [Spectre.Console](https://spectreconsole.net/), Copyright (c) 2020 Patrik Svensson, Phil Scott, Nils Andresen. +- [Sharprompt](https://github.com/shibayan/Sharprompt), Copyright (c) 2019 shibayan. +- [xmldoc2md](https://github.com/FRACerqueira/xmldoc2md), Copyright (c) 2022 Charles de Vandière. +- [FIGlet](https://github.com/auriou/FIGlet), Copyright (c) 2014 Philippe AURIOU diff --git a/Src/PromptPlus.csproj b/Src/PromptPlus.csproj index 6218ec50..362897f5 100644 --- a/Src/PromptPlus.csproj +++ b/Src/PromptPlus.csproj @@ -17,12 +17,12 @@ - + Fernando Cerqueira - Interactive command-line toolkit for .Net core with powerful controls and commands to create professional console applications. + Interactive command-line toolkit for .NET Core with powerful controls and commands to create professional console applications. https://github.com/FRACerqueira/PromptPlus/releases cli;command-line;console;interactive;prompt;terminal;c#;toolkit https://fracerqueira.github.io/PromptPlus @@ -30,7 +30,7 @@ PromptPlus NugetREADME.md https://fracerqueira.github.io/PromptPlus - 4.0.4 + 4.0.5 icon.png © 2021 - Fernando Cerqueira False @@ -142,7 +142,7 @@ - + @@ -159,6 +159,6 @@ - + diff --git a/Src/README.txt b/Src/README.txt index 10af00ab..d8a0a0dd 100644 --- a/Src/README.txt +++ b/Src/README.txt @@ -9,7 +9,7 @@ Welcome to PromptPlus ===================== -Interactive command-line toolkit for .Net core with powerful controls and commands +Interactive command-line toolkit for .NET Core with powerful controls and commands to create professional console applications. All controls input/filter (except Masked input) using **GNU Readline** @@ -23,43 +23,70 @@ https://fracerqueira.github.io/PromptPlus For migrate V3.3 to V4.X see this link: https://fracerqueira.github.io/PromptPlus/migrateversion.html. -PromptPlus was developed in c# with target frameworks: +PromptPlus was developed in C# with target frameworks: - netstandard2.1 - .NET 6 - .NET 7 -*** Whats news in V4.0.4 *** +*** What's new in V4.0.5 *** +---------------------------- +- Added new global propety 'ExtraExceptionInfo' to write extra console exception info +- Added new global propety 'DisableToggleTooltip' to disable toggle Tooltip +- Added new global propety 'ShowOnlyExistingPagination' to disable Page information when pagination not exists +- Added new Method DisableToggleTooltip(bool value) to overwrite default DisableToggleTooltip in control +- Added new Method ShowOnlyExistingPagination(bool value) to overwrite default Overwrite default Show pagination only if exists in control +- Added new item to Enum FilterMode : 'Disabled'. This item disable filter feature in coletions +- Improved to not show text prompt when text value is null or empty +- Improved terminal mode detection (for Windows 11 Versions) +- Rebuilt FIGlet to MIT License +- Fixed credits (MIT License Copyright) +- Fixed bug PromptPlus not restore StyleSchema when ResetColor +- Fixed bug Exception trying to filter Select prompt with description +- Fixed Spell checking (Breaking Changes) + - SugestionInput to SuggestionInput + - Controls: MaskEdit/AddTolist/Input + - SugestionOutput to SuggestionOutput + - Controls: MaskEdit/AddTolist/Input + - MaxLenght to MaxLength + - Controls: AutoComplete/AddTolist/Input + - StyleControls.Sugestion to StyleControls.Suggestion + - StyleSchemaExtensions.Sugestion to StyleSchemaExtensions.Suggestion + - PromptPlusException.Plataform to PromptPlusException.Platform + +Special thanks to ividyon(https://github.com/ividyon) for spell checking corrections, all documentation, fixed credits (MIT License Copyright) and wrong method/property names + +*** What's new in V4.0.4 *** ---------------------------- - Fixed bug PromptPlus not restore terminal original setting when shutdown application - Fixed bug Autocomplete does not change result when backspace is pressed during search - Added Property CurrentBuffer in console drive to return Current Buffer running (Primary/Secondary) -- Added SwapBuffer command to swith Primary/Secondar buffer (Valid only When console 'ansi' suported) +- Added SwapBuffer command to switch Primary/Secondary buffer (Valid only When console 'ansi' supported) - Renamed 'AlternateScreen' to 'RunOnBuffer'. Now executes a custom action on TargetBuffer and returns to CurrentBuffer - Refactored console drivers initialization, control options initialization - Added auto create Environment 'PromptPlusConvertCodePage' to custom automate convert codepage to unicode-codepage - Default value is = '850;65001' -*** Whats news in V4.0.3 *** +*** What's new in V4.0.3 *** --------------------------- - New control to switch Alternate screen - Fixed bug Console does not change foreground/background color correctly - Fixed bug Control ProgressBar - - Not show gradient when setted ProgressBarType.Fill + - Not show gradient when set ProgressBarType.Fill - Improve testability of result classes/struct (Internal to public) -*** Whats news in V4.0.2 *** +*** What's new in V4.0.2 *** --------------------------- - New Control Pipeline - PromptPlus.Pipeline(T startvalue) - Changed WaitControl to take context value in tasks and return context in result - - There are small break-chages + - There are small break-changes - Add Answer key check equals "Yes"/"No" using config values - IsYesResponseKey(this ConsoleKeyInfo keyinfo) - IsNoResponseKey(this ConsoleKeyInfo keyinfo) -*** Whats news in V4.0.X *** +*** What's new in V4.0.X *** ---------------------------- - Fixed duplicate tooltip in calendar - New console engine @@ -126,4 +153,16 @@ var kp = PromptPlus ----------- Copyright 2021 @ Fernando Cerqueira -PromptPlus project is licensed under the the MIT license. \ No newline at end of file +PromptPlus project is licensed under the the MIT license. + + +**Credits** +----------- + +PromptPlus includes code from other software released under the MIT license: + +Spectre.Console(https://spectreconsole.net/), Copyright (c) 2020 Patrik Svensson, Phil Scott, Nils Andresen. +Sharprompt(https://github.com/shibayan/Sharprompt), Copyright (c) 2019 shibayan. +xmldoc2md(https://github.com/FRACerqueira/xmldoc2md), Copyright (c) 2022 Charles de Vandière. +FIGlet(https://github.com/auriou/FIGlet), Copyright (c) 2014 Philippe AURIOU + diff --git a/Src/Resources/PromptPlusResources.Designer.cs b/Src/Resources/PromptPlusResources.Designer.cs index 00a47411..b30ecf57 100644 --- a/Src/Resources/PromptPlusResources.Designer.cs +++ b/Src/Resources/PromptPlusResources.Designer.cs @@ -1,7 +1,6 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -115,11 +114,11 @@ internal static string CurrentFolder { } /// - /// Looks up a localized string similar to Current seleted. + /// Looks up a localized string similar to Current selected. /// - internal static string CurrentSeleted { + internal static string CurrentSelected { get { - return ResourceManager.GetString("CurrentSeleted", resourceCulture); + return ResourceManager.GetString("CurrentSelected", resourceCulture); } } @@ -160,11 +159,11 @@ internal static string Group { } /// - /// Looks up a localized string similar to Enter:Fisnish. + /// Looks up a localized string similar to Enter:Finish. /// - internal static string InputFisnishEnter { + internal static string InputFinishEnter { get { - return ResourceManager.GetString("InputFisnishEnter", resourceCulture); + return ResourceManager.GetString("InputFinishEnter", resourceCulture); } } @@ -367,11 +366,11 @@ internal static string MoveYear { } /// - /// Looks up a localized string similar to Enter:Fisnish, Space:Check/Uncheck. + /// Looks up a localized string similar to Enter:Finish, Space:Check/Uncheck. /// - internal static string MultiSelectFisnishEnter { + internal static string MultiSelectFinishEnter { get { - return ResourceManager.GetString("MultiSelectFisnishEnter", resourceCulture); + return ResourceManager.GetString("MultiSelectFinishEnter", resourceCulture); } } @@ -493,11 +492,11 @@ internal static string PressedKey { } /// - /// Looks up a localized string similar to Enter:Fisnish. + /// Looks up a localized string similar to Enter:Finish. /// - internal static string SelectFisnishEnter { + internal static string SelectFinishEnter { get { - return ResourceManager.GetString("SelectFisnishEnter", resourceCulture); + return ResourceManager.GetString("SelectFinishEnter", resourceCulture); } } @@ -592,7 +591,7 @@ internal static string TooltipChart { } /// - /// Looks up a localized string similar to {0}:Swith view Legdend. + /// Looks up a localized string similar to {0}:Switch view legend. /// internal static string TooltipChartSwitchLegend { get { @@ -601,7 +600,7 @@ internal static string TooltipChartSwitchLegend { } /// - /// Looks up a localized string similar to {0}:Swith order view. + /// Looks up a localized string similar to {0}:Switch order view. /// internal static string TooltipChartSwitchOrder { get { @@ -628,7 +627,7 @@ internal static string TooltipEditItem { } /// - /// Looks up a localized string similar to Enter:Add, Ctrl+Enter:Fisnish. + /// Looks up a localized string similar to Enter:Add, Ctrl+Enter:Finish. /// internal static string TooltipEnterPressList { get { @@ -673,7 +672,7 @@ internal static string TooltipHistoryToggle { } /// - /// Looks up a localized string similar to {0}:Invert Seleted. + /// Looks up a localized string similar to {0}:Invert Selected. /// internal static string TooltipInvertSelectAll { get { @@ -745,20 +744,20 @@ internal static string TooltipSelectFilter { } /// - /// Looks up a localized string similar to Esc:Cancel sugestion. + /// Looks up a localized string similar to Esc:Cancel suggestion. /// - internal static string TooltipSugestionEsc { + internal static string TooltipSuggestionEsc { get { - return ResourceManager.GetString("TooltipSugestionEsc", resourceCulture); + return ResourceManager.GetString("TooltipSuggestionEsc", resourceCulture); } } /// - /// Looks up a localized string similar to Tab/Shift Tab:Sugestions. + /// Looks up a localized string similar to Tab/Shift Tab:Suggestions. /// - internal static string TooltipSugestionToggle { + internal static string TooltipSuggestionToggle { get { - return ResourceManager.GetString("TooltipSugestionToggle", resourceCulture); + return ResourceManager.GetString("TooltipSuggestionToggle", resourceCulture); } } @@ -799,7 +798,7 @@ internal static string TooltipToggleNotes { } /// - /// Looks up a localized string similar to {0}:Swith view password. + /// Looks up a localized string similar to {0}:Switch view password. /// internal static string TooltipViewPassword { get { diff --git a/Src/Resources/PromptPlusResources.pt-BR.resx b/Src/Resources/PromptPlusResources.pt-BR.resx index 0685bebc..9830a0bc 100644 --- a/Src/Resources/PromptPlusResources.pt-BR.resx +++ b/Src/Resources/PromptPlusResources.pt-BR.resx @@ -135,7 +135,7 @@ Pasta corrente - + Selecionado @@ -150,7 +150,7 @@ Grupo - + Enter:Concluir @@ -219,7 +219,7 @@ PgUp/PgDown:Mudar Ano - + Enter:Concluir, Space:Marcar/Desmarcar @@ -261,7 +261,7 @@ Tecla pressionada - + Enter:Concluir @@ -295,7 +295,7 @@ Up/Down/PgUp/PgDown:Mover - {0}:Ver/Esconder legdenda + {0}:Ver/Esconder legenda {0}:Mudar ordenação @@ -342,10 +342,10 @@ Filtro:Dgite um texto para filtrar - + Esc:Cancelar sugestões - + Tab/Shift Tab:Sugestões diff --git a/Src/Resources/PromptPlusResources.resx b/Src/Resources/PromptPlusResources.resx index 1eda5299..e3b40c52 100644 --- a/Src/Resources/PromptPlusResources.resx +++ b/Src/Resources/PromptPlusResources.resx @@ -135,8 +135,8 @@ Current folder - - Current seleted + + Current selected Done @@ -150,8 +150,8 @@ Group - - Enter:Fisnish + + Enter:Finish Invalid Mask @@ -219,8 +219,8 @@ PgUp/PgDown:Change Year - - Enter:Fisnish, Space:Check/Uncheck + + Enter:Finish, Space:Check/Uncheck Maximum item selection({0}) has been exceeded @@ -261,8 +261,8 @@ Pressed key - - Enter:Fisnish + + Enter:Finish Item disabled @@ -295,10 +295,10 @@ Up/Down/PgUp/PgDown:Move - {0}:Swith view Legdend + {0}:Switch view legend - {0}:Swith order view + {0}:Switch order view {0}:Toggle Chart type @@ -307,7 +307,7 @@ {0}:Edit item - Enter:Add, Ctrl+Enter:Fisnish + Enter:Add, Ctrl+Enter:Finish {0}:Toggle Full Path @@ -322,7 +322,7 @@ Down/PgDown:Historic(Min. {0} chars) - {0}:Invert Seleted + {0}:Invert Selected Ordination: {0} @@ -345,11 +345,11 @@ Filter:Enter text to filter the items - - Esc:Cancel sugestion + + Esc:Cancel suggestion - - Tab/Shift Tab:Sugestions + + Tab/Shift Tab:Suggestions {0}:Toggle tooltips @@ -364,7 +364,7 @@ {0}:Toggle Notes - {0}:Swith view password + {0}:Switch view password Press a valid key diff --git a/Template/PromptPlusTemplate/MainAsync.cs b/Template/PromptPlusTemplate/MainAsync.cs new file mode 100644 index 00000000..fcf95b7f --- /dev/null +++ b/Template/PromptPlusTemplate/MainAsync.cs @@ -0,0 +1,81 @@ +using System; +using System.Collections.Generic; +using System.Dynamic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Hosting; +using PPlus; +using PPlus.Controls; + +namespace PromptPlusTemplate +{ + internal class MainAsync + { + private readonly CancellationToken _cancellationToken; + public MainAsync(IHostApplicationLifetime hostApplicationLifetime) + { + //set token to abort promptplus control + _cancellationToken = hostApplicationLifetime.ApplicationStopping; + } + + public async ValueTask Run() + { + PromptPlus.DoubleDash("Choose a option"); + var result = PromptPlus + .Select("") // no show prompt + .AddItem("Opc1") + .AddItem("Opc2") + .AddItem("Opc3") + .FilterType(FilterMode.Disabled) // disable filter feature + .Run(_cancellationToken); + + //check if result is not valid (AKA: Aborted by CTRL+C (_cancellationToken.IsCancellationRequested = true) or [ESC]) + if (result.IsAborted) + { + //abnormal termination + //do anything (Graceful Shutdown) + return await ValueTask.FromResult(-1); + } + //get valid result + var Inputcontent = result.Value; + //do anything with Inputcontent. + + PromptPlus.DoubleDash("Choose a option with overwrite global setting"); + result = PromptPlus + .Select("Seleted") // show prompt + .Config(cfg => + { + cfg.ShowOnlyExistingPagination(false) + .DisableToggleTooltip(false) + .ShowTooltip(true); + }) + .AddItem("Opc1") + .AddItem("Opc2") + .AddItem("Opc3") + .FilterType(FilterMode.Contains) // this is the default filter if this command is omitted + .Run(_cancellationToken); + if (result.IsAborted) + { + //abnormal termination + //do anything (Graceful Shutdown) + return await ValueTask.FromResult(-1); + } + + + + //Check if user Aborted by CTRL+C + //Must be setted Console.CancelKeyPress event.See comment code in Program.cs + //if (_cancellationToken.IsCancellationRequested) + //{ + // do anything (Graceful Shutdown) + // return await ValueTask.FromResult(-1); + //} + + + //Normal termination + return await ValueTask.FromResult(0); + } + } +} diff --git a/Template/PromptPlusTemplate/Program.cs b/Template/PromptPlusTemplate/Program.cs new file mode 100644 index 00000000..ccdd03f1 --- /dev/null +++ b/Template/PromptPlusTemplate/Program.cs @@ -0,0 +1,87 @@ +using System; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.Logging; +using PPlus; + +namespace PromptPlusTemplate +{ + public class Program + { + public static async Task Main(string[] args) + { + using IHost host = Host.CreateDefaultBuilder(args) + .ConfigureAppConfiguration(cfg => + { + cfg.AddCommandLine(args); + }) + .ConfigureServices((context, services) => + { + //add services + services.AddSingleton(); + }) + .ConfigureLogging((context, cfg) => + { + cfg.ClearProviders(); + //add logprovider + }) + .Build(); + + using IServiceScope scope = host.Services.CreateScope(); + + var main = scope.ServiceProvider.GetRequiredService(); + var lt = scope.ServiceProvider.GetRequiredService(); + + //detect ctrl+c and trigger event to stop app (Graceful Shutdown) + Console.CancelKeyPress += (sender, evtarg) => + { + lt.StopApplication(); + evtarg.Cancel = true; + }; + + //initialize PromptPlus + InitConfigPromptPlus(); + + //start Application + int exitcode = -2; + try + { + exitcode = await main.Run(); + } + catch (AggregateException aex) + { + foreach (var ex in aex.InnerExceptions) + { + //do anything + } + } + catch (Exception ex) + { + //do anything + } + + //return to Environment exitcode (0: Normal termination, otherwhise abnormal termination) + Environment.Exit(exitcode); + } + + private static void InitConfigPromptPlus() + { + //******************************************************************* + //Note: Sample(partial) Custom global set Environment for PromptPlus. + //******************************************************************* + + //Note: Disable key [ESC] to abort exec. for all controls. Default value : true + PromptPlus.Config.EnabledAbortKey = false; + + //Note: Hide tooltips at statup for all controls. Default value : true + PromptPlus.Config.ShowTooltip = false; + + //Note: DisableToggle Tooltip. Default value : false + PromptPlus.Config.DisableToggleTooltip = true; + + //Note: Show pagination only if exists. Default value : false + PromptPlus.Config.ShowOnlyExistingPagination = true; + } + } +} \ No newline at end of file diff --git a/Template/PromptPlusTemplate/PromptPlusTemplate.csproj b/Template/PromptPlusTemplate/PromptPlusTemplate.csproj new file mode 100644 index 00000000..5ff9ffad --- /dev/null +++ b/Template/PromptPlusTemplate/PromptPlusTemplate.csproj @@ -0,0 +1,20 @@ + + + + Exe + net7.0 + enable + enable + PromptPlusTemplate.Program + + + + + + + + + + + + diff --git a/UnitTests/AnsiDriverTest/BeepTest.cs b/UnitTests/AnsiDriverTest/BeepTest.cs index c049346f..95abd7b9 100644 --- a/UnitTests/AnsiDriverTest/BeepTest.cs +++ b/UnitTests/AnsiDriverTest/BeepTest.cs @@ -1,4 +1,9 @@ -using PPlus.Tests.Util; +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + +using PPlus.Tests.Util; namespace PPlus.Tests.AnsiDriverTest { diff --git a/UnitTests/AnsiDriverTest/ClearLineTest.cs b/UnitTests/AnsiDriverTest/ClearLineTest.cs index 244f225d..c716f682 100644 --- a/UnitTests/AnsiDriverTest/ClearLineTest.cs +++ b/UnitTests/AnsiDriverTest/ClearLineTest.cs @@ -1,4 +1,9 @@ -using PPlus.Tests.Util; +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + +using PPlus.Tests.Util; namespace PPlus.Tests.AnsiDriverTest { diff --git a/UnitTests/AnsiDriverTest/ClearTest.cs b/UnitTests/AnsiDriverTest/ClearTest.cs index c83deaf3..73798cd6 100644 --- a/UnitTests/AnsiDriverTest/ClearTest.cs +++ b/UnitTests/AnsiDriverTest/ClearTest.cs @@ -1,4 +1,9 @@ -using PPlus.Tests.Util; +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + +using PPlus.Tests.Util; namespace PPlus.Tests.AnsiDriverTest { diff --git a/UnitTests/AnsiDriverTest/Commands/WriteLineExtensionsTest.cs b/UnitTests/AnsiDriverTest/Commands/WriteLineExtensionsTest.cs index a0f2633e..dbdc3f6a 100644 --- a/UnitTests/AnsiDriverTest/Commands/WriteLineExtensionsTest.cs +++ b/UnitTests/AnsiDriverTest/Commands/WriteLineExtensionsTest.cs @@ -1,4 +1,9 @@ -using PPlus.Tests.Util; +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + +using PPlus.Tests.Util; namespace PPlus.Tests.AnsiDriverTest.Commands { diff --git a/UnitTests/AnsiDriverTest/CursorTest.cs b/UnitTests/AnsiDriverTest/CursorTest.cs index c9d4c488..2a962b14 100644 --- a/UnitTests/AnsiDriverTest/CursorTest.cs +++ b/UnitTests/AnsiDriverTest/CursorTest.cs @@ -1,4 +1,9 @@ -using PPlus.Tests.Util; +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + +using PPlus.Tests.Util; namespace PPlus.Tests.AnsiDriverTest { diff --git a/UnitTests/AnsiDriverTest/OverflowStrategy.cs b/UnitTests/AnsiDriverTest/OverflowStrategy.cs index dbd257f2..aa8aa2f9 100644 --- a/UnitTests/AnsiDriverTest/OverflowStrategy.cs +++ b/UnitTests/AnsiDriverTest/OverflowStrategy.cs @@ -1,4 +1,9 @@ -using PPlus.Tests.Util; +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + +using PPlus.Tests.Util; namespace PPlus.Tests.AnsiDriverTest { diff --git a/UnitTests/AnsiDriverTest/PadScreenTest.cs b/UnitTests/AnsiDriverTest/PadScreenTest.cs index 96f20475..b0ea2e69 100644 --- a/UnitTests/AnsiDriverTest/PadScreenTest.cs +++ b/UnitTests/AnsiDriverTest/PadScreenTest.cs @@ -1,4 +1,9 @@ -using PPlus.Tests.Util; +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + +using PPlus.Tests.Util; namespace PPlus.Tests.AnsiDriverTest { diff --git a/UnitTests/AnsiDriverTest/SetInSetIErrorSetOutTest.cs b/UnitTests/AnsiDriverTest/SetInSetIErrorSetOutTest.cs index b0eea321..74c500d0 100644 --- a/UnitTests/AnsiDriverTest/SetInSetIErrorSetOutTest.cs +++ b/UnitTests/AnsiDriverTest/SetInSetIErrorSetOutTest.cs @@ -1,4 +1,9 @@ -using PPlus.Tests.Util; +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + +using PPlus.Tests.Util; namespace PPlus.Tests.AnsiDriverTest { diff --git a/UnitTests/Controls/AddToList/AddToListTests.cs b/UnitTests/Controls/AddToList/AddToListTests.cs index 54c953fb..d5565ebb 100644 --- a/UnitTests/Controls/AddToList/AddToListTests.cs +++ b/UnitTests/Controls/AddToList/AddToListTests.cs @@ -1,4 +1,9 @@ -using PPlus.Controls; +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + +using PPlus.Controls; using PPlus.Controls.Objects; using PPlus.Tests.Util; @@ -6,12 +11,12 @@ namespace PPlus.Tests.Controls.AddToList { public class AddToListTests : BaseTest { - SugestionOutput SugestionInputSample(SugestionInput arg) + SuggestionOutput SuggestionInputSample(SuggestionInput arg) { - var result = new SugestionOutput(); - result.Add("sugestion 1"); - result.Add("sugestion 2"); - result.Add("sugestion 3"); + var result = new SuggestionOutput(); + result.Add("suggestion 1"); + result.Add("suggestion 2"); + result.Add("suggestion 3"); return result; } @@ -263,11 +268,11 @@ public void Should_CtrlEnterEnd() } [Fact] - public void Should_TryResultMaxLenght() + public void Should_TryResultMaxLength() { var ctrl = (ListControl)PromptPlus .AddtoList("P", "D") - .MaxLenght(3); + .MaxLength(3); ctrl.InitControl(CancellationToken.None); CompletesIn(100, () => @@ -405,11 +410,11 @@ public void Should_TryResultAcceptInputUpperCase() } [Fact] - public void Should_TryResulSugestion1() + public void Should_TryResulSuggestion1() { var ctrl = (ListControl)PromptPlus .AddtoList("P", "D") - .SuggestionHandler(SugestionInputSample); + .SuggestionHandler(SuggestionInputSample); ctrl.InitControl(CancellationToken.None); CompletesIn(100, () => @@ -420,16 +425,16 @@ public void Should_TryResulSugestion1() var result = ctrl.TryResult(CancellationToken.None); Assert.False(result.IsAborted); Assert.True(result.IsRunning); - Assert.Equal("sugestion 1", result.Value.First()); + Assert.Equal("suggestion 1", result.Value.First()); }); } [Fact] - public void Should_TryResulSugestion2() + public void Should_TryResulSuggestion2() { var ctrl = (ListControl)PromptPlus .AddtoList("P", "D") - .SuggestionHandler(SugestionInputSample); + .SuggestionHandler(SuggestionInputSample); ctrl.InitControl(CancellationToken.None); CompletesIn(100, () => @@ -440,16 +445,16 @@ public void Should_TryResulSugestion2() var result = ctrl.TryResult(CancellationToken.None); Assert.False(result.IsAborted); Assert.True(result.IsRunning); - Assert.Equal("sugestion 3", result.Value.First()); + Assert.Equal("suggestion 3", result.Value.First()); }); } [Fact] - public void Should_TryResulCancelSugestion() + public void Should_TryResulCancelSuggestion() { var ctrl = (ListControl)PromptPlus .AddtoList("P", "D") - .SuggestionHandler(SugestionInputSample); + .SuggestionHandler(SuggestionInputSample); ctrl.InitControl(CancellationToken.None); CompletesIn(100, () => diff --git a/UnitTests/Controls/AddToListMasked/AddToListMaskedTests.cs b/UnitTests/Controls/AddToListMasked/AddToListMaskedTests.cs index 21996f04..731af2e1 100644 --- a/UnitTests/Controls/AddToListMasked/AddToListMaskedTests.cs +++ b/UnitTests/Controls/AddToListMasked/AddToListMaskedTests.cs @@ -1,4 +1,9 @@ -using System.Globalization; +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + +using System.Globalization; using PPlus.Controls; using PPlus.Controls.Objects; using PPlus.Tests.Util; @@ -7,12 +12,12 @@ namespace PPlus.Tests.Controls.AddToList { public class AddToListMaskedTests : BaseTest { - SugestionOutput SugestionInputSample(SugestionInput arg) + SuggestionOutput SuggestionInputSample(SuggestionInput arg) { - var result = new SugestionOutput(); - result.Add("sugestion 1"); - result.Add("sugestion 2"); - result.Add("sugestion 3"); + var result = new SuggestionOutput(); + result.Add("suggestion 1"); + result.Add("suggestion 2"); + result.Add("suggestion 3"); return result; } @@ -884,12 +889,12 @@ public void Should_TryResultLowercase() } [Fact] - public void Should_TryResulSugestion1() + public void Should_TryResulSuggestion1() { var ctrl = (MaskEditListControl)PromptPlus .AddtoMaskEditList("P", "D") .Mask("A{20}") - .SuggestionHandler(SugestionInputSample); + .SuggestionHandler(SuggestionInputSample); ctrl.InitControl(CancellationToken.None); CompletesIn(100, () => @@ -900,17 +905,17 @@ public void Should_TryResulSugestion1() var result = ctrl.TryResult(CancellationToken.None); Assert.False(result.IsAborted); Assert.True(result.IsRunning); - Assert.Equal("sugestion 1", result.Value.First().Masked); + Assert.Equal("suggestion 1", result.Value.First().Masked); }); } [Fact] - public void Should_TryResulSugestion2() + public void Should_TryResulSuggestion2() { var ctrl = (MaskEditListControl)PromptPlus .AddtoMaskEditList("P", "D") .Mask("A{20}") - .SuggestionHandler(SugestionInputSample); + .SuggestionHandler(SuggestionInputSample); ctrl.InitControl(CancellationToken.None); CompletesIn(100, () => @@ -921,17 +926,17 @@ public void Should_TryResulSugestion2() var result = ctrl.TryResult(CancellationToken.None); Assert.False(result.IsAborted); Assert.True(result.IsRunning); - Assert.Equal("sugestion 3", result.Value.First().Masked); + Assert.Equal("suggestion 3", result.Value.First().Masked); }); } [Fact] - public void Should_TryResulCancelSugestion() + public void Should_TryResulCancelSuggestion() { var ctrl = (MaskEditListControl)PromptPlus .AddtoMaskEditList("P", "D") .Mask("A{20}") - .SuggestionHandler(SugestionInputSample); + .SuggestionHandler(SuggestionInputSample); ctrl.InitControl(CancellationToken.None); CompletesIn(100, () => diff --git a/UnitTests/Controls/Banner/BannerTests.cs b/UnitTests/Controls/Banner/BannerTests.cs index 420fd7dc..82e6aaf9 100644 --- a/UnitTests/Controls/Banner/BannerTests.cs +++ b/UnitTests/Controls/Banner/BannerTests.cs @@ -1,26 +1,19 @@ -using PPlus.Controls; +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + +using PPlus.Controls; using PPlus.Tests.Util; namespace PPlus.Tests.Controls.Banner { public class BannerTests : BaseTest { - [Theory] - [InlineData(CharacterWidth.Full)] - [InlineData(CharacterWidth.Smush)] - [InlineData(CharacterWidth.Fitted)] - public void Should_InitAsciiArtWithNoError(CharacterWidth value) - { - var ctrl = new BannerControl(PromptPlus.Config, PromptPlus._consoledrive, "Test"); - ctrl.FIGletWidth(value); - ctrl.InitAsciiArt(); - } - [Fact] public void Should_LoadFontWithNoError() { var ctrl = new BannerControl(PromptPlus.Config, PromptPlus._consoledrive, "Test"); - ctrl.InitAsciiArt(); ctrl.LoadFont("starwars.flf"); } @@ -28,7 +21,6 @@ public void Should_LoadFontWithNoError() public void Should_LoadFontStreamWithNoError() { var ctrl = new BannerControl(PromptPlus.Config, PromptPlus._consoledrive, "Test"); - ctrl.InitAsciiArt(); using var sr = new FileStream("starwars.flf", FileMode.Open); ctrl.LoadFont(sr); } @@ -52,7 +44,6 @@ public void Should_RunWithNoErrorUnicode(BannerDashOptions value) cfg.IsUnicodeSupported = true; }); var ctrl = new BannerControl(PromptPlus.Config, PromptPlus._consoledrive, "Test"); - ctrl.InitAsciiArt(); ctrl.Run(null, value); } @@ -75,7 +66,6 @@ public void Should_RunWithNoErrorNotUnicode(BannerDashOptions value) cfg.IsUnicodeSupported= false; }); var ctrl = new BannerControl(PromptPlus.Config, PromptPlus._consoledrive, "Test"); - ctrl.InitAsciiArt(); ctrl.Run(null, value); } @@ -89,7 +79,6 @@ public void Should_Runoutput1() var output = PromptPlus.RecordOutput(() => { var ctrl = new BannerControl(PromptPlus.Config, PromptPlus._consoledrive, "Test"); - ctrl.InitAsciiArt(); ctrl.Run(); }); Assert.Equal(Expectations.GetVerifyAnsi("Banner.txt"), output); @@ -106,7 +95,6 @@ public void Should_Runoutput2() var output = PromptPlus.RecordOutput(() => { var ctrl = new BannerControl(PromptPlus.Config, PromptPlus._consoledrive, "Test"); - ctrl.InitAsciiArt(); ctrl.Run(); }); Assert.Equal(Expectations.GetVerifyStd("Banner.txt"), output); diff --git a/UnitTests/Controls/BaseOptionsTests.cs b/UnitTests/Controls/BaseOptionsTests.cs index 2783e235..578dffad 100644 --- a/UnitTests/Controls/BaseOptionsTests.cs +++ b/UnitTests/Controls/BaseOptionsTests.cs @@ -1,4 +1,9 @@ -using PPlus.Controls; +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + +using PPlus.Controls; using PPlus.Tests.Util; namespace PPlus.Tests.Controls diff --git a/UnitTests/Controls/ConfigTests.cs b/UnitTests/Controls/ConfigTests.cs index a75b6450..ba8443f4 100644 --- a/UnitTests/Controls/ConfigTests.cs +++ b/UnitTests/Controls/ConfigTests.cs @@ -1,4 +1,9 @@ -using PPlus.Controls; +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + +using PPlus.Controls; using PPlus.Tests.Util; using System.Globalization; diff --git a/UnitTests/Controls/EastAsianWidthTests.cs b/UnitTests/Controls/EastAsianWidthTests.cs index b8b2731d..306bd6fd 100644 --- a/UnitTests/Controls/EastAsianWidthTests.cs +++ b/UnitTests/Controls/EastAsianWidthTests.cs @@ -1,4 +1,12 @@ -using PPlus.Controls.Objects; +// *************************************************************************************** +// MIT LICENCE +// Copyright (c) 2019 shibayan. +// https://github.com/shibayan/Sharprompt +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + + +using PPlus.Controls.Objects; using PPlus.Tests.Util; namespace PPlus.Tests.Controls diff --git a/UnitTests/Controls/EmacsBufferTests.cs b/UnitTests/Controls/EmacsBufferTests.cs index e16a2cff..4739b313 100644 --- a/UnitTests/Controls/EmacsBufferTests.cs +++ b/UnitTests/Controls/EmacsBufferTests.cs @@ -1,4 +1,9 @@ -using PPlus.Controls.Objects; +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + +using PPlus.Controls.Objects; using PPlus.Tests.Util; namespace PPlus.Tests.Controls @@ -125,7 +130,7 @@ internal void Should_have_accept_Home_and_Rightarrow() } [Fact] - //Emacs keyboard shortcut when when have any text with lenght > 1 + //Emacs keyboard shortcut when when have any text with length > 1 //Transpose the previous two characters internal void Should_have_accept_ctrl_T() { diff --git a/UnitTests/Controls/Input/InputTests.cs b/UnitTests/Controls/Input/InputTests.cs index 5e1b30aa..6bdcc345 100644 --- a/UnitTests/Controls/Input/InputTests.cs +++ b/UnitTests/Controls/Input/InputTests.cs @@ -1,4 +1,9 @@ -using PPlus.Controls; +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + +using PPlus.Controls; using PPlus.Controls.Objects; using PPlus.Tests.Util; @@ -6,12 +11,12 @@ namespace PPlus.Tests.Controls.Input { public class InputTests : BaseTest { - SugestionOutput SugestionInputSample(SugestionInput arg) + SuggestionOutput SuggestionInputSample(SuggestionInput arg) { - var result = new SugestionOutput(); - result.Add("sugestion 1"); - result.Add("sugestion 2"); - result.Add("sugestion 3"); + var result = new SuggestionOutput(); + result.Add("suggestion 1"); + result.Add("suggestion 2"); + result.Add("suggestion 3"); return result; } @@ -364,11 +369,11 @@ public void Should_TryResultDefaultSetting2() } [Fact] - public void Should_TryResultMaxLenght() + public void Should_TryResultMaxLength() { var ctrl = (InputControl)PromptPlus .Input("P", "D") - .MaxLenght(3); + .MaxLength(3); ctrl.InitControl(CancellationToken.None); CompletesIn(100, () => @@ -1087,11 +1092,11 @@ public void Should_SaveHistory() [Fact] - public void Should_TryResulSugestion1() + public void Should_TryResulSuggestion1() { var ctrl = (InputControl)PromptPlus .Input("P", "D") - .SuggestionHandler(SugestionInputSample); + .SuggestionHandler(SuggestionInputSample); ctrl.InitControl(CancellationToken.None); CompletesIn(100, () => @@ -1100,16 +1105,16 @@ public void Should_TryResulSugestion1() var result = ctrl.TryResult(CancellationToken.None); Assert.False(result.IsAborted); Assert.True(result.IsRunning); - Assert.Equal("sugestion 1", result.Value); + Assert.Equal("suggestion 1", result.Value); }); } [Fact] - public void Should_TryResulSugestion2() + public void Should_TryResulSuggestion2() { var ctrl = (InputControl)PromptPlus .Input("P", "D") - .SuggestionHandler(SugestionInputSample); + .SuggestionHandler(SuggestionInputSample); ctrl.InitControl(CancellationToken.None); CompletesIn(100, () => @@ -1118,17 +1123,17 @@ public void Should_TryResulSugestion2() var result = ctrl.TryResult(CancellationToken.None); Assert.False(result.IsAborted); Assert.True(result.IsRunning); - Assert.Equal("sugestion 3", result.Value); + Assert.Equal("suggestion 3", result.Value); }); } [Fact] - public void Should_TryResulCancelSugestion() + public void Should_TryResulCancelSuggestion() { var ctrl = (InputControl)PromptPlus .Input("P", "D") - .SuggestionHandler(SugestionInputSample); + .SuggestionHandler(SuggestionInputSample); ctrl.InitControl(CancellationToken.None); CompletesIn(100, () => @@ -1139,7 +1144,7 @@ public void Should_TryResulCancelSugestion() var result = ctrl.TryResult(CancellationToken.None); Assert.False(result.IsAborted); Assert.True(result.IsRunning); - Assert.Equal("sugestion 1", result.Value); + Assert.Equal("suggestion 1", result.Value); }); } diff --git a/UnitTests/Controls/InputAutoComplete/InputAutoCompleteTests.cs b/UnitTests/Controls/InputAutoComplete/InputAutoCompleteTests.cs index 6a292a3a..77c6f4c6 100644 --- a/UnitTests/Controls/InputAutoComplete/InputAutoCompleteTests.cs +++ b/UnitTests/Controls/InputAutoComplete/InputAutoCompleteTests.cs @@ -1,4 +1,9 @@ -using PPlus.Controls; +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + +using PPlus.Controls; using PPlus.Controls.Objects; using PPlus.Tests.Util; @@ -551,12 +556,12 @@ public void Should_TryResultDefaultSetting2() } [Fact] - public void Should_TryResultMaxLenght() + public void Should_TryResultMaxLength() { var ctrl = (AutoCompleteControl)PromptPlus .AutoComplete("P", "D") .CompletionAsyncService(MYServiceCompleteAsync) - .MaxLenght(2); + .MaxLength(2); ActionOnDispose = () => ctrl.FinalizeControl(CancellationToken.None); ctrl.InitControl(CancellationToken.None); diff --git a/UnitTests/Controls/InputMaskEdit/InputMaskEditTests.cs b/UnitTests/Controls/InputMaskEdit/InputMaskEditTests.cs index d409e15f..94f0f6d0 100644 --- a/UnitTests/Controls/InputMaskEdit/InputMaskEditTests.cs +++ b/UnitTests/Controls/InputMaskEdit/InputMaskEditTests.cs @@ -1,4 +1,9 @@ -using System.Globalization; +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + +using System.Globalization; using PPlus.Controls; using PPlus.Controls.Objects; using PPlus.Tests.Util; @@ -8,9 +13,9 @@ namespace PPlus.Tests.Controls.InputMaskEdit public class InputMaskEditTests : BaseTest { - SugestionOutput SugestionInputSample(SugestionInput arg) + SuggestionOutput SuggestionInputSample(SuggestionInput arg) { - var result = new SugestionOutput(); + var result = new SuggestionOutput(); result.Add("123-AAA"); result.Add("234-BBB"); result.Add("567-CCC"); @@ -999,12 +1004,12 @@ public void Should_ChangeDescription() [Fact] - public void Should_TryResulSugestion1() + public void Should_TryResulSuggestion1() { var ctrl = (MaskEditControl)PromptPlus .MaskEdit("P", "D") .Mask("9{3}-AAA") - .SuggestionHandler(SugestionInputSample); + .SuggestionHandler(SuggestionInputSample); ctrl.InitControl(CancellationToken.None); CompletesIn(100, () => @@ -1018,12 +1023,12 @@ public void Should_TryResulSugestion1() } [Fact] - public void Should_TryResulSugestion2() + public void Should_TryResulSuggestion2() { var ctrl = (MaskEditControl)PromptPlus .MaskEdit("P", "D") .Mask("9{3}-AAA") - .SuggestionHandler(SugestionInputSample); + .SuggestionHandler(SuggestionInputSample); ctrl.InitControl(CancellationToken.None); CompletesIn(100, () => @@ -1038,12 +1043,12 @@ public void Should_TryResulSugestion2() [Fact] - public void Should_TryResulCancelSugestion() + public void Should_TryResulCancelSuggestion() { var ctrl = (MaskEditControl)PromptPlus .MaskEdit("P", "D") .Mask("9{3}-AAA") - .SuggestionHandler(SugestionInputSample); + .SuggestionHandler(SuggestionInputSample); ctrl.InitControl(CancellationToken.None); CompletesIn(100, () => diff --git a/UnitTests/Controls/KeyPress/KeyPressTests.cs b/UnitTests/Controls/KeyPress/KeyPressTests.cs index 3351f8e2..aff22115 100644 --- a/UnitTests/Controls/KeyPress/KeyPressTests.cs +++ b/UnitTests/Controls/KeyPress/KeyPressTests.cs @@ -1,4 +1,9 @@ -using PPlus.Controls; +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + +using PPlus.Controls; using PPlus.Controls.Objects; using PPlus.Tests.Util; using System.Globalization; diff --git a/UnitTests/Controls/MaskedBufferCurrencyTests.cs b/UnitTests/Controls/MaskedBufferCurrencyTests.cs index 1d933822..e014dffa 100644 --- a/UnitTests/Controls/MaskedBufferCurrencyTests.cs +++ b/UnitTests/Controls/MaskedBufferCurrencyTests.cs @@ -1,4 +1,9 @@ -using System.Globalization; +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + +using System.Globalization; using PPlus.Controls; using PPlus.Controls.Objects; using PPlus.Tests.Util; diff --git a/UnitTests/Controls/MaskedBufferDateOnlyTests.cs b/UnitTests/Controls/MaskedBufferDateOnlyTests.cs index d00f4995..9a552e07 100644 --- a/UnitTests/Controls/MaskedBufferDateOnlyTests.cs +++ b/UnitTests/Controls/MaskedBufferDateOnlyTests.cs @@ -1,4 +1,9 @@ -using System.Globalization; +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + +using System.Globalization; using PPlus.Controls; using PPlus.Controls.Objects; using PPlus.Tests.Util; diff --git a/UnitTests/Controls/MaskedBufferDateTimeTests.cs b/UnitTests/Controls/MaskedBufferDateTimeTests.cs index 71798d56..4c3b28bb 100644 --- a/UnitTests/Controls/MaskedBufferDateTimeTests.cs +++ b/UnitTests/Controls/MaskedBufferDateTimeTests.cs @@ -1,4 +1,9 @@ -using System.Globalization; +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + +using System.Globalization; using PPlus.Controls; using PPlus.Controls.Objects; using PPlus.Tests.Util; diff --git a/UnitTests/Controls/MaskedBufferGenericTests.cs b/UnitTests/Controls/MaskedBufferGenericTests.cs index 3266f829..a40026e1 100644 --- a/UnitTests/Controls/MaskedBufferGenericTests.cs +++ b/UnitTests/Controls/MaskedBufferGenericTests.cs @@ -1,4 +1,9 @@ -using PPlus.Controls; +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + +using PPlus.Controls; using PPlus.Controls.Objects; using PPlus.Tests.Util; diff --git a/UnitTests/Controls/MaskedBufferNumericTests.cs b/UnitTests/Controls/MaskedBufferNumericTests.cs index 0b6dae89..3aa1280c 100644 --- a/UnitTests/Controls/MaskedBufferNumericTests.cs +++ b/UnitTests/Controls/MaskedBufferNumericTests.cs @@ -1,4 +1,9 @@ -using System.Globalization; +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + +using System.Globalization; using PPlus.Controls; using PPlus.Controls.Objects; using PPlus.Tests.Util; diff --git a/UnitTests/Controls/MaskedBufferTimeOnlyTests.cs b/UnitTests/Controls/MaskedBufferTimeOnlyTests.cs index 99a459df..36d83313 100644 --- a/UnitTests/Controls/MaskedBufferTimeOnlyTests.cs +++ b/UnitTests/Controls/MaskedBufferTimeOnlyTests.cs @@ -1,4 +1,9 @@ -using System.Globalization; +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + +using System.Globalization; using PPlus.Controls; using PPlus.Controls.Objects; using PPlus.Tests.Util; diff --git a/UnitTests/Controls/MultiSelect/MultiSelectTests.cs b/UnitTests/Controls/MultiSelect/MultiSelectTests.cs index 620c799a..eeb549d7 100644 --- a/UnitTests/Controls/MultiSelect/MultiSelectTests.cs +++ b/UnitTests/Controls/MultiSelect/MultiSelectTests.cs @@ -1,4 +1,9 @@ -using System.ComponentModel.DataAnnotations; +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + +using System.ComponentModel.DataAnnotations; using System.Text.Json; using PPlus.Controls; using PPlus.Controls.Objects; @@ -12,13 +17,13 @@ private static IEnumerable LoadData() { var aux = new List { - new MyClass { Id = 7, MyText = "Text4", MyDesc="Text4 for id=4", IsDisabled = false, IsHide = true , IsSeleted = true}, - new MyClass { Id = 4, MyText = "Text4", MyDesc="Text4 for id=4", IsDisabled = false, IsHide = false , IsSeleted = true}, + new MyClass { Id = 7, MyText = "Text4", MyDesc="Text4 for id=4", IsDisabled = false, IsHide = true , IsSelected = true}, + new MyClass { Id = 4, MyText = "Text4", MyDesc="Text4 for id=4", IsDisabled = false, IsHide = false , IsSelected = true}, new MyClass { Id = 5, MyText = "Text5", MyDesc="Text5 for id=5", IsDisabled = false, IsHide = false }, new MyClass { Id = 6, MyText = "Text6", MyDesc="Text6 for id=6", IsDisabled = false, IsHide = true }, new MyClass { Id = 1, MyText = "Text1", MyDesc="Text1 for id=1", IsDisabled = false, IsHide = false }, new MyClass { Id = 0, MyText = "Text1", MyDesc="Text1 for id=0", IsDisabled = false, IsHide = false }, - new MyClass { Id = 2, MyText = "Text2", MyDesc="Text2 for id=2", IsDisabled = true, IsSeleted = true }, + new MyClass { Id = 2, MyText = "Text2", MyDesc="Text2 for id=2", IsDisabled = true, IsSelected = true }, new MyClass { Id = 3, MyText = "Text3", MyDesc="Text3 for id=3", IsDisabled = true, IsHide = false } }; return aux; @@ -29,7 +34,7 @@ private class MyClass public string? MyText { get; set; } public string? MyDesc { get; set; } public bool IsDisabled { get; set; } - public bool IsSeleted { get; set; } + public bool IsSelected { get; set; } public bool IsHide { get; set; } } @@ -844,16 +849,16 @@ public void Should_ErrorInvertSelectAllGrouped() public void Should_WithScoped() { var datasample = LoadData(); - var expectedsel = datasample.Where(x => x.IsSeleted).Count() - datasample.Where(x => x.IsHide && x.IsSeleted).Count(); + var expectedsel = datasample.Where(x => x.IsSelected).Count() - datasample.Where(x => x.IsHide && x.IsSelected).Count(); var ctrl = (MultiSelectControl)PromptPlus.MultiSelect("MultiSelect") - .AddItems(datasample.Where(x => x.IsSeleted), selected: true) - .AddItems(datasample.Where(x => !x.IsSeleted)) + .AddItems(datasample.Where(x => x.IsSelected), selected: true) + .AddItems(datasample.Where(x => !x.IsSelected)) .AddItemsTo(AdderScope.Disable, datasample.Where(x => x.IsDisabled).ToArray()) .AddItemsTo(AdderScope.Remove, datasample.Where(x => x.IsHide).ToArray()) .TextSelector(x => x.MyText!) .EqualItems((item1, item2) => item1.Id == item2.Id) .ChangeDescription(x => x.MyDesc!) - .AddDefault(datasample.Where(x => x.IsSeleted).ToArray()); + .AddDefault(datasample.Where(x => x.IsSelected).ToArray()); ctrl.InitControl(CancellationToken.None); @@ -871,16 +876,16 @@ public void Should_WithScoped() public void Should_WithFixedSelectedAndFixedUnselect() { var datasample = LoadData(); - var expectedsel = datasample.Where(x => x.IsSeleted).Count() - datasample.Where(x => x.IsHide && x.IsSeleted).Count(); + var expectedsel = datasample.Where(x => x.IsSelected).Count() - datasample.Where(x => x.IsHide && x.IsSelected).Count(); var ctrl = (MultiSelectControl)PromptPlus.MultiSelect("MultiSelect") - .AddItems(datasample.Where(x => x.IsSeleted), selected: true) - .AddItems(datasample.Where(x => !x.IsSeleted)) + .AddItems(datasample.Where(x => x.IsSelected), selected: true) + .AddItems(datasample.Where(x => !x.IsSelected)) .AddItemsTo(AdderScope.Disable, datasample.Where(x => x.IsDisabled).ToArray()) .AddItemsTo(AdderScope.Remove, datasample.Where(x => x.IsHide).ToArray()) .TextSelector(x => x.MyText!) .EqualItems((item1, item2) => item1.Id == item2.Id) .ChangeDescription(x => x.MyDesc!) - .AddDefault(datasample.Where(x => x.IsSeleted).ToArray()); + .AddDefault(datasample.Where(x => x.IsSelected).ToArray()); ctrl.InitControl(CancellationToken.None); diff --git a/UnitTests/Controls/PaginatorTest.cs b/UnitTests/Controls/PaginatorTest.cs index 75eebdc5..d410422c 100644 --- a/UnitTests/Controls/PaginatorTest.cs +++ b/UnitTests/Controls/PaginatorTest.cs @@ -1,4 +1,11 @@ -using PPlus.Controls.Objects; +// *************************************************************************************** +// MIT LICENCE +// Copyright (c) 2019 shibayan. +// https://github.com/shibayan/Sharprompt +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + +using PPlus.Controls.Objects; using PPlus.Tests.Util; namespace PPlus.Tests.Controls @@ -60,7 +67,7 @@ public void Should_have_3_items_CurrentPage() } [Fact] - public void Should_have_seletedItem() + public void Should_have_selectedItem() { // Given var items = new List(); @@ -96,7 +103,7 @@ public void Should_have_UnSelected() [Fact] - public void Should_have_seletedItem_with_FistItem() + public void Should_have_selectedItem_with_FistItem() { // Given var items = new List(); @@ -113,7 +120,7 @@ public void Should_have_seletedItem_with_FistItem() } [Fact] - public void Should_have_seletedItem_with_LastItem() + public void Should_have_selectedItem_with_LastItem() { // Given var items = new List(); @@ -130,7 +137,7 @@ public void Should_have_seletedItem_with_LastItem() } [Fact] - public void Should_have_seletedItem_with_NextPage_unselect() + public void Should_have_selectedItem_with_NextPage_unselect() { // Given var items = new List(); @@ -149,7 +156,7 @@ public void Should_have_seletedItem_with_NextPage_unselect() [Theory] [InlineData(IndexOption.FirstItem)] [InlineData(IndexOption.FirstItemWhenHasPages)] - internal void Should_have_seletedItem_with_NextPage_FistSelect(IndexOption opc) + internal void Should_have_selectedItem_with_NextPage_FistSelect(IndexOption opc) { // Given var items = new List(); @@ -168,7 +175,7 @@ internal void Should_have_seletedItem_with_NextPage_FistSelect(IndexOption opc) [Theory] [InlineData(IndexOption.LastItem)] [InlineData(IndexOption.LastItemWhenHasPages)] - internal void Should_have_seletedItem_with_NextPage_LastSelect(IndexOption opc) + internal void Should_have_selectedItem_with_NextPage_LastSelect(IndexOption opc) { // Given var items = new List(); @@ -185,7 +192,7 @@ internal void Should_have_seletedItem_with_NextPage_LastSelect(IndexOption opc) } [Fact] - public void Should_have_seletedItem_with_FistItem_and_validator_Select() + public void Should_have_selectedItem_with_FistItem_and_validator_Select() { // Given var items = new List(); @@ -201,7 +208,7 @@ public void Should_have_seletedItem_with_FistItem_and_validator_Select() Assert.Equal("1", pg.SelectedItem); } [Fact] - public void Should_have_seletedItem_with_LastItem_and_validator_Select() + public void Should_have_selectedItem_with_LastItem_and_validator_Select() { // Given var items = new List(); @@ -220,7 +227,7 @@ public void Should_have_seletedItem_with_LastItem_and_validator_Select() [Theory] [InlineData(IndexOption.FirstItem)] [InlineData(IndexOption.FirstItemWhenHasPages)] - internal void Should_have_seletedItem_with_NextPage_FistSelect_and_validator_Select(IndexOption opc) + internal void Should_have_selectedItem_with_NextPage_FistSelect_and_validator_Select(IndexOption opc) { // Given var items = new List(); @@ -239,7 +246,7 @@ internal void Should_have_seletedItem_with_NextPage_FistSelect_and_validator_Sel [Theory] [InlineData(IndexOption.LastItem)] [InlineData(IndexOption.LastItemWhenHasPages)] - internal void Should_have_seletedItem_with_NextPage_LastSelect_and_validator_Selec(IndexOption opc) + internal void Should_have_selectedItem_with_NextPage_LastSelect_and_validator_Selec(IndexOption opc) { // Given var items = new List(); @@ -256,7 +263,7 @@ internal void Should_have_seletedItem_with_NextPage_LastSelect_and_validator_Sel } [Fact] - internal void Should_have_seletedItem_with_UpdateFilter() + internal void Should_have_selectedItem_with_UpdateFilter() { // Given var items = new List(); @@ -275,7 +282,7 @@ internal void Should_have_seletedItem_with_UpdateFilter() } [Fact] - internal void Should_have_seletedItem_with_UpdateFilter_and_tryget() + internal void Should_have_selectedItem_with_UpdateFilter_and_tryget() { // Given var items = new List(); diff --git a/UnitTests/Controls/Select/SelectTests.cs b/UnitTests/Controls/Select/SelectTests.cs index f388fc65..a2c60fdb 100644 --- a/UnitTests/Controls/Select/SelectTests.cs +++ b/UnitTests/Controls/Select/SelectTests.cs @@ -1,4 +1,9 @@ -using System.ComponentModel.DataAnnotations; +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + +using System.ComponentModel.DataAnnotations; using System.Text.Json; using PPlus.Controls; using PPlus.Controls.Objects; diff --git a/UnitTests/Controls/SliderNumber/SliderNumberTests.cs b/UnitTests/Controls/SliderNumber/SliderNumberTests.cs index dc003a40..7806cd7d 100644 --- a/UnitTests/Controls/SliderNumber/SliderNumberTests.cs +++ b/UnitTests/Controls/SliderNumber/SliderNumberTests.cs @@ -1,4 +1,9 @@ -using System.Text.Json; +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + +using System.Text.Json; using PPlus.Controls; using PPlus.Controls.Objects; using PPlus.Tests.Util; diff --git a/UnitTests/Controls/SliderSwitch/SliderSwitchTests.cs b/UnitTests/Controls/SliderSwitch/SliderSwitchTests.cs index 75b8c20e..fe9ee05b 100644 --- a/UnitTests/Controls/SliderSwitch/SliderSwitchTests.cs +++ b/UnitTests/Controls/SliderSwitch/SliderSwitchTests.cs @@ -1,4 +1,9 @@ -using System.Text.Json; +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + +using System.Text.Json; using PPlus.Controls; using PPlus.Controls.Objects; using PPlus.Tests.Util; @@ -304,7 +309,7 @@ public void Should_AcceptInputFinishTemplateAbort1() var sb = new ScreenBuffer(); ctrl.FinishTemplate(sb, true, true); Assert.Contains(sb.Buffer, x => !x.SaveCursor); - Assert.Contains(sb.Buffer, x => (x.Text ?? string.Empty).Trim() == "P:"); + Assert.Contains(sb.Buffer, x => (x.Text ?? string.Empty).Trim() == "P"); Assert.DoesNotContain(sb.Buffer, x => (x.Text ?? string.Empty) == "D"); Assert.DoesNotContain(sb.Buffer, x => (x.Text ?? string.Empty).Contains("On")); Assert.Contains(sb.Buffer, x => (x.Text ?? string.Empty) == Messages.CanceledKey); diff --git a/UnitTests/Controls/StyleSchemaTest.cs b/UnitTests/Controls/StyleSchemaTest.cs index 9a437e9d..050d4d7c 100644 --- a/UnitTests/Controls/StyleSchemaTest.cs +++ b/UnitTests/Controls/StyleSchemaTest.cs @@ -1,4 +1,9 @@ -using PPlus.Controls; +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + +using PPlus.Controls; using PPlus.Tests.Util; namespace PPlus.Tests.Controls @@ -21,7 +26,7 @@ public void Should_InitDefaultStyleSchema() Assert.Equal(Style.Default.Foreground(ConsoleColor.White), ss.Prompt()); Assert.Equal(Style.Default.Foreground(ConsoleColor.Cyan), ss.Answer()); Assert.Equal(Style.Default.Foreground(ConsoleColor.DarkYellow), ss.Description()); - Assert.Equal(Style.Default.Foreground(ConsoleColor.Yellow), ss.Sugestion()); + Assert.Equal(Style.Default.Foreground(ConsoleColor.Yellow), ss.Suggestion()); Assert.Equal(Style.Default.Foreground(ConsoleColor.Gray), ss.UnSelected()); Assert.Equal(Style.Default.Foreground(ConsoleColor.Green), ss.Selected()); Assert.Equal(Style.Default.Foreground(ConsoleColor.DarkGray), ss.Disabled()); @@ -50,7 +55,7 @@ public void Should_UpdateBackgoundStyleSchema() Assert.Equal(Color.Aquamarine1, ss.Answer().Background); Assert.Equal(Color.Aquamarine1, ss.Description().Background); - Assert.Equal(Color.Aquamarine1, ss.Sugestion().Background); + Assert.Equal(Color.Aquamarine1, ss.Suggestion().Background); Assert.Equal(Color.Aquamarine1, ss.UnSelected().Background); Assert.Equal(Color.Aquamarine1, ss.Selected().Background); Assert.Equal(Color.Aquamarine1, ss.Disabled().Background); diff --git a/UnitTests/Controls/TaskProgressBar/ProgressBarTests.cs b/UnitTests/Controls/TaskProgressBar/ProgressBarTests.cs index 20696cce..69acd14d 100644 --- a/UnitTests/Controls/TaskProgressBar/ProgressBarTests.cs +++ b/UnitTests/Controls/TaskProgressBar/ProgressBarTests.cs @@ -1,4 +1,9 @@ -using PPlus.Controls; +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + +using PPlus.Controls; using PPlus.Controls.Objects; using PPlus.Tests.Util; using Shouldly; diff --git a/UnitTests/Controls/TaskWaitControl/WaitControlTests.cs b/UnitTests/Controls/TaskWaitControl/WaitControlTests.cs index 27294b00..87b04557 100644 --- a/UnitTests/Controls/TaskWaitControl/WaitControlTests.cs +++ b/UnitTests/Controls/TaskWaitControl/WaitControlTests.cs @@ -1,4 +1,9 @@ -using PPlus.Controls; +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + +using PPlus.Controls; using PPlus.Controls.Objects; using PPlus.Tests.Util; diff --git a/UnitTests/Objects/ColorTests.cs b/UnitTests/Objects/ColorTests.cs index 30579626..1cc87f27 100644 --- a/UnitTests/Objects/ColorTests.cs +++ b/UnitTests/Objects/ColorTests.cs @@ -1,4 +1,13 @@ -using PPlus.Tests.Util; +// *************************************************************************************** +// MIT LICENCE +// Copyright 2020 Patrik Svensson, Phil Scott, Nils Andresen. +// https://spectreconsole.net +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + + + +using PPlus.Tests.Util; using Shouldly; namespace PPlus.Tests.Objects diff --git a/UnitTests/Objects/StyleTest.cs b/UnitTests/Objects/StyleTest.cs index f4bbce6e..d8503e2e 100644 --- a/UnitTests/Objects/StyleTest.cs +++ b/UnitTests/Objects/StyleTest.cs @@ -1,4 +1,12 @@ -using PPlus.Drivers; +// *************************************************************************************** +// MIT LICENCE +// Copyright 2020 Patrik Svensson, Phil Scott, Nils Andresen. +// https://spectreconsole.net +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + + +using PPlus.Drivers; using PPlus.Tests.Util; using Shouldly; diff --git a/UnitTests/Profile/ProfileTest.cs b/UnitTests/Profile/ProfileTest.cs index 11572f1f..140d047b 100644 --- a/UnitTests/Profile/ProfileTest.cs +++ b/UnitTests/Profile/ProfileTest.cs @@ -1,3 +1,8 @@ +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + using PPlus.Tests.Util; namespace PPlus.Tests.Profile diff --git a/UnitTests/StandardDriverTest/BeepTest.cs b/UnitTests/StandardDriverTest/BeepTest.cs index 8ce24f95..fd79d3d9 100644 --- a/UnitTests/StandardDriverTest/BeepTest.cs +++ b/UnitTests/StandardDriverTest/BeepTest.cs @@ -1,4 +1,9 @@ -using PPlus.Tests.Util; +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + +using PPlus.Tests.Util; namespace PPlus.Tests.StandardDriverTest { diff --git a/UnitTests/StandardDriverTest/ClearLineTest.cs b/UnitTests/StandardDriverTest/ClearLineTest.cs index d2c0ee5f..0a706359 100644 --- a/UnitTests/StandardDriverTest/ClearLineTest.cs +++ b/UnitTests/StandardDriverTest/ClearLineTest.cs @@ -1,4 +1,9 @@ -using PPlus.Tests.Util; +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + +using PPlus.Tests.Util; namespace PPlus.Tests.StandardDriverTest { diff --git a/UnitTests/StandardDriverTest/ClearTest.cs b/UnitTests/StandardDriverTest/ClearTest.cs index bed96f56..060bb1c3 100644 --- a/UnitTests/StandardDriverTest/ClearTest.cs +++ b/UnitTests/StandardDriverTest/ClearTest.cs @@ -1,4 +1,9 @@ -using PPlus.Tests.Util; +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + +using PPlus.Tests.Util; namespace PPlus.Tests.StandardDriverTest { diff --git a/UnitTests/StandardDriverTest/Commands/WriteLineExtensionsTest.cs b/UnitTests/StandardDriverTest/Commands/WriteLineExtensionsTest.cs index 7b386bde..400e320c 100644 --- a/UnitTests/StandardDriverTest/Commands/WriteLineExtensionsTest.cs +++ b/UnitTests/StandardDriverTest/Commands/WriteLineExtensionsTest.cs @@ -1,4 +1,9 @@ -using PPlus.Tests.Util; +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + +using PPlus.Tests.Util; namespace PPlus.Tests.StandardDriverTest.Commands { diff --git a/UnitTests/StandardDriverTest/CursorTest.cs b/UnitTests/StandardDriverTest/CursorTest.cs index c61ff880..d641a95a 100644 --- a/UnitTests/StandardDriverTest/CursorTest.cs +++ b/UnitTests/StandardDriverTest/CursorTest.cs @@ -1,4 +1,9 @@ -using PPlus.Tests.Util; +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + +using PPlus.Tests.Util; namespace PPlus.Tests.StandardDriverTest { diff --git a/UnitTests/StandardDriverTest/OverflowStrategy.cs b/UnitTests/StandardDriverTest/OverflowStrategy.cs index 5bae9756..d2a73042 100644 --- a/UnitTests/StandardDriverTest/OverflowStrategy.cs +++ b/UnitTests/StandardDriverTest/OverflowStrategy.cs @@ -1,4 +1,9 @@ -using PPlus.Tests.Util; +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + +using PPlus.Tests.Util; namespace PPlus.Tests.StandardDriverTest { diff --git a/UnitTests/StandardDriverTest/PadScreenTest.cs b/UnitTests/StandardDriverTest/PadScreenTest.cs index ece519a5..c9566745 100644 --- a/UnitTests/StandardDriverTest/PadScreenTest.cs +++ b/UnitTests/StandardDriverTest/PadScreenTest.cs @@ -1,4 +1,9 @@ -using PPlus.Tests.Util; +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + +using PPlus.Tests.Util; namespace PPlus.Tests.StandardDriverTest { diff --git a/UnitTests/StandardDriverTest/SetInSetIErrorSetOutTest.cs b/UnitTests/StandardDriverTest/SetInSetIErrorSetOutTest.cs index 43d28bec..e8425d50 100644 --- a/UnitTests/StandardDriverTest/SetInSetIErrorSetOutTest.cs +++ b/UnitTests/StandardDriverTest/SetInSetIErrorSetOutTest.cs @@ -1,4 +1,9 @@ -using PPlus.Tests.Util; +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + +using PPlus.Tests.Util; namespace PPlus.Tests.StandardDriverTest { diff --git a/UnitTests/Util/BaseTest.cs b/UnitTests/Util/BaseTest.cs index d792c3ce..6a22949b 100644 --- a/UnitTests/Util/BaseTest.cs +++ b/UnitTests/Util/BaseTest.cs @@ -1,4 +1,9 @@ -namespace PPlus.Tests.Util +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + +namespace PPlus.Tests.Util { public abstract class BaseTest : IDisposable { diff --git a/UnitTests/Util/Expectations.cs b/UnitTests/Util/Expectations.cs index 1c582602..6d0c6851 100644 --- a/UnitTests/Util/Expectations.cs +++ b/UnitTests/Util/Expectations.cs @@ -1,4 +1,9 @@ -using System.Text; +// *************************************************************************************** +// MIT LICENCE +// The maintenance and evolution is maintained by the PromptPlus project under MIT license +// *************************************************************************************** + +using System.Text; namespace PPlus.Tests.Util { diff --git a/WhatNews.md b/WHATSNEW.md similarity index 100% rename from WhatNews.md rename to WHATSNEW.md diff --git a/docs/_config.yml b/docs/_config.yml index 79c00e70..f2095e74 100644 --- a/docs/_config.yml +++ b/docs/_config.yml @@ -1,4 +1,4 @@ -description: Interactive command-line toolkit for .Net core with powerful controls and commands to create professional console applications. +description: Interactive command-line toolkit for .NET Core with powerful controls and commands to create professional console applications. show_downloads: false google_analytics: theme: jekyll-theme-cayman diff --git a/docs/apis/apis.md b/docs/apis/apis.md index a2203290..c3030919 100644 --- a/docs/apis/apis.md +++ b/docs/apis/apis.md @@ -66,8 +66,6 @@ - [CaseOptions](./pplus.controls.caseoptions.md) -- [CharacterWidth](./pplus.controls.characterwidth.md) - - [ChartBarType](./pplus.controls.chartbartype.md) - [ChartOrder](./pplus.controls.chartorder.md) @@ -192,9 +190,9 @@ - [StyleTreeView](./pplus.controls.styletreeview.md) -- [SugestionInput](./pplus.controls.sugestioninput.md) +- [SuggestionInput](./pplus.controls.suggestioninput.md) -- [SugestionOutput](./pplus.controls.sugestionoutput.md) +- [SuggestionOutput](./pplus.controls.suggestionoutput.md) - [SymbolType](./pplus.controls.symboltype.md) diff --git a/docs/apis/pplus.controls.baseoptions.md b/docs/apis/pplus.controls.baseoptions.md index dfc3ab90..31360dc5 100644 --- a/docs/apis/pplus.controls.baseoptions.md +++ b/docs/apis/pplus.controls.baseoptions.md @@ -81,6 +81,20 @@ public IPromptConfig Description(string value) [IPromptConfig](./pplus.controls.ipromptconfig.md) +### **DisableToggleTooltip(Boolean)** + +```csharp +public IPromptConfig DisableToggleTooltip(bool value) +``` + +#### Parameters + +`value` [Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean)
+ +#### Returns + +[IPromptConfig](./pplus.controls.ipromptconfig.md) + ###
**EnabledAbortKey(Boolean)** ```csharp @@ -165,6 +179,20 @@ public IPromptConfig SetContext(object value) [IPromptConfig](./pplus.controls.ipromptconfig.md) +### **ShowOnlyExistingPagination(Boolean)** + +```csharp +public IPromptConfig ShowOnlyExistingPagination(bool value) +``` + +#### Parameters + +`value` [Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean)
+ +#### Returns + +[IPromptConfig](./pplus.controls.ipromptconfig.md) + ###
**ShowTooltip(Boolean)** ```csharp diff --git a/docs/apis/pplus.controls.characterwidth.md b/docs/apis/pplus.controls.characterwidth.md deleted file mode 100644 index 5f391cf7..00000000 --- a/docs/apis/pplus.controls.characterwidth.md +++ /dev/null @@ -1,34 +0,0 @@ -# PromptPlus API:CharacterWidth - -[![Build](https://github.com/FRACerqueira/PromptPlus/workflows/Build/badge.svg)](https://github.com/FRACerqueira/PromptPlus/actions/workflows/build.yml) -[![Publish](https://github.com/FRACerqueira/PromptPlus/actions/workflows/publish.yml/badge.svg)](https://github.com/FRACerqueira/PromptPlus/actions/workflows/publish.yml) -[![License](https://img.shields.io/github/license/FRACerqueira/PromptPlus)](https://github.com/FRACerqueira/PromptPlus/blob/master/LICENSE) -[![NuGet](https://img.shields.io/nuget/v/PromptPlus)](https://www.nuget.org/packages/PromptPlus/) -[![Downloads](https://img.shields.io/nuget/dt/PromptPlus)](https://www.nuget.org/packages/PromptPlus/) - -[**Back to List Api**](./apis.md) - -# CharacterWidth - -Namespace: PPlus.Controls - -Represents a Width Ascii banner. - -```csharp -public enum CharacterWidth -``` - -Inheritance [Object](https://docs.microsoft.com/en-us/dotnet/api/system.object) → [ValueType](https://docs.microsoft.com/en-us/dotnet/api/system.valuetype) → [Enum](https://docs.microsoft.com/en-us/dotnet/api/system.enum) → [CharacterWidth](./pplus.controls.characterwidth.md)
-Implements [IComparable](https://docs.microsoft.com/en-us/dotnet/api/system.icomparable), [IFormattable](https://docs.microsoft.com/en-us/dotnet/api/system.iformattable), [IConvertible](https://docs.microsoft.com/en-us/dotnet/api/system.iconvertible) - -## Fields - -| Name | Value | Description | -| --- | --: | --- | -| Smush | 0 | Smush Width | -| Fitted | 1 | Fitted Width | -| Full | 2 | Full Width | - - -- - - -[**Back to List Api**](./apis.md) diff --git a/docs/apis/pplus.controls.configcontrols.md b/docs/apis/pplus.controls.configcontrols.md index b6892479..2736f907 100644 --- a/docs/apis/pplus.controls.configcontrols.md +++ b/docs/apis/pplus.controls.configcontrols.md @@ -77,7 +77,7 @@ public HotKey ChartBarSwitchTypePress { get; set; } ###
**CompletionMaxCount** Get/Set Completion Max Items to return. -
Default value : 1000. If value less than 1 internal sette to 1. +
Default value : 1000. If value less than 1 internal set to 1. ```csharp public int CompletionMaxCount { get; set; } @@ -90,7 +90,7 @@ public int CompletionMaxCount { get; set; } ###
**CompletionMinimumPrefixLength** Get/Set Minimum Prefix Length. -
Default value : 3.If value less than 0 internal sette to 0. +
Default value : 3.If value less than 0 internal set to 0. ```csharp public int CompletionMinimumPrefixLength { get; set; } @@ -103,7 +103,7 @@ public int CompletionMinimumPrefixLength { get; set; } ###
**CompletionWaitToStart** Get/Set Interval in mileseconds to wait start Completion funcion. -
Default value : 1000. If value less than 10 internal sette to 10. +
Default value : 1000. If value less than 10 internal set to 10. ```csharp public int CompletionWaitToStart { get; set; } @@ -125,6 +125,19 @@ public CultureInfo DefaultCulture { get; set; } [CultureInfo](https://docs.microsoft.com/en-us/dotnet/api/system.globalization.cultureinfo)
+###
**DisableToggleTooltip** + +Get/Set Disable toggle Tooltip for all controls at startup. +
Default value : false + +```csharp +public bool DisableToggleTooltip { get; set; } +``` + +#### Property Value + +[Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean)
+ ###
**EditItemPress** Get/Set [HotKey](./pplus.controls.hotkey.md) to Edit item. @@ -140,7 +153,7 @@ public HotKey EditItemPress { get; set; } ### **EnabledAbortKey** -Get/Set enabled abortKey(ESC) for all controls. +Get/Set enable abortKey(ESC) for all controls.
Default value : true ```csharp @@ -232,7 +245,7 @@ public Nullable NoChar { get; set; } ###
**PageSize** Get/Set Page Size from colletions. -
Default value : 10. If value less than 1 internal sette to 1. +
Default value : 10. If value less than 1 internal set to 1. ```csharp public int PageSize { get; set; } @@ -294,9 +307,22 @@ public HotKey SelectAllPress { get; set; } [HotKey](./pplus.controls.hotkey.md)
+###
**ShowOnlyExistingPagination** + +Get/Set Show pagination only if exists +
Default value : false + +```csharp +public bool ShowOnlyExistingPagination { get; set; } +``` + +#### Property Value + +[Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean)
+ ###
**ShowTooltip** -Get/Set enabled show Tooltip for all controls. +Get/Set enable show Tooltip for all controls at startup.
Default value : true ```csharp @@ -339,7 +365,7 @@ Get/Set [HotKey](./pplus.controls.hotkey.md) to show/hide Tooltip.
Default value : '[F1]' ```csharp -public HotKey TooltipKeyPress { get; } +public HotKey TooltipKeyPress { get; set; } ``` #### Property Value diff --git a/docs/apis/pplus.controls.filtermode.md b/docs/apis/pplus.controls.filtermode.md index 9111c7c8..7e773125 100644 --- a/docs/apis/pplus.controls.filtermode.md +++ b/docs/apis/pplus.controls.filtermode.md @@ -27,6 +27,7 @@ Implements [IComparable](https://docs.microsoft.com/en-us/dotnet/api/system.icom | --- | --: | --- | | Contains | 0 | Filter with Contains text | | StartsWith | 1 | Filter with start with text | +| Disabled | 2 | Disabled Filter feature | - - - diff --git a/docs/apis/pplus.controls.hideprogressbar.md b/docs/apis/pplus.controls.hideprogressbar.md index bde74652..d4b59827 100644 --- a/docs/apis/pplus.controls.hideprogressbar.md +++ b/docs/apis/pplus.controls.hideprogressbar.md @@ -12,7 +12,7 @@ Namespace: PPlus.Controls -Represents the elememt to hide on ProgressBar +Represents the element to hide on ProgressBar ```csharp public enum HideProgressBar diff --git a/docs/apis/pplus.controls.ibannercontrol.md b/docs/apis/pplus.controls.ibannercontrol.md index 876bdc04..30cccab6 100644 --- a/docs/apis/pplus.controls.ibannercontrol.md +++ b/docs/apis/pplus.controls.ibannercontrol.md @@ -20,23 +20,6 @@ public interface IBannerControl ## Methods -###
**FIGletWidth(CharacterWidth)** - -Set [CharacterWidth](./pplus.controls.characterwidth.md) for the banner - -```csharp -IBannerControl FIGletWidth(CharacterWidth value) -``` - -#### Parameters - -`value` [CharacterWidth](./pplus.controls.characterwidth.md)
-CharacterWidth [CharacterWidth](./pplus.controls.characterwidth.md) - -#### Returns - -[IBannerControl](./pplus.controls.ibannercontrol.md) - ###
**LoadFont(String)** Load external font from file diff --git a/docs/apis/pplus.controls.icontrolautocomplete.md b/docs/apis/pplus.controls.icontrolautocomplete.md index bd1a9ad2..83ee97df 100644 --- a/docs/apis/pplus.controls.icontrolautocomplete.md +++ b/docs/apis/pplus.controls.icontrolautocomplete.md @@ -43,7 +43,7 @@ function to accept ### **AddValidators(params Func<Object, ValidationResult>[])** Add a validator to accept sucessfull finish of control. -
Tip: see to validators embeding +
Tip: see to validators embedding ```csharp IControlAutoComplete AddValidators(params Func[] validators) @@ -113,7 +113,7 @@ Number of max.items ###
**CompletionWaitToStart(Int32)** Number of mileseconds to wait before to start function autocomplete -
Default value : 1000. If value less than 10 internal sette to 10. +
Default value : 1000. If value less than 10 internal set to 10. ```csharp IControlAutoComplete CompletionWaitToStart(int value) @@ -196,18 +196,18 @@ Transform option [IControlAutoComplete](./pplus.controls.icontrolautocomplete.md) -###
**MaxLenght(UInt16)** +### **MaxLength(UInt16)** -MaxLenght of input text. +MaxLength of input text. ```csharp -IControlAutoComplete MaxLenght(ushort value) +IControlAutoComplete MaxLength(ushort value) ``` #### Parameters `value` [UInt16](https://docs.microsoft.com/en-us/dotnet/api/system.uint16)
-Lenght +Length #### Returns @@ -216,7 +216,7 @@ Lenght ###
**MinimumPrefixLength(Int32)** Number minimum of chars to accept autocomplete -
Default value : 3. If value less than 0 internal sette to 0. +
Default value : 3. If value less than 0 internal set to 0. ```csharp IControlAutoComplete MinimumPrefixLength(int value) @@ -286,7 +286,7 @@ The [SpinnersType](./pplus.controls.spinnerstype.md) Style of spinner. [Style](./pplus.style.md) `speedAnimation` [Nullable<Int32>](https://docs.microsoft.com/en-us/dotnet/api/system.nullable-1)
-Number of mileseconds foreach interation of spinner. Valid only to SpinnersType.custom, otherwise will be ignored +Number of mileseconds foreach iteration of spinner. Valid only to SpinnersType.custom, otherwise will be ignored `customspinner` [IEnumerable<String>](https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.ienumerable-1)
IEnumerable values for custom spinner. Valid only to SpinnersType.custom, otherwise will be ignored diff --git a/docs/apis/pplus.controls.icontrolcalendar.md b/docs/apis/pplus.controls.icontrolcalendar.md index 289515b8..175a7f7f 100644 --- a/docs/apis/pplus.controls.icontrolcalendar.md +++ b/docs/apis/pplus.controls.icontrolcalendar.md @@ -45,7 +45,7 @@ The [ItemCalendar](./pplus.controls.itemcalendar.md) ###
**AddValidators(params Func<Object, ValidationResult>[])** Add a validator to accept sucessfull finish of control. -
Tip: see to validators embeding +
Tip: see to validators embedding ```csharp IControlCalendar AddValidators(params Func[] validators) @@ -143,7 +143,7 @@ IControlCalendar Default(DateTime value, PolicyInvalidDate policy) [DateTime](https://docs.microsoft.com/en-us/dotnet/api/system.datetime) `policy` [PolicyInvalidDate](./pplus.controls.policyinvaliddate.md)
-Policy to next/previous valid date if seleted date is invalid +Policy to next/previous valid date if selected date is invalid #### Returns diff --git a/docs/apis/pplus.controls.icontrolinput.md b/docs/apis/pplus.controls.icontrolinput.md index 8d835f1e..aa322a6e 100644 --- a/docs/apis/pplus.controls.icontrolinput.md +++ b/docs/apis/pplus.controls.icontrolinput.md @@ -43,7 +43,7 @@ function to accept ###
**AddValidators(params Func<Object, ValidationResult>[])** Add a validator to accept sucessfull finish of control. -
Tip: see to validators embeding +
Tip: see to validators embedding ```csharp IControlInput AddValidators(params Func[] validators) @@ -282,18 +282,18 @@ char secret [IControlInput](./pplus.controls.icontrolinput.md) -###
**MaxLenght(UInt16)** +### **MaxLength(UInt16)** -MaxLenght of input text. +MaxLength of input text. ```csharp -IControlInput MaxLenght(ushort value) +IControlInput MaxLength(ushort value) ``` #### Parameters `value` [UInt16](https://docs.microsoft.com/en-us/dotnet/api/system.uint16)
-Lenght +Length #### Returns @@ -319,18 +319,18 @@ The timeout for valid items saved. Default value is 365 days [IControlInput](./pplus.controls.icontrolinput.md) -###
**SuggestionHandler(Func<SugestionInput, SugestionOutput>)** +### **SuggestionHandler(Func<SuggestionInput, SuggestionOutput>)** Add Suggestion Handler feature ```csharp -IControlInput SuggestionHandler(Func value) +IControlInput SuggestionHandler(Func value) ``` #### Parameters -`value` [Func<SugestionInput, SugestionOutput>](https://docs.microsoft.com/en-us/dotnet/api/system.func-2)
-function to apply suggestions. [SugestionInput](./pplus.controls.sugestioninput.md) and [SugestionOutput](./pplus.controls.sugestionoutput.md) +`value` [Func<SuggestionInput, SuggestionOutput>](https://docs.microsoft.com/en-us/dotnet/api/system.func-2)
+function to apply suggestions. [SuggestionInput](./pplus.controls.suggestioninput.md) and [SuggestionOutput](./pplus.controls.suggestionoutput.md) #### Returns diff --git a/docs/apis/pplus.controls.icontrolkeypress.md b/docs/apis/pplus.controls.icontrolkeypress.md index df3a4a43..94084f7d 100644 --- a/docs/apis/pplus.controls.icontrolkeypress.md +++ b/docs/apis/pplus.controls.icontrolkeypress.md @@ -77,7 +77,7 @@ The [SpinnersType](./pplus.controls.spinnerstype.md) Style of spinner. [Style](./pplus.style.md) `speedAnimation` [Nullable<Int32>](https://docs.microsoft.com/en-us/dotnet/api/system.nullable-1)
-Number of mileseconds foreach interation of spinner. Valid only to SpinnersType.custom, otherwise will be ignored +Number of mileseconds foreach iteration of spinner. Valid only to SpinnersType.custom, otherwise will be ignored `customspinner` [IEnumerable<String>](https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.ienumerable-1)
IEnumerable value for custom spinner. Valid only to SpinnersType.custom, otherwise will be ignored diff --git a/docs/apis/pplus.controls.icontrollist.md b/docs/apis/pplus.controls.icontrollist.md index d98c2a43..a0d56c44 100644 --- a/docs/apis/pplus.controls.icontrollist.md +++ b/docs/apis/pplus.controls.icontrollist.md @@ -83,7 +83,7 @@ true the item cannot be removed; otherwise yes. ###
**AddValidators(params Func<Object, ValidationResult>[])** Add a validator to accept sucessfull finish of control. -
Tip: see to validators embeding +
Tip: see to validators embedding ```csharp IControlList AddValidators(params Func[] validators) @@ -220,18 +220,18 @@ Action to execute [IControlList](./pplus.controls.icontrollist.md) -###
**MaxLenght(UInt16)** +### **MaxLength(UInt16)** -MaxLenght of input text. +MaxLength of input text. ```csharp -IControlList MaxLenght(ushort value) +IControlList MaxLength(ushort value) ``` #### Parameters `value` [UInt16](https://docs.microsoft.com/en-us/dotnet/api/system.uint16)
-Lenght +Length #### Returns @@ -274,18 +274,18 @@ Maximum number of items [IControlList](./pplus.controls.icontrollist.md) -###
**SuggestionHandler(Func<SugestionInput, SugestionOutput>)** +### **SuggestionHandler(Func<SuggestionInput, SuggestionOutput>)** Add Suggestion Handler feature ```csharp -IControlList SuggestionHandler(Func value) +IControlList SuggestionHandler(Func value) ``` #### Parameters -`value` [Func<SugestionInput, SugestionOutput>](https://docs.microsoft.com/en-us/dotnet/api/system.func-2)
-function to apply suggestions. [SugestionInput](./pplus.controls.sugestioninput.md) and [SugestionOutput](./pplus.controls.sugestionoutput.md) +`value` [Func<SuggestionInput, SuggestionOutput>](https://docs.microsoft.com/en-us/dotnet/api/system.func-2)
+function to apply suggestions. [SuggestionInput](./pplus.controls.suggestioninput.md) and [SuggestionOutput](./pplus.controls.suggestionoutput.md) #### Returns diff --git a/docs/apis/pplus.controls.icontrolmaskedit.md b/docs/apis/pplus.controls.icontrolmaskedit.md index 7327d6ce..740c7c3e 100644 --- a/docs/apis/pplus.controls.icontrolmaskedit.md +++ b/docs/apis/pplus.controls.icontrolmaskedit.md @@ -38,7 +38,7 @@ IControlMaskEdit AcceptEmptyValue() ###
**AddValidators(params Func<Object, ValidationResult>[])** Add a validator to accept sucessfull finish of control. -
Tip: see to validators embeding +
Tip: see to validators embedding ```csharp IControlMaskEdit AddValidators(params Func[] validators) @@ -55,7 +55,7 @@ the function validator. ###
**AmmoutPositions(Int32, Int32, Boolean)** -Defines integer lenght, decimal lenght and accept signl. +Defines integer length, decimal length and accept signl.
Valid only for type MaskedType.Number or Currency, otherwise this set will be ignored.
This set is Requeried for these types. ```csharp @@ -65,10 +65,10 @@ IControlMaskEdit AmmoutPositions(int intvalue, int decimalvalue, bool acceptSign #### Parameters `intvalue` [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32)
-integer lenght +integer length `decimalvalue` [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32)
-decimal lenght +decimal length `acceptSignal` [Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean)
True accept signal; otherwise, no. @@ -416,7 +416,7 @@ Prompt mask overwriter. Default value is 'â– '/'_' ###
**NegativeStyle(Style)** Overwrite [Style](./pplus.style.md) to region neggative input. -
Default Foreground : 'StyleControls.Answer'
Default Background : Same Console Background when setted +
Default Foreground : 'StyleControls.Answer'
Default Background : Same Console Background when set ```csharp IControlMaskEdit NegativeStyle(Style value) @@ -454,7 +454,7 @@ The timeout for valid items saved. Default value is 365 days ###
**PositiveStyle(Style)** Overwrite [Style](./pplus.style.md) to region positive input. -
Default Foreground : 'StyleControls.Answer'
Default Background : Same Console Background when setted +
Default Foreground : 'StyleControls.Answer'
Default Background : Same Console Background when set ```csharp IControlMaskEdit PositiveStyle(Style value) @@ -469,18 +469,18 @@ Style [IControlMaskEdit](./pplus.controls.icontrolmaskedit.md) -###
**SuggestionHandler(Func<SugestionInput, SugestionOutput>)** +### **SuggestionHandler(Func<SuggestionInput, SuggestionOutput>)** Add Suggestion (with mask!) Handler feature ```csharp -IControlMaskEdit SuggestionHandler(Func value) +IControlMaskEdit SuggestionHandler(Func value) ``` #### Parameters -`value` [Func<SugestionInput, SugestionOutput>](https://docs.microsoft.com/en-us/dotnet/api/system.func-2)
-function to apply suggestions. [SugestionInput](./pplus.controls.sugestioninput.md) and [SugestionOutput](./pplus.controls.sugestionoutput.md) +`value` [Func<SuggestionInput, SuggestionOutput>](https://docs.microsoft.com/en-us/dotnet/api/system.func-2)
+function to apply suggestions. [SuggestionInput](./pplus.controls.suggestioninput.md) and [SuggestionOutput](./pplus.controls.suggestionoutput.md) #### Returns @@ -489,7 +489,7 @@ function to apply suggestions. [SugestionInput](./pplus.controls.sugestioninput. ###
**TypeTipStyle(Style)** Overwrite [Style](./pplus.style.md) to region tip type input. -
Default Foreground : 'ConsoleColor.Yellow'
Default Background : same Console Background when setted +
Default Foreground : 'ConsoleColor.Yellow'
Default Background : same Console Background when set ```csharp IControlMaskEdit TypeTipStyle(Style value) diff --git a/docs/apis/pplus.controls.icontrolmaskeditlist.md b/docs/apis/pplus.controls.icontrolmaskeditlist.md index ed2261cb..5d3bbbc3 100644 --- a/docs/apis/pplus.controls.icontrolmaskeditlist.md +++ b/docs/apis/pplus.controls.icontrolmaskeditlist.md @@ -78,7 +78,7 @@ true the item cannot be removed; otherwise yes. ###
**AddValidators(params Func<Object, ValidationResult>[])** Add a validator to accept sucessfull finish of control. -
Tip: see to validators embeding +
Tip: see to validators embedding ```csharp IControlMaskEditList AddValidators(params Func[] validators) @@ -107,7 +107,7 @@ IControlMaskEditList AllowDuplicate() ###
**AmmoutPositions(Int32, Int32, Boolean)** -Defines integer lenght, decimal lenght and accept signl. +Defines integer length, decimal length and accept signl.
Valid only for type MaskedType.Number or Currency, otherwise this set will be ignored.
This set is Requeried for these types. ```csharp @@ -117,10 +117,10 @@ IControlMaskEditList AmmoutPositions(int intvalue, int decimalvalue, bool accept #### Parameters `intvalue` [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32)
-integer lenght +integer length `decimalvalue` [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32)
-decimal lenght +decimal length `acceptSignal` [Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean)
True accept signal; otherwise, no. @@ -402,7 +402,7 @@ Prompt mask overwriter. Default value is 'â– '/'_' ###
**NegativeStyle(Style)** Overwrite [Style](./pplus.style.md) to region neggative input. -
Default Foreground : 'StyleControls.Answer'
Default Background : same Console Background when setted +
Default Foreground : 'StyleControls.Answer'
Default Background : same Console Background when set ```csharp IControlMaskEditList NegativeStyle(Style value) @@ -437,7 +437,7 @@ Number of Max.items ###
**PositiveStyle(Style)** Overwrite [Style](./pplus.style.md) to region positive input. -
Default Foreground : 'StyleControls.Answer'
Default Background : Same Console Background when setted +
Default Foreground : 'StyleControls.Answer'
Default Background : Same Console Background when set ```csharp IControlMaskEditList PositiveStyle(Style value) @@ -472,18 +472,18 @@ Maximum number of items [IControlMaskEditList](./pplus.controls.icontrolmaskeditlist.md) -###
**SuggestionHandler(Func<SugestionInput, SugestionOutput>)** +### **SuggestionHandler(Func<SuggestionInput, SuggestionOutput>)** Add Suggestion Handler feature ```csharp -IControlMaskEditList SuggestionHandler(Func value) +IControlMaskEditList SuggestionHandler(Func value) ``` #### Parameters -`value` [Func<SugestionInput, SugestionOutput>](https://docs.microsoft.com/en-us/dotnet/api/system.func-2)
-function to apply suggestions. [SugestionInput](./pplus.controls.sugestioninput.md) and [SugestionOutput](./pplus.controls.sugestionoutput.md) +`value` [Func<SuggestionInput, SuggestionOutput>](https://docs.microsoft.com/en-us/dotnet/api/system.func-2)
+function to apply suggestions. [SuggestionInput](./pplus.controls.suggestioninput.md) and [SuggestionOutput](./pplus.controls.suggestionoutput.md) #### Returns @@ -492,7 +492,7 @@ function to apply suggestions. [SugestionInput](./pplus.controls.sugestioninput. ###
**TypeTipStyle(Style)** Overwrite [Style](./pplus.style.md) to region tip type input. -
Default Foreground : 'ConsoleColor.Yellow'
Default Background : same Console Background when setted +
Default Foreground : 'ConsoleColor.Yellow'
Default Background : same Console Background when set ```csharp IControlMaskEditList TypeTipStyle(Style value) diff --git a/docs/apis/pplus.controls.icontrolmultiselect-1.md b/docs/apis/pplus.controls.icontrolmultiselect-1.md index d5dbcad0..961abb58 100644 --- a/docs/apis/pplus.controls.icontrolmultiselect-1.md +++ b/docs/apis/pplus.controls.icontrolmultiselect-1.md @@ -29,7 +29,7 @@ Implements IPromptControls<IEnumerable<T>> ###
**AddDefault(params T[])** -Add default value seleted to initial list. +Add default value selected to initial list. ```csharp IControlMultiSelect AddDefault(params T[] values) @@ -356,7 +356,7 @@ Overflow strategy ### **OverwriteDefaultFrom(String, Nullable<TimeSpan>)** -Overwrite defaults start seleted value with last result saved on history. +Overwrite defaults start selected value with last result saved on history. ```csharp IControlMultiSelect OverwriteDefaultFrom(string value, Nullable timeout) @@ -393,7 +393,7 @@ Number of Max.items ### **Range(Int32, Nullable<Int32>)** -Defines a minimum and maximum (optional) range of items seleted in the list +Defines a minimum and maximum (optional) range of items selected in the list ```csharp IControlMultiSelect Range(int minvalue, Nullable maxvalue) diff --git a/docs/apis/pplus.controls.icontrolmultiselectbrowser.md b/docs/apis/pplus.controls.icontrolmultiselectbrowser.md index 87297fcf..b204708a 100644 --- a/docs/apis/pplus.controls.icontrolmultiselectbrowser.md +++ b/docs/apis/pplus.controls.icontrolmultiselectbrowser.md @@ -160,7 +160,7 @@ action to apply changes. [IPromptConfig](./pplus.controls.ipromptconfig.md) ### **Default(String)** -Default item (fullpath) seleted when started +Default item (fullpath) selected when started ```csharp IControlMultiSelectBrowser Default(string value) @@ -486,7 +486,7 @@ The [SpinnersType](./pplus.controls.spinnerstype.md) Style of spinner. [Style](./pplus.style.md) `speedAnimation` [Nullable<Int32>](https://docs.microsoft.com/en-us/dotnet/api/system.nullable-1)
-Number of mileseconds foreach interation of spinner. Valid only to SpinnersType.custom, otherwise will be ignored +Number of mileseconds foreach iteration of spinner. Valid only to SpinnersType.custom, otherwise will be ignored `customspinner` [IEnumerable<String>](https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.ienumerable-1)
IEnumerable values for custom spinner. Valid only to SpinnersType.custom, otherwise will be ignored diff --git a/docs/apis/pplus.controls.icontrolprogressbar-1.md b/docs/apis/pplus.controls.icontrolprogressbar-1.md index bd5dde63..f6479441 100644 --- a/docs/apis/pplus.controls.icontrolprogressbar-1.md +++ b/docs/apis/pplus.controls.icontrolprogressbar-1.md @@ -185,7 +185,7 @@ Fracional Digits ###
**HideElements(HideProgressBar)** Hide elements in ProgressBar. Default is Show all elements -
For more one element use | separate (Enum Flag) +
For more one element use '|' separate (Enum Flag) ```csharp IControlProgressBar HideElements(HideProgressBar value) @@ -218,7 +218,7 @@ The [SpinnersType](./pplus.controls.spinnerstype.md) Style of spinner. [Style](./pplus.style.md) `speedAnimation` [Nullable<Int32>](https://docs.microsoft.com/en-us/dotnet/api/system.nullable-1)
-Number of mileseconds foreach interation of spinner. Valid only to SpinnersType.custom, otherwise will be ignored +Number of mileseconds foreach iteration of spinner. Valid only to SpinnersType.custom, otherwise will be ignored `customspinner` [IEnumerable<String>](https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.ienumerable-1)
IEnumerable values for custom spinner. Valid only to SpinnersType.custom, otherwise will be ignored diff --git a/docs/apis/pplus.controls.icontrolselect-1.md b/docs/apis/pplus.controls.icontrolselect-1.md index ab14f970..a2d296e1 100644 --- a/docs/apis/pplus.controls.icontrolselect-1.md +++ b/docs/apis/pplus.controls.icontrolselect-1.md @@ -135,7 +135,7 @@ action to apply changes. [IPromptConfig](./pplus.controls.ipromptconfig.md) ###
**Default(T)** -Default value seleted. +Default value selected. ```csharp IControlSelect Default(T value) @@ -246,7 +246,7 @@ expresion to sort the colletion ### **OverwriteDefaultFrom(String, Nullable<TimeSpan>)** -Overwrite defaults start seleted value with last result saved on history. +Overwrite defaults start selected value with last result saved on history. ```csharp IControlSelect OverwriteDefaultFrom(string value, Nullable timeout) diff --git a/docs/apis/pplus.controls.icontrolselectbrowser.md b/docs/apis/pplus.controls.icontrolselectbrowser.md index 56e90329..d44fd8f4 100644 --- a/docs/apis/pplus.controls.icontrolselectbrowser.md +++ b/docs/apis/pplus.controls.icontrolselectbrowser.md @@ -143,7 +143,7 @@ action to apply changes. [IPromptConfig](./pplus.controls.ipromptconfig.md) ### **Default(String)** -Default item (fullpath) seleted when started +Default item (fullpath) selected when started ```csharp IControlSelectBrowser Default(string value) @@ -432,7 +432,7 @@ The [SpinnersType](./pplus.controls.spinnerstype.md) Style of spinner. [Style](./pplus.style.md) `speedAnimation` [Nullable<Int32>](https://docs.microsoft.com/en-us/dotnet/api/system.nullable-1)
-Number of mileseconds foreach interation of spinner. Valid only to SpinnersType.custom, otherwise will be ignored +Number of mileseconds foreach iteration of spinner. Valid only to SpinnersType.custom, otherwise will be ignored `customspinner` [IEnumerable<String>](https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.ienumerable-1)
IEnumerable values for custom spinner. Valid only to SpinnersType.custom, otherwise will be ignored diff --git a/docs/apis/pplus.controls.icontrolsliderswitch.md b/docs/apis/pplus.controls.icontrolsliderswitch.md index 7d42b042..868346a5 100644 --- a/docs/apis/pplus.controls.icontrolsliderswitch.md +++ b/docs/apis/pplus.controls.icontrolsliderswitch.md @@ -94,7 +94,7 @@ action to apply changes. [IPromptConfig](./pplus.controls.ipromptconfig.md) ###
**Default(Boolean)** -Default value for swith +Default value for switch ```csharp IControlSliderSwitch Default(bool value) diff --git a/docs/apis/pplus.controls.icontroltreeviewmultiselect-1.md b/docs/apis/pplus.controls.icontroltreeviewmultiselect-1.md index a297dfc8..f171fb33 100644 --- a/docs/apis/pplus.controls.icontroltreeviewmultiselect-1.md +++ b/docs/apis/pplus.controls.icontroltreeviewmultiselect-1.md @@ -168,7 +168,7 @@ action to apply changes. [IPromptConfig](./pplus.controls.ipromptconfig.md) ### **Default(T)** -Default item node seleted when started +Default item node selected when started ```csharp IControlTreeViewMultiSelect Default(T value) diff --git a/docs/apis/pplus.controls.icontroltreeviewselect-1.md b/docs/apis/pplus.controls.icontroltreeviewselect-1.md index f0a35527..953fbec4 100644 --- a/docs/apis/pplus.controls.icontroltreeviewselect-1.md +++ b/docs/apis/pplus.controls.icontroltreeviewselect-1.md @@ -151,7 +151,7 @@ action to apply changes. [IPromptConfig](./pplus.controls.ipromptconfig.md) ### **Default(T)** -Default item node seleted when started +Default item node selected when started ```csharp IControlTreeViewSelect Default(T value) diff --git a/docs/apis/pplus.controls.icontrolwait-1.md b/docs/apis/pplus.controls.icontrolwait-1.md index 2d5a51a1..2331d353 100644 --- a/docs/apis/pplus.controls.icontrolwait-1.md +++ b/docs/apis/pplus.controls.icontrolwait-1.md @@ -195,7 +195,7 @@ The [SpinnersType](./pplus.controls.spinnerstype.md) Style of spinner. [Style](./pplus.style.md) `speedAnimation` [Nullable<Int32>](https://docs.microsoft.com/en-us/dotnet/api/system.nullable-1)
-Number of mileseconds foreach interation of spinner. Valid only to SpinnersType.custom, otherwise will be ignored +Number of mileseconds foreach iteration of spinner. Valid only to SpinnersType.custom, otherwise will be ignored `customspinner` [IEnumerable<String>](https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.ienumerable-1)
IEnumerable values for custom spinner. Valid only to SpinnersType.custom, otherwise will be ignored diff --git a/docs/apis/pplus.controls.ipromptconfig.md b/docs/apis/pplus.controls.ipromptconfig.md index 961cb60d..702fb260 100644 --- a/docs/apis/pplus.controls.ipromptconfig.md +++ b/docs/apis/pplus.controls.ipromptconfig.md @@ -96,6 +96,23 @@ Value description with style [IPromptConfig](./pplus.controls.ipromptconfig.md) +###
**DisableToggleTooltip(Boolean)** + +Overwrite default DisableToggleTooltip of control + +```csharp +IPromptConfig DisableToggleTooltip(bool value) +``` + +#### Parameters + +`value` [Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean)
+value + +#### Returns + +[IPromptConfig](./pplus.controls.ipromptconfig.md) + ###
**EnabledAbortKey(Boolean)** Overwrite default Enabled/Disabled AbortKey press of control @@ -198,6 +215,23 @@ value [IPromptConfig](./pplus.controls.ipromptconfig.md) +### **ShowOnlyExistingPagination(Boolean)** + +Overwrite default Show pagination only if exists + +```csharp +IPromptConfig ShowOnlyExistingPagination(bool value) +``` + +#### Parameters + +`value` [Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean)
+value + +#### Returns + +[IPromptConfig](./pplus.controls.ipromptconfig.md) + ###
**ShowTooltip(Boolean)** Overwrite default Show/Hide Tooltip of control diff --git a/docs/apis/pplus.controls.itembrowser.md b/docs/apis/pplus.controls.itembrowser.md index c6d4f15d..fe06a5a6 100644 --- a/docs/apis/pplus.controls.itembrowser.md +++ b/docs/apis/pplus.controls.itembrowser.md @@ -60,7 +60,7 @@ public bool IsFolder { get; internal set; } ### **Length** -Get Length of item. If a folder lenght represents number of item. If file lenght represents the size in bytes +Get Length of item. If a folder length represents number of item. If file length represents the size in bytes ```csharp public long Length { get; internal set; } diff --git a/docs/apis/pplus.controls.stylecontrols.md b/docs/apis/pplus.controls.stylecontrols.md index 3368c854..c4abf784 100644 --- a/docs/apis/pplus.controls.stylecontrols.md +++ b/docs/apis/pplus.controls.stylecontrols.md @@ -28,7 +28,7 @@ Implements [IComparable](https://docs.microsoft.com/en-us/dotnet/api/system.icom | Prompt | 0 | Prompt Region | | Answer | 1 | Answer Region | | Description | 2 | Description Region | -| Sugestion | 3 | Sugestion Region | +| Suggestion | 3 | Suggestion Region | | Selected | 4 | Selected state | | UnSelected | 5 | UnSelected state | | Disabled | 6 | Disabled state | diff --git a/docs/apis/pplus.controls.styleschemaextensions.md b/docs/apis/pplus.controls.styleschemaextensions.md index dd0680c9..8bd7c0ee 100644 --- a/docs/apis/pplus.controls.styleschemaextensions.md +++ b/docs/apis/pplus.controls.styleschemaextensions.md @@ -25,7 +25,7 @@ Inheritance [Object](https://docs.microsoft.com/en-us/dotnet/api/system.object) ### **Answer(StyleSchema)** Get [Style](./pplus.style.md) text Answer. -
ValueResult Foreground : 'ConsoleColor.Cyan'
ValueResult Background : same Console Background when setted +
ValueResult Foreground : 'ConsoleColor.Cyan'
ValueResult Background : same Console Background when set ```csharp public static Style Answer(StyleSchema schema) @@ -88,7 +88,7 @@ Foreground [Color](./pplus.color.md) ###
**Chart(StyleSchema)** Get [Style](./pplus.style.md) text Chart. -
ValueResult Foreground : 'ConsoleColor.White'
ValueResult Background : same Console Background when setted +
ValueResult Foreground : 'ConsoleColor.White'
ValueResult Background : same Console Background when set ```csharp public static Style Chart(StyleSchema schema) @@ -105,7 +105,7 @@ public static Style Chart(StyleSchema schema) ###
**Description(StyleSchema)** Get [Style](./pplus.style.md) text Description. -
ValueResult Foreground : 'ConsoleColor.DarkYellow'
ValueResult Background : same Console Background when setted +
ValueResult Foreground : 'ConsoleColor.DarkYellow'
ValueResult Background : same Console Background when set ```csharp public static Style Description(StyleSchema schema) @@ -122,7 +122,7 @@ public static Style Description(StyleSchema schema) ###
**Disabled(StyleSchema)** Get [Style](./pplus.style.md) text Disabled. -
ValueResult Foreground : 'ConsoleColor.DarkGray'
ValueResult Background : same Console Background when setted +
ValueResult Foreground : 'ConsoleColor.DarkGray'
ValueResult Background : same Console Background when set ```csharp public static Style Disabled(StyleSchema schema) @@ -139,7 +139,7 @@ public static Style Disabled(StyleSchema schema) ###
**Error(StyleSchema)** Get [Style](./pplus.style.md) text Error. -
ValueResult Foreground : 'ConsoleColor.Red'
ValueResult Background : same Console Background when setted +
ValueResult Foreground : 'ConsoleColor.Red'
ValueResult Background : same Console Background when set ```csharp public static Style Error(StyleSchema schema) @@ -156,7 +156,7 @@ public static Style Error(StyleSchema schema) ###
**Pagination(StyleSchema)** Get [Style](./pplus.style.md) text Pagination. -
ValueResult Foreground : 'ConsoleColor.DarkGray'
ValueResult Background : same Console Background when setted +
ValueResult Foreground : 'ConsoleColor.DarkGray'
ValueResult Background : same Console Background when set ```csharp public static Style Pagination(StyleSchema schema) @@ -173,7 +173,7 @@ public static Style Pagination(StyleSchema schema) ###
**Prompt(StyleSchema)** Get [Style](./pplus.style.md) text Prompt. -
ValueResult Foreground : 'ConsoleColor.White'
ValueResult Background : same Console Background when setted +
ValueResult Foreground : 'ConsoleColor.White'
ValueResult Background : same Console Background when set ```csharp public static Style Prompt(StyleSchema schema) @@ -190,7 +190,7 @@ public static Style Prompt(StyleSchema schema) ###
**Selected(StyleSchema)** Get [Style](./pplus.style.md) text Selected. -
ValueResult Foreground : 'ConsoleColor.Green'
ValueResult Background : same Console Background when setted +
ValueResult Foreground : 'ConsoleColor.Green'
ValueResult Background : same Console Background when set ```csharp public static Style Selected(StyleSchema schema) @@ -221,13 +221,13 @@ public static Style Slider(StyleSchema schema) [Style](./pplus.style.md) -###
**Sugestion(StyleSchema)** +### **Suggestion(StyleSchema)** -Get [Style](./pplus.style.md) text Sugestion. -
ValueResult Foreground : 'ConsoleColor.Yellow'
ValueResult Background : same Console Background when setted +Get [Style](./pplus.style.md) text Suggestion. +
ValueResult Foreground : 'ConsoleColor.Yellow'
ValueResult Background : same Console Background when set ```csharp -public static Style Sugestion(StyleSchema schema) +public static Style Suggestion(StyleSchema schema) ``` #### Parameters @@ -241,7 +241,7 @@ public static Style Sugestion(StyleSchema schema) ###
**TaggedInfo(StyleSchema)** Get [Style](./pplus.style.md) text Tagged info. -
ValueResult Foreground : 'ConsoleColor.DarkYellow'
ValueResult Background : same Console Background when setted +
ValueResult Foreground : 'ConsoleColor.DarkYellow'
ValueResult Background : same Console Background when set ```csharp public static Style TaggedInfo(StyleSchema schema) @@ -258,7 +258,7 @@ public static Style TaggedInfo(StyleSchema schema) ###
**Tooltips(StyleSchema)** Get [Style](./pplus.style.md) text Tooltips. -
ValueResult Foreground : 'ConsoleColor.DarkGray'
ValueResult Background : same Console Background when setted +
ValueResult Foreground : 'ConsoleColor.DarkGray'
ValueResult Background : same Console Background when set ```csharp public static Style Tooltips(StyleSchema schema) @@ -275,7 +275,7 @@ public static Style Tooltips(StyleSchema schema) ###
**UnSelected(StyleSchema)** Get [Style](./pplus.style.md) text UnSelected. -
ValueResult Foreground : 'ConsoleColor.Gray'
ValueResult Background : same Console Background when setted +
ValueResult Foreground : 'ConsoleColor.Gray'
ValueResult Background : same Console Background when set ```csharp public static Style UnSelected(StyleSchema schema) diff --git a/docs/apis/pplus.controls.sugestioninput.md b/docs/apis/pplus.controls.suggestioninput.md similarity index 81% rename from docs/apis/pplus.controls.sugestioninput.md rename to docs/apis/pplus.controls.suggestioninput.md index 22c4e91a..ba123758 100644 --- a/docs/apis/pplus.controls.sugestioninput.md +++ b/docs/apis/pplus.controls.suggestioninput.md @@ -1,4 +1,4 @@ -# PromptPlus API:SugestionInput +# PromptPlus API:SuggestionInput [![Build](https://github.com/FRACerqueira/PromptPlus/workflows/Build/badge.svg)](https://github.com/FRACerqueira/PromptPlus/actions/workflows/build.yml) [![Publish](https://github.com/FRACerqueira/PromptPlus/actions/workflows/publish.yml/badge.svg)](https://github.com/FRACerqueira/PromptPlus/actions/workflows/publish.yml) @@ -8,17 +8,17 @@ [**Back to List Api**](./apis.md) -# SugestionInput +# SuggestionInput Namespace: PPlus.Controls -Represents The Sugestion Input struct. +Represents The Suggestion Input struct. ```csharp -public struct SugestionInput +public struct SuggestionInput ``` -Inheritance [Object](https://docs.microsoft.com/en-us/dotnet/api/system.object) → [ValueType](https://docs.microsoft.com/en-us/dotnet/api/system.valuetype) → [SugestionInput](./pplus.controls.sugestioninput.md) +Inheritance [Object](https://docs.microsoft.com/en-us/dotnet/api/system.object) → [ValueType](https://docs.microsoft.com/en-us/dotnet/api/system.valuetype) → [SuggestionInput](./pplus.controls.suggestioninput.md) ## Properties @@ -36,7 +36,7 @@ public object Context { get; } ###
**Text** -Get Sugestion Text input +Get Suggestion Text input ```csharp public string Text { get; } @@ -48,12 +48,12 @@ public string Text { get; } ## Constructors -### **SugestionInput()** +### **SuggestionInput()** -Create a SugestionInput +Create a SuggestionInput ```csharp -SugestionInput() +SuggestionInput() ``` **Remarks:** diff --git a/docs/apis/pplus.controls.sugestionoutput.md b/docs/apis/pplus.controls.suggestionoutput.md similarity index 78% rename from docs/apis/pplus.controls.sugestionoutput.md rename to docs/apis/pplus.controls.suggestionoutput.md index 65d2f54b..385506e1 100644 --- a/docs/apis/pplus.controls.sugestionoutput.md +++ b/docs/apis/pplus.controls.suggestionoutput.md @@ -1,4 +1,4 @@ -# PromptPlus API:SugestionOutput +# PromptPlus API:SuggestionOutput [![Build](https://github.com/FRACerqueira/PromptPlus/workflows/Build/badge.svg)](https://github.com/FRACerqueira/PromptPlus/actions/workflows/build.yml) [![Publish](https://github.com/FRACerqueira/PromptPlus/actions/workflows/publish.yml/badge.svg)](https://github.com/FRACerqueira/PromptPlus/actions/workflows/publish.yml) @@ -8,33 +8,33 @@ [**Back to List Api**](./apis.md) -# SugestionOutput +# SuggestionOutput Namespace: PPlus.Controls -Represents The Sugestion output struct. +Represents The Suggestion output struct. ```csharp -public struct SugestionOutput +public struct SuggestionOutput ``` -Inheritance [Object](https://docs.microsoft.com/en-us/dotnet/api/system.object) → [ValueType](https://docs.microsoft.com/en-us/dotnet/api/system.valuetype) → [SugestionOutput](./pplus.controls.sugestionoutput.md) +Inheritance [Object](https://docs.microsoft.com/en-us/dotnet/api/system.object) → [ValueType](https://docs.microsoft.com/en-us/dotnet/api/system.valuetype) → [SuggestionOutput](./pplus.controls.suggestionoutput.md) ## Constructors -### **SugestionOutput()** +### **SuggestionOutput()** -Create a empty SugestionOutput +Create a empty SuggestionOutput ```csharp -SugestionOutput() +SuggestionOutput() ``` ## Methods ### **Add(String)** -Add sugestion +Add suggestion ```csharp void Add(string value) @@ -43,11 +43,11 @@ void Add(string value) #### Parameters `value` [String](https://docs.microsoft.com/en-us/dotnet/api/system.string)
-text sugestion +text suggestion ###
**AddRange(IEnumerable<String>)** -Add Enumerable sugestions +Add Enumerable suggestions ```csharp void AddRange(IEnumerable items) @@ -56,7 +56,7 @@ void AddRange(IEnumerable items) #### Parameters `items` [IEnumerable<String>](https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.ienumerable-1)
-Enumerable text sugestions +Enumerable text suggestions - - - diff --git a/docs/apis/pplus.promptplus.md b/docs/apis/pplus.promptplus.md index fdcc1185..da1370b3 100644 --- a/docs/apis/pplus.promptplus.md +++ b/docs/apis/pplus.promptplus.md @@ -154,6 +154,18 @@ public static TextWriter Error { get; } [TextWriter](https://docs.microsoft.com/en-us/dotnet/api/system.io.textwriter)
+###
**ExtraExceptionInfo** + +Get/set extra console exception info + +```csharp +public static bool ExtraExceptionInfo { get; set; } +``` + +#### Property Value + +[Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean)
+ ###
**ForegroundColor** Get/Set Foreground console with color. @@ -1383,13 +1395,13 @@ The returned value is null if the end of the input stream has been reached.
Read the line from stream using Emacs keyboard shortcuts. A line is defined as a sequence of characters followed by
a car return ('\r'), a line feed ('\n'), or a carriage return
immedy followed by a line feed. The resulting string does not
contain the terminating carriage return and/or line feed. ```csharp -public static string ReadLineWithEmacs(Nullable maxlenght, CaseOptions caseOptions, Action afteraccept) +public static string ReadLineWithEmacs(Nullable maxlength, CaseOptions caseOptions, Action afteraccept) ``` #### Parameters -`maxlenght` [Nullable<UInt32>](https://docs.microsoft.com/en-us/dotnet/api/system.nullable-1)
-The input Max-lenght +`maxlength` [Nullable<UInt32>](https://docs.microsoft.com/en-us/dotnet/api/system.nullable-1)
+The input Max-length `caseOptions` [CaseOptions](./pplus.controls.caseoptions.md)
The input [CaseOptions](./pplus.controls.caseoptions.md) diff --git a/docs/apis/pplus.promptplusexception.md b/docs/apis/pplus.promptplusexception.md index 79d883b4..669de156 100644 --- a/docs/apis/pplus.promptplusexception.md +++ b/docs/apis/pplus.promptplusexception.md @@ -85,12 +85,12 @@ public string Message { get; } [String](https://docs.microsoft.com/en-us/dotnet/api/system.string)
-###
**Plataform** +### **Platform** -The Plataform running +The Platform running ```csharp -public string Plataform { get; } +public string Platform { get; } ``` #### Property Value @@ -139,20 +139,19 @@ public string Version { get; } [String](https://docs.microsoft.com/en-us/dotnet/api/system.string)
-## Constructors +## Methods -###
**PromptPlusException(String)** +### **ToString()** -Represents an exception thrown by PromptPlus +Write string exception ```csharp -public PromptPlusException(string message) +public string ToString() ``` -#### Parameters +#### Returns -`message` [String](https://docs.microsoft.com/en-us/dotnet/api/system.string)
-The message for exception +The string exception - - - diff --git a/docs/colors.md b/docs/colors.md index 745f11c0..12230c6d 100644 --- a/docs/colors.md +++ b/docs/colors.md @@ -16,7 +16,7 @@ The color class has implicit conversion to ConsoleColor. There are conversion me - Console Color - Converts a System.Console.ConsoleColor - RGB - - Converts a RGB formar (R,G,B) + - Converts a RGB format (R,G,B) - Name - Converts a name standard color diff --git a/docs/globalsettings.md b/docs/globalsettings.md index 6bb6aff0..3e7d7abd 100644 --- a/docs/globalsettings.md +++ b/docs/globalsettings.md @@ -8,7 +8,7 @@ [**Main**](index.md#table-of-contents) -The global setting modified properties for all controls. To set use : PromptPlus.Config.[Property]. Example : +The global setting modified properties for all controls. To set use: PromptPlus.Config.[Property]. Example: ```csharp PromptPlus.Config.PageSize = 10; @@ -26,36 +26,36 @@ PromptPlus.Config.PageSize = 10; - DefaultCulture - Get/Set default Culture for all controls. - PageSize - - Get/Set Page Size from colletions. Default value : 10. If value < 1 internal sette to 1. + - Get/Set Page Size from colletions. Default value: 10. If value < 1 internal set to 1. - CompletionMinimumPrefixLength - - Get/Set Minimum Prefix Length for feature AutoComplete. Default value : 3.If value < 0 internal sette to 0. + - Get/Set Minimum Prefix Length for feature AutoComplete. Default value: 3.If value < 0 internal set to 0. - CompletionWaitToStart - - Get/Set Interval in mileseconds to wait start Completion feature. Default value : 1000. If value less than 10 internal sette to 10. + - Get/Set Interval in mileseconds to wait start Completion feature. Default value: 1000. If value less than 10 internal set to 10. - CompletionMaxCount - - Get/Set Completion Max Items to return for feature AutoComplete. Default value : 1000. If value less than 1 internal sette to 1. + - Get/Set Completion Max Items to return for feature AutoComplete. Default value: 1000. If value less than 1 internal set to 1. - HistoryTimeout - - Get/Set History feature Timeout. Default value : 365 days + - Get/Set History feature Timeout. Default value: 365 days - ShowTooltip - - Get/Set enabled start show Tooltip for all controls. Default value : true + - Get/Set enabled start show Tooltip for all controls. Default value: true - EnabledAbortKey - - Get/Set enabled abortKey(ESC) for all controls. Default value : true + - Get/Set enabled abortKey(ESC) for all controls. Default value: true - HideAfterFinish - - Get/Set hide controls after finish for all controls. Default value : false + - Get/Set hide controls after finish for all controls. Default value: false - HideOnAbort - - Get/Set hide controls On Abort for all controls. Default value : false + - Get/Set hide controls On Abort for all controls. Default value: false - SecretChar - - Get/Set value char for secret input. Default value : '#'. Fall-back when null : '#' + - Get/Set value char for secret input. Default value: '#'. Fall-back when null: '#' - YesChar - - Get/Set value for YES answer. efault value : YesChar in built-in resources. Fall-back when null : Y + - Get/Set value for YES answer. Default value: YesChar in built-in resources. Fall-back when null: Y - NoChar - - Get/Set value for NO answer. Default value : NoChar in built-in resources. Fall-back when null : N + - Get/Set value for NO answer. Default value: NoChar in built-in resources. Fall-back when null: N ## Symbols [**Top**](#promptplus-settings) Global symbols modify the graphical representation of some characters for all controls. Warning: Changes to these symbols may cause an unwanted type. -To set use : PromptPlus.Config. Symbols(SymbolType, value, unicode). Example : +To set use: PromptPlus.Config. Symbols(SymbolType, value, unicode). Example: ```csharp //SET diff --git a/docs/index.md b/docs/index.md index 2d75691b..eb59f924 100644 --- a/docs/index.md +++ b/docs/index.md @@ -6,7 +6,7 @@ [![NuGet](https://img.shields.io/nuget/v/PromptPlus)](https://www.nuget.org/packages/PromptPlus/) [![Downloads](https://img.shields.io/nuget/dt/PromptPlus)](https://www.nuget.org/packages/PromptPlus/) -**PromptPlus** was developed in c# with the **netstandard2.1**, **.Net 6** and **.Net 7** target frameworks. +**PromptPlus** was developed in C# with the **netstandard2.1**, **.NET 6** and **.NET 7** target frameworks. ## Table of Contents @@ -25,35 +25,65 @@ - [Global Settings](globalsettings.md) - [Supported Platforms](#supported-platforms) - [License](#license) +- [Credits](#credits) - [API Reference](./apis/apis.md) -## Whats news in V4.0.4 +## What's new in V4.0.5 + +- Added new global propety 'ExtraExceptionInfo' to write extra console exception info +- Added new global propety 'DisableToggleTooltip' to disable toggle Tooltip +- Added new global propety 'ShowOnlyExistingPagination' to disable Page information when pagination not exists +- Added new Method DisableToggleTooltip(bool value) to overwrite default DisableToggleTooltip in control +- Added new Method ShowOnlyExistingPagination(bool value) to overwrite default Overwrite default Show pagination only if exists in control +- Added new item to Enum FilterMode : 'Disabled'. This item disable filter feature in coletions +- Improved to not show text prompt when text value is null or empty +- Improved terminal mode detection (for Windows 11 Versions) +- Rebuilt FIGlet to MIT License +- Fixed credits (MIT License Copyright) +- Fixed bug PromptPlus not restore StyleSchema when ResetColor +- Fixed Spell checking (Breaking Changes) + - SugestionInput to SuggestionInput + - Controls: MaskEdit/AddTolist/Input + - SugestionOutput to SuggestionOutput + - Controls: MaskEdit/AddTolist/Input + - MaxLenght to MaxLength + - Controls: AutoComplete/AddTolist/Input + - StyleControls.Sugestion to StyleControls.Suggestion + - StyleSchemaExtensions.Sugestion to StyleSchemaExtensions.Suggestion + - PromptPlusException.Plataform to PromptPlusException.Platform + +**Special thanks to [ividyon](https://github.com/ividyon) for spell checking corrections, all documentation, fixed credits (MIT License Copyright) and wrong method/property names** + +## What's new in V4.0.4 + - Fixed bug PromptPlus not restore terminal original setting when shutdown application - Fixed bug Autocomplete does not change result when backspace is pressed during search - Added Property CurrentBuffer in console drive to return Current Buffer running (Primary/Secondary) -- Added SwapBuffer command to swith Primary/Secondar buffer (Valid only When console 'ansi' suported) +- Added SwapBuffer command to switch Primary/Secondary buffer (Valid only When console 'ansi' supported) - Renamed 'AlternateScreen' to 'RunOnBuffer'. Now executes a custom action on TargetBuffer and returns to CurrentBuffer - Refactored console drivers initialization, control options initialization - Added auto create Environment 'PromptPlusConvertCodePage' to custom automate convert codepage to unicode-codepage - Default value is = '850;65001' -## Whats news in V4.0.3 +## What's new in V4.0.3 + - New control to switch Alternate screen - Fixed bug Console does not change foreground/background color correctly - Fixed bug Control ProgressBar - - Not show gradient when setted ProgressBarType.Fill + - Not show gradient when set ProgressBarType.Fill - Improve testability of result classes/struct (Internal to public) -## Whats news in V4.0.2 +## What's new in V4.0.2 + - New Control Pipeline - PromptPlus.Pipeline(T startvalue) - Changed WaitControl to take context value in tasks and return context in result - - There are small break-chages + - There are small break-changes - Add Answer key check equals "Yes"/"No" using config values - IsYesResponseKey(this ConsoleKeyInfo keyinfo) - IsNoResponseKey(this ConsoleKeyInfo keyinfo) -## Whats news in V4.0.X +## What's new in V4.0.X ### Newest controls and color improvement and layout @@ -68,7 +98,7 @@ ## Features [**Top**](#table-of-contents) -**_All features have IntelliSense_. The PromptPlus have more 20 controls with many features like: filters, validators, history, sugestions, spinner(19 embeding type and plus custom yours!), colors and styles for control-elements** : +**_All features have IntelliSense_. PromptPlus has more than 20 controls with many features like: filters, validators, history, suggestions, spinner(19 embedding type and plus custom yours!), colors and styles for control-elements** : - Banner Ascii - Input text / Secret / AutoComplete with spinner - MaskEdit Generic / Only Date / Only Time / DateTime / Number / Currency @@ -94,9 +124,9 @@ - Extra actions per stage : OnStartControl/OnInputRender/OnTryAcceptInput/OnFinishControl (ever) - Tooltips (ever and configurable) - Filter by Contains / StartsWith (configurable) (depends on the control) -- Collection subset items and interations (depends on the control) +- Collection subset items and iterations (depends on the control) - Page information and page-size(depends on the control) -- Spinner animmation (depends on the control) +- Spinner animation (depends on the control) - Error message (depends on the control and validators) All controls use **fluent interface**; an object-oriented API whose design relies extensively on method chaining. Its goal is to increase code legibility. The term was coined in 2005 by Eric Evans and Martin Fowler. @@ -123,7 +153,7 @@ For migrate V3 to V4 [**see this link**](migrateversion.md). ## Installing [**Top**](#table-of-contents) -PromptPlus was developed in c# with the **netstandard2.1, .NET 6 AND .NET7** target frameworks. +PromptPlus was developed in C# with the **netstandard2.1**, **.NET 6** AND **.NET 7** target frameworks. ``` Install-Package PromptPlus [-pre] @@ -147,12 +177,12 @@ dotnet run --project [name of sample] ## Console Engine [**Top**](#table-of-contents) -The console driver have the ability to detect terminal capabilities and allow for **24-bit color and text overflow strategies** based on terminal size, and left and right margins for a nicer layout. +The console driver has the ability to detect terminal capabilities and allow for **24-bit color and text overflow strategies** based on terminal size, and left and right margins for a nicer layout. The new engine detects support ansi commands and adjust output for this functionality respecting OS differences , terminal mode and Windows console mode. The Colors are automatically adjusted to the capacity of the terminal. This automatic adjustment may slightly modify the final color when converting to a lower bit resolution. ### Wrap to Console - Code sample -The PromptPlus have wrap from console for key features **cross-plataform**. +PromptPlus has **cross-platform** wrap to console for key features. ```csharp //Console.CursorLeft = 1; @@ -165,21 +195,21 @@ PromptPlus.ReadKey(); - Clear(Color? backcolor = null) - Clear console with color and set BackgroundColor with color. - ClearLine(int? row = null, Style? style = null) - - Clear row line with style + - Clear row line with style. - ClearRestOfLine(Style? style = null) - - Clear rest of line + - Clear rest of line. - WriteLines(int steps = 1) - - write many new lines + - Write many new lines. - SingleDash(string value, DashOptions dashOptions = DashOptions.AsciiSingleBorder, int extralines = 0, Style? style = null) - - Writes Write single dash after. + - Writes a line with a single dash line after. - DoubleDash(string value, DashOptions dashOptions = DashOptions.AsciiSingleBorder, int extralines = 0, Style? style = null) - - Writes a pair of lines of dashes. + - Writes a line between a pair of dash lines. - MoveCursor(CursorDirection direction, int steps) - Move cursor by direction - WaitKeypress(bool intercept, CancellationToken? cancellationToken) - - Wait a keypress with cancelation token -- ReadLineWithEmacs(uint? maxlenght = uint.MaxValue,Action afteraccept = null, CaseOptions caseOptions = CaseOptions.Any) - - Read line from stream using Emacs keyboard shortcuts with maxlenght, case options and user action after each accepted keystroke + - Wait a keypress with cancellation token +- ReadLineWithEmacs(uint? maxlength = uint.MaxValue,Action afteraccept = null, CaseOptions caseOptions = CaseOptions.Any) + - Read line from stream using Emacs keyboard shortcuts with maxlength, case options and user action after each accepted keystroke ### Extend Write / Writeline - Write(string value, Style? style = null, bool clearrestofline = false) @@ -257,7 +287,7 @@ PromptPlus ![](./images/consoleoverflowcapacity.gif) -#### Sample color capacity ([Projet sample](https://github.com/FRACerqueira/PromptPlus/tree/main/Samples/ConsoleFeaturesSamples)) +#### Sample color capacity ([Project sample](https://github.com/FRACerqueira/PromptPlus/tree/main/Samples/ConsoleFeaturesSamples)) **_Note: This layout and code was inspired by the excellent project:spectreconsole, having the same color palette_** @@ -270,7 +300,7 @@ PromptPlus PromptPlus applies the language/culture **only when running controls**. The language/culture of the application is **not affected**. If language/culture is not informed, the application's language/culture will be used with fallback to en-US. -All messages are affected when changed language/culture. PromptPlus has languages embeded: +All messages are affected when changed language/culture. PromptPlus has languages embedded: - en-US (Default) - pt-BR @@ -366,7 +396,7 @@ For more details [visit the **official API page**](./apis/pplus.promptpluskeyinf PromptPlus have a lot extensions to **commons validator** and **validator import**(No duplicate code!) -For more details see [**List validators embeding**](./apis/pplus.controls.promptvalidators.md) +For more details see [**List validators embedding**](./apis/pplus.controls.promptvalidators.md) ```csharp private class MylCass @@ -414,4 +444,15 @@ PromptPlus.EnabledAbortKey = false; Copyright 2021 @ Fernando Cerqueira -PromptPlus project is licensed under the the MIT license. For more information see [License](./LICENSE.md). +PromptPlus is licensed under the MIT license. For more information see [LICENSE](./LICENSE.md). + +## Credits +[**Top**](#table-of-contents) + +PromptPlus includes code from other software released under the MIT license: + +- [Spectre.Console](https://spectreconsole.net/), Copyright (c) 2020 Patrik Svensson, Phil Scott, Nils Andresen. +- [Sharprompt](https://github.com/shibayan/Sharprompt), Copyright (c) 2019 shibayan. +- [xmldoc2md](https://github.com/FRACerqueira/xmldoc2md), Copyright (c) 2022 Charles de Vandière. +- [FIGlet](https://github.com/auriou/FIGlet), Copyright (c) 2014 Philippe AURIOU + diff --git a/docs/migrateversion.md b/docs/migrateversion.md index de00fc8d..8e0ea671 100644 --- a/docs/migrateversion.md +++ b/docs/migrateversion.md @@ -56,14 +56,14 @@ - DescriptionSelector(Func value); - TO: ChangeDescription(Func value); - Changed: - - SuggestionHandler(Func value, bool EnterTryFininsh = false) - - TO: SuggestionHandler(Func value); + - SuggestionHandler(Func value, bool EnterTryFininsh = false) + - TO: SuggestionHandler(Func value); ### Autocomplete - Removed: CompletionInterval(value) - Removed: AcceptWithoutMatch() -- Changegd: +- Changed: - SpeedAnimation(int value) - TO: Spinner(SpinnersType spinnersType, Style? SpinnerStyle = null, int? speedAnimation = null, IEnumerable? customspinner = null) - Changed: @@ -168,7 +168,7 @@ - Many Changes, see new Keypress Control -### Slider (Number/Swith) +### Slider (Number/Switch) - Many Changes, see new Sliders Control diff --git a/docs/snapshot.md b/docs/snapshot.md index 581e80e0..5d65d6aa 100644 --- a/docs/snapshot.md +++ b/docs/snapshot.md @@ -10,7 +10,7 @@ ## Table of Contents -For each snapshot, the title is **name of projet** in folder at github [**Samples**](https://github.com/FRACerqueira/PromptPlus/tree/main/Samples). +For each snapshot, the title is **name of project** in folder at github [**Samples**](https://github.com/FRACerqueira/PromptPlus/tree/main/Samples). - [Pipeline](#pipeline) - [Alternate screen](#alternate-screen) @@ -25,7 +25,7 @@ For each snapshot, the title is **name of projet** in folder at github [**Sample - [Wait Time](#wait-time) - [Chart Bar](#chart-bar) - [Progress Bar](#progress-bar) -- [Slider Swith (on/off style)](#slider-swith) +- [Slider Switch (on/off style)](#slider-switch) - [Slider Number (vertical/Horizontal with bar)](#slider-number) - [Add to List Basic/Masked](#add-to-list) - [Browser Select file/folder](#browser-select) @@ -60,7 +60,7 @@ For each snapshot, the title is **name of projet** in folder at github [**Sample ![](./images/inputsample3.gif) -[**Top**](#promptplus-snapshot) | [**Main**](index.md#table-of-contents) | [InputWithSugestionSamples](https://github.com/FRACerqueira/PromptPlus/tree/main/Samples/InputWithSugestionSamples) +[**Top**](#promptplus-snapshot) | [**Main**](index.md#table-of-contents) | [InputWithSuggestionSamples](https://github.com/FRACerqueira/PromptPlus/tree/main/Samples/InputWithSuggestionSamples) ![](./images/inputsample4.gif) @@ -165,9 +165,9 @@ For each snapshot, the title is **name of projet** in folder at github [**Sample ![](./images/progressbar1.gif) -### Slider Swith +### Slider Switch -[**Top**](#promptplus-snapshot) | [**Main**](index.md#table-of-contents) | [SliderSwithSamples](https://github.com/FRACerqueira/PromptPlus/tree/main/Samples/SliderSwithSamples) +[**Top**](#promptplus-snapshot) | [**Main**](index.md#table-of-contents) | [SliderSwitchSamples](https://github.com/FRACerqueira/PromptPlus/tree/main/Samples/SliderSwitchSamples) ![](./images/sliderswitch1.gif)