summary refs log tree commit diff
path: root/ui.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--ui.c39
1 files changed, 31 insertions, 8 deletions
diff --git a/ui.c b/ui.c
index 643d627..1273028 100644
--- a/ui.c
+++ b/ui.c
@@ -76,6 +76,15 @@ static void windowAppend(struct Window *win) {
 	windows.tag[win->tag.id] = win;
 }
 
+static void windowInsert(struct Window *win, struct Window *next) {
+	win->prev = next->prev;
+	win->next = next;
+	if (win->prev) win->prev->next = win;
+	win->next->prev = win;
+	if (!win->prev) windows.head = win;
+	windows.tag[win->tag.id] = win;
+}
+
 static void windowRemove(struct Window *win) {
 	windows.tag[win->tag.id] = NULL;
 	if (win->prev) win->prev->next = win->next;
@@ -365,6 +374,17 @@ void uiShowTag(struct Tag tag) {
 	uiShowWindow(windowFor(tag));
 }
 
+static void uiShowAuto(void) {
+	struct Window *unread = NULL;
+	struct Window *hot;
+	for (hot = windows.head; hot; hot = hot->next) {
+		if (hot->hot) break;
+		if (!unread && hot->unread) unread = hot;
+	}
+	if (!hot && !unread) return;
+	uiShowWindow(hot ? hot : unread);
+}
+
 void uiShowNum(int num, bool relative) {
 	struct Window *win = (relative ? windows.active : windows.head);
 	if (num < 0) {
@@ -375,15 +395,18 @@ void uiShowNum(int num, bool relative) {
 	if (win) uiShowWindow(win);
 }
 
-static void uiShowAuto(void) {
-	struct Window *unread = NULL;
-	struct Window *hot;
-	for (hot = windows.head; hot; hot = hot->next) {
-		if (hot->hot) break;
-		if (!unread && hot->unread) unread = hot;
+void uiMoveTag(struct Tag tag, int num, bool relative) {
+	struct Window *win = windowFor(tag);
+	windowRemove(win);
+	struct Window *ins = (relative ? win : windows.head);
+	if (num < 0) {
+		for (; ins; ins = ins->prev) if (!num++) break;
+	} else {
+		if (relative) ins = ins->next;
+		for (; ins; ins = ins->next) if (!num--) break;
 	}
-	if (!hot && !unread) return;
-	uiShowWindow(hot ? hot : unread);
+	ins ? windowInsert(win, ins) : windowAppend(win);
+	uiStatus();
 }
 
 void uiCloseTag(struct Tag tag) {
d/> 2021-10-14Import LibreSSL 3.4.1June McEnroe 2021-09-17Import LibreSSL 3.4.0June McEnroe 2021-08-24Import LibreSSL 3.3.4June McEnroe 2021-05-25Bump version to 3.3.3p1 3.3.3p1June McEnroe 2021-05-25build: Add scripts to EXTRA_DISTJune McEnroe 2021-05-25import: Add missing scripts/wrap-compiler-for-flag-checkJune McEnroe 2021-05-08Import LibreSSL 3.3.3June McEnroe 2021-04-18build: Remove added x509_verify.3 links 3.3.2June McEnroe 2021-04-18tls: Use EC_KEY_set_ex_dataJune McEnroe 2021-04-18Import LibreSSL 3.3.2June McEnroe 2021-03-05Bump version to 3.3.1p1 3.3.1p1June McEnroe 2021-03-05build: Add OpenSSL includes to libcompatJune McEnroe Some compat sources (getentropy_linux.c for example) require OpenSSL. Reported by Robert Scheck. 2020-12-15Import LibreSSL 3.3.1June McEnroe 2020-11-24Import LibreSSL 3.3.0June McEnroe 2020-10-22Import LibreSSL 3.2.2June McEnroe 2020-09-29Import LibreSSL 3.2.1June McEnroe 2020-09-29import: Add m4/ax_add_fortify_source.m4June McEnroe 2020-08-05build: Add README.7 to EXTRA_DIST 3.2.0June McEnroe 2020-08-03doc: Indicate that only OpenSSL 1.1.1b and newer workJune McEnroe