summary refs log tree commit diff
path: root/ui.c
diff options
context:
space:
mode:
authorC. McEnroe2020-02-09 08:14:22 -0500
committerC. McEnroe2020-02-09 08:14:22 -0500
commit16316679a136bae76c73e328858eceb7fffae72c (patch)
tree81cd72e69145360c3d04a242cdbd3bd3f5ee882b /ui.c
parent26eefa35c90760536a2045a5d097e7670613c4b0 (diff)
Add M-a
Diffstat (limited to 'ui.c')
-rw-r--r--ui.c25
1 files changed, 25 insertions, 0 deletions
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);