ref: 3784df6eb213fc0ccd683ed396d42645e1bca718 roman/src/romanpkg/termask.nim -rw-r--r-- 7.4 KiB
Add support for editing subscription title

This commit adds a new dependency on the noise library, a Nim
implementation of linenoise. This is being used instead of rdstdin in
the Nim standard library (which wraps linenoise) because it's nice to
give the user the current name as a default when editing, which rdstdin
doesn't allow.
Use generic version of promptList for choosing feed
Implement manage subcommand with unsubscribe support
Show cursor when exiting termask
Clear leftover entries when scrolling through multiple pages

This fixes #13. Previously, feeds with (say) 15 entries would show posts
1-10 for selection on the first page of results, and when advanced to
the second page of results, posts 11-15 would be shown, but 6-10 would
still be visible below them. Now, those old results are wiped from the
Fix issue with closing termask with cursor moved down

This closes #9.
Use formatted names for displaying link selections

This change required us to genericize the promptList function, which in
turn forced us to go back to using pure tables (instead of strtabs) for
the hash maps passed to promptList, effectively undoing 8a33f484.
Remove commented out line
Remove unneeded imports

Now that Nim 1.0 has been released, the compiler warns about unused
imports. I was generally careful about avoiding these, but there were a
few that I missed.
Use strtabs instead of Table[string, string]
Return user to post selection after closing post
Fix bug with menu scrolling on empty screen
Load configuration values from config file

This is a large commit! The types were all moved out of their own
modules into a common types module to avoid circular dependencies with
the config object. It also adds a default config file and starts the
process of moving some of the hardcoded defaults into the file.
Return user to feed selection after viewing a post

This commit adds a new error type, InterruptError, to handle the user
asking us nicely to exit during the selection. This lets us check if
this has been raised after each selection, and if not, return the user
to the beginning. It also fixes a few bugs in the menu paging
Allow left/right arrows for menu navigation
Use arrow keys and bidirectional travel in menus

Previously, the user had to use tab to cycle through the selection
prompts, and they could only go down. Now, they can use the up and down
arrows (or k/j) to navigate through the feed!
Show which posts have already been read

Posts that are opened have their GUID stored in
$XDG_SHARE_HOME/roman/read-posts. For now, this filepath is
Linux-specific, but paths for other platforms will be added soon.
Revert to using a menu selector and add menu paging

There are still some edge cases that will break (for example, the pager
will break on lines that are longer than the terminal width), and the
instructions interface needs improvement, but this is sufficient for an
initial commit!
Simplify workflow of asking for user input
Improve leftover displayed options after interrupt
Ask user to select which feed to see posts from