Add M-n, M-p to jump to highlights
parent
dbc0c3ef40
commit
49e626b2f3
10
catgirl.1
10
catgirl.1
|
@ -1,4 +1,4 @@
|
||||||
.Dd August 20, 2020
|
.Dd September 3, 2020
|
||||||
.Dt CATGIRL 1
|
.Dt CATGIRL 1
|
||||||
.Os
|
.Os
|
||||||
.
|
.
|
||||||
|
@ -473,6 +473,8 @@ Switch to previously selected window.
|
||||||
Scroll to top.
|
Scroll to top.
|
||||||
.It Ic M->
|
.It Ic M->
|
||||||
Scroll to bottom.
|
Scroll to bottom.
|
||||||
|
.It Ic M- Ns Ar n
|
||||||
|
Switch to window by number 0\(en9.
|
||||||
.It Ic M-a
|
.It Ic M-a
|
||||||
Cycle through unread windows.
|
Cycle through unread windows.
|
||||||
.It Ic M-l
|
.It Ic M-l
|
||||||
|
@ -484,8 +486,10 @@ to return to
|
||||||
.Nm .
|
.Nm .
|
||||||
.It Ic M-m
|
.It Ic M-m
|
||||||
Insert a blank line in the window.
|
Insert a blank line in the window.
|
||||||
.It Ic M- Ns Ar n
|
.It Ic M-n
|
||||||
Switch to window by number 0\(en9.
|
Scroll to next highlight.
|
||||||
|
.It Ic M-p
|
||||||
|
Scroll to previous highlight.
|
||||||
.It Ic M-u
|
.It Ic M-u
|
||||||
Scroll to first unread line.
|
Scroll to first unread line.
|
||||||
.It Ic M-v
|
.It Ic M-v
|
||||||
|
|
22
ui.c
22
ui.c
|
@ -196,6 +196,8 @@ static short colorPair(short fg, short bg) {
|
||||||
X(KeyMetaF, "\33f", NULL) \
|
X(KeyMetaF, "\33f", NULL) \
|
||||||
X(KeyMetaL, "\33l", NULL) \
|
X(KeyMetaL, "\33l", NULL) \
|
||||||
X(KeyMetaM, "\33m", NULL) \
|
X(KeyMetaM, "\33m", NULL) \
|
||||||
|
X(KeyMetaN, "\33n", NULL) \
|
||||||
|
X(KeyMetaP, "\33p", NULL) \
|
||||||
X(KeyMetaQ, "\33q", NULL) \
|
X(KeyMetaQ, "\33q", NULL) \
|
||||||
X(KeyMetaU, "\33u", NULL) \
|
X(KeyMetaU, "\33u", NULL) \
|
||||||
X(KeyMetaV, "\33v", NULL) \
|
X(KeyMetaV, "\33v", NULL) \
|
||||||
|
@ -499,9 +501,21 @@ static void windowScrollPage(struct Window *window, int n) {
|
||||||
windowScroll(window, n * (MAIN_LINES - SplitLines - MarkerLines - 1));
|
windowScroll(window, n * (MAIN_LINES - SplitLines - MarkerLines - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void windowScrollUnread(struct Window *window) {
|
static void windowScrollTo(struct Window *window, int top) {
|
||||||
window->scroll = 0;
|
window->scroll = 0;
|
||||||
windowScroll(window, window->unreadHard - MAIN_LINES + MarkerLines);
|
windowScroll(window, top - MAIN_LINES + MarkerLines);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void windowScrollHot(struct Window *window, int dir) {
|
||||||
|
size_t from = BufferCap - window->scroll - MAIN_LINES + MarkerLines + dir;
|
||||||
|
for (size_t i = from; i < BufferCap; i += dir) {
|
||||||
|
const struct Line *line = bufferHard(window->buffer, i);
|
||||||
|
const struct Line *prev = bufferHard(window->buffer, i - 1);
|
||||||
|
if (!line || line->heat < Hot) continue;
|
||||||
|
if (prev && prev->heat > Warm) continue;
|
||||||
|
windowScrollTo(window, BufferCap - i);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Util uiNotifyUtil;
|
struct Util uiNotifyUtil;
|
||||||
|
@ -823,8 +837,10 @@ static void keyCode(int code) {
|
||||||
break; case KeyMetaF: edit(id, EditNextWord, 0);
|
break; case KeyMetaF: edit(id, EditNextWord, 0);
|
||||||
break; case KeyMetaL: bufferList(window->buffer);
|
break; case KeyMetaL: bufferList(window->buffer);
|
||||||
break; case KeyMetaM: insertBlank(window);
|
break; case KeyMetaM: insertBlank(window);
|
||||||
|
break; case KeyMetaN: windowScrollHot(window, +1);
|
||||||
|
break; case KeyMetaP: windowScrollHot(window, -1);
|
||||||
break; case KeyMetaQ: edit(id, EditCollapse, 0);
|
break; case KeyMetaQ: edit(id, EditCollapse, 0);
|
||||||
break; case KeyMetaU: windowScrollUnread(window);
|
break; case KeyMetaU: windowScrollTo(window, window->unreadHard);
|
||||||
break; case KeyMetaV: windowScrollPage(window, +1);
|
break; case KeyMetaV: windowScrollPage(window, +1);
|
||||||
|
|
||||||
break; case KEY_BACKSPACE: edit(id, EditDeletePrev, 0);
|
break; case KEY_BACKSPACE: edit(id, EditDeletePrev, 0);
|
||||||
|
|
Loading…
Reference in New Issue