diff --git a/Licenses/LICENSE-EastAsianWidthDotNet.md b/Licenses/LICENSE-EastAsianWidthDotNet.md new file mode 100644 index 0000000..b5a22bf --- /dev/null +++ b/Licenses/LICENSE-EastAsianWidthDotNet.md @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 Atsushi Nakamura + +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 bac13cc..5f71da5 100644 --- a/PromptPlus.sln +++ b/PromptPlus.sln @@ -107,6 +107,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AlternateScreenSamples", "S EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Licenses", "Licenses", "{ADBB4294-4DC0-43FC-A57A-4C2F9BDB68A8}" ProjectSection(SolutionItems) = preProject + Licenses\LICENSE-EastAsianWidthDotNet.md = Licenses\LICENSE-EastAsianWidthDotNet.md Licenses\LICENSE-FIGlet.md = Licenses\LICENSE-FIGlet.md Licenses\LICENSE-SpectreConsole.md = Licenses\LICENSE-SpectreConsole.md Licenses\LICENSE-xmldoc2md.md = Licenses\LICENSE-xmldoc2md.md diff --git a/README.md b/README.md index 75b6d0e..3db0c2f 100644 --- a/README.md +++ b/README.md @@ -80,6 +80,11 @@ - Optimize resource usage in rendering (less cultural dependency) - Improvement : - Reinforce the validation of invalid or optional parameters in all controls +- Improvement : + - Remove code copy (MIT license) from other project and applied package (for lower maintenance) +- Documentation: + - Examples of snapshot controls updated to reflect layout changes and reduced image size (faster page loading) + - Reviewed credit references and licenses - Renamed command: - 'DescriptionWithInputType' to 'ShowTipInputType'. - Now extra-line to tip InputType @@ -544,20 +549,22 @@ See the [Contributing guide](CONTRIBUTING.md) for developer documentation. PromptPlus **includes code(Copy)** from other software released under the **MIT license**: -- [Spectre.Console](https://spectreconsole.net/), Copyright (c) 2020 Patrik Svensson, Phil Scott, Nils Andresen. -- [FIGlet](https://github.com/auriou/FIGlet), Copyright (c) 2014 Philippe AURIOU +- [Spectre.Console](https://spectreconsole.net/), Copyright (c) 2020 Patrik Svensson, Phil Scott, Nils Andresen. See [LICENSE](Licenses/LICENSE-SpectreConsole.md). + +- [FIGlet](https://github.com/auriou/FIGlet), Copyright (c) 2014 Philippe AURIOU. See [LICENSE](Licenses/LICENSE-FIGlet.md). + +**EastAsian width generated by package** + +- [EastAsianWidthDotNet](https://github.com/nuitsjp/EastAsianWidthDotNet), Copyright (c) 2020 Atsushi Nakamura. See [LICENSE](Licenses/LICENSE-EastAsianWidthDotNet.md). **API documentation generated by** -- [xmldoc2md](https://github.com/FRACerqueira/xmldoc2md), Copyright (c) 2022 Charles de Vandière. +- [xmldoc2md](https://github.com/FRACerqueira/xmldoc2md), Copyright (c) 2022 Charles de Vandière. See [LICENSE](Licenses/LICENSE-xmldoc2md.md). ## License [**Top**](#table-of-contents) Copyright 2021 @ Fernando Cerqueira -PromptPlus is licensed under the MIT license. For more information see [LICENSE](https://github.com/FRACerqueira/PromptPlus/blob/master/LICENSE). +PromptPlus is licensed under the MIT license. See [LICENSE](https://github.com/FRACerqueira/PromptPlus/blob/master/LICENSE). -* For Spectre.Console licensing information, see [LICENSE-SpectreConsole](Licenses/LICENSE-SpectreConsole.md). -* For FIGlet licensing information, see [LICENSE-FIGlet](Licenses/LICENSE-FIGlet.md). -* For xmldoc2md licensing information, see [LICENSE-xmldoc2md](Licenses/LICENSE-xmldoc2md.md). diff --git a/Src/Controls/StringStyle.cs b/Src/Controls/StringStyle.cs index 0729fab..a0c4ee5 100644 --- a/Src/Controls/StringStyle.cs +++ b/Src/Controls/StringStyle.cs @@ -3,7 +3,7 @@ // The maintenance and evolution is maintained by the PromptPlus project under MIT license // *************************************************************************************** -using PPlus.Controls.Objects; +using EastAsianWidthDotNet; using System; namespace PPlus.Controls @@ -32,7 +32,7 @@ public StringStyle(string text) { Text = text.NormalizeNewLines(); Style = Style.Default; - Width = (text??string.Empty).Length; + Width = (text??string.Empty).GetWidth(); } /// @@ -54,7 +54,7 @@ public StringStyle(string text, Style style) { Text = text.NormalizeNewLines(); Style = style; - Width = (text ?? string.Empty).Length; + Width = (text ?? string.Empty).GetWidth(); SkipMarkup = false; ClearRestOfLine = true; } @@ -64,7 +64,7 @@ internal StringStyle(string text, Style style, bool skipmarkupparse, bool clearr { Text = text.NormalizeNewLines(); Style = style; - Width = (text ?? string.Empty).Length; + Width = (text ?? string.Empty).GetWidth(); SkipMarkup = skipmarkupparse; ClearRestOfLine = clearrestofline; } diff --git a/Src/Drivers/ConsoleDriveMemory.cs b/Src/Drivers/ConsoleDriveMemory.cs index ea61804..6e07a51 100644 --- a/Src/Drivers/ConsoleDriveMemory.cs +++ b/Src/Drivers/ConsoleDriveMemory.cs @@ -11,6 +11,7 @@ using System; using System.Collections.Generic; using PPlus.Controls.Objects; +using EastAsianWidthDotNet; namespace PPlus.Drivers { @@ -303,10 +304,10 @@ private void EnsureCursorPosition(Segment[] segments) var itemaux = item; do { - max = _profile.BufferWidth - CursorLeft - itemaux.Length; + max = _profile.BufferWidth - CursorLeft - itemaux.GetWidth(); if (max >= 0) { - SetCursorPosition(CursorLeft + itemaux.Length, CursorTop); + SetCursorPosition(CursorLeft + itemaux.GetWidth(), CursorTop); itemaux = string.Empty; } else @@ -316,7 +317,7 @@ private void EnsureCursorPosition(Segment[] segments) itemaux = itemaux[..(max * -1)]; } } - while (itemaux.Length != 0); + while (itemaux.GetWidth() != 0); if (pos < lines.Length) { SetCursorPosition(CursorLeft, CursorTop + 1); @@ -350,7 +351,7 @@ private int CountLines(Segment[] segments, int left, int width, int padleft) { if (part != null) { - pos += part.Length; + pos += part.GetWidth(); switch (overflow) { case Overflow.None: diff --git a/Src/Drivers/ConsoleDriveWindows.cs b/Src/Drivers/ConsoleDriveWindows.cs index d37cc0c..0873c31 100644 --- a/Src/Drivers/ConsoleDriveWindows.cs +++ b/Src/Drivers/ConsoleDriveWindows.cs @@ -3,6 +3,7 @@ // The maintenance and evolution is maintained by the PromptPlus project under MIT license // *************************************************************************************** +using EastAsianWidthDotNet; using PPlus.Controls.Objects; using PPlus.Drivers.Ansi; using System; @@ -329,7 +330,7 @@ private int CountLines(Segment[] segments, int left, int width, int padleft) } if (part != null) { - pos += part.Length; + pos += part.GetWidth(); switch (overflow) { case Overflow.None: diff --git a/Src/NugetREADME.md b/Src/NugetREADME.md index a294272..19d4d18 100644 --- a/Src/NugetREADME.md +++ b/Src/NugetREADME.md @@ -54,6 +54,11 @@ PromptPlus **Supports 4/8/24-bit colors** in the terminal with auto-detection of - Optimize resource usage in rendering (less cultural dependency) - Improvement : - Reinforce the validation of invalid or optional parameters in all controls +- Improvement : + - Remove code copy (MIT license) from other project and applied package (for lower maintenance) +- Documentation: + - Examples of snapshot controls updated to reflect layout changes and reduced image size (faster page loading) + - Reviewed credit references and licenses - Renamed command: - 'DescriptionWithInputType' to 'ShowTipInputType'. - Now extra-line to tip InputType @@ -121,17 +126,25 @@ var kp = PromptPlus - macOS - Terminal.app -## **License** +## Credits -Copyright 2021 @ Fernando Cerqueira +PromptPlus **includes code(Copy)** from other software released under the **MIT license**: + +- [Spectre.Console](https://spectreconsole.net/), Copyright (c) 2020 Patrik Svensson, Phil Scott, Nils Andresen. See [LICENSE](Licenses/LICENSE-SpectreConsole.md). + +- [FIGlet](https://github.com/auriou/FIGlet), Copyright (c) 2014 Philippe AURIOU. See [LICENSE](Licenses/LICENSE-FIGlet.md). -This project is licensed under the [MIT License](https://github.com/FRACerqueira/PromptPlus/blob/master/LICENSE) +**EastAsian width generated by package** +- [EastAsianWidthDotNet](https://github.com/nuitsjp/EastAsianWidthDotNet), Copyright (c) 2020 Atsushi Nakamura. See [LICENSE](Licenses/LICENSE-EastAsianWidthDotNet.md). -## **Credits** +**API documentation generated by** +- [xmldoc2md](https://github.com/FRACerqueira/xmldoc2md), Copyright (c) 2022 Charles de Vandière. See [LICENSE](Licenses/LICENSE-xmldoc2md.md). + +## License + +Copyright 2021 @ Fernando Cerqueira -PromptPlus **includes code(copy)** from other software released under the **MIT license**: +PromptPlus is licensed under the MIT license. See [LICENSE](https://github.com/FRACerqueira/PromptPlus/blob/master/LICENSE). -- [Spectre.Console](https://spectreconsole.net/), Copyright (c) 2020 Patrik Svensson, Phil Scott, Nils Andresen. -- [FIGlet](https://github.com/auriou/FIGlet), Copyright (c) 2014 Philippe AURIOU diff --git a/Src/PromptPlus.csproj b/Src/PromptPlus.csproj index 415d0af..f01694c 100644 --- a/Src/PromptPlus.csproj +++ b/Src/PromptPlus.csproj @@ -55,6 +55,7 @@ + diff --git a/Src/README.txt b/Src/README.txt index 6813d22..5110f7f 100644 --- a/Src/README.txt +++ b/Src/README.txt @@ -74,6 +74,11 @@ PromptPlus was developed in C# with target frameworks: - Optimize resource usage in rendering (less cultural dependency) - Improvement : - Reinforce the validation of invalid or optional parameters in all controls +- Improvement : + - Remove code copy (MIT license) from other project and applied package (for lower maintenance) +- Documentation: + - Examples of snapshot controls updated to reflect layout changes and reduced image size (faster page loading) + - Reviewed credit references and licenses - Renamed command: - 'DescriptionWithInputType' to 'ShowTipInputType'. - Now extra-line to tip InputType @@ -141,13 +146,6 @@ var kp = PromptPlus - macOS - Terminal.app -**License** ------------ - -Copyright 2021 @ Fernando Cerqueira -PromptPlus project is licensed under the the MIT license. -https://github.com/FRACerqueira/PromptPlus/blob/master/LICENSE - **Credits** ----------- @@ -156,3 +154,13 @@ PromptPlus includes code(copy) from other software released under the MIT licens Spectre.Console(https://spectreconsole.net/), Copyright (c) 2020 Patrik Svensson, Phil Scott, Nils Andresen. FIGlet(https://github.com/auriou/FIGlet), Copyright (c) 2014 Philippe AURIOU +**EastAsian width generated by package** + +[EastAsianWidthDotNet](https://github.com/nuitsjp/EastAsianWidthDotNet), Copyright (c) 2020 Atsushi Nakamura. + +**License** +----------- + +Copyright 2021 @ Fernando Cerqueira +PromptPlus project is licensed under the the MIT license. +https://github.com/FRACerqueira/PromptPlus/blob/master/LICENSE \ No newline at end of file diff --git a/docs/index.md b/docs/index.md index a6a3b9f..c6d3264 100644 --- a/docs/index.md +++ b/docs/index.md @@ -25,8 +25,8 @@ - [Validators](#validators) - [Global Settings](globalsettings.md) - [Supported Platforms](#supported-platforms) -- [License](#license) - [Credits](#credits) +- [License](#license) - [API Reference](./apis/apis.md) ## What's new in V4.2.0 @@ -73,6 +73,11 @@ - Optimize resource usage in rendering (less cultural dependency) - Improvement : - Reinforce the validation of invalid or optional parameters in all controls +- Improvement : + - Remove code copy (MIT license) from other project and applied package (for lower maintenance) +- Documentation: + - Examples of snapshot controls updated to reflect layout changes and reduced image size (faster page loading) + - Reviewed credit references and licenses - Renamed command: - 'DescriptionWithInputType' to 'ShowTipInputType'. - Now extra-line to tip InputType @@ -443,21 +448,28 @@ PromptPlus.EnabledAbortKey = false; - macOS - Terminal.app -## License + +## Credits [**Top**](#table-of-contents) -Copyright 2021 @ Fernando Cerqueira +PromptPlus **includes code(Copy)** from other software released under the **MIT license**: -PromptPlus is licensed under the MIT license. For more information see [LICENSE](https://github.com/FRACerqueira/PromptPlus/blob/master/LICENSE). +- [Spectre.Console](https://spectreconsole.net/), Copyright (c) 2020 Patrik Svensson, Phil Scott, Nils Andresen. See [LICENSE](Licenses/LICENSE-SpectreConsole.md). -## Credits -[**Top**](#table-of-contents) +- [FIGlet](https://github.com/auriou/FIGlet), Copyright (c) 2014 Philippe AURIOU. See [LICENSE](Licenses/LICENSE-FIGlet.md). -PromptPlus **includes code(copy)** from other software released under the **MIT license**: +**EastAsian width generated by package** -- [Spectre.Console](https://spectreconsole.net/), Copyright (c) 2020 Patrik Svensson, Phil Scott, Nils Andresen. -- [FIGlet](https://github.com/auriou/FIGlet), Copyright (c) 2014 Philippe AURIOU +- [EastAsianWidthDotNet](https://github.com/nuitsjp/EastAsianWidthDotNet), Copyright (c) 2020 Atsushi Nakamura. See [LICENSE](Licenses/LICENSE-EastAsianWidthDotNet.md). **API documentation generated by** -- [xmldoc2md](https://github.com/FRACerqueira/xmldoc2md), Copyright (c) 2022 Charles de Vandière. \ No newline at end of file +- [xmldoc2md](https://github.com/FRACerqueira/xmldoc2md), Copyright (c) 2022 Charles de Vandière. See [LICENSE](Licenses/LICENSE-xmldoc2md.md). + +## License +[**Top**](#table-of-contents) + +Copyright 2021 @ Fernando Cerqueira + +PromptPlus is licensed under the MIT license. See [LICENSE](https://github.com/FRACerqueira/PromptPlus/blob/master/LICENSE). +