summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--catgirl.16
-rw-r--r--ui.c13
2 files changed, 18 insertions, 1 deletions
diff --git a/catgirl.1 b/catgirl.1
index 6e9f867..ad2b3a2 100644
--- a/catgirl.1
+++ b/catgirl.1
@@ -1,4 +1,4 @@
-.Dd September  3, 2020
+.Dd September  6, 2020
 .Dt CATGIRL 1
 .Os
 .
@@ -459,6 +459,10 @@ Redraw the UI.
 Switch to next window.
 .It Ic C-p
 Switch to previous window.
+.It Ic C-r
+Scroll to previous line matching input.
+.It Ic C-s
+Scroll to next line matching input.
 .It Ic C-v
 Scroll down a page.
 .It Ic M--
diff --git a/ui.c b/ui.c
index 4178d8f..676f969 100644
--- a/ui.c
+++ b/ui.c
@@ -518,6 +518,17 @@ static void windowScrollHot(struct Window *window, int dir) {
 	}
 }
 
+static void
+windowScrollSearch(struct Window *window, const char *str, 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);
+		if (!line || !strcasestr(line->str, str)) continue;
+		windowScrollTo(window, BufferCap - i);
+		break;
+	}
+}
+
 struct Util uiNotifyUtil;
 static void notify(uint id, const char *str) {
 	if (!uiNotifyUtil.argc) return;
@@ -877,6 +888,8 @@ static void keyCtrl(wchar_t ch) {
 		break; case L'L': clearok(curscr, true);
 		break; case L'N': uiShowNum(windows.show + 1);
 		break; case L'P': uiShowNum(windows.show - 1);
+		break; case L'R': windowScrollSearch(window, editBuffer(NULL), -1);
+		break; case L'S': windowScrollSearch(window, editBuffer(NULL), +1);
 		break; case L'T': edit(id, EditTranspose, 0);
 		break; case L'U': edit(id, EditDeleteHead, 0);
 		break; case L'V': windowScrollPage(window, -1);
2019-12-22Add CAVEAT about expecting plain-textJune McEnroe 2019-12-22Quote user, pass and mailboxJune McEnroe 2019-12-22Use sequence numbers rather than UIDsJune McEnroe 2019-12-22Use EXAMINE rather than SELECTJune McEnroe 2019-12-22Export To and CC headersJune McEnroe 2019-12-22Add missing includeJune McEnroe 2019-12-22Export In-Reply-To headersJune McEnroe 2019-12-21Add git-fetch-email to READMEJune McEnroe 2019-12-21Clarify purpose in READMEJune McEnroe 2019-12-21Add READMEJune McEnroe 2019-12-21Add copyright header to git-fetch-emailJune McEnroe 2019-12-21Add git-fetch-email to SEE ALSO of imboxJune McEnroe 2019-12-21Add git-fetch-email wrapperJune McEnroe 2019-12-21Determine host by SRV lookupJune McEnroe 2019-12-21Clean up remaining codeJune McEnroe 2019-12-21Clean up mboxrd codeJune McEnroe 2019-12-21Convert CRLF to LFJune McEnroe 2019-12-21Implement -CFSTJune McEnroe 2019-12-21Rewrite aspirational manualJune McEnroe 2019-12-21Null-terminate read literalsJune McEnroe