From df9c5da1732c318d860f0d4003fa2d9b38062911 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Orhun=20Parmaks=C4=B1z?= Date: Tue, 10 Dec 2024 21:36:17 +0300 Subject: [PATCH] refactor: use tui-markdown crate --- Cargo.lock | 1026 ++++++++---------------------------- git-cliff-tui/Cargo.toml | 7 +- git-cliff-tui/src/event.rs | 26 +- git-cliff-tui/src/main.rs | 91 +--- git-cliff-tui/src/state.rs | 103 ++-- git-cliff-tui/src/ui.rs | 92 ++-- 6 files changed, 308 insertions(+), 1037 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d30730695a..db181b084c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -51,12 +51,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "aligned-vec" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4aa90d7ce82d4be67b64039a3d588d38dbcc6736577de4a847025ce5b0c468d1" - [[package]] name = "aligned-vec" version = "0.6.1" @@ -87,6 +81,19 @@ dependencies = [ "libc", ] +[[package]] +name = "ansi-to-tui" +version = "7.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67555e1f1ece39d737e28c8a017721287753af3f93225e4a445b29ccb0f5912c" +dependencies = [ + "nom", + "ratatui", + "simdutf8", + "smallvec", + "thiserror 1.0.63", +] + [[package]] name = "anstream" version = "0.6.15" @@ -142,23 +149,6 @@ version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" -[[package]] -name = "arbitrary" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d5a26814d8dcb93b0e5a0ff3c6d80a8843bafb21b39e8e18a6f05471870e110" - -[[package]] -name = "arg_enum_proc_macro" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ae92a5119aa49cdbcf6b9f893fe4e1d98b04ccbf82ee0584ad948a44a734dea" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "arraydeque" version = "0.5.1" @@ -202,29 +192,6 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" -[[package]] -name = "av1-grain" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6678909d8c5d46a42abcf571271e15fdbc0a225e3646cf23762cd415046c78bf" -dependencies = [ - "anyhow", - "arrayvec", - "log", - "nom", - "num-rational", - "v_frame", -] - -[[package]] -name = "avif-serialize" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "876c75a42f6364451a033496a14c44bffe41f5f4a8236f697391f11024e596d2" -dependencies = [ - "arrayvec", -] - [[package]] name = "backtrace" version = "0.3.73" @@ -252,16 +219,6 @@ version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" -[[package]] -name = "better-panic" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fa9e1d11a268684cbd90ed36370d7577afb6c62d912ddff5c15fc34343e5036" -dependencies = [ - "backtrace", - "console", -] - [[package]] name = "bincode" version = "1.3.3" @@ -290,12 +247,6 @@ dependencies = [ "virtue", ] -[[package]] -name = "bit_field" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc827186963e592360843fb5ba4b973e145841266c1357f7180c43526f2e5b61" - [[package]] name = "bitflags" version = "1.3.2" @@ -307,15 +258,6 @@ name = "bitflags" version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" -dependencies = [ - "serde", -] - -[[package]] -name = "bitstream-io" -version = "2.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b81e1519b0d82120d2fd469d5bfb2919a9361c48b02d82d04befc1cdd2002452" [[package]] name = "block" @@ -342,12 +284,6 @@ dependencies = [ "serde", ] -[[package]] -name = "built" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "236e6289eda5a812bc6b53c3b024039382a2895fbbeef2d748b2931546d392c4" - [[package]] name = "bumpalo" version = "3.16.0" @@ -366,12 +302,6 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" -[[package]] -name = "byteorder-lite" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495" - [[package]] name = "bytes" version = "1.7.1" @@ -457,16 +387,6 @@ dependencies = [ "once_cell", ] -[[package]] -name = "cfg-expr" -version = "0.15.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d067ad48b8650848b989a59a86c6c36a995d02d2bf778d45c3c5d57bc2718f02" -dependencies = [ - "smallvec", - "target-lexicon", -] - [[package]] name = "cfg-if" version = "1.0.0" @@ -577,12 +497,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "color_quant" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" - [[package]] name = "colorchoice" version = "1.0.2" @@ -600,7 +514,6 @@ dependencies = [ "itoa", "rustversion", "ryu", - "serde", "static_assertions", ] @@ -619,15 +532,9 @@ version = "0.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68578f196d2a33ff61b27fae256c3164f65e36382648e30666dde05b8cc9dfdf" dependencies = [ - "async-trait", - "convert_case", - "json5", "nom", "pathdiff", - "ron", - "rust-ini", "serde", - "serde_json", "toml", "yaml-rust2", ] @@ -645,26 +552,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "const-random" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87e00182fe74b066627d63b85fd550ac2998d4b0bd86bfed477a0ae4c7c71359" -dependencies = [ - "const-random-macro", -] - -[[package]] -name = "const-random-macro" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9d839f2a20b0aee515dc581a6172f2321f96cab76c1a38a4c584a194955390e" -dependencies = [ - "getrandom", - "once_cell", - "tiny-keccak", -] - [[package]] name = "conventional_commit_parser" version = "0.9.4" @@ -675,15 +562,6 @@ dependencies = [ "pest_derive", ] -[[package]] -name = "convert_case" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec182b0ca2f35d8fc196cf3404988fd8b8c739a4d270ff118a398feb0cbec1ca" -dependencies = [ - "unicode-segmentation", -] - [[package]] name = "copypasta" version = "0.10.1" @@ -750,15 +628,6 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "crossbeam-channel" -version = "0.5.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33480d6946193aa8033910124896ca395333cae7e2d1113d1fef6c3272217df2" -dependencies = [ - "crossbeam-utils", -] - [[package]] name = "crossbeam-deque" version = "0.8.5" @@ -792,7 +661,7 @@ checksum = "829d955a0bb380ef178a640b91779e3987da38c9aea133b20614cfed8cdea9c6" dependencies = [ "bitflags 2.6.0", "crossterm_winapi", - "mio 1.0.2", + "mio", "parking_lot", "rustix", "signal-hook", @@ -809,12 +678,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "crunchy" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" - [[package]] name = "crypto-common" version = "0.1.6" @@ -933,15 +796,6 @@ dependencies = [ "libloading", ] -[[package]] -name = "dlv-list" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "442039f5147480ba31067cb00ada1adae6892028e40e45fc5de7b7df6dcc1b5f" -dependencies = [ - "const-random", -] - [[package]] name = "doc-comment" version = "0.3.3" @@ -1049,49 +903,12 @@ dependencies = [ "once_cell", ] -[[package]] -name = "exr" -version = "1.72.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "887d93f60543e9a9362ef8a21beedd0a833c5d9610e18c67abe15a5963dcb1a4" -dependencies = [ - "bit_field", - "flume", - "half", - "lebe", - "miniz_oxide 0.7.4", - "rayon-core", - "smallvec", - "zune-inflate", -] - [[package]] name = "fastrand" version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" -[[package]] -name = "fdeflate" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f9bfee30e4dedf0ab8b422f03af778d9612b63f502710fc500a334ebe2de645" -dependencies = [ - "simd-adler32", -] - -[[package]] -name = "filetime" -version = "0.2.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf401df4a4e3872c4fe8151134cf483738e74b67fc934d6532c882b3d24a4550" -dependencies = [ - "cfg-if", - "libc", - "libredox", - "windows-sys 0.59.0", -] - [[package]] name = "findshlibs" version = "0.10.2" @@ -1114,15 +931,6 @@ dependencies = [ "miniz_oxide 0.8.0", ] -[[package]] -name = "flume" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55ac459de2512911e4b674ce33cf20befaba382d05b62b008afc1c8b57cbf181" -dependencies = [ - "spin", -] - [[package]] name = "fnv" version = "1.0.7" @@ -1138,15 +946,6 @@ dependencies = [ "percent-encoding", ] -[[package]] -name = "fsevent-sys" -version = "4.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76ee7a02da4d231650c7cea31349b889be2f45ddb3ef3032d2ec8185f6313fd2" -dependencies = [ - "libc", -] - [[package]] name = "futures" version = "0.3.31" @@ -1218,6 +1017,12 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" +[[package]] +name = "futures-timer" +version = "3.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f288b0a4f20f9a56b5d1da57e2227c661b7b16168e2f72365f57b63326e29b24" + [[package]] name = "futures-util" version = "0.3.31" @@ -1256,6 +1061,15 @@ dependencies = [ "windows-targets 0.48.5", ] +[[package]] +name = "getopts" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14dbbfd5c71d70241ecf9e6f13737f7b5ce823821063188d7e46c41d371eebd5" +dependencies = [ + "unicode-width 0.1.13", +] + [[package]] name = "getrandom" version = "0.2.15" @@ -1267,16 +1081,6 @@ dependencies = [ "wasi", ] -[[package]] -name = "gif" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fb2d69b19215e18bb912fa30f7ce15846e301408695e44e0ef719f1da9e19f2" -dependencies = [ - "color_quant", - "weezl", -] - [[package]] name = "gimli" version = "0.29.0" @@ -1354,10 +1158,9 @@ version = "2.5.0" dependencies = [ "copypasta", "git-cliff", - "md-tui", - "notify", "ratatui", "throbber-widgets-tui", + "tui-markdown", ] [[package]] @@ -1434,16 +1237,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "half" -version = "2.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6dd08c532ae367adf81c312a4580bc67f1d0fe8bc9c460520283f4c0ff277888" -dependencies = [ - "cfg-if", - "crunchy", -] - [[package]] name = "hashbrown" version = "0.14.5" @@ -1867,12 +1660,6 @@ dependencies = [ "syn", ] -[[package]] -name = "icy_sixel" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86858ae800284d596cfdefcb0ad435c3493c12f35367431bbe9b2b3858c1155b" - [[package]] name = "idna" version = "1.0.3" @@ -1910,45 +1697,6 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "image" -version = "0.25.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99314c8a2152b8ddb211f924cdae532d8c5e4c8bb54728e12fff1b0cd5963a10" -dependencies = [ - "bytemuck", - "byteorder-lite", - "color_quant", - "exr", - "gif", - "image-webp", - "num-traits", - "png", - "qoi", - "ravif", - "rayon", - "rgb", - "tiff", - "zune-core", - "zune-jpeg", -] - -[[package]] -name = "image-webp" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f79afb8cbee2ef20f59ccd477a218c12a93943d075b492015ecb1bb81f8ee904" -dependencies = [ - "byteorder-lite", - "quick-error", -] - -[[package]] -name = "imgref" -version = "1.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44feda355f4159a7c757171a77de25daf6411e217b4cabd03bd6650690468126" - [[package]] name = "include-flate" version = "0.3.0" @@ -1995,6 +1743,12 @@ dependencies = [ "web-time", ] +[[package]] +name = "indoc" +version = "2.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488bcc03bc9ca4d7991399f2b5" + [[package]] name = "inferno" version = "0.11.21" @@ -2013,26 +1767,6 @@ dependencies = [ "str_stack", ] -[[package]] -name = "inotify" -version = "0.9.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8069d3ec154eb856955c1c0fbffefbf5f3c40a104ec912d4797314c1801abff" -dependencies = [ - "bitflags 1.3.2", - "inotify-sys", - "libc", -] - -[[package]] -name = "inotify-sys" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e05c02b5e89bff3b946cedeca278abc628fe811e604f027c45a8aa3cf793d0eb" -dependencies = [ - "libc", -] - [[package]] name = "instability" version = "0.3.2" @@ -2043,32 +1777,12 @@ dependencies = [ "syn", ] -[[package]] -name = "interpolate_name" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c34819042dc3d3971c46c2190835914dfbe0c3c13f61449b2997f4e9722dfa60" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "ipnet" version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" -[[package]] -name = "is-docker" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "928bae27f42bc99b60d9ac7334e3a21d10ad8f1835a4e12ec3ec0464765ed1b3" -dependencies = [ - "once_cell", -] - [[package]] name = "is-terminal" version = "0.4.13" @@ -2080,31 +1794,12 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "is-wsl" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "173609498df190136aa7dea1a91db051746d339e18476eed5ca40521f02d7aa5" -dependencies = [ - "is-docker", - "once_cell", -] - [[package]] name = "is_terminal_polyfill" version = "1.70.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" -[[package]] -name = "itertools" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" -dependencies = [ - "either", -] - [[package]] name = "itertools" version = "0.13.0" @@ -2129,12 +1824,6 @@ dependencies = [ "libc", ] -[[package]] -name = "jpeg-decoder" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5d4a7da358eff58addd2877a45865158f0d78c911d43a5784ceb7bbf52833b0" - [[package]] name = "js-sys" version = "0.3.70" @@ -2144,37 +1833,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "json5" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96b0db21af676c1ce64250b5f40f3ce2cf27e4e47cb91ed91eb6fe9350b430c1" -dependencies = [ - "pest", - "pest_derive", - "serde", -] - -[[package]] -name = "kqueue" -version = "1.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7447f1ca1b7b563588a205fe93dea8df60fd981423a768bc1c0ded35ed147d0c" -dependencies = [ - "kqueue-sys", - "libc", -] - -[[package]] -name = "kqueue-sys" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed9625ffda8729b85e45cf04090035ac368927b8cebc34898e7c120f52e4838b" -dependencies = [ - "bitflags 1.3.2", - "libc", -] - [[package]] name = "lazy-bytes-cast" version = "5.0.1" @@ -2210,12 +1868,6 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" -[[package]] -name = "lebe" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03087c2bad5e1034e8cace5926dec053fb3790248370865f5117a7d0213354c8" - [[package]] name = "libc" version = "0.2.158" @@ -2246,17 +1898,6 @@ dependencies = [ "rle-decode-fast", ] -[[package]] -name = "libfuzzer-sys" -version = "0.4.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a96cfd5557eb82f2b83fed4955246c988d331975a002961b07c81584d107e7f7" -dependencies = [ - "arbitrary", - "cc", - "once_cell", -] - [[package]] name = "libgit2-sys" version = "0.17.0+1.8.1" @@ -2293,7 +1934,6 @@ checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" dependencies = [ "bitflags 2.6.0", "libc", - "redox_syscall", ] [[package]] @@ -2308,6 +1948,12 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "linked-hash-map" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" + [[package]] name = "linux-raw-sys" version = "0.4.14" @@ -2342,15 +1988,6 @@ version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" -[[package]] -name = "loop9" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fae87c125b03c1d2c0150c90365d7d6bcc53fb73a9acaef207d2d065860f062" -dependencies = [ - "imgref", -] - [[package]] name = "lru" version = "0.12.4" @@ -2369,40 +2006,6 @@ dependencies = [ "libc", ] -[[package]] -name = "maybe-rayon" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ea1f30cedd69f0a2954655f7188c6a834246d2bcf1e315e2ac40c4b24dc9519" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "md-tui" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "800ab166bcff601da943a9a85b727e57bd74722016b4321f385b0caddf4d1107" -dependencies = [ - "better-panic", - "cc", - "config", - "crossterm", - "dirs", - "image", - "itertools 0.13.0", - "lazy_static", - "notify", - "open", - "pest", - "pest_derive", - "ratatui", - "ratatui-image", - "serde", - "strsim", - "tree-sitter-highlight", -] - [[package]] name = "memchr" version = "2.7.4" @@ -2469,7 +2072,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" dependencies = [ "adler", - "simd-adler32", ] [[package]] @@ -2481,18 +2083,6 @@ dependencies = [ "adler2", ] -[[package]] -name = "mio" -version = "0.8.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" -dependencies = [ - "libc", - "log", - "wasi", - "windows-sys 0.48.0", -] - [[package]] name = "mio" version = "1.0.2" @@ -2506,12 +2096,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "new_debug_unreachable" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" - [[package]] name = "next_version" version = "0.2.19" @@ -2544,58 +2128,12 @@ dependencies = [ "minimal-lexical", ] -[[package]] -name = "noop_proc_macro" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0676bb32a98c1a483ce53e500a81ad9c3d5b3f7c920c28c24e9cb0980d0b5bc8" - -[[package]] -name = "notify" -version = "6.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6205bd8bb1e454ad2e27422015fb5e4f2bcc7e08fa8f27058670d208324a4d2d" -dependencies = [ - "bitflags 2.6.0", - "crossbeam-channel", - "filetime", - "fsevent-sys", - "inotify", - "kqueue", - "libc", - "log", - "mio 0.8.11", - "walkdir", - "windows-sys 0.48.0", -] - -[[package]] -name = "num-bigint" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" -dependencies = [ - "num-integer", - "num-traits", -] - [[package]] name = "num-conv" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" -[[package]] -name = "num-derive" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "num-format" version = "0.4.4" @@ -2606,26 +2144,6 @@ dependencies = [ "itoa", ] -[[package]] -name = "num-integer" -version = "0.1.46" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" -dependencies = [ - "num-traits", -] - -[[package]] -name = "num-rational" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" -dependencies = [ - "num-bigint", - "num-integer", - "num-traits", -] - [[package]] name = "num-traits" version = "0.2.19" @@ -2635,15 +2153,6 @@ dependencies = [ "autocfg", ] -[[package]] -name = "num_threads" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c7398b9c8b70908f6371f47ed36737907c87c52af34c268fed0bf0ceb92ead9" -dependencies = [ - "libc", -] - [[package]] name = "number_prefix" version = "0.4.0" @@ -2695,14 +2204,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] -name = "open" -version = "5.3.0" +name = "onig" +version = "6.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c4b31c8722ad9171c6d77d3557db078cab2bd50afcc9d09c8b315c59df8ca4f" +dependencies = [ + "bitflags 1.3.2", + "libc", + "once_cell", + "onig_sys", +] + +[[package]] +name = "onig_sys" +version = "69.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61a877bf6abd716642a53ef1b89fb498923a4afca5c754f9050b4d081c05c4b3" +checksum = "7b829e3d7e9cc74c7e315ee8edb185bf4190da5acde74afd7fc59c35b1f086e7" dependencies = [ - "is-wsl", - "libc", - "pathdiff", + "cc", + "pkg-config", ] [[package]] @@ -2711,16 +2231,6 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" -[[package]] -name = "ordered-multimap" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49203cdcae0030493bad186b28da2fa25645fa276a51b6fec8010d281e02ef79" -dependencies = [ - "dlv-list", - "hashbrown 0.14.5", -] - [[package]] name = "parking_lot" version = "0.12.3" @@ -2893,16 +2403,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" [[package]] -name = "png" -version = "0.17.13" +name = "plist" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06e4b0d3d1312775e782c86c91a111aa1f910cbb65e1337f9975b5f9a554b5e1" +checksum = "42cf17e9a1800f5f396bc67d193dc9411b59012a5876445ef450d449881e1016" dependencies = [ - "bitflags 1.3.2", - "crc32fast", - "fdeflate", - "flate2", - "miniz_oxide 0.7.4", + "base64 0.22.1", + "indexmap", + "quick-xml 0.32.0", + "serde", + "time", ] [[package]] @@ -2938,7 +2448,7 @@ version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ebbe2f8898beba44815fdc9e5a4ae9c929e21c5dc29b0c774a15555f7f58d6d0" dependencies = [ - "aligned-vec 0.6.1", + "aligned-vec", "backtrace", "cfg-if", "findshlibs", @@ -2973,6 +2483,15 @@ dependencies = [ "yansi", ] +[[package]] +name = "proc-macro-crate" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecf48c7ca261d60b74ab1a7b20da18bede46776b2e55535cb958eb595c5fa7b" +dependencies = [ + "toml_edit", +] + [[package]] name = "proc-macro2" version = "1.0.92" @@ -2983,44 +2502,38 @@ dependencies = [ ] [[package]] -name = "profiling" -version = "1.0.15" +name = "pulldown-cmark" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43d84d1d7a6ac92673717f9f6d1518374ef257669c24ebc5ac25d5033828be58" +checksum = "f86ba2052aebccc42cbbb3ed234b8b13ce76f75c3551a303cb2bcffcff12bb14" dependencies = [ - "profiling-procmacros", + "bitflags 2.6.0", + "getopts", + "memchr", + "pulldown-cmark-escape", + "unicase", ] [[package]] -name = "profiling-procmacros" -version = "1.0.15" +name = "pulldown-cmark-escape" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8021cf59c8ec9c432cfc2526ac6b8aa508ecaf29cd415f271b8406c1b851c3fd" -dependencies = [ - "quote", - "syn", -] +checksum = "007d8adb5ddab6f8e3f491ac63566a7d5002cc7ed73901f72057943fa71ae1ae" [[package]] -name = "qoi" -version = "0.4.1" +name = "quick-xml" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f6d64c71eb498fe9eae14ce4ec935c555749aef511cca85b5568910d6e48001" +checksum = "7f50b1c63b38611e7d4d7f68b82d3ad0cc71a2ad2e7f61fc10f1328d917c93cd" dependencies = [ - "bytemuck", + "memchr", ] -[[package]] -name = "quick-error" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3" - [[package]] name = "quick-xml" -version = "0.26.0" +version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f50b1c63b38611e7d4d7f68b82d3ad0cc71a2ad2e7f61fc10f1328d917c93cd" +checksum = "1d3a6e5838b60e0e8fa7a43f22ade549a37d61f8bdbe636d0d7816191de969c2" dependencies = [ "memchr", ] @@ -3123,110 +2636,23 @@ dependencies = [ [[package]] name = "ratatui" -version = "0.28.1" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdef7f9be5c0122f890d58bdf4d964349ba6a6161f705907526d891efabba57d" +checksum = "eabd94c2f37801c20583fc49dd5cd6b0ba68c716787c2dd6ed18571e1e63117b" dependencies = [ "bitflags 2.6.0", "cassowary", "compact_str", "crossterm", + "indoc", "instability", - "itertools 0.13.0", + "itertools", "lru", "paste", - "serde", "strum", - "strum_macros", - "time", "unicode-segmentation", "unicode-truncate", - "unicode-width 0.1.13", -] - -[[package]] -name = "ratatui-image" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de94276254cb20fb7431726875bd2ac6391a6ffc26f4b8e3d23f79d1286b491e" -dependencies = [ - "base64 0.22.1", - "crossterm", - "dyn-clone", - "icy_sixel", - "image", - "rand", - "ratatui", - "rustix", -] - -[[package]] -name = "rav1e" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd87ce80a7665b1cce111f8a16c1f3929f6547ce91ade6addf4ec86a8dda5ce9" -dependencies = [ - "arbitrary", - "arg_enum_proc_macro", - "arrayvec", - "av1-grain", - "bitstream-io", - "built", - "cfg-if", - "interpolate_name", - "itertools 0.12.1", - "libc", - "libfuzzer-sys", - "log", - "maybe-rayon", - "new_debug_unreachable", - "noop_proc_macro", - "num-derive", - "num-traits", - "once_cell", - "paste", - "profiling", - "rand", - "rand_chacha", - "simd_helpers", - "system-deps", - "thiserror 1.0.63", - "v_frame", - "wasm-bindgen", -] - -[[package]] -name = "ravif" -version = "0.11.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8f0bfd976333248de2078d350bfdf182ff96e168a24d23d2436cef320dd4bdd" -dependencies = [ - "avif-serialize", - "imgref", - "loop9", - "quick-error", - "rav1e", - "rgb", -] - -[[package]] -name = "rayon" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" -dependencies = [ - "either", - "rayon-core", -] - -[[package]] -name = "rayon-core" -version = "1.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" -dependencies = [ - "crossbeam-deque", - "crossbeam-utils", + "unicode-width 0.2.0", ] [[package]] @@ -3289,6 +2715,12 @@ version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" +[[package]] +name = "relative-path" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba39f3699c378cd8970968dcbff9c43159ea4cfbd88d43c00b22f2ef10a435d2" + [[package]] name = "reqwest" version = "0.11.27" @@ -3426,15 +2858,33 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "88f8660c1ff60292143c98d08fc6e2f654d722db50410e3f3797d40baaf9d8f3" [[package]] -name = "ron" -version = "0.8.1" +name = "rstest" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b91f7eff05f748767f183df4320a63d6936e9c6107d97c9e6bdd9784f4289c94" +checksum = "0a2c585be59b6b5dd66a9d2084aa1d8bd52fbdb806eafdeffb52791147862035" dependencies = [ - "base64 0.21.7", - "bitflags 2.6.0", - "serde", - "serde_derive", + "futures", + "futures-timer", + "rstest_macros", + "rustc_version", +] + +[[package]] +name = "rstest_macros" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "825ea780781b15345a146be27eaefb05085e337e869bff01b4306a4fd4a9ad5a" +dependencies = [ + "cfg-if", + "glob", + "proc-macro-crate", + "proc-macro2", + "quote", + "regex", + "relative-path", + "rustc_version", + "syn", + "unicode-ident", ] [[package]] @@ -3472,16 +2922,6 @@ dependencies = [ "walkdir", ] -[[package]] -name = "rust-ini" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e0698206bcb8882bf2a9ecb4c1e7785db57ff052297085a6efd4fe42302068a" -dependencies = [ - "cfg-if", - "ordered-multimap", -] - [[package]] name = "rustc-demangle" version = "0.1.24" @@ -3494,6 +2934,15 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "583034fd73374156e66797ed8e5b0d5690409c9226b22d87cb7f19821c05d152" +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver", +] + [[package]] name = "rustix" version = "0.38.34" @@ -3761,7 +3210,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34db1a06d485c9142248b7a054f034b349b212551f3dfd19c94d45a754a217cd" dependencies = [ "libc", - "mio 1.0.2", + "mio", "signal-hook", ] @@ -3775,19 +3224,10 @@ dependencies = [ ] [[package]] -name = "simd-adler32" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" - -[[package]] -name = "simd_helpers" -version = "0.1.0" +name = "simdutf8" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95890f873bec569a0362c235787f3aca6e1e887302ba4840839bcc6459c42da6" -dependencies = [ - "quote", -] +checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e" [[package]] name = "siphasher" @@ -3871,9 +3311,6 @@ name = "spin" version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" -dependencies = [ - "lock_api", -] [[package]] name = "ssri" @@ -4004,6 +3441,28 @@ dependencies = [ "syn", ] +[[package]] +name = "syntect" +version = "5.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "874dcfa363995604333cf947ae9f751ca3af4522c60886774c4963943b4746b1" +dependencies = [ + "bincode 1.3.3", + "bitflags 1.3.2", + "flate2", + "fnv", + "once_cell", + "onig", + "plist", + "regex-syntax", + "serde", + "serde_derive", + "serde_json", + "thiserror 1.0.63", + "walkdir", + "yaml-rust", +] + [[package]] name = "system-configuration" version = "0.5.1" @@ -4025,25 +3484,6 @@ dependencies = [ "libc", ] -[[package]] -name = "system-deps" -version = "6.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3e535eb8dded36d55ec13eddacd30dec501792ff23a0b1682c38601b8cf2349" -dependencies = [ - "cfg-expr", - "heck", - "pkg-config", - "toml", - "version-compare", -] - -[[package]] -name = "target-lexicon" -version = "0.12.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" - [[package]] name = "temp-dir" version = "0.1.14" @@ -4146,25 +3586,14 @@ dependencies = [ [[package]] name = "throbber-widgets-tui" -version = "0.7.1" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46994acd1137e3e5b78d9b9112d91596b20e64fc6ec788dfc0f2430a2e965633" +checksum = "1d36b5738d666a2b4c91b7c24998a8588db724b3107258343ebf8824bf55b06d" dependencies = [ "rand", "ratatui", ] -[[package]] -name = "tiff" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba1310fcea54c6a9a4fd1aad794ecc02c31682f6bfbecdf460bf19533eed1e3e" -dependencies = [ - "flate2", - "jpeg-decoder", - "weezl", -] - [[package]] name = "time" version = "0.3.36" @@ -4173,9 +3602,7 @@ checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" dependencies = [ "deranged", "itoa", - "libc", "num-conv", - "num_threads", "powerfmt", "serde", "time-core", @@ -4198,15 +3625,6 @@ dependencies = [ "time-core", ] -[[package]] -name = "tiny-keccak" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" -dependencies = [ - "crunchy", -] - [[package]] name = "tinystr" version = "0.7.6" @@ -4241,7 +3659,7 @@ dependencies = [ "backtrace", "bytes", "libc", - "mio 1.0.2", + "mio", "pin-project-lite", "socket2", "tokio-macros", @@ -4372,9 +3790,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ "pin-project-lite", + "tracing-attributes", "tracing-core", ] +[[package]] +name = "tracing-attributes" +version = "0.1.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "tracing-core" version = "0.1.32" @@ -4385,33 +3815,27 @@ dependencies = [ ] [[package]] -name = "tree-sitter" -version = "0.21.0" +name = "try-lock" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "705bf7c0958d0171dd7d3a6542f2f4f21d87ed5f1dc8db52919d3a6bed9a359a" -dependencies = [ - "cc", - "regex", -] +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] -name = "tree-sitter-highlight" -version = "0.21.0" +name = "tui-markdown" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f8c0df4e17827db04b150377bc992fc59a4017e4177626640e91053c53b6aa0" +checksum = "d592c08d55bda8429ea3f1bc421082925b0124ee98fb67e6d4b119cca7377518" dependencies = [ - "lazy_static", - "regex", - "thiserror 1.0.63", - "tree-sitter", + "ansi-to-tui", + "itertools", + "pretty_assertions", + "pulldown-cmark", + "ratatui", + "rstest", + "syntect", + "tracing", ] -[[package]] -name = "try-lock" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" - [[package]] name = "typenum" version = "1.17.0" @@ -4485,9 +3909,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83" [[package]] name = "unicode-segmentation" @@ -4501,7 +3925,7 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b3644627a5af5fa321c95b9b235a72fd24cd29c648c2c379431e6628655627bf" dependencies = [ - "itertools 0.13.0", + "itertools", "unicode-segmentation", "unicode-width 0.1.13", ] @@ -4598,29 +4022,12 @@ version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "81dfa00651efa65069b0b6b651f4aaa31ba9e3c3ce0137aaad053604ee7e0314" -[[package]] -name = "v_frame" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6f32aaa24bacd11e488aa9ba66369c7cd514885742c9fe08cfe85884db3e92b" -dependencies = [ - "aligned-vec 0.5.0", - "num-traits", - "wasm-bindgen", -] - [[package]] name = "vcpkg" version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" -[[package]] -name = "version-compare" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "852e951cb7832cb45cb1169900d19760cfa39b82bc0ea9c0e5a14ae88411c98b" - [[package]] name = "version_check" version = "0.9.5" @@ -4856,12 +4263,6 @@ dependencies = [ "rustls-pki-types", ] -[[package]] -name = "weezl" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53a85b86a771b1c87058196170769dd264f66c0782acf1ae6cc51bfd64b39082" - [[package]] name = "winapi" version = "0.3.9" @@ -5201,6 +4602,15 @@ version = "0.8.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a5cbf750400958819fb6178eaa83bee5cd9c29a26a40cc241df8c70fdd46984" +[[package]] +name = "yaml-rust" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85" +dependencies = [ + "linked-hash-map", +] + [[package]] name = "yaml-rust2" version = "0.8.1" @@ -5339,27 +4749,3 @@ dependencies = [ "cc", "pkg-config", ] - -[[package]] -name = "zune-core" -version = "0.4.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f423a2c17029964870cfaabb1f13dfab7d092a62a29a89264f4d36990ca414a" - -[[package]] -name = "zune-inflate" -version = "0.2.54" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73ab332fe2f6680068f3582b16a24f90ad7096d5d39b974d1c0aff0125116f02" -dependencies = [ - "simd-adler32", -] - -[[package]] -name = "zune-jpeg" -version = "0.4.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16099418600b4d8f028622f73ff6e3deaabdff330fb9a2a131dea781ee8b0768" -dependencies = [ - "zune-core", -] diff --git a/git-cliff-tui/Cargo.toml b/git-cliff-tui/Cargo.toml index a9fddb7570..19ad380e36 100644 --- a/git-cliff-tui/Cargo.toml +++ b/git-cliff-tui/Cargo.toml @@ -6,11 +6,10 @@ license = "MIT" edition = "2021" [dependencies] -ratatui = "0.28.1" -md-tui = { version = "0.8.6", default-features = false } -notify = { version = "6.1.1", default-features = false } +ratatui = "0.29.0" copypasta = "0.10.1" -throbber-widgets-tui = "0.7.0" +throbber-widgets-tui = "0.8.0" +tui-markdown = "0.3.0" [dependencies.git-cliff] version = "2.5.0" # managed by release.sh diff --git a/git-cliff-tui/src/event.rs b/git-cliff-tui/src/event.rs index 4d113051e6..a4c26d4624 100644 --- a/git-cliff-tui/src/event.rs +++ b/git-cliff-tui/src/event.rs @@ -34,10 +34,6 @@ pub enum Event { Generate, /// Generate changelog when the file changes. AutoGenerate, - /// Render markdown. - RenderMarkdown(String), - /// Error event. - Error(String), } /// Terminal event handler. @@ -122,7 +118,7 @@ pub fn handle_key_events( KeyCode::Char('c') | KeyCode::Char('C') => { if key_event.modifiers == KeyModifiers::CONTROL { state.quit(); - } else if let Some(contents) = state.get_changelog_contents()? { + } else if let Some(contents) = state.generate_changelog()? { if let Some(clipboard) = &mut state.clipboard { if let Err(e) = clipboard.set_contents(contents) { eprintln!("Failed to set clipboard contents: {e}"); @@ -132,24 +128,22 @@ pub fn handle_key_events( } KeyCode::Char('k') | KeyCode::Char('K') | KeyCode::Up => { state.list_state.select_previous(); - state.process_changelog()?; + sender.send(Event::Generate)?; } KeyCode::Char('j') | KeyCode::Char('J') | KeyCode::Down => { state.list_state.select_next(); - state.process_changelog()?; + sender.send(Event::Generate)?; } KeyCode::Char('h') | KeyCode::Char('H') | KeyCode::Left => { - state.markdown.scroll_index = - state.markdown.scroll_index.saturating_sub(1); + state.scroll_index = state.scroll_index.saturating_sub(1); } KeyCode::Char('l') | KeyCode::Char('L') | KeyCode::Right => { - if key_event.modifiers == KeyModifiers::CONTROL { - state.markdown.scroll_index = - state.markdown.scroll_index.saturating_add(1); - } else { - state.args.latest = !state.args.latest; - sender.send(Event::Generate)?; - } + state.scroll_index = state.scroll_index.saturating_add(1); + + // TODO: Tweak latest flag + // + // state.args.latest = !state.args.latest; + // sender.send(Event::Generate)?; } KeyCode::Enter => sender.send(Event::Generate)?, KeyCode::Char('a') | KeyCode::Char('A') => { diff --git a/git-cliff-tui/src/main.rs b/git-cliff-tui/src/main.rs index 5f390d7f9d..1a4aea1661 100644 --- a/git-cliff-tui/src/main.rs +++ b/git-cliff-tui/src/main.rs @@ -1,15 +1,9 @@ -use std::path::{ - Path, - PathBuf, -}; - use crate::{ event::{ Event, EventHandler, }, state::{ - Config, Result, State, }, @@ -23,14 +17,6 @@ use git_cliff::args::{ Args, Parser, }; -use notify::{ - RecursiveMode, - Watcher, -}; -use ratatui::crossterm::event::{ - DisableMouseCapture, - EnableMouseCapture, -}; fn main() -> Result<()> { // Parse command-line arguments. @@ -39,60 +25,33 @@ fn main() -> Result<()> { // Create an application state. let mut state = State::new(args.clone())?; - // Add default configuration file. - if Path::new("cliff.toml").exists() { - state.configs.insert(0, Config { - file: "cliff.toml".into(), - ..Default::default() - }); - } - - // Add the configuration file from the command-line arguments. - if &args.config != &PathBuf::from("cliff.toml") { - if args.config.exists() { - state.configs.insert(0, Config { - file: args.config.to_string_lossy().to_string(), - ..Default::default() - }); - } - } - - // Generate the changelog. - state.generate_changelog()?; + // Get the changelog data. + state.get_changelog_data()?; // Initialize the terminal user interface. let events = EventHandler::new(250); let mut terminal = ratatui::init(); - ratatui::crossterm::execute!(terminal.backend_mut(), EnableMouseCapture)?; - // Watch for file changes. - let sender = events.sender.clone(); - let mut watcher = - notify::recommended_watcher(move |res: notify::Result| { - match res { - Ok(event) => { - if event.kind.is_modify() { - sender - .send(Event::AutoGenerate) - .expect("failed to send event"); - } - } - Err(e) => panic!("watch error: {e:?}"), - } - })?; - - for config in state.configs.iter() { - let path = Path::new(&config.file); - if path.exists() { - watcher.watch(path, RecursiveMode::NonRecursive)?; - } - } + // TODO: Watch for file changes. + // + // let sender = events.sender.clone(); + // let mut watcher = + // notify::recommended_watcher(move |res: notify::Result| { + // match res { + // Ok(event) => { + // if event.kind.is_modify() { + // sender + // .send(Event::AutoGenerate) + // .expect("failed to send event"); + // } + // } + // Err(e) => panic!("watch error: {e:?}"), + // } + // })?; // Start the main loop. while state.is_running { - // Render the user interface. terminal.draw(|frame| ui::render(&mut state, frame))?; - // Handle events. let event = events.next()?; match event { Event::Tick => state.tick(), @@ -104,6 +63,7 @@ fn main() -> Result<()> { Event::Mouse(_) => {} Event::Resize(_, _) => {} Event::Generate | Event::AutoGenerate => { + state.process_changelog()?; // if event == Event::AutoGenerate && !state.autoload { // continue; // } @@ -127,22 +87,9 @@ fn main() -> Result<()> { // .expect("failed to send event"); // }); } - Event::RenderMarkdown(_) => { - // state.is_generating = false; - // state.changelog = changelog; - // state.markdown.component = - // Some(md_tui::parser::parse_markdown( None, - // &state.changelog, - // state.markdown.area.width, - // )); - } - Event::Error(e) => { - state.error = Some(e); - } } } ratatui::restore(); - ratatui::crossterm::execute!(terminal.backend_mut(), DisableMouseCapture)?; Ok(()) } diff --git a/git-cliff-tui/src/state.rs b/git-cliff-tui/src/state.rs index 40cf4b5c63..90b73de687 100644 --- a/git-cliff-tui/src/state.rs +++ b/git-cliff-tui/src/state.rs @@ -2,8 +2,6 @@ use copypasta::ClipboardContext; use git_cliff::args::Args; use git_cliff::core::changelog::Changelog; use git_cliff::core::embed::BuiltinConfig; -use md_tui::nodes::root::ComponentRoot; -use ratatui::layout::Rect; use ratatui::widgets::ListState; use std::error; use throbber_widgets_tui::ThrobberState; @@ -11,78 +9,49 @@ use throbber_widgets_tui::ThrobberState; /// Application result type. pub type Result = std::result::Result>; -/// Changelog configuration. -#[derive(Debug, Default)] -pub struct Config { - /// Name/path of the configuration. - pub file: String, -} - -/// Markdown content. -#[derive(Default)] -pub struct Markdown { - /// Rendered component. - pub component: Option, - /// Widget area. - pub area: Rect, - /// Selected config index. - pub config_index: usize, - /// Scroll index. - pub scroll_index: u16, -} - -/// Is the application running? /// Application state. pub struct State<'a> { /// git-cliff arguments. - pub args: Args, - /// Is the application running? - pub is_running: bool, - /// Configuration files. - pub configs: Vec, + pub args: Args, + /// Built-in configuration files. + pub builtin_configs: Vec, /// The state of the list. - pub list_state: ListState, - /// Changelog. - pub changelog: Option>, - /// Error message. - pub error: Option, - /// Rendered markdown. - pub markdown: Markdown, - /// Autoload changes. - pub autoload: bool, + pub list_state: ListState, + /// Changelog object. + pub changelog: Option>, + /// Changelog contents. + pub contents: String, + /// Scroll index. + pub scroll_index: usize, /// Clipboard context. - pub clipboard: Option, - /// Is the sidebar toggled? - pub is_toggled: bool, + pub clipboard: Option, /// Throbber state. - pub throbber_state: ThrobberState, + pub throbber_state: ThrobberState, /// Is generating? - pub is_generating: bool, + pub is_generating: bool, + /// Is the sidebar toggled? + pub is_toggled: bool, + /// Autoload changes. + pub autoload: bool, + /// Is the application running? + pub is_running: bool, } -impl<'a> State<'a> { +impl State<'_> { /// Constructs a new instance. pub fn new(args: Args) -> Result { - let configs = BuiltinConfig::iter() - .map(|file| Config { - file: file.to_string(), - }) - .collect(); + let configs = BuiltinConfig::iter().map(|file| file.to_string()).collect(); Ok(Self { args, - is_running: true, - is_toggled: true, - is_generating: false, - configs, + builtin_configs: configs, list_state: { let mut list_state = ListState::default(); list_state.select_first(); list_state }, changelog: None, - error: None, - markdown: Markdown::default(), - autoload: true, + contents: String::new(), + scroll_index: 0, throbber_state: ThrobberState::default(), clipboard: match ClipboardContext::new() { Ok(ctx) => Some(ctx), @@ -91,21 +60,27 @@ impl<'a> State<'a> { None } }, + is_generating: false, + is_toggled: true, + autoload: true, + is_running: true, }) } /// Generates the changelog. - pub fn generate_changelog(&mut self) -> Result<()> { + /// + /// This runs once the application starts for fetching the remote data if + /// necessary. + pub fn get_changelog_data(&mut self) -> Result<()> { self.changelog = Some(git_cliff::generate_changelog(&mut self.args)?); Ok(()) } /// Returns the changelog contents. - pub fn get_changelog_contents(&mut self) -> Result> { + pub fn generate_changelog(&mut self) -> Result> { if let Some(changelog) = &self.changelog { - let config = git_cliff::core::embed::BuiltinConfig::parse( - self.configs[self.list_state.selected().unwrap_or_default()] - .file + let config = BuiltinConfig::parse( + self.builtin_configs[self.list_state.selected().unwrap_or_default()] .clone(), )? .0; @@ -128,12 +103,8 @@ impl<'a> State<'a> { /// Processes the changelog contents. pub fn process_changelog(&mut self) -> Result<()> { - if let Some(contents) = &self.get_changelog_contents()? { - self.markdown.component = Some(md_tui::parser::parse_markdown( - None, - &contents, - self.markdown.area.width, - )); + if let Some(contents) = &self.generate_changelog()? { + self.contents = contents.clone(); } Ok(()) } diff --git a/git-cliff-tui/src/ui.rs b/git-cliff-tui/src/ui.rs index e8a8bc3b12..79ff90a17e 100644 --- a/git-cliff-tui/src/ui.rs +++ b/git-cliff-tui/src/ui.rs @@ -1,5 +1,4 @@ use crate::state::State; -use md_tui::nodes::root::Component; use ratatui::{ layout::{ Alignment, @@ -27,7 +26,6 @@ use ratatui::{ Scrollbar, ScrollbarOrientation, ScrollbarState, - Wrap, }, Frame, }; @@ -57,9 +55,9 @@ pub fn render(state: &mut State, frame: &mut Frame) { Constraint::Min( state.is_toggled as u16 * state - .configs + .builtin_configs .iter() - .map(|c| c.file.len() as u16) + .map(|c| c.len() as u16) .map(|c| c + 6) .max() .unwrap_or_default(), @@ -68,11 +66,7 @@ pub fn render(state: &mut State, frame: &mut Frame) { ]) .split(rects[0]); render_list(state, frame, rects[0]); - if state.error.is_some() { - render_error(state, frame, rects[1]); - } else { - render_changelog(state, frame, rects[1]); - } + render_changelog(state, frame, rects[1]); } fn render_key_bindings(frame: &mut Frame, area: Rect) { @@ -100,11 +94,11 @@ fn render_key_bindings(frame: &mut Frame, area: Rect) { } fn render_list(state: &mut State, frame: &mut Frame, area: Rect) { - if !state.configs.is_empty() { + if !state.builtin_configs.is_empty() { let items = state - .configs + .builtin_configs .iter() - .map(|c| ListItem::new(c.file.to_string())) + .map(|c| ListItem::new(c.to_string())) .collect::>(); let list = List::new(items) .block( @@ -125,17 +119,13 @@ fn render_list(state: &mut State, frame: &mut Frame, area: Rect) { vertical: 1, horizontal: 0, }), - &mut ScrollbarState::new(state.configs.len()) + &mut ScrollbarState::new(state.builtin_configs.len()) .position(state.list_state.selected().unwrap_or_default()), ); } } fn render_changelog(state: &mut State, frame: &mut Frame, area: Rect) { - state.markdown.area = area.inner(Margin { - horizontal: 1, - vertical: 1, - }); frame.render_widget( Block::bordered() .title_top("|Changelog|".yellow().into_left_aligned_line()) @@ -143,15 +133,17 @@ fn render_changelog(state: &mut State, frame: &mut Frame, area: Rect) { Line::from(if state.is_generating { vec![ "|".fg(Color::Rgb(100, 100, 100)), - "> Generating...".white().into(), + "> Generating...".white(), "|".fg(Color::Rgb(100, 100, 100)), ] - } else if state.markdown.component.is_some() { + } else if !state.contents.is_empty() { vec![ "|".fg(Color::Rgb(100, 100, 100)), - state.configs[state.markdown.config_index] - .file - .clone() + state + .list_state + .selected() + .map(|i| state.builtin_configs[i].clone()) + .unwrap_or_default() .white() .italic(), "|".fg(Color::Rgb(100, 100, 100)), @@ -187,7 +179,7 @@ fn render_changelog(state: &mut State, frame: &mut Frame, area: Rect) { } else { vec![ "|".fg(Color::Rgb(100, 100, 100)), - "Select config to start".white().into(), + "Select config to start".white(), "|".fg(Color::Rgb(100, 100, 100)), ] }) @@ -201,19 +193,22 @@ fn render_changelog(state: &mut State, frame: &mut Frame, area: Rect) { ), area, ); - if let Some(component) = &mut state.markdown.component { - let mut height = 2; - for child in component.children() { - if let Component::TextComponent(c) = child { - let mut c = c.clone(); - c.set_scroll_offset(state.markdown.scroll_index); - c.set_y_offset(height); - height += c.height(); - if c.height() + c.scroll_offset() + 1 < height { - frame.render_widget(c.clone(), state.markdown.area); - } - } - } + if !state.contents.is_empty() { + frame.render_widget( + tui_markdown::from_str( + &state + .contents + .lines() + .skip(state.scroll_index) + .collect::>() + .join("\n"), + ), + area.inner(Margin { + horizontal: 1, + vertical: 1, + }), + ); + frame.render_stateful_widget( Scrollbar::new(ScrollbarOrientation::VerticalRight) .begin_symbol(Some("↑")) @@ -222,8 +217,8 @@ fn render_changelog(state: &mut State, frame: &mut Frame, area: Rect) { vertical: 1, horizontal: 0, }), - &mut ScrollbarState::new(component.height() as usize) - .position(state.markdown.scroll_index as usize), + &mut ScrollbarState::new(state.contents.len()) + .position(state.scroll_index), ); } @@ -249,24 +244,3 @@ fn render_changelog(state: &mut State, frame: &mut Frame, area: Rect) { ); } } - -fn render_error(state: &mut State, frame: &mut Frame, area: Rect) { - if let Some(error) = &state.error { - frame.render_widget( - Block::bordered() - .title_top("|Error|".red().into_centered_line()) - .border_type(BorderType::Rounded) - .border_style(Style::default().fg(Color::Rgb(100, 100, 100))), - area, - ); - frame.render_widget( - Paragraph::new(Line::from(error.clone())) - .alignment(Alignment::Center) - .wrap(Wrap { trim: false }), - area.inner(Margin { - horizontal: 1, - vertical: 1, - }), - ); - } -}