Call inputUpdate when switching windows

Because changing windows (to <network> or <debug>) will affect the
prompt.
master
C. McEnroe 2020-02-04 20:46:16 -05:00
parent de4c9df074
commit 55757243f4
1 changed files with 23 additions and 21 deletions

44
ui.c
View File

@ -325,27 +325,6 @@ static void unmark(void) {
statusUpdate(); statusUpdate();
} }
static void windowShow(struct Window *window) {
touchwin(window->pad);
windows.other = windows.active;
windows.active = window;
windows.other->mark = true;
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);
}
static int wordWidth(const char *str) { static int wordWidth(const char *str) {
size_t len = strcspn(str, " "); size_t len = strcspn(str, " ");
int width = 0; int width = 0;
@ -462,6 +441,7 @@ static void inputUpdate(void) {
NULL NULL
); );
if (self.nick) { if (self.nick) {
// TODO: Check if input is command or action.
waddch(input, '<'); waddch(input, '<');
waddstr(input, self.nick); waddstr(input, self.nick);
waddstr(input, "> "); waddstr(input, "> ");
@ -476,6 +456,28 @@ static void inputUpdate(void) {
wmove(input, y, x); wmove(input, y, x);
} }
static void windowShow(struct Window *window) {
touchwin(window->pad);
windows.other = windows.active;
windows.active = window;
windows.other->mark = true;
inputUpdate();
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);
}
static void keyCode(int code) { static void keyCode(int code) {
switch (code) { switch (code) {
break; case KEY_RESIZE:; // TODO break; case KEY_RESIZE:; // TODO