Factor out unmark

master
C. McEnroe 2020-02-04 04:09:54 -05:00
parent 43845c6115
commit d57e786876
1 changed files with 11 additions and 7 deletions

18
ui.c
View File

@ -362,16 +362,20 @@ static void statusUpdate(void) {
putp(from_status_line); putp(from_status_line);
} }
static void unmark(void) {
windows.active->heat = Cold;
windows.active->unread = 0;
windows.active->mark = false;
statusUpdate();
}
void uiShowID(size_t id) { void uiShowID(size_t id) {
windows.active->mark = true;
struct Window *window = windowFor(id); struct Window *window = windowFor(id);
window->heat = Cold; touchwin(window->pad);
window->unread = 0;
window->mark = false;
windows.other = windows.active; windows.other = windows.active;
windows.active = window; windows.active = window;
touchwin(window->pad); windows.other->mark = true;
statusUpdate(); unmark();
} }
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) {
@ -403,7 +407,7 @@ void uiFormat(
static void keyCode(int code) { static void keyCode(int code) {
switch (code) { switch (code) {
break; case KEY_RESIZE:; // TODO break; case KEY_RESIZE:; // TODO
break; case KeyFocusIn:; // TODO break; case KeyFocusIn: unmark();
break; case KeyFocusOut: windows.active->mark = true; break; case KeyFocusOut: windows.active->mark = true;
break; case KeyPasteOn:; // TODO break; case KeyPasteOn:; // TODO
break; case KeyPasteOff:; // TODO break; case KeyPasteOff:; // TODO