List windows with /window

Reuse the /window command to preserve /wi abbreviation.
weechat-hashes
C. McEnroe 2021-05-28 20:38:43 -04:00
parent 1deee3c81b
commit f559322224
4 changed files with 17 additions and 3 deletions

View File

@ -1,4 +1,4 @@
.Dd May 27, 2021 .Dd May 28, 2021
.Dt CATGIRL 1 .Dt CATGIRL 1
.Os .Os
. .
@ -517,6 +517,8 @@ or matching
Temporarily remove a message highlight pattern. Temporarily remove a message highlight pattern.
.It Ic /unignore Ar pattern .It Ic /unignore Ar pattern
Temporarily remove a message ignore pattern. Temporarily remove a message ignore pattern.
.It Ic /window
List all windows.
.It Ic /window Ar name .It Ic /window Ar name
Switch to window by name. Switch to window by name.
.It Ic /window Ar num | Ic / Ns Ar num .It Ic /window Ar num | Ic / Ns Ar num

1
chat.h
View File

@ -302,6 +302,7 @@ void uiInitLate(void);
void uiShow(void); void uiShow(void);
void uiHide(void); void uiHide(void);
void uiDraw(void); void uiDraw(void);
void uiWindows(void);
void uiShowID(uint id); void uiShowID(uint id);
void uiShowNum(uint num); void uiShowNum(uint num);
void uiMoveID(uint id, uint num); void uiMoveID(uint id, uint num);

View File

@ -373,8 +373,9 @@ static void commandQuery(uint id, char *params) {
} }
static void commandWindow(uint id, char *params) { static void commandWindow(uint id, char *params) {
if (!params) return; if (!params) {
if (isdigit(params[0])) { uiWindows();
} else if (isdigit(params[0])) {
uiShowNum(strtoul(params, NULL, 10)); uiShowNum(strtoul(params, NULL, 10));
} else { } else {
id = idFind(params); id = idFind(params);

10
ui.c
View File

@ -797,6 +797,16 @@ static void inputUpdate(void) {
wmove(input, y, x); 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) { static void windowShow(uint num) {
if (num != windows.show) { if (num != windows.show) {
windows.swap = windows.show; windows.swap = windows.show;