Switch windows with M-0 through M-9

master
C. McEnroe 2020-02-04 04:41:11 -05:00
parent d57e786876
commit a65841c3cb
1 changed files with 17 additions and 2 deletions

19
ui.c
View File

@ -369,8 +369,7 @@ static void unmark(void) {
statusUpdate(); statusUpdate();
} }
void uiShowID(size_t id) { static void windowShow(struct Window *window) {
struct Window *window = windowFor(id);
touchwin(window->pad); touchwin(window->pad);
windows.other = windows.active; windows.other = windows.active;
windows.active = window; windows.active = window;
@ -378,6 +377,19 @@ void uiShowID(size_t id) {
unmark(); unmark();
} }
void uiShowID(size_t id) {
windowShow(windowFor(id));
}
void uiShowNum(size_t num) {
struct Window *window = windows.head;
for (size_t i = 0; i < num; ++i) {
window = window->next;
if (!window) return;
}
windowShow(window);
}
void uiWrite(size_t id, enum Heat heat, const time_t *time, const char *str) { void uiWrite(size_t id, enum Heat heat, const time_t *time, const char *str) {
(void)time; (void)time;
struct Window *window = windowFor(id); struct Window *window = windowFor(id);
@ -417,6 +429,9 @@ static void keyCode(int code) {
static void keyMeta(wchar_t ch) { static void keyMeta(wchar_t ch) {
switch (ch) { switch (ch) {
break; case L'm': uiWrite(windows.active->id, Cold, NULL, ""); break; case L'm': uiWrite(windows.active->id, Cold, NULL, "");
break; default: {
if (ch >= L'0' && ch <= L'9') uiShowNum(ch - L'0');
}
} }
} }