Tabs relied heavily on `ViewExt`'s `title()` function, while also
requiring a separate `id`. The `id`, if used, should be an internal part
of the struct and not part of its API. This also removes the hashmap as
it will never be faster than sequentially looking up all the names,
since there will most likely never be that many tabs in a `TabbedView`.
* feat: add `info` command line subcommand
Adding an info command allows the documentation to refer to it when
mentioning platform specific information. This gives users a nicer
experience since they don't need to think about how `ncspot` will behave
on their system, but can run `ncspot info` to get that information.
* fix: info command don't create runtime directory
* fix: don't print runtime path on Windows
Windows doesn't use the runtime path so it shouldn't be printed there.
* fix: make `info` command easier to parse
* docs: add back the default configuration directory
Clippy's `use_self` line ensures that `Self` is used instead of the real
name whenever possible. This makes searching easier and cleans up the
code a bit.
* Add command for adding song to playlist
* edits for code style
* Return playlist dialog via `CommandResult::Modal`
---------
Co-authored-by: Henrik Friedrichsen <henrik@affekt.org>
- Show error on deletion, as we currently do not have a Uri we can pass to the
Spotify API to delete local files in playlists
- Mark local files in `ListView`
fixes#1213
The `screenchange` member variable on `Layout` didn't seem to be used
for anything except for debugging. A comment in `on_layout` makes it
seem like it wasn't meant to be used for debugging purposes but for
actual functionality that wasn't implemented.
After refactoring layout, the if statements were removed in favor of a
single match. This changed the control flow a bit, breaking mouse event
propagation.
Some applications move their 'global' data into a struct called `App` or
`Application`. This makes it very clear what data belongs to the
'global' scope or in other words, to the application itself.
Change the behavior of `ListView` to treat a click on an item that is
already selected as a double click. It allows the user to play songs
(not episodes since currently it's not possible to determine if a
`ListItem` is an episode) by "double clicking" them. It is a bit of a
hack, but it works pretty well. A possible downside is that when people
that don't like mouse integration in a TUI click to focus the terminal
window, it could jump to the song they clicked if that happened to be
the selected one.
Autojump seems to take precedence over regular keys, which isn't the
wanted behavior, especially when there are playlists in the list that
contain some of the most common Vim keybindings. For example when there
is a playlist called 'jazz', pressing `j` will jump to that playlist
instead of going down.
This commit disables autojump for now. If search inside the add to
playlist dialog would be a wanted feature, it could be implemented using
the default Vim search button `/` which would work the same way as
searching in other lists works right now.
Some basic cleanup of function signatures that took ownership of their
parameters, even though they didn't need ownership. Switching over the
usage of `Arc` to a normal borrow has the added benefit of cleaning up
the code a bit since now a reference can be given instead of having to
clone the values. The other benefit is that a lot of clones aren't
necessary anymore. It's not going to have noticable performance
benefits, but it is still a good thing to have less clones all over the
code.
* fix(backtrace): Fix backtrace logging and stdout
- Add manual implementation for panic that logs backtrace to a file.
- Remove all manual output to stdout.
- Fix new clippy warnings from Rust 1.65.
* Update docs
Co-authored-by: Henrik Friedrichsen <henrik@affekt.org>
Like mentioned in the corresponding issue by ayushjaipuriyar, ncspot
would crash when the queue was empty, shuffled, and played. This commit
fixes that, together with some minor clippy fixes.
PlayTrackMenu was used before the refactor of the contextmenus. I forgot
to clean up the struct before making the commit since rustc didn't
complain. Just cleaning up my mistakes ;)
* Add save option to context menu of all possible ListItems
* Add play options to context menus
* Fix for playlists and tracks
* Move playback controls into main menu
Previously two vectors of categories were created. The pagination was set up to
store the newly fetched page in the `Vec` that was not displayed.
With this change newly fetched pages should correctly show up in the "Browse"
screen.
As reported in #939
Instead of storing a separate copy of the view title.
Additionally, rename `ViewExt.set_title()` to `ViewExt.with_title()` as it
consumes `self` and returns ownership.
With af08a56 properly passing down relativized events we don't have to implement
to scrollbar dragging logic ourselves anymore, but can rely on the one in
cursive.
This also fixes#839
The previous behavior would select and open the last item if the user clicked a
row after the last item. This change prevents such a behavior as it can be
misleading.
Related to #840