summary refs log tree commit diff
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);
2-25Add M-a to switch to hot or unread windowJune McEnroe 2019-02-25Refactor uiReadJune McEnroe 2019-02-24Scroll by full pages with PageUp/PageDownJune McEnroe 2019-02-23Clarify /window documentationJune McEnroe 2019-02-23Use first word of params in input commandsJune McEnroe 2019-02-23Add C-n and C-p key bindings to switch windowsJune McEnroe 2019-02-23Change example command to join #ascii.town on freenodeJune McEnroe 2019-02-23Call def_prog_mode after termNoFlowJune McEnroe 2019-02-22Move IRC formatting reset to C-sJune McEnroe 2019-02-22Disable terminal flow controlJune McEnroe 2019-02-22Bind up and down arrows to scrollJune McEnroe 2019-02-22Remove topic TODOJune McEnroe 2019-02-22Add /znc commandJune McEnroe 2019-02-22Update status line after scrolling and term eventsJune McEnroe 2019-02-22Reorganize input.cJune McEnroe 2019-02-22Fix name of <raw> window in man pageJune McEnroe 2019-02-22Rename global tags with angle bracketsJune McEnroe 2019-02-22Show status window while connectingJune McEnroe 2019-02-22Reorganize UI code for the umpteenth timeJune McEnroe 2019-02-21Replace "view" with "window"June McEnroe 2019-02-21Remove ROT13June McEnroe 2019-02-21Clean up man pageJune McEnroe 2019-01-26Draw UI before connectingJune McEnroe 2019-01-25Avoid unused variable warnings with getyxJune McEnroe 2019-01-25Add GNU/Linux build instructionsJune McEnroe