Add uint typedef
parent
9d7e0726c2
commit
14c60a15bc
1
chat.h
1
chat.h
|
@ -30,6 +30,7 @@
|
||||||
#define err(...) do { uiHide(); err(__VA_ARGS__); } while (0)
|
#define err(...) do { uiHide(); err(__VA_ARGS__); } while (0)
|
||||||
#define errx(...) do { uiHide(); errx(__VA_ARGS__); } while (0)
|
#define errx(...) do { uiHide(); errx(__VA_ARGS__); } while (0)
|
||||||
|
|
||||||
|
typedef unsigned uint;
|
||||||
typedef unsigned char byte;
|
typedef unsigned char byte;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
|
|
2
term.c
2
term.c
|
@ -51,7 +51,7 @@ void termMode(enum TermMode mode, bool set) {
|
||||||
enum { Esc = '\33' };
|
enum { Esc = '\33' };
|
||||||
|
|
||||||
enum TermEvent termEvent(char ch) {
|
enum TermEvent termEvent(char ch) {
|
||||||
static int state = 0;
|
static uint state = 0;
|
||||||
switch (T(state, ch)) {
|
switch (T(state, ch)) {
|
||||||
case T(0, Esc): state = 1; return 0;
|
case T(0, Esc): state = 1; return 0;
|
||||||
case T(1, '['): state = 2; return 0;
|
case T(1, '['): state = 2; return 0;
|
||||||
|
|
9
ui.c
9
ui.c
|
@ -68,8 +68,9 @@ static short pair8(short pair) {
|
||||||
struct View {
|
struct View {
|
||||||
struct Tag tag;
|
struct Tag tag;
|
||||||
WINDOW *log;
|
WINDOW *log;
|
||||||
int scroll, unread;
|
int scroll;
|
||||||
bool hot, mark;
|
bool hot, mark;
|
||||||
|
uint unread;
|
||||||
struct View *prev;
|
struct View *prev;
|
||||||
struct View *next;
|
struct View *next;
|
||||||
};
|
};
|
||||||
|
@ -227,7 +228,7 @@ static void uiTitle(const struct View *view) {
|
||||||
int unread;
|
int unread;
|
||||||
char *str;
|
char *str;
|
||||||
int len = asprintf(
|
int len = asprintf(
|
||||||
&str, "%s%n (%d)", view->tag.name, &unread, view->unread
|
&str, "%s%n (%u)", view->tag.name, &unread, view->unread
|
||||||
);
|
);
|
||||||
if (len < 0) err(EX_OSERR, "asprintf");
|
if (len < 0) err(EX_OSERR, "asprintf");
|
||||||
if (!view->unread) str[unread] = '\0';
|
if (!view->unread) str[unread] = '\0';
|
||||||
|
@ -244,7 +245,7 @@ static void uiStatus(void) {
|
||||||
int unread;
|
int unread;
|
||||||
wchar_t *str;
|
wchar_t *str;
|
||||||
int len = aswprintf(
|
int len = aswprintf(
|
||||||
&str, L"%c %d %s %n(\3%02d%d\3) ",
|
&str, L"%c %d %s %n(\3%02d%u\3) ",
|
||||||
(view == ui.view ? IRCReverse : IRCReset),
|
(view == ui.view ? IRCReverse : IRCReset),
|
||||||
num, view->tag.name,
|
num, view->tag.name,
|
||||||
&unread, (view->hot ? IRCYellow : IRCDefault), view->unread
|
&unread, (view->hot ? IRCYellow : IRCDefault), view->unread
|
||||||
|
@ -274,7 +275,7 @@ static void viewRemove(struct View *view) {
|
||||||
views.tags[view->tag.id] = NULL;
|
views.tags[view->tag.id] = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const int LogLines = 256;
|
static const int LogLines = 512;
|
||||||
|
|
||||||
static struct View *viewTag(struct Tag tag) {
|
static struct View *viewTag(struct Tag tag) {
|
||||||
struct View *view = views.tags[tag.id];
|
struct View *view = views.tags[tag.id];
|
||||||
|
|
Loading…
Reference in New Issue