nushell/crates/nu-explore
Reilly Wood a9c2349ada
Refactor explore cursor code (#12979)
`explore` has 3 cursor-related structs that are extensively used to
track the currently shown "window" of the data being shown. I was
finding the cursor code quite difficult to follow, so this PR:
- rewrites the base `Cursor` struct from scratch, with some tests
- makes big changes to `WindowCursor`
- renames `XYCursor` to `WindowCursor2D`
- makes some of the cursor functions fallible as a start towards better
error handling
- changes lots of function names to things that I find more intuitive
- adds comments, including ASCII diagrams to explain how the cursors
work

More work could be done (I'd like to review/change more function names
in `WindowCursor` and `WindowCursor2D` and add more tests), but this is
the limit of what I can get done in a weekend. I think this part of the
code is in a better place now.

# Testing performed

I did a lot of manual testing in the record view and binary viewer,
moving around with arrow keys / page up+down / home+end.

This can definitely wait until after the release freeze, this area has
very few automated tests and it'd be good to let the changes bake a bit.
2024-06-04 19:50:11 -07:00
..
src Refactor explore cursor code (#12979) 2024-06-04 19:50:11 -07:00
.gitignore [MVP][WIP] less like pager (#6984) 2022-12-01 09:32:10 -06:00
Cargo.toml bump version to 0.94.3 (#13055) 2024-06-05 06:52:40 +08:00
LICENSE Fix rest of license year ranges (#8727) 2023-04-04 09:03:29 +12:00