sfeed

Simple RSS and Atom feed parser
git clone https://git.sinitax.com/codemadness/sfeed
Log | Files | Refs | README | LICENSE | Upstream | sfeed.txt

commit f726178a4c61037da62f7dfd0c20b23a3675d6ac
parent 1d6b7c5d3f09ec2118400207b81b1332f1ee319a
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Fri, 21 Jan 2022 20:20:01 +0100

add feature to go to the next bold row and previous bold row with J and K

This replaces the current J and K keybind, which was rarely useful.

Thanks to IanJ for the suggestion and feedback!

Diffstat:
Msfeed_curses.1 | 6+++---
Msfeed_curses.c | 29++++++++++++++++++++++-------
2 files changed, 25 insertions(+), 10 deletions(-)

diff --git a/sfeed_curses.1 b/sfeed_curses.1 @@ -1,4 +1,4 @@ -.Dd January 19, 2022 +.Dd January 22, 2022 .Dt SFEED_CURSES 1 .Os .Sh NAME @@ -49,9 +49,9 @@ Go one row up. .It j, ARROW DOWN Go one row down. .It K -Go one row up and open the item. +Go to the previous bold row. .It J -Go one row down and open the item. +Go to the next bold row. .It h, ARROW LEFT Focus feeds pane. .It l, ARROW RIGHT diff --git a/sfeed_curses.c b/sfeed_curses.c @@ -2125,17 +2125,11 @@ main(int argc, char *argv[]) break; keyup: case 'k': - case 'K': pane_scrolln(&panes[selpane], -1); - if (ch == 'K') - goto openitem; break; keydown: case 'j': - case 'J': pane_scrolln(&panes[selpane], +1); - if (ch == 'J') - goto openitem; break; keyleft: case 'h': @@ -2153,6 +2147,28 @@ keyright: if (layout == LayoutMonocle) updategeom(); break; + case 'K': + p = &panes[selpane]; + if (!p->nrows) + break; + for (pos = p->pos - 1; pos >= 0; pos--) { + if ((row = pane_row_get(p, pos)) && row->bold) { + pane_setpos(p, pos); + break; + } + } + break; + case 'J': + p = &panes[selpane]; + if (!p->nrows) + break; + for (pos = p->pos + 1; pos < p->nrows; pos++) { + if ((row = pane_row_get(p, pos)) && row->bold) { + pane_setpos(p, pos); + break; + } + } + break; case '\t': selpane = selpane == PaneFeeds ? PaneItems : PaneFeeds; if (layout == LayoutMonocle) @@ -2260,7 +2276,6 @@ nextpage: break; case 'o': /* feeds: load, items: plumb URL */ case '\n': -openitem: if (selpane == PaneFeeds && panes[selpane].nrows) feed_open_selected(&panes[selpane]); else if (selpane == PaneItems && panes[selpane].nrows)