gyscos / cursive

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

Fail to build file-tree-viewer #112

Open matthiasbeyer opened 7 years ago

matthiasbeyer commented 7 years ago

Hi,

I fail hard building a file-tree viewer.

The idea is to build a nested ListView, but the first nesting does not get expanded:

2017-03-05-151626_1280x800_scrot

Do you have any ideas? I could share the source, if it is really necessary (Or just share the module where I defined my helper type).

gyscos commented 7 years ago

ListView is currently very much a work-in-progress, and still has some severe limitations: for instance, it can only contain views that are 1-line high (it was mostly intended for forms). :( A more general-purpose GridView is planned~ish.

In the meantime, you can either:

BonsaiDen commented 7 years ago

Small heads up, I'm currently working on a tree view implementation :)

It isn't 100% there just yet but should be finished within the next few days.

The view is generic over anything that implements fmt::Display + fmt::Debug but you'll have to handle any advanced stuff yourself as the API is really low level (insert, remove, collapse operations are all based on row indices).

There's also a file viewer example which lazily loads and inserts the directory contents once they are unfolded by the user :)

As stated above still WIP, so expect panics and dead kittens for the time being.

tree