AMythicDev / minus

An asynchronous, runtime data feedable terminal paging library for Rust
https://crates.io/crates/minus/
Apache License 2.0
316 stars 23 forks source link

Pager panics when static output has > `u16::get_max()` lines #50

Closed itsjunetime closed 2 years ago

itsjunetime commented 2 years ago

Describe the bug When the static output has more lines than u16::get_max() and the user attempts to move to a line whose number is larger than u16::get_max(), the pager panics. This is because of the unwrap on line 106 of search.rs.

To Reproduce Statically page output with more than u16::get_max() (65535) lines of output, then jump to the bottom with G

Expected behavior The pager should not crash.

Desktop: macOS Big Sur, iTerm2, rustc 1.55 stable, minus version 4.0.1.

I have a fix ready to go that doesn't crash and passes all tests when running cargo test --release --all-features. If you'd like this to be fixed, I'd love to submit a PR with the fix.

AMythicDev commented 2 years ago

I am interested in looking into the PR. Thanks for reporting the bug

itsjunetime commented 2 years ago

Just opened #51, which should fix this.

AMythicDev commented 2 years ago

Merged into main branch