From 63ec0e3f0ebbe5e8873c1e00423dfbacff7574bc Mon Sep 17 00:00:00 2001 From: Josh McKinney Date: Tue, 23 Jul 2024 20:58:26 -0700 Subject: [PATCH] chore: various fixes / clippy lints (#6) - **chore: set msrv to 1.74** - **chore: move shared config to tui-widgets** - **chore: use workspace package metadata** - **fix: various clippy lints** --- .gitignore | 1 + .../.markdownlint.yaml => .markdownlint.yaml | 2 + .../CONTRIBUTING.md => CONTRIBUTING.md | 8 +- Cargo.lock | 20 +- Cargo.toml | 11 +- bacon.toml | 40 +++- tui-scrollview/cliff.toml => cliff.toml | 0 .../release-plz.toml => release-plz.toml | 0 tui-prompts/rustfmt.toml => rustfmt.toml | 0 tui-big-text/.github/dependabot.yml | 15 -- tui-big-text/.github/workflows/check.yml | 12 - tui-big-text/.github/workflows/release.yml | 17 -- tui-big-text/.github/workflows/test.yml | 11 - tui-big-text/.gitignore | 2 - tui-big-text/LICENSE-APACHE | 202 ---------------- tui-big-text/LICENSE-MIT | 21 -- tui-big-text/bacon.toml | 83 ------- tui-big-text/cliff.toml | 88 ------- tui-big-text/typos.toml | 3 - tui-prompts/.gitignore | 1 - tui-prompts/.markdownlint.yaml | 8 - tui-prompts/LICENSE | 221 ------------------ tui-prompts/bacon.toml | 78 ------- tui-prompts/dependabot.yml | 12 - tui-prompts/src/lib.rs | 2 - tui-prompts/src/text_prompt.rs | 9 +- tui-scrollview/.gitignore | 1 - tui-scrollview/CONTRIBUTING.md | 86 ------- tui-scrollview/Cargo.toml | 12 +- tui-scrollview/LICENSE-APACHE | 202 ---------------- tui-scrollview/LICENSE-MIT | 21 -- tui-scrollview/dependabot.yml | 15 -- tui-scrollview/examples/scrollview.rs | 10 +- tui-scrollview/release-plz.toml | 2 - tui-scrollview/src/scroll_view.rs | 10 +- typos.toml | 2 + 36 files changed, 85 insertions(+), 1143 deletions(-) rename tui-big-text/.markdownlint.yaml => .markdownlint.yaml (92%) rename tui-big-text/CONTRIBUTING.md => CONTRIBUTING.md (94%) rename tui-scrollview/cliff.toml => cliff.toml (100%) rename tui-big-text/release-plz.toml => release-plz.toml (100%) rename tui-prompts/rustfmt.toml => rustfmt.toml (100%) delete mode 100644 tui-big-text/.github/dependabot.yml delete mode 100644 tui-big-text/.github/workflows/check.yml delete mode 100644 tui-big-text/.github/workflows/release.yml delete mode 100644 tui-big-text/.github/workflows/test.yml delete mode 100644 tui-big-text/.gitignore delete mode 100644 tui-big-text/LICENSE-APACHE delete mode 100644 tui-big-text/LICENSE-MIT delete mode 100644 tui-big-text/bacon.toml delete mode 100644 tui-big-text/cliff.toml delete mode 100644 tui-big-text/typos.toml delete mode 100644 tui-prompts/.gitignore delete mode 100644 tui-prompts/.markdownlint.yaml delete mode 100644 tui-prompts/LICENSE delete mode 100644 tui-prompts/bacon.toml delete mode 100644 tui-prompts/dependabot.yml delete mode 100644 tui-scrollview/.gitignore delete mode 100644 tui-scrollview/CONTRIBUTING.md delete mode 100644 tui-scrollview/LICENSE-APACHE delete mode 100644 tui-scrollview/LICENSE-MIT delete mode 100644 tui-scrollview/dependabot.yml delete mode 100644 tui-scrollview/release-plz.toml create mode 100644 typos.toml diff --git a/.gitignore b/.gitignore index ea8c4bf..4fffb2f 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /target +/Cargo.lock diff --git a/tui-big-text/.markdownlint.yaml b/.markdownlint.yaml similarity index 92% rename from tui-big-text/.markdownlint.yaml rename to .markdownlint.yaml index 1e42fce..b7d6d89 100644 --- a/tui-big-text/.markdownlint.yaml +++ b/.markdownlint.yaml @@ -1,5 +1,7 @@ no-inline-html: allowed_elements: + - h1 + - img - br - details - summary diff --git a/tui-big-text/CONTRIBUTING.md b/CONTRIBUTING.md similarity index 94% rename from tui-big-text/CONTRIBUTING.md rename to CONTRIBUTING.md index 1124c7a..5f558cb 100644 --- a/tui-big-text/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,6 +1,6 @@ # Contribution guidelines -First off, thank you for considering contributing to tui-big-text. +First off, thank you for considering contributing to tui-widgets. If your contribution is not straightforward, please first discuss the change you wish to make by creating a new issue before making the change. @@ -8,7 +8,7 @@ wish to make by creating a new issue before making the change. ## Reporting issues Before reporting an issue on the -[issue tracker](https://github.com/joshka/tui-big-text/issues), +[issue tracker](https://github.com/joshka/tui-widgets/issues), please check that it has not already been reported by searching for some related keywords. @@ -55,8 +55,8 @@ A specification for adding human and machine readable meaning to commit messages This is no different than other Rust projects. ```shell -git clone https://github.com/joshka/tui-big-text -cd tui-big-text +git clone https://github.com/joshka/tui-widgets +cd tui-widgets cargo test ``` diff --git a/Cargo.lock b/Cargo.lock index d960fe7..522f33f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -161,9 +161,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "clap" -version = "4.5.8" +version = "4.5.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84b3edb18336f4df585bc9aa31dd99c036dfa5dc5e9a2939a722a188f3a8970d" +checksum = "8f6b81fb3c84f5563d509c59b5a48d935f689e993afa90fe39047f05adef9142" dependencies = [ "clap_builder", "clap_derive", @@ -171,9 +171,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.8" +version = "4.5.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1c09dd5ada6c6c78075d6fd0da3f90d8080651e2d6cc8eb2f1aaa4034ced708" +checksum = "5ca6706fd5224857d9ac5eb9355f6683563cc0541c7cd9d014043b57cbec78ac" dependencies = [ "anstream", "anstyle", @@ -382,9 +382,9 @@ checksum = "875488b8711a968268c7cf5d139578713097ca4635a76044e8fe8eedf831d07e" [[package]] name = "futures" -version = "0.3.21" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f73fe65f54d1e12b726f517d3e2135ca3125a437b6d998caf1962961f7172d9e" +checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" dependencies = [ "futures-channel", "futures-core", @@ -793,9 +793,9 @@ dependencies = [ [[package]] name = "ratatui-macros" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8c61408e431e111a6fecee4270953cdbef8a0b363fd215a5dadd9b93ce0797d" +checksum = "6eb998c66043d39b6e8c1ebb9db7227857eb180263a5f52dba2fafd19e6eb485" dependencies = [ "ratatui", ] @@ -1001,9 +1001,9 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "strum" -version = "0.26.1" +version = "0.26.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "723b93e8addf9aa965ebe2d11da6d7540fa2283fcea14b3371ff055f7ba13f5f" +checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06" dependencies = [ "strum_macros", ] diff --git a/Cargo.toml b/Cargo.toml index eb68784..c5a26dc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,7 +7,7 @@ authors = ["Joshka"] license = "MIT OR Apache-2.0" repository = "https://github.com/joshka/tui-widgets" edition = "2021" -rust-version = "1.63.0" +rust-version = "1.74.0" categories = ["command-line-interface", "gui"] keywords = ["cli", "console", "ratatui", "terminal", "tui"] @@ -26,6 +26,15 @@ rstest = "0.21.0" strum = { version = "0.26.1", features = ["derive"] } tokio = { version = "1.39" } +[lints.rust] +unused = "warn" + +[lints.clippy] +# cargo = "warn" # currently fails because crossterm 0.27.0 uses multiple windows crate versions +pedantic = "warn" +nursery = "warn" + + [package] name = "tui-widgets" description = "A collection of useful widgets for building terminal user interfaces using Ratatui" diff --git a/bacon.toml b/bacon.toml index 3b6bcda..9ae9913 100644 --- a/bacon.toml +++ b/bacon.toml @@ -23,7 +23,15 @@ command = [ need_stdout = false [jobs.clippy] -command = ["cargo", "clippy", "--all-targets", "--color", "always"] +command = [ + "cargo", + "clippy", + "--workspace", + "--all-features", + "--all-targets", + "--color", + "always", +] need_stdout = false [jobs.test] @@ -48,7 +56,7 @@ need_stdout = false [jobs.doc-open] command = ["cargo", "doc", "--color", "always", "--no-deps", "--open"] need_stdout = false -on_success = "back" # so that we don't open the browser at each change +on_success = "job:doc" # so that we don't open the browser at each change # You can run your application and have the result displayed in bacon, # *if* it makes sense for this crate. You can run an example the same @@ -65,9 +73,35 @@ command = [ need_stdout = true allow_warnings = true +[jobs.coverage] +command = [ + "cargo", + "llvm-cov", + "--workspace", + "--lcov", + "--output-path", + "target/lcov.info", + "--color", + "always", +] + +[jobs.format] +command = ["cargo", "+nightly", "fmt", "--", "--check"] + +[jobs.rdme] +command = ["cargo", "rdme", "--force"] +need_stdout = true + +[jobs.vhs] +command = ["vhs", "tui-prompts/examples/text.tape"] +need_stdout = true + # You may define here keybindings that would be specific to # a project, for example a shortcut to launch a specific job. # Shortcuts to internal functions (scrolling, toggling, etc.) # should go in your personal global prefs.toml file instead. [keybindings] -# alt-m = "job:my-job" +shift-r = "job:rdme" +f = "job:format" +o = "job:coverage" +v = "job:vhs" diff --git a/tui-scrollview/cliff.toml b/cliff.toml similarity index 100% rename from tui-scrollview/cliff.toml rename to cliff.toml diff --git a/tui-big-text/release-plz.toml b/release-plz.toml similarity index 100% rename from tui-big-text/release-plz.toml rename to release-plz.toml diff --git a/tui-prompts/rustfmt.toml b/rustfmt.toml similarity index 100% rename from tui-prompts/rustfmt.toml rename to rustfmt.toml diff --git a/tui-big-text/.github/dependabot.yml b/tui-big-text/.github/dependabot.yml deleted file mode 100644 index 0efb945..0000000 --- a/tui-big-text/.github/dependabot.yml +++ /dev/null @@ -1,15 +0,0 @@ -# To get started with Dependabot version updates, you'll need to specify which -# package ecosystems to update and where the package manifests are located. -# Please see the documentation for all configuration options: -# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates - -version: 2 -updates: - - package-ecosystem: "github-actions" - directory: "/" - schedule: - interval: "weekly" - - package-ecosystem: "cargo" # See documentation for possible values - directory: "/" # Location of package manifests - schedule: - interval: "weekly" diff --git a/tui-big-text/.github/workflows/check.yml b/tui-big-text/.github/workflows/check.yml deleted file mode 100644 index 957418f..0000000 --- a/tui-big-text/.github/workflows/check.yml +++ /dev/null @@ -1,12 +0,0 @@ -on: - push: - branches: - - main - pull_request: -jobs: - check: - permissions: - checks: write - uses: joshka/github-workflows/.github/workflows/rust-check.yml@main - with: - msrv: 1.74.0 diff --git a/tui-big-text/.github/workflows/release.yml b/tui-big-text/.github/workflows/release.yml deleted file mode 100644 index c8c413f..0000000 --- a/tui-big-text/.github/workflows/release.yml +++ /dev/null @@ -1,17 +0,0 @@ -permissions: - pull-requests: write - contents: write - -on: - push: - branches: - - main - workflow_dispatch: -jobs: - release-plz: - uses: joshka/github-workflows/.github/workflows/rust-release-plz.yml@main - permissions: - pull-requests: write - contents: write - secrets: - CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} diff --git a/tui-big-text/.github/workflows/test.yml b/tui-big-text/.github/workflows/test.yml deleted file mode 100644 index 6c8e69a..0000000 --- a/tui-big-text/.github/workflows/test.yml +++ /dev/null @@ -1,11 +0,0 @@ -on: - push: - branches: - - main - pull_request: - -jobs: - test: - uses: joshka/github-workflows/.github/workflows/rust-test.yml@main - secrets: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/tui-big-text/.gitignore b/tui-big-text/.gitignore deleted file mode 100644 index 4fffb2f..0000000 --- a/tui-big-text/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/target -/Cargo.lock diff --git a/tui-big-text/LICENSE-APACHE b/tui-big-text/LICENSE-APACHE deleted file mode 100644 index d645695..0000000 --- a/tui-big-text/LICENSE-APACHE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/tui-big-text/LICENSE-MIT b/tui-big-text/LICENSE-MIT deleted file mode 100644 index 05d9d5e..0000000 --- a/tui-big-text/LICENSE-MIT +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2023 Josh McKinney - -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. diff --git a/tui-big-text/bacon.toml b/tui-big-text/bacon.toml deleted file mode 100644 index 9175fa3..0000000 --- a/tui-big-text/bacon.toml +++ /dev/null @@ -1,83 +0,0 @@ -# This is a configuration file for the bacon tool -# -# Bacon repository: https://github.com/Canop/bacon -# Complete help on configuration: https://dystroy.org/bacon/config/ -# You can also check bacon's own bacon.toml file -# as an example: https://github.com/Canop/bacon/blob/main/bacon.toml - -default_job = "check" - -[jobs.check] -command = ["cargo", "check", "--color", "always"] -need_stdout = false - -[jobs.check-all] -command = ["cargo", "check", "--all-targets", "--color", "always"] -need_stdout = false - -[jobs.clippy] -command = ["cargo", "clippy", "--all-targets", "--color", "always"] -need_stdout = false - -[jobs.test] -command = [ - "cargo", - "test", - "--color", - "always", - "--", - "--color", - "always", # see https://github.com/Canop/bacon/issues/124 -] -need_stdout = true - -[jobs.doc] -command = ["cargo", "doc", "--color", "always", "--no-deps"] -need_stdout = false - -# If the doc compiles, then it opens in your browser and bacon switches -# to the previous job -[jobs.doc-open] -command = ["cargo", "doc", "--color", "always", "--no-deps", "--open"] -need_stdout = false -# so that we don't open the browser at each change -on_success = "back" - -# You can run your application and have the result displayed in bacon, -# *if* it makes sense for this crate. You can run an example the same -# way. Don't forget the `--color always` part or the errors won't be -# properly parsed. -[jobs.run] -command = [ - "cargo", - "run", - "--color", - "always", - # put launch parameters for your program behind a `--` separator -] -need_stdout = true -allow_warnings = true - -[jobs.coverage] -command = [ - "cargo", - "llvm-cov", - "--lcov", - "--output-path", - "target/lcov.info", - "--color", - "always", -] - -[jobs.rdme] -command = ["cargo", "rdme", "--force"] -need_stdout = true - -# You may define here keybindings that would be specific to -# a project, for example a shortcut to launch a specific job. -# Shortcuts to internal functions (scrolling, toggling, etc.) -# should go in your personal global prefs.toml file instead. -[keybindings] -# alt-m = "job:my-job" -v = "job:coverage" -shift-r = "job:rdme" \ No newline at end of file diff --git a/tui-big-text/cliff.toml b/tui-big-text/cliff.toml deleted file mode 100644 index b6afdf3..0000000 --- a/tui-big-text/cliff.toml +++ /dev/null @@ -1,88 +0,0 @@ -# git-cliff ~ default configuration file -# https://git-cliff.org/docs/configuration -# -# Lines starting with "#" are comments. -# Configuration options are organized into tables and keys. -# See documentation for more information on available options. - -[changelog] -# changelog header -header = """ -# Changelog\n -All notable changes to this project will be documented in this file.\n -""" -# template for the changelog body -# https://keats.github.io/tera/docs/#introduction -body = """ -{% if version %}\ - ## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }} -{% else %}\ - ## [unreleased] -{% endif %}\ -{% for group, commits in commits | group_by(attribute="group") %} - ### {{ group | striptags | trim | upper_first }} - {% for commit in commits %} - - {% if commit.scope %}*({{ commit.scope }})* {% endif %}\ - {% if commit.breaking %}[**breaking**] {% endif %}\ - {{ commit.message | upper_first }}\ - {% endfor %} -{% endfor %}\n -""" -# template for the changelog footer -footer = """ - -""" -# remove the leading and trailing s -trim = true -# postprocessors -postprocessors = [ - # { pattern = '', replace = "https://github.com/orhun/git-cliff" }, # replace repository URL -] - -[git] -# parse the commits based on https://www.conventionalcommits.org -conventional_commits = true -# filter out the commits that are not conventional -filter_unconventional = true -# process each line of a commit as an individual commit -split_commits = false -# regex for preprocessing the commit messages -commit_preprocessors = [ - # Replace issue numbers - { pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](https://github.com/joshka/tui-big-text/issues/${2}))" }, - # Check spelling of the commit with https://github.com/crate-ci/typos - # If the spelling is incorrect, it will be automatically fixed. - #{ pattern = '.*', replace_command = 'typos --write-changes -' }, -] -# regex for parsing and grouping commits -commit_parsers = [ - { message = "^feat", group = "๐Ÿš€ Features" }, - { message = "^fix", group = "๐Ÿ› Bug Fixes" }, - { message = "^doc", group = "๐Ÿ“š Documentation" }, - { message = "^perf", group = "โšก Performance" }, - { message = "^refactor", group = "๐Ÿšœ Refactor" }, - { message = "^style", group = "๐ŸŽจ Styling" }, - { message = "^test", group = "๐Ÿงช Testing" }, - { message = "^chore\\(release\\): prepare for", skip = true }, - { message = "^chore\\(pr\\)", skip = true }, - { message = "^chore\\(pull\\)", skip = true }, - { message = "^chore|^ci", group = "โš™๏ธ Miscellaneous Tasks" }, - { body = ".*security", group = "๐Ÿ›ก๏ธ Security" }, - { message = "^revert", group = "โ—€๏ธ Revert" }, -] -# protect breaking changes from being skipped due to matching a skipping commit_parser -protect_breaking_commits = false -# filter out the commits that are not matched by commit parsers -filter_commits = false -# regex for matching git tags -# tag_pattern = "v[0-9].*" -# regex for skipping tags -# skip_tags = "" -# regex for ignoring tags -# ignore_tags = "" -# sort the tags topologically -topo_order = false -# sort the commits inside sections by oldest/newest order -sort_commits = "oldest" -# limit the number of commits included in the changelog. -# limit_commits = 42 diff --git a/tui-big-text/typos.toml b/tui-big-text/typos.toml deleted file mode 100644 index d84bd4d..0000000 --- a/tui-big-text/typos.toml +++ /dev/null @@ -1,3 +0,0 @@ -[default.extend-words] -# Don't correct the surname "Teh" -ratatui = "ratatui" \ No newline at end of file diff --git a/tui-prompts/.gitignore b/tui-prompts/.gitignore deleted file mode 100644 index ea8c4bf..0000000 --- a/tui-prompts/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/target diff --git a/tui-prompts/.markdownlint.yaml b/tui-prompts/.markdownlint.yaml deleted file mode 100644 index 50bddae..0000000 --- a/tui-prompts/.markdownlint.yaml +++ /dev/null @@ -1,8 +0,0 @@ -no-inline-html: - allowed_elements: - - h1 - - img - - details - - summary -line-length: - line_length: 100 diff --git a/tui-prompts/LICENSE b/tui-prompts/LICENSE deleted file mode 100644 index 7aa886f..0000000 --- a/tui-prompts/LICENSE +++ /dev/null @@ -1,221 +0,0 @@ -Copyright (c) Josh McKinney - -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. - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright {yyyy} {name of copyright owner} - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/tui-prompts/bacon.toml b/tui-prompts/bacon.toml deleted file mode 100644 index cf580ad..0000000 --- a/tui-prompts/bacon.toml +++ /dev/null @@ -1,78 +0,0 @@ -# This is a configuration file for the bacon tool -# -# Bacon repository: https://github.com/Canop/bacon -# Complete help on configuration: https://dystroy.org/bacon/config/ -# You can also check bacon's own bacon.toml file -# as an example: https://github.com/Canop/bacon/blob/main/bacon.toml - -default_job = "check" - -[jobs.check] -command = ["cargo", "check", "--color", "always"] -need_stdout = false - -[jobs.check-all] -command = ["cargo", "check", "--all-targets", "--color", "always"] -need_stdout = false - -[jobs.clippy] -command = [ - "cargo", "clippy", - "--all-targets", - "--color", "always", -] -need_stdout = false - -[jobs.test] -command = [ - "cargo", "test", "--color", "always", - "--", "--color", "always", # see https://github.com/Canop/bacon/issues/124 -] -need_stdout = true - -[jobs.doc] -command = ["cargo", "doc", "--color", "always"] -need_stdout = false - -# If the doc compiles, then it opens in your browser and bacon switches -# to the previous job -[jobs.doc-open] -command = ["cargo", "doc", "--color", "always", "--open"] -need_stdout = false -on_success = "job:doc" # so that we don't open the browser at each change - -# You can run your application and have the result displayed in bacon, -# *if* it makes sense for this crate. You can run an example the same -# way. Don't forget the `--color always` part or the errors won't be -# properly parsed. -[jobs.run] -command = [ - "cargo", "run", - "--color", "always", - # put launch parameters for your program behind a `--` separator -] -need_stdout = true -allow_warnings = true - -[jobs.vhs] -command = ["vhs", "examples/text.tape"] -need_stdout = true - -[jobs.coverage] -command = [ - "cargo", - "llvm-cov", - "--lcov","--output-path=target/lcov.info", - "--all-features", - "--", "--color", "always", -] -need_stdout = true - -# You may define here keybindings that would be specific to -# a project, for example a shortcut to launch a specific job. -# Shortcuts to internal functions (scrolling, toggling, etc.) -# should go in your personal global prefs.toml file instead. -[keybindings] -# alt-m = "job:my-job" -v = "job:vhs" -o = "job:coverage" diff --git a/tui-prompts/dependabot.yml b/tui-prompts/dependabot.yml deleted file mode 100644 index de3743d..0000000 --- a/tui-prompts/dependabot.yml +++ /dev/null @@ -1,12 +0,0 @@ -# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates - -version: 2 -updates: - - package-ecosystem: "github-actions" - directory: "/" - schedule: - interval: "weekly" - - package-ecosystem: "cargo" - directory: "/" - schedule: - interval: "weekly" diff --git a/tui-prompts/src/lib.rs b/tui-prompts/src/lib.rs index d6b5eae..b0a44af 100644 --- a/tui-prompts/src/lib.rs +++ b/tui-prompts/src/lib.rs @@ -1,5 +1,3 @@ -#![warn(clippy::pedantic, clippy::nursery, clippy::cargo, unused)] - mod prompt; mod status; diff --git a/tui-prompts/src/text_prompt.rs b/tui-prompts/src/text_prompt.rs index 965c1c0..e909a1c 100644 --- a/tui-prompts/src/text_prompt.rs +++ b/tui-prompts/src/text_prompt.rs @@ -55,8 +55,6 @@ impl<'a> TextPrompt<'a> { } #[must_use] - // const causes: error[E0493]: destructor of `std::option::Option>` cannot be evaluated at compile-time - #[allow(clippy::missing_const_for_fn)] pub fn with_block(mut self, block: Block<'a>) -> Self { self.block = Some(block); self @@ -107,11 +105,7 @@ impl<'a> StatefulWidget for TextPrompt<'a> { let position = (state.position() + prompt_length).min(area.area() as usize - 1); let row = position / width; let column = position % width; - // sizes are already constrained to the u16 range - #[allow(clippy::cast_possible_truncation)] - { - *state.cursor_mut() = (area.x + column as u16, area.y + row as u16); - } + *state.cursor_mut() = (area.x + column as u16, area.y + row as u16); Paragraph::new(lines).render(area, buf); } } @@ -168,7 +162,6 @@ fn line_split_at(line: Line, mid: usize) -> (Line, Line) { /// /// TODO: move this into the `Span` type. /// TODO: fix this so that it operates on multi-width characters. -#[allow(clippy::needless_pass_by_value)] fn span_split_at(span: Span, mid: usize) -> (Span, Span) { let (first, second) = span.content.split_at(mid); let first = Span { diff --git a/tui-scrollview/.gitignore b/tui-scrollview/.gitignore deleted file mode 100644 index ea8c4bf..0000000 --- a/tui-scrollview/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/target diff --git a/tui-scrollview/CONTRIBUTING.md b/tui-scrollview/CONTRIBUTING.md deleted file mode 100644 index a99b8d0..0000000 --- a/tui-scrollview/CONTRIBUTING.md +++ /dev/null @@ -1,86 +0,0 @@ -# Contribution guidelines - -First off, thank you for considering contributing to tui-scrollview. - -If your contribution is not straightforward, please first discuss the change you wish to make by -creating a new issue before making the change. - -## Reporting issues - -Before reporting an issue on the [issue tracker](https://github.com/joshka/tui-scrollview/issues), -please check that it has not already been reported by searching for some related keywords. - -## Pull requests - -Try to do one pull request per change. - -## Commit Message Format - -This project adheres to [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/). -A specification for adding human and machine readable meaning to commit messages. - -### Commit Message Header - -```plain -(): - โ”‚ โ”‚ โ”‚ - โ”‚ โ”‚ โ””โ”€โซธ Summary in present tense. Not capitalized. No period at the end. - โ”‚ โ”‚ - โ”‚ โ””โ”€โซธ Commit Scope - โ”‚ - โ””โ”€โซธ Commit Type: feat|fix|build|ci|docs|perf|refactor|test|chore -``` - -#### Type - -| feat | Features | A new feature -|----------|--------------------------|---------------------------------------------------------| -| fix | Bug Fixes | A bug fix | -| docs | Documentation | Documentation only changes | -| style | Styles | Changes that do not affect the meaning of the code\ -(white-space, formatting, missing semi-colons, etc) | -| refactor | Code Refactoring | A code change that neither fixes a bug nor adds a feature| -| perf | Performance Improvements | A code change that improves performance | -| test | Tests | Adding missing tests or correcting existing tests | -| build | Builds | Changes that affect the build system or external dependencies (example scopes: main, serde) | -| ci | Continuous Integrations | Changes to our CI configuration files and scripts (example scopes: Github Actions) | -| chore | Chores | Other changes that don't modify src or test files | -| revert | Reverts | Reverts a previous commit | - -## Developing - -### Set up - -This is no different than other Rust projects. - -```shell -git clone https://github.com/joshka/tui-scrollview -cd tui-scrollview -cargo test -``` - -### Useful Commands - -- Run Clippy: - - ```shell - cargo clippy --all-targets --all-features --workspace - ``` - -- Run all tests: - - ```shell - cargo test --all-features --workspace - ``` - -- Check to see if there are code formatting issues - - ```shell - cargo fmt --all -- --check - ``` - -- Format the code in the project - - ```shell - cargo fmt --all - ``` diff --git a/tui-scrollview/Cargo.toml b/tui-scrollview/Cargo.toml index de8757d..7a4a13f 100644 --- a/tui-scrollview/Cargo.toml +++ b/tui-scrollview/Cargo.toml @@ -1,13 +1,15 @@ [package] name = "tui-scrollview" version = "0.3.8" -authors = ["Joshka"] description = "A simple scrollable view for Ratatui" -license = "MIT OR Apache-2.0" -repository = "https://github.com/joshka/tui-scrollview" -edition = "2021" -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +authors.workspace = true +categories.workspace = true +edition.workspace = true +keywords.workspace = true +license.workspace = true +repository.workspace = true +rust-version.workspace = true [dependencies] indoc.workspace = true diff --git a/tui-scrollview/LICENSE-APACHE b/tui-scrollview/LICENSE-APACHE deleted file mode 100644 index d645695..0000000 --- a/tui-scrollview/LICENSE-APACHE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/tui-scrollview/LICENSE-MIT b/tui-scrollview/LICENSE-MIT deleted file mode 100644 index 05d9d5e..0000000 --- a/tui-scrollview/LICENSE-MIT +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2023 Josh McKinney - -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. diff --git a/tui-scrollview/dependabot.yml b/tui-scrollview/dependabot.yml deleted file mode 100644 index d9dbff3..0000000 --- a/tui-scrollview/dependabot.yml +++ /dev/null @@ -1,15 +0,0 @@ -# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates - -version: 2 -updates: - - package-ecosystem: "github-actions" - directory: "/" - schedule: - interval: "weekly" - - package-ecosystem: "cargo" - directory: "/" - schedule: - interval: "weekly" - groups: - all-dependencies: - patterns: ["*"] diff --git a/tui-scrollview/examples/scrollview.rs b/tui-scrollview/examples/scrollview.rs index 956b71b..a780ce1 100644 --- a/tui-scrollview/examples/scrollview.rs +++ b/tui-scrollview/examples/scrollview.rs @@ -143,9 +143,11 @@ impl App { } fn line_numbers(&self, height: u16) -> impl Widget { - let line_numbers = (1..=height) - .map(|n| format!("{n:>4} \n")) - .collect::(); + use std::fmt::Write; + let line_numbers = (1..=height).fold(String::new(), |mut output, n| { + let _ = writeln!(output, "{n:>4} "); + output + }); Text::from(line_numbers).dim() } @@ -177,7 +179,7 @@ impl App { } } -const CHART_DATA: [(&'static str, u64, Color); 3] = [ +const CHART_DATA: [(&str, u64, Color); 3] = [ ("Red", 2, Color::Red), ("Green", 7, Color::Green), ("Blue", 11, Color::Blue), diff --git a/tui-scrollview/release-plz.toml b/tui-scrollview/release-plz.toml deleted file mode 100644 index 066aebb..0000000 --- a/tui-scrollview/release-plz.toml +++ /dev/null @@ -1,2 +0,0 @@ -[workspace] -changelog_config = "cliff.toml" diff --git a/tui-scrollview/src/scroll_view.rs b/tui-scrollview/src/scroll_view.rs index 2e69d09..d49cdee 100644 --- a/tui-scrollview/src/scroll_view.rs +++ b/tui-scrollview/src/scroll_view.rs @@ -141,19 +141,19 @@ impl ScrollView { (0, 0) => { // area is taller and wider than the scroll_view state.offset = Position::default(); - return Rect::new(state.offset.x, state.offset.y, area.width, area.height); + Rect::new(state.offset.x, state.offset.y, area.width, area.height) } (_, 0) if area.height > size.height => { // area is taller and narrower than the scroll_view state.offset.y = 0; self.render_horizontal_scrollbar(area, buf, state); - return Rect::new(state.offset.x, 0, area.width, area.height - 1); + Rect::new(state.offset.x, 0, area.width, area.height - 1) } (0, _) if area.width > size.width => { // area is wider and shorter than the scroll_view state.offset.x = 0; self.render_vertical_scrollbar(area, buf, state); - return Rect::new(0, state.offset.y, area.width - 1, area.height); + Rect::new(0, state.offset.y, area.width - 1, area.height) } (_, _) => { // scroll_view is both wider and taller than the area @@ -167,12 +167,12 @@ impl ScrollView { }; self.render_vertical_scrollbar(vertical_area, buf, state); self.render_horizontal_scrollbar(horizontal_area, buf, state); - return Rect::new( + Rect::new( state.offset.x, state.offset.y, area.width - 1, area.height - 1, - ); + ) } } } diff --git a/typos.toml b/typos.toml new file mode 100644 index 0000000..372dc95 --- /dev/null +++ b/typos.toml @@ -0,0 +1,2 @@ +[default.extend-words] +ratatui = "ratatui"