jeff-hughes/shellcaster

Trying to scroll on an empty list panics

jeff-hughes opened this issue · 3 comments

See for details: #3 (comment)

Ok we're getting somewhere! You are right it has to do with the scrolling. So I can fire up the app and it just stays there, like a full screen of empty stuff, but I have about half of the height of probably what I assume is one line highlighted. If I use the right arrow that "highlighted" portion then becomes the whole width of the screen, still with the height of one line. If I try to use the down arrow however, that's where it panics, and I get this error:

thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', src/ui.rs:473:27 
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

I try running it with backtrace, but I get the exact same error... not sure what is going on, or if I'm doing the backtrace wrong.

Yeah, so currently when you first start the app with an empty database, it just looks like that. There's an empty menu list, and it highlights the first element in that zero-element list, so it just looks...empty. But it's successfully running. If you press "a" you can add a new feed and get the ball rolling so it's no longer empty.

But yes, I'll add it to my todo list: There needs to be a sort of "welcome screen" to show people that it's working properly and give some hints about the keyboard shortcuts to get things rolling. For now....you just have to rely on the Github readme :)

(Also, as a side note, I've found the backtrace thing doesn't quite work properly because the program is using ncurses and thus it hijacks the terminal output. The workaround I've found at the moment is just to pipe stderr to a file, so the backtrace ends up in there. Something like so: RUST_BACKTRACE=1 cargo run 2> error.log )