summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--catgirl.12
-rw-r--r--ui.c25
2 files changed, 27 insertions, 0 deletions
diff --git a/catgirl.1 b/catgirl.1
index 5648c92..e5d17b4 100644
--- a/catgirl.1
+++ b/catgirl.1
@@ -246,6 +246,8 @@ Redraw the UI.
 Switch to next window.
 .It Ic C-p
 Switch to previous window.
+.It Ic M-a
+Cycle through unread windows.
 .It Ic M-m
 Insert a blank line in the window.
 .It Ic M- Ns Ar n
diff --git a/ui.c b/ui.c
index 8d0f0f7..ace7c1e 100644
--- a/ui.c
+++ b/ui.c
@@ -194,6 +194,7 @@ static void errExit(void) {
 	X(KeyMeta7, "\0337") \
 	X(KeyMeta8, "\0338") \
 	X(KeyMeta9, "\0339") \
+	X(KeyMetaA, "\33a") \
 	X(KeyMetaB, "\33b") \
 	X(KeyMetaD, "\33d") \
 	X(KeyMetaF, "\33f") \
@@ -619,6 +620,29 @@ void uiCloseNum(size_t num) {
 	windowClose(window);
 }
 
+static void showAuto(void) {
+	static bool origin;
+	if (!origin) {
+		windows.other = windows.active;
+		origin = true;
+	}
+	struct Window *other = windows.other;
+	for (struct Window *window = windows.head; window; window = window->next) {
+		if (window->heat < Hot) continue;
+		windowShow(window);
+		windows.other = other;
+		return;
+	}
+	for (struct Window *window = windows.head; window; window = window->next) {
+		if (window->heat < Warm) continue;
+		windowShow(window);
+		windows.other = other;
+		return;
+	}
+	windowShow(windows.other);
+	origin = false;
+}
+
 static void keyCode(int code) {
 	size_t id = windows.active->id;
 	switch (code) {
@@ -628,6 +652,7 @@ static void keyCode(int code) {
 		break; case KeyPasteOn:; // TODO
 		break; case KeyPasteOff:; // TODO
 
+		break; case KeyMetaA: showAuto();
 		break; case KeyMetaB: edit(id, EditPrevWord, 0);
 		break; case KeyMetaD: edit(id, EditDeleteNextWord, 0);
 		break; case KeyMetaF: edit(id, EditNextWord, 0);
td>June McEnroe 2018-08-07Convert input to multibyte before handlingJune McEnroe 2018-08-07Populate tab-complete listJune McEnroe 2018-08-07Fix /me formatting side-effectsJune McEnroe 2018-08-07Define ui.c BUF_LEN with enumJune McEnroe 2018-08-07Hack clang into checking uiFmt format stringsJune McEnroe 2018-08-07Handle PART and QUIT without messagesJune McEnroe 2018-08-07Make safe filling the who bufferJune McEnroe 2018-08-07Add reverse and reset IRC formatting codesJune McEnroe 2018-08-06Rewrite line editing again, add formattingJune McEnroe 2018-08-06Fix allocation size in vaswprintfJune McEnroe 2018-08-06Implement word wrappingJune McEnroe 2018-08-06Use wchar_t strings for all of UIJune McEnroe 2018-08-06Rename line editing functionsJune McEnroe 2018-08-05Initialize all possible color pairsJune McEnroe 2018-08-05Refactor color initializationJune McEnroe 2018-08-05Add ^L redrawJune McEnroe 2018-08-05Use 16 colors if availableJune McEnroe 2018-08-05Limit parsed colors to number of mIRC colorsJune McEnroe 2018-08-04Show source link on exitJune McEnroe 2018-08-04Implement line editing, scrollingJune McEnroe 2018-08-04Handle /topicJune McEnroe