Show input in italics for actions and set Debug prompt

master
C. McEnroe 2020-02-06 19:05:51 -05:00
parent 34514cf2ee
commit 9cff026b5a
1 changed files with 33 additions and 25 deletions

58
ui.c
View File

@ -474,36 +474,44 @@ static void inputAdd(struct Style *style, const char *str) {
} }
static void inputUpdate(void) { static void inputUpdate(void) {
wmove(input, 0, 0); size_t id = windows.active->id;
wattr_set( const char *nick = self.nick;
input,
colorAttr(mapColor(self.color)),
colorPair(mapColor(self.color), -1),
NULL
);
const char *head = editHead(); const char *head = editHead();
const char *skip = NULL; const char *skip = NULL;
if (self.nick) { const char *pre = "";
size_t id = windows.active->id; const char *suf = " ";
if (NULL != (skip = commandIsPrivmsg(id, head))) { struct Style style = { .fg = self.color, .bg = Default };
waddch(input, '<'); if (NULL != (skip = commandIsPrivmsg(id, head))) {
waddstr(input, self.nick); pre = "<";
waddstr(input, "> "); suf = "> ";
} else if (NULL != (skip = commandIsNotice(id, head))) { } else if (NULL != (skip = commandIsNotice(id, head))) {
waddch(input, '-'); pre = "-";
waddstr(input, self.nick); suf = "- ";
waddstr(input, "- "); } else if (NULL != (skip = commandIsAction(id, head))) {
} else if (NULL != (skip = commandIsAction(id, head))) { style.attr |= A_ITALIC;
waddstr(input, "* "); pre = "* ";
waddstr(input, self.nick); } else if (id == Debug) {
waddch(input, ' '); skip = head;
} style.fg = Gray;
pre = "<<";
nick = NULL;
} }
if (skip) head = skip;
int y, x; int y, x;
struct Style style = Reset; wmove(input, 0, 0);
inputAdd(&style, head); if (skip) {
wattr_set(
input,
style.attr | colorAttr(mapColor(style.fg)),
colorPair(mapColor(style.fg), mapColor(style.bg)),
NULL
);
waddstr(input, pre);
if (nick) waddstr(input, nick);
waddstr(input, suf);
}
style.fg = Default;
inputAdd(&style, (skip ? skip : head));
getyx(input, y, x); getyx(input, y, x);
inputAdd(&style, editTail()); inputAdd(&style, editTail());
wclrtoeol(input); wclrtoeol(input);