diff options
author | Vince Mutolo | 2022-05-02 14:24:22 +0000 |
---|---|---|
committer | GitHub | 2022-05-02 14:24:22 +0000 |
commit | f9baced216df60122f2aae08d382931d77901ca9 (patch) | |
tree | 44326181702d03e18f5d9c810331c2993524296c /Cargo.lock | |
parent | 567ddef388986dd2cea5c7f3eb1aa1a978c3e6d3 (diff) |
add reflow command (#2128)
* add reflow command
Users need to be able to hard-wrap text for many applications, including
comments in code, git commit messages, plaintext documentation, etc. It
often falls to the user to manually insert line breaks where appropriate
in order to hard-wrap text.
This commit introduces the "reflow" command (both in the TUI and core
library) to automatically hard-wrap selected text to a given number of
characters (defined by Unicode "extended grapheme clusters"). It handles
lines with a repeated prefix, such as comments ("//") and indentation.
* reflow: consider newlines to be word separators
* replace custom reflow impl with textwrap crate
* Sync reflow command docs with book
* reflow: add default max_line_len language setting
Co-authored-by: Vince Mutolo <vince@mutolo.org>
Diffstat (limited to 'Cargo.lock')
-rw-r--r-- | Cargo.lock | 27 |
1 files changed, 27 insertions, 0 deletions
@@ -374,6 +374,7 @@ dependencies = [ "slotmap", "smallvec", "smartstring", + "textwrap", "toml", "tree-sitter", "unicode-general-category", @@ -1006,6 +1007,12 @@ dependencies = [ ] [[package]] +name = "smawk" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f67ad224767faa3c7d8b6d91985b78e70a1324408abcb1cfcc2be4c06bc06043" + +[[package]] name = "socket2" version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1045,6 +1052,17 @@ dependencies = [ ] [[package]] +name = "textwrap" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb" +dependencies = [ + "smawk", + "unicode-linebreak", + "unicode-width", +] + +[[package]] name = "thiserror" version = "1.0.30" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1180,6 +1198,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1218098468b8085b19a2824104c70d976491d247ce194bbd9dc77181150cdfd6" [[package]] +name = "unicode-linebreak" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a52dcaab0c48d931f7cc8ef826fa51690a08e1ea55117ef26f89864f532383f" +dependencies = [ + "regex", +] + +[[package]] name = "unicode-normalization" version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" |