Christian Rocha
5023d4a0be
Remove some code duplication with stash and news message handling
2020-11-19 22:45:02 -05:00
Christian Rocha
86e581c79c
Add matching stash/news documents to filter results as they're loaded
2020-11-19 22:26:31 -05:00
Christian Rocha
53b9c7ee62
Open correct document when filtered down to one item
2020-11-18 12:33:39 -05:00
Christian Rocha
929b1ed3b3
Remove pointer reference from stashModel.getNotes()
...
It's not altering the model, so removing the pointer reference to
reflect that.
2020-11-18 12:33:39 -05:00
Christian Rocha
4e6460682e
Consolidate common model properties to reduce duplication
2020-11-18 12:33:39 -05:00
Christian Rocha
ae4c85e97d
Maintain positions when renaming documents in a filtered listing
2020-11-17 15:57:55 -05:00
Christian Rocha
de09997fdb
Normalize strings during filtering
...
This makes it easier to match characters with diacritics (i.e. you can type 'o'
and match an 'ö').
2020-11-17 15:57:55 -05:00
Christian Rocha
58eca2414a
Match documents which were stashed in-session then renamed
...
Note that we've also removed field `displayPath` from struct `markdown`
as it turned out to not be necssary in the first place.
2020-11-17 15:57:55 -05:00
Nicolas Martin
d98e3c11ba
Switch to sahilm/fuzzy
for fuzzy-filtering and text highlighting
2020-11-17 15:57:55 -05:00
Christian Rocha
f9883e8f8d
Change 'search' to 'filter'
2020-11-17 15:57:55 -05:00
Christian Rocha
fb5a81f4d6
Upgrade to Bubble Tea v0.12.2 and Bubbles v0.7.5
2020-11-17 15:57:55 -05:00
Christian Rocha
7722b6e6bc
Minor comment improvement
2020-11-17 15:57:55 -05:00
Christian Rocha
d09b225087
Filter against relative path rather than full path
2020-11-17 15:57:55 -05:00
Christian Rocha
8277cbb71f
Remove some consts + check cell widths of prompts, not byte lengths
...
We're able to remove those consts by virtue of reflow's new-ish
ansi.PrintableRuneWidth.
2020-11-17 15:57:55 -05:00
Christian Rocha
4b121593d4
Mop up styling big time
2020-11-17 15:57:55 -05:00
Christian Rocha
7b7a398c74
Don't dim the search entry when blurring the search field
2020-11-17 15:57:55 -05:00
Christian Rocha
759b8707f8
Tidying up
2020-11-17 15:57:55 -05:00
Christian Rocha
899c038402
Also add tab/shift+tab bindings to file browser
2020-11-17 15:57:55 -05:00
Christian Rocha
a17cfa6d26
Shift+tab also moves into filtered results
2020-11-17 15:57:55 -05:00
Christian Rocha
2e1579542e
Don't highlight filtered items until search is blurred
2020-11-17 15:57:55 -05:00
Christian Rocha
ef0f5338f4
Pressing return with no items filtered clears the filter
2020-11-17 15:57:55 -05:00
Christian Rocha
9797f225a7
Change help text if we've filtered down to one item
2020-11-17 15:57:55 -05:00
Christian Rocha
75528db9f1
Maintain previous filtering after unloading a document
2020-11-17 15:57:55 -05:00
Christian Rocha
6965caf3af
When stashing/unstashing an item during filtering maintain its position
2020-11-17 15:57:55 -05:00
Nicolas Martin
5e27376af4
Keep displaying local markdowns after stashing & deleting them
2020-11-17 15:57:55 -05:00
Nicolas Martin
2131b255ef
Reset cursor and page positions when entering the search state
2020-11-17 15:57:55 -05:00
Nicolas Martin
aba133b7e6
There's always at least 1 page available in the paginator
...
Passing 0 to `paginator.SetTotalPages()` is ineffective as it won't alter the
model (paginator needs at least 1 page) and therefore doesn't update the page
count. Filtering can lead to 0 items in the stash view - in this case we still
want to have a page available in the paginator - so we also have pass 1 to
`setTotalPages()`.
2020-11-17 15:57:55 -05:00
Nicolas Martin
7500d88e93
TIL: 'News' is singular
2020-11-17 15:57:55 -05:00
Nicolas Martin
89965743a1
Ensure the search binding "/" always works
2020-11-17 15:57:55 -05:00
Nicolas Martin
c91501655f
Dont panic during actions in the filtered stash view w/o items
...
Filterng down the stash to 0 items (no cursor is displayed as there are no items
left) caused a panic during execution of one of these actions:
- x: Delete
- m: Set Memo
- s: Stash file
This change prevents that from happening by breaking the switch statement when
there are no items left.
Also glow now uses the filtered markdown notes in the `stashHelpView` so
`m.selectedMarkdown()` cannot return a nil refernce anymore.
2020-11-17 15:57:55 -05:00
Nicolas Martin
56847c1b01
Dim search results during filtering
2020-11-17 15:57:55 -05:00
Nicolas Martin
4782b99154
Display news item count in stash view
2020-11-17 15:57:55 -05:00
Nicolas Martin
7fb4a43474
Fix cursor placement when paging trough filtered notes
2020-11-17 15:57:55 -05:00
Nicolas Martin
fbe93a90ff
Add a prefix according to the markdownType when filtering notes
2020-11-17 15:57:55 -05:00
Nicolas Martin
faeef13e55
Get the cursor movement going while filtering stashitems
2020-11-17 15:57:55 -05:00
Nicolas Martin
259f4b584b
Use setTotalPages() to set the number of items in the paginator
...
This takes the filtered stash state in account
2020-11-17 15:57:55 -05:00
Nicolas Martin
e985f96dc4
Add fuzzy filtering for stash notes
2020-11-17 15:57:55 -05:00
Nicolas Martin
9fd3dfef5a
Add a searchinput box to the stashModel
2020-11-17 15:57:55 -05:00
Nicolas Martin
23fb61f752
Add stash states for searching through notes
...
- stashStateSearchNotes will be used while entering the search term
- stashStateShowFiltered will only display the filtered notes in the stash view.
2020-11-17 15:57:55 -05:00
Christian Rocha
32f0be2688
Use the same type to track docs to load and docs loaded
2020-10-19 15:50:50 +00:00
Christian Rocha
54a7394448
Simplify loading completion check
2020-10-19 15:50:50 +00:00
Christian Rocha
fcf109aaff
Add flag for local files only (aka disable network) in TUI
2020-10-19 15:50:50 +00:00
Christian Rocha
e73190a217
Move "stashed only" flag from the package-level into the model
2020-10-19 15:50:50 +00:00
Christian Rocha
26b3292f57
Don't allow stashing until authed + introduce "offline mode" in UI
2020-10-05 13:54:24 +02:00
Christian Rocha
b94615f5ac
Fix debug log in stash deletion command
2020-10-05 13:54:24 +02:00
Christian Rocha
2b064546b9
Move markdown types into a separate file
2020-10-05 13:54:24 +02:00
Christian Rocha
f2537b1811
Update loading message if you're just loading your stash
2020-10-05 13:54:24 +02:00
Christian Rocha
eb6fa55ec3
Run glow stash
to browse stashed files only
2020-10-05 13:54:24 +02:00
Christian Rocha
676d215966
Keybindings for navigating to the start/end of file listing
2020-10-05 13:54:01 +02:00
Christian Rocha
b296cbb780
Remove newlines the linter is complaining about
2020-10-05 13:54:01 +02:00