summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2021-01-29 23:32:47 -0500
committerJune McEnroe <june@causal.agency>2021-01-29 23:32:47 -0500
commitbeeddcb11f3b351cc677346a97a9b387e352ea12 (patch)
treee98ff90b30b1c4e5e5e602ba02c36a12b1b4287e
parentOnly skip setting swap in windowShow (diff)
downloadcatgirl-beeddcb11f3b351cc677346a97a9b387e352ea12.tar.gz
catgirl-beeddcb11f3b351cc677346a97a9b387e352ea12.zip
Actually scroll to first line for "scroll to top"
Diffstat (limited to '')
-rw-r--r--ui.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/ui.c b/ui.c
index c2c848f..f44073a 100644
--- a/ui.c
+++ b/ui.c
@@ -826,6 +826,14 @@ static void scrollPage(struct Window *window, int n) {
 	windowScroll(window, n * (MAIN_LINES - SplitLines - MarkerLines - 1));
 }
 
+static void scrollTop(struct Window *window) {
+	for (size_t i = 0; i < BufferCap; ++i) {
+		if (!bufferHard(window->buffer, i)) continue;
+		scrollTo(window, BufferCap - i);
+		break;
+	}
+}
+
 static void scrollHot(struct Window *window, int dir) {
 	for (size_t i = windowTop(window) + dir; i < BufferCap; i += dir) {
 		const struct Line *line = bufferHard(window->buffer, i);
@@ -910,7 +918,7 @@ static void keyCode(int code) {
 		break; case KeyMetaSlash: windowShow(windows.swap);
 
 		break; case KeyMetaGt: scrollTo(window, 0);
-		break; case KeyMetaLt: scrollTo(window, BufferCap);
+		break; case KeyMetaLt: scrollTop(window);
 
 		break; case KeyMeta0 ... KeyMeta9: uiShowNum(code - KeyMeta0);
 		break; case KeyMetaA: showAuto();
td> 2019-09-10Set Accept-Encoding in titleJune McEnroe 2019-09-08Set title User-AgentJune McEnroe 2019-09-07Add -x flag to titleJune McEnroe 2019-09-07Ignore SIGPIPE in relayJune McEnroe 2019-09-07Add A Memory Called EmpireJune McEnroe 2019-09-05Handle lack of Content-TypeJune McEnroe 2019-09-05Use CURLINFO_CONTENT_TYPEJune McEnroe 2019-09-05Decode entities in titlesJune McEnroe 2019-09-05Print title as soon as it's availableJune McEnroe 2019-09-05Use CURL_PREFIX to set flagsJune McEnroe 2019-09-05Add titleJune McEnroe 2019-09-04Add Avorter n'est pas tuerJune McEnroe 2019-08-29Unset executable on shell scriptsJune McEnroe 2019-08-29Add long-missing setopt to bin.7June McEnroe 2019-08-29Add editJune McEnroe