diff options
-rw-r--r-- | sfeed_curses.1 | 6 | ||||
-rw-r--r-- | sfeed_curses.c | 29 |
2 files changed, 25 insertions, 10 deletions
diff --git a/sfeed_curses.1 b/sfeed_curses.1 index 3d7fcab..9ce0bab 100644 --- 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 index d6eb4f7..0cd7ebd 100644 --- 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) |