From f559322224cc3bfa6c1d37631fb6dc5fa93449b9 Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Fri, 28 May 2021 20:38:43 -0400 Subject: List windows with /window Reuse the /window command to preserve /wi abbreviation. --- catgirl.1 | 4 +++- chat.h | 1 + command.c | 5 +++-- ui.c | 10 ++++++++++ 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/catgirl.1 b/catgirl.1 index 8ae7313..23615af 100644 --- a/catgirl.1 +++ b/catgirl.1 @@ -1,4 +1,4 @@ -.Dd May 27, 2021 +.Dd May 28, 2021 .Dt CATGIRL 1 .Os . @@ -517,6 +517,8 @@ or matching Temporarily remove a message highlight pattern. .It Ic /unignore Ar pattern Temporarily remove a message ignore pattern. +.It Ic /window +List all windows. .It Ic /window Ar name Switch to window by name. .It Ic /window Ar num | Ic / Ns Ar num diff --git a/chat.h b/chat.h index 44ec9b8..e48799c 100644 --- a/chat.h +++ b/chat.h @@ -302,6 +302,7 @@ void uiInitLate(void); void uiShow(void); void uiHide(void); void uiDraw(void); +void uiWindows(void); void uiShowID(uint id); void uiShowNum(uint num); void uiMoveID(uint id, uint num); diff --git a/command.c b/command.c index ef82d30..4c290fc 100644 --- a/command.c +++ b/command.c @@ -373,8 +373,9 @@ static void commandQuery(uint id, char *params) { } static void commandWindow(uint id, char *params) { - if (!params) return; - if (isdigit(params[0])) { + if (!params) { + uiWindows(); + } else if (isdigit(params[0])) { uiShowNum(strtoul(params, NULL, 10)); } else { id = idFind(params); diff --git a/ui.c b/ui.c index add6eb3..6449e27 100644 --- a/ui.c +++ b/ui.c @@ -797,6 +797,16 @@ static void inputUpdate(void) { wmove(input, y, x); } +void uiWindows(void) { + for (uint num = 0; num < windows.len; ++num) { + const struct Window *window = windows.ptrs[num]; + uiFormat( + Network, Warm, NULL, "\3%02d%u %s", + idColors[window->id], num, idNames[window->id] + ); + } +} + static void windowShow(uint num) { if (num != windows.show) { windows.swap = windows.show; -- cgit 1.4.1 a564fb7792b62426edfa79&follow=1'>Add link to photosJune McEnroe 2024-04-14Remove redundant headings from feedJune McEnroe 2024-04-14Add atom feed generationJune McEnroe 2024-04-14Add descriptions for 2024-04-14June McEnroe 2024-04-14Add descriptions for 2024-04-10June McEnroe 2024-04-14Add meta viewport, some padding for the anchorsJune McEnroe