From cfd2cfc82b1b4120dcd7ce5c0ad6b762145bff29 Mon Sep 17 00:00:00 2001 From: Vonr Date: Wed, 6 Sep 2023 21:35:43 +0800 Subject: [PATCH] ver: 1.0.10 Fix wrapping around to 0 when trying to scroll down from second last package in list to last package in list. --- Cargo.lock | 79 +++++++++++++++++++++++++++++++++++++++-------------- Cargo.toml | 13 +++++---- src/main.rs | 2 +- 3 files changed, 66 insertions(+), 28 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2d858e0..9bb993d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -130,22 +130,6 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "crossterm" -version = "0.26.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a84cda67535339806297f1b331d6dd6320470d2a0fe65381e79ee9e156dd3d13" -dependencies = [ - "bitflags 1.3.2", - "crossterm_winapi", - "libc", - "mio", - "parking_lot", - "signal-hook", - "signal-hook-mio", - "winapi", -] - [[package]] name = "crossterm" version = "0.27.0" @@ -153,11 +137,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f476fe445d41c9e991fd07515a6f463074b782242ccf4a5b7b1d1012e70824df" dependencies = [ "bitflags 2.4.0", + "crossterm_winapi", "libc", "mio", "parking_lot", "signal-hook", "signal-hook-mio", + "winapi", ] [[package]] @@ -185,6 +171,12 @@ dependencies = [ "thousands", ] +[[package]] +name = "either" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" + [[package]] name = "flate2" version = "1.0.26" @@ -210,6 +202,12 @@ version = "0.27.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e" +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + [[package]] name = "hermit-abi" version = "0.3.2" @@ -232,6 +230,15 @@ version = "2.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c785eefb63ebd0e33416dfcb8d6da0bf27ce752843a45632a67bf10d4d4b5c4" +[[package]] +name = "itertools" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "1.0.9" @@ -368,12 +375,12 @@ dependencies = [ [[package]] name = "parui" -version = "1.0.9" +version = "1.0.10" dependencies = [ "atomic", "bytemuck", "compact_strings", - "crossterm 0.27.0", + "crossterm", "dhat", "nohash-hasher", "parking_lot", @@ -420,15 +427,17 @@ dependencies = [ [[package]] name = "ratatui" -version = "0.22.0" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8285baa38bdc9f879d92c0e37cb562ef38aa3aeefca22b3200186bc39242d3d5" +checksum = "2e2e4cd95294a85c3b4446e63ef054eea43e0205b1fd60120c16b74ff7ff96ad" dependencies = [ "bitflags 2.4.0", "cassowary", - "crossterm 0.26.1", + "crossterm", "indoc", + "itertools", "paste", + "strum", "unicode-segmentation", "unicode-width", ] @@ -501,6 +510,12 @@ dependencies = [ "untrusted", ] +[[package]] +name = "rustversion" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" + [[package]] name = "ryu" version = "1.0.15" @@ -596,6 +611,28 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" +[[package]] +name = "strum" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" +dependencies = [ + "strum_macros", +] + +[[package]] +name = "strum_macros" +version = "0.25.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad8d03b598d3d0fff69bf533ee3ef19b8eeb342729596df84bcc7e1f96ec4059" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "rustversion", + "syn", +] + [[package]] name = "syn" version = "2.0.26" diff --git a/Cargo.toml b/Cargo.toml index 6a7351d..03e8aaf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "parui" description = "Simple TUI frontend for paru or yay." -version = "1.0.9" +version = "1.0.10" edition = "2021" license = "MIT" readme = "README.md" @@ -28,7 +28,6 @@ atomic = "0.6.0" parking_lot = "0.12.1" nohash-hasher = "0.2.0" compact_strings = "1.2.2" -dhat = "0.3.2" [dependencies.crossterm] version = "0.27.0" @@ -41,17 +40,19 @@ features = ["process", "rt-multi-thread", "time", "macros", "sync"] [dependencies.tui] package = "ratatui" -version = "0.22.0" +version = "0.23.0" features = ["crossterm"] [dependencies.ureq] version = "2.7.1" -default-features = false -features = ["gzip", "tls"] [dependencies.bytemuck] version = "1.13.1" features = ["derive"] +[dependencies.dhat] +version = "0.3.2" +optional = true + [features] -dhat = [] +dhat = ["dep:dhat"] diff --git a/src/main.rs b/src/main.rs index 9da7dd6..9a9ebcf 100644 --- a/src/main.rs +++ b/src/main.rs @@ -484,7 +484,7 @@ async fn main() -> Result<(), io::Error> { } else { let result_count = shown_len() - 1; - if result_count > 1 && current < result_count - 1 { + if result_count > 1 && current < result_count { current += 1; } else { current = 0;