summary refs log tree commit diff
path: root/ui.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--ui.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/ui.c b/ui.c
index 6d1338b..c738617 100644
--- a/ui.c
+++ b/ui.c
@@ -573,6 +573,34 @@ void uiShowNum(size_t num) {
 	windowShow(window);
 }
 
+static void windowClose(struct Window *window) {
+	if (window->id == Network) return;
+	if (windows.active == window) {
+		windowShow(window->prev ? window->prev : window->next);
+	}
+	if (windows.other == window) windows.other = NULL;
+	windowRemove(window);
+	for (size_t i = 0; i < BufferCap; ++i) {
+		free(window->buffer.lines[i]);
+	}
+	delwin(window->pad);
+	free(window);
+	statusUpdate();
+}
+
+void uiCloseID(size_t id) {
+	windowClose(windowFor(id));
+}
+
+void uiCloseNum(size_t num) {
+	struct Window *window = windows.head;
+	for (size_t i = 0; i < num; ++i) {
+		window = window->next;
+		if (!window) return;
+	}
+	windowClose(window);
+}
+
 static void keyCode(int code) {
 	size_t id = windows.active->id;
 	switch (code) {
6c&follow=1'>Rename query ID on nick changeJune McEnroe 2020-02-11Call completeClear when closing a windowJune McEnroe 2020-02-11Don't insert color codes for non-mentionsJune McEnroe 2020-02-11Take first two words in colorMentionsJune McEnroe 2020-02-11Use time_t for save signatureJune McEnroe 2020-02-11Set self.nick to * initiallyJune McEnroe 2020-02-11Define ColorCap instead of hardcoding 100June McEnroe 2020-02-11Move hash to top of chat.hJune McEnroe 2020-02-11Move base64 out of chat.hJune McEnroe 2020-02-11Move XDG_SUBDIR out of chat.hJune McEnroe 2020-02-11Fix whois idle unit calculationJune McEnroe 2020-02-11Cast towupper to wchar_tJune McEnroe 2020-02-11Cast set but unused variables to voidJune McEnroe 2020-02-11Declare strlcatJune McEnroe 2020-02-11Check if VDSUSP existsJune McEnroe 2020-02-11Fix completeReplace iterationJune McEnroe 2020-02-11Use pkg(8) to configure on FreeBSDJune McEnroe 2020-02-11Remove legacy codeJune McEnroe 2020-02-11Add INSTALLING section to READMEJune McEnroe