about summary refs log tree commit diff
path: root/ui.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--ui.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/ui.c b/ui.c
index 5f0cb63..5d3f070 100644
--- a/ui.c
+++ b/ui.c
@@ -460,6 +460,12 @@ static size_t windowTop(const struct Window *window) {
 	return top;
 }
 
+static size_t windowBottom(const struct Window *window) {
+	size_t bottom = BufferCap - (window->scroll ?: 1);
+	if (window->scroll) bottom -= SplitLines + MarkerLines;
+	return bottom;
+}
+
 static void mainAdd(int y, const char *str) {
 	int ny, nx;
 	wmove(main, y, 0);
@@ -598,13 +604,17 @@ static void resize(void) {
 	mainUpdate();
 }
 
-static void bufferList(const struct Buffer *buffer) {
+static void windowList(const struct Window *window) {
 	uiHide();
 	waiting = true;
 
+	uint num = 0;
+	const struct Line *line = bufferHard(window->buffer, windowBottom(window));
+	if (line) num = line->num;
 	for (size_t i = 0; i < BufferCap; ++i) {
-		const struct Line *line = bufferSoft(buffer, i);
+		line = bufferSoft(window->buffer, i);
 		if (!line) continue;
+		if (line->num > num) break;
 		if (!line->str[0]) {
 			printf("\n");
 			continue;
@@ -859,7 +869,7 @@ static void keyCode(int code) {
 		break; case KeyMetaB: edit(id, EditPrevWord, 0);
 		break; case KeyMetaD: edit(id, EditDeleteNextWord, 0);
 		break; case KeyMetaF: edit(id, EditNextWord, 0);
-		break; case KeyMetaL: bufferList(window->buffer);
+		break; case KeyMetaL: windowList(window);
 		break; case KeyMetaM: uiWrite(id, Warm, NULL, "");
 		break; case KeyMetaN: scrollHot(window, +1);
 		break; case KeyMetaP: scrollHot(window, -1);
nce.1?h=3.0&id=da8d4e0d70258e11815fafde5e1ef6794f53bd11&follow=1'>Stop referring to server-time as IRCv3.2June McEnroe IRCv3 has moved away from grouping specs together into versions like this. SASL is still referred to as IRCv3.2 because there are two different versions of that spec. 2021-06-17Add mailing list archive to READMEJune McEnroe 2021-06-10Stop accumulating ISUPPORT tokens once MOTD startsJune McEnroe This avoids duplicating tokens when a client sends VERSION and the server responds with its 005s again. 2021-06-09Use seprintf for snip, removing strlcpynJune McEnroe 2021-06-09Use seprintf for reserializeJune McEnroe 2021-06-09Use seprintf for capListJune McEnroe 2021-06-09Add seprintfJune McEnroe Based on seprint(2) from Plan 9. I'm not sure if my return value exactly matches Plan 9's in the case of truncation. seprint(2) is described only as returning a pointer to the terminating '\0', but if it does so even in the case of truncation, it is awkward for the caller to detect. This implementation returns end in the truncation case, so that (ptr == end) indicates truncation. 2021-05-27Add pounce-notify to README 2.4June McEnroe 2021-05-27Fix ENVIRONMENT formatting in pounce-notify(1)June McEnroe 2021-05-27Add note about Libera.Chat SASL-only rangesJune McEnroe 2021-05-25Add QUIRKS fileJune McEnroe 2021-05-19Replace freenode with tilde.chatJune McEnroe 2021-05-04notify: Reword pounce-notify manualJune McEnroe 2021-05-02Clean up Makefiles, configure scriptsJune McEnroe Default MANDIR to ${PREFIX}/man since it turns out man-db includes /usr/local/man by default. Add support for BINDIR. Separate libs out into LDADD variables. 2021-04-30palaver: Exit on getopt failureJune McEnroe Oops. 2021-04-30notify: Implement pounce-notifyJune McEnroe