gyscos / cursive

A Text User Interface library for the Rust programming language
MIT License
4.24k stars 240 forks source link

TableView member #629

Open smallB007 opened 2 years ago

smallB007 commented 2 years ago

Hi, the struct TableView, has among other members, items and rows_to_items: pub struct TableView<T, H> { [...] items: Vec, rows_to_items: Vec, [...] } The rows_to_items is in my opinion superfluous member and complicates code unnecessarily, as we can have all the information stored in the 'items'. What's the idea behind the rows_to_items member? Thank you

gyscos commented 2 years ago

Hi, and thanks for the report!

Note that cursive_table_view is a separate crate: https://github.com/BonsaiDen/cursive_table_view.

I didn't write this crate so I can't say for sure, but I suppose I can see some value in keeping the main items array stable, while being able to display them in arbitrary order?

smallB007 commented 2 years ago

Hi and thanks for the reply!

I actually managed to modify the cursive_table_view in a way that it doesn't have second member storing the same data, and also allows the items to be displayed in arbitrary order. The code got greatly simplified. At some point I'll do pull request.