Replace "view" with "window"
I think originally I didn't want to use the same word as curses WINDOW but it's really much clearer for the user if they're just called windows. UI code probably needs yet another rewrite though. Still feels messy.weechat-hashes
parent
c0c59d093f
commit
f3db938ded
4
chat.h
4
chat.h
|
@ -121,8 +121,8 @@ void uiDraw(void);
|
||||||
void uiRead(void);
|
void uiRead(void);
|
||||||
void uiPrompt(void);
|
void uiPrompt(void);
|
||||||
|
|
||||||
void uiViewTag(struct Tag tag);
|
void uiWindowTag(struct Tag tag);
|
||||||
void uiViewNum(int num);
|
void uiWindowNum(int num);
|
||||||
void uiCloseTag(struct Tag tag);
|
void uiCloseTag(struct Tag tag);
|
||||||
|
|
||||||
enum UIHeat {
|
enum UIHeat {
|
||||||
|
|
2
handle.c
2
handle.c
|
@ -219,7 +219,7 @@ static void handleJoin(char *prefix, char *params) {
|
||||||
|
|
||||||
if (!strcmp(nick, self.nick)) {
|
if (!strcmp(nick, self.nick)) {
|
||||||
tabTouch(TagNone, chan);
|
tabTouch(TagNone, chan);
|
||||||
uiViewTag(tag);
|
uiWindowTag(tag);
|
||||||
logReplay(tag);
|
logReplay(tag);
|
||||||
}
|
}
|
||||||
tabTouch(tag, nick);
|
tabTouch(tag, nick);
|
||||||
|
|
26
input.c
26
input.c
|
@ -54,7 +54,7 @@ static void inputRaw(struct Tag tag, char *params) {
|
||||||
if (!params || !self.raw) {
|
if (!params || !self.raw) {
|
||||||
self.raw ^= true;
|
self.raw ^= true;
|
||||||
uiFmt(
|
uiFmt(
|
||||||
TagRaw, UIWarm, "Raw view is %s",
|
TagRaw, UIWarm, "Raw window is %s",
|
||||||
self.raw ? "enabled" : "disabled"
|
self.raw ? "enabled" : "disabled"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -92,7 +92,7 @@ static void inputQuery(struct Tag tag, char *params) {
|
||||||
char *nick = param(tag, "/query", ¶ms, "nick");
|
char *nick = param(tag, "/query", ¶ms, "nick");
|
||||||
if (!nick) return;
|
if (!nick) return;
|
||||||
tabTouch(TagNone, nick);
|
tabTouch(TagNone, nick);
|
||||||
uiViewTag(tagFor(nick));
|
uiWindowTag(tagFor(nick));
|
||||||
logReplay(tagFor(nick));
|
logReplay(tagFor(nick));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,19 +139,19 @@ static void inputOpen(struct Tag tag, char *params) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void inputView(struct Tag tag, char *params) {
|
static void inputWindow(struct Tag tag, char *params) {
|
||||||
(void)tag;
|
(void)tag;
|
||||||
char *view = param(tag, "/view", ¶ms, "name or number");
|
char *name = param(tag, "/window", ¶ms, "name or number");
|
||||||
if (!view) return;
|
if (!name) return;
|
||||||
int num = strtol(view, &view, 0);
|
int num = strtol(name, &name, 0);
|
||||||
if (!view[0]) {
|
if (!name[0]) {
|
||||||
uiViewNum(num);
|
uiWindowNum(num);
|
||||||
} else {
|
} else {
|
||||||
struct Tag tag = tagFind(view);
|
struct Tag tag = tagFind(name);
|
||||||
if (tag.id != TagNone.id) {
|
if (tag.id != TagNone.id) {
|
||||||
uiViewTag(tag);
|
uiWindowTag(tag);
|
||||||
} else {
|
} else {
|
||||||
uiFmt(tag, UIHot, "No view for %s", view);
|
uiFmt(tag, UIHot, "No window for %s", name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -186,9 +186,9 @@ static const struct {
|
||||||
{ "/raw", inputRaw },
|
{ "/raw", inputRaw },
|
||||||
{ "/topic", inputTopic },
|
{ "/topic", inputTopic },
|
||||||
{ "/url", inputURL },
|
{ "/url", inputURL },
|
||||||
{ "/view", inputView },
|
|
||||||
{ "/who", inputWho },
|
{ "/who", inputWho },
|
||||||
{ "/whois", inputWhois },
|
{ "/whois", inputWhois },
|
||||||
|
{ "/window", inputWindow },
|
||||||
};
|
};
|
||||||
static const size_t CommandsLen = sizeof(Commands) / sizeof(Commands[0]);
|
static const size_t CommandsLen = sizeof(Commands) / sizeof(Commands[0]);
|
||||||
|
|
||||||
|
@ -215,7 +215,7 @@ void input(struct Tag tag, char *input) {
|
||||||
char *trail;
|
char *trail;
|
||||||
strtol(&word[1], &trail, 0);
|
strtol(&word[1], &trail, 0);
|
||||||
if (!trail[0]) {
|
if (!trail[0]) {
|
||||||
inputView(tag, &word[1]);
|
inputWindow(tag, &word[1]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
257
ui.c
257
ui.c
|
@ -65,21 +65,21 @@ static short pair8(short pair) {
|
||||||
return (pair & 0x70) >> 1 | (pair & 0x07);
|
return (pair & 0x70) >> 1 | (pair & 0x07);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct View {
|
struct Window {
|
||||||
struct Tag tag;
|
struct Tag tag;
|
||||||
WINDOW *log;
|
WINDOW *log;
|
||||||
int scroll;
|
int scroll;
|
||||||
bool hot, mark;
|
bool hot, mark;
|
||||||
uint unread;
|
uint unread;
|
||||||
struct View *prev;
|
struct Window *prev;
|
||||||
struct View *next;
|
struct Window *next;
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct {
|
static struct {
|
||||||
bool hide;
|
bool hide;
|
||||||
WINDOW *status;
|
WINDOW *status;
|
||||||
WINDOW *input;
|
WINDOW *input;
|
||||||
struct View *view;
|
struct Window *window;
|
||||||
} ui;
|
} ui;
|
||||||
|
|
||||||
void uiShow(void) {
|
void uiShow(void) {
|
||||||
|
@ -108,7 +108,7 @@ void uiInit(void) {
|
||||||
keypad(ui.input, true);
|
keypad(ui.input, true);
|
||||||
nodelay(ui.input, true);
|
nodelay(ui.input, true);
|
||||||
|
|
||||||
uiViewTag(TagStatus);
|
uiWindowTag(TagStatus);
|
||||||
uiShow();
|
uiShow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,8 +136,8 @@ void uiDraw(void) {
|
||||||
if (ui.hide) return;
|
if (ui.hide) return;
|
||||||
wnoutrefresh(ui.status);
|
wnoutrefresh(ui.status);
|
||||||
pnoutrefresh(
|
pnoutrefresh(
|
||||||
ui.view->log,
|
ui.window->log,
|
||||||
ui.view->scroll - logHeight(), 0,
|
ui.window->scroll - logHeight(), 0,
|
||||||
1, 0,
|
1, 0,
|
||||||
lastLine() - 1, lastCol()
|
lastLine() - 1, lastCol()
|
||||||
);
|
);
|
||||||
|
@ -221,19 +221,19 @@ static int addWrap(WINDOW *win, const wchar_t *str) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct {
|
static struct {
|
||||||
struct View *head;
|
struct Window *head;
|
||||||
struct View *tail;
|
struct Window *tail;
|
||||||
struct View *tags[TagsLen];
|
struct Window *tag[TagsLen];
|
||||||
} views;
|
} windows;
|
||||||
|
|
||||||
static void uiTitle(const struct View *view) {
|
static void uiTitle(const struct Window *win) {
|
||||||
int unread;
|
int unread;
|
||||||
char *str;
|
char *str;
|
||||||
int len = asprintf(
|
int len = asprintf(
|
||||||
&str, "%s%n (%u)", view->tag.name, &unread, view->unread
|
&str, "%s%n (%u)", win->tag.name, &unread, win->unread
|
||||||
);
|
);
|
||||||
if (len < 0) err(EX_OSERR, "asprintf");
|
if (len < 0) err(EX_OSERR, "asprintf");
|
||||||
if (!view->unread) str[unread] = '\0';
|
if (!win->unread) str[unread] = '\0';
|
||||||
termTitle(str);
|
termTitle(str);
|
||||||
free(str);
|
free(str);
|
||||||
}
|
}
|
||||||
|
@ -241,127 +241,126 @@ static void uiTitle(const struct View *view) {
|
||||||
static void uiStatus(void) {
|
static void uiStatus(void) {
|
||||||
wmove(ui.status, 0, 0);
|
wmove(ui.status, 0, 0);
|
||||||
int num = 0;
|
int num = 0;
|
||||||
for (const struct View *view = views.head; view; view = view->next, ++num) {
|
for (const struct Window *win = windows.head; win; win = win->next, ++num) {
|
||||||
if (!view->unread && view != ui.view) continue;
|
if (!win->unread && ui.window != win) continue;
|
||||||
if (view == ui.view) uiTitle(view);
|
if (ui.window == win) uiTitle(win);
|
||||||
int unread;
|
int unread;
|
||||||
wchar_t *str;
|
wchar_t *str;
|
||||||
int len = aswprintf(
|
int len = aswprintf(
|
||||||
&str, L"%c %d %s %n(\3%02d%u\3) ",
|
&str, L"%c %d %s %n(\3%02d%u\3) ",
|
||||||
(view == ui.view ? IRCReverse : IRCReset),
|
(ui.window == win ? IRCReverse : IRCReset),
|
||||||
num, view->tag.name,
|
num, win->tag.name,
|
||||||
&unread, (view->hot ? IRCYellow : IRCDefault), view->unread
|
&unread, (win->hot ? IRCYellow : IRCDefault), win->unread
|
||||||
);
|
);
|
||||||
if (len < 0) err(EX_OSERR, "aswprintf");
|
if (len < 0) err(EX_OSERR, "aswprintf");
|
||||||
if (!view->unread) str[unread] = L'\0';
|
if (!win->unread) str[unread] = L'\0';
|
||||||
addWrap(ui.status, str);
|
addWrap(ui.status, str);
|
||||||
free(str);
|
free(str);
|
||||||
}
|
}
|
||||||
|
// TODO: Put window's topic in the rest of the status area.
|
||||||
wclrtoeol(ui.status);
|
wclrtoeol(ui.status);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void viewAppend(struct View *view) {
|
static void windowAppend(struct Window *win) {
|
||||||
if (views.tail) views.tail->next = view;
|
if (windows.tail) windows.tail->next = win;
|
||||||
view->prev = views.tail;
|
win->prev = windows.tail;
|
||||||
view->next = NULL;
|
win->next = NULL;
|
||||||
views.tail = view;
|
windows.tail = win;
|
||||||
if (!views.head) views.head = view;
|
if (!windows.head) windows.head = win;
|
||||||
views.tags[view->tag.id] = view;
|
windows.tag[win->tag.id] = win;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void viewRemove(struct View *view) {
|
static void windowRemove(struct Window *win) {
|
||||||
if (view->prev) view->prev->next = view->next;
|
if (win->prev) win->prev->next = win->next;
|
||||||
if (view->next) view->next->prev = view->prev;
|
if (win->next) win->next->prev = win->prev;
|
||||||
if (views.head == view) views.head = view->next;
|
if (windows.head == win) windows.head = win->next;
|
||||||
if (views.tail == view) views.tail = view->prev;
|
if (windows.tail == win) windows.tail = win->prev;
|
||||||
views.tags[view->tag.id] = NULL;
|
windows.tag[win->tag.id] = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const int LogLines = 512;
|
static const int LogLines = 512;
|
||||||
|
|
||||||
static struct View *viewTag(struct Tag tag) {
|
static struct Window *windowTag(struct Tag tag) {
|
||||||
struct View *view = views.tags[tag.id];
|
struct Window *win = windows.tag[tag.id];
|
||||||
if (view) return view;
|
if (win) return win;
|
||||||
|
|
||||||
view = calloc(1, sizeof(*view));
|
win = calloc(1, sizeof(*win));
|
||||||
if (!view) err(EX_OSERR, "calloc");
|
if (!win) err(EX_OSERR, "calloc");
|
||||||
|
|
||||||
view->tag = tag;
|
win->tag = tag;
|
||||||
|
win->mark = true;
|
||||||
|
win->scroll = LogLines;
|
||||||
|
win->log = newpad(LogLines, COLS);
|
||||||
|
wsetscrreg(win->log, 0, LogLines - 1);
|
||||||
|
scrollok(win->log, true);
|
||||||
|
wmove(win->log, LogLines - 1, 0);
|
||||||
|
|
||||||
view->log = newpad(LogLines, COLS);
|
windowAppend(win);
|
||||||
wsetscrreg(view->log, 0, LogLines - 1);
|
return win;
|
||||||
scrollok(view->log, true);
|
|
||||||
wmove(view->log, LogLines - 1, 0);
|
|
||||||
|
|
||||||
view->scroll = LogLines;
|
|
||||||
view->mark = true;
|
|
||||||
|
|
||||||
viewAppend(view);
|
|
||||||
return view;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void viewClose(struct View *view) {
|
static void windowClose(struct Window *win) {
|
||||||
viewRemove(view);
|
windowRemove(win);
|
||||||
delwin(view->log);
|
delwin(win->log);
|
||||||
free(view);
|
free(win);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void uiResize(void) {
|
static void uiResize(void) {
|
||||||
wresize(ui.status, 1, COLS);
|
wresize(ui.status, 1, COLS);
|
||||||
for (struct View *view = views.head; view; view = view->next) {
|
for (struct Window *win = windows.head; win; win = win->next) {
|
||||||
wresize(view->log, LogLines, COLS);
|
wresize(win->log, LogLines, COLS);
|
||||||
wmove(view->log, LogLines - 1, lastCol());
|
wmove(win->log, LogLines - 1, lastCol());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void viewUnmark(struct View *view) {
|
static void windowUnmark(struct Window *win) {
|
||||||
view->mark = false;
|
win->mark = false;
|
||||||
view->unread = 0;
|
win->unread = 0;
|
||||||
view->hot = false;
|
win->hot = false;
|
||||||
uiStatus();
|
uiStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void uiView(struct View *view) {
|
static void uiWindow(struct Window *win) {
|
||||||
touchwin(view->log);
|
touchwin(win->log);
|
||||||
if (ui.view) ui.view->mark = true;
|
if (ui.window) ui.window->mark = true;
|
||||||
viewUnmark(view);
|
windowUnmark(win);
|
||||||
ui.view = view;
|
ui.window = win;
|
||||||
uiStatus();
|
uiStatus();
|
||||||
uiPrompt();
|
uiPrompt();
|
||||||
}
|
}
|
||||||
|
|
||||||
void uiViewTag(struct Tag tag) {
|
void uiWindowTag(struct Tag tag) {
|
||||||
uiView(viewTag(tag));
|
uiWindow(windowTag(tag));
|
||||||
}
|
}
|
||||||
|
|
||||||
void uiViewNum(int num) {
|
void uiWindowNum(int num) {
|
||||||
if (num < 0) {
|
if (num < 0) {
|
||||||
for (struct View *view = views.tail; view; view = view->prev) {
|
for (struct Window *win = windows.tail; win; win = win->prev) {
|
||||||
if (++num) continue;
|
if (++num) continue;
|
||||||
uiView(view);
|
uiWindow(win);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (struct View *view = views.head; view; view = view->next) {
|
for (struct Window *win = windows.head; win; win = win->next) {
|
||||||
if (num--) continue;
|
if (num--) continue;
|
||||||
uiView(view);
|
uiWindow(win);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void uiCloseTag(struct Tag tag) {
|
void uiCloseTag(struct Tag tag) {
|
||||||
struct View *view = viewTag(tag);
|
struct Window *win = windowTag(tag);
|
||||||
if (ui.view == view) {
|
if (ui.window == win) {
|
||||||
if (view->next) {
|
if (win->next) {
|
||||||
uiView(view->next);
|
uiWindow(win->next);
|
||||||
} else if (view->prev) {
|
} else if (win->prev) {
|
||||||
uiView(view->prev);
|
uiWindow(win->prev);
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
viewClose(view);
|
windowClose(win);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void notify(struct Tag tag, const wchar_t *line) {
|
static void notify(struct Tag tag, const wchar_t *line) {
|
||||||
|
@ -387,24 +386,24 @@ static void notify(struct Tag tag, const wchar_t *line) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void uiLog(struct Tag tag, enum UIHeat heat, const wchar_t *line) {
|
void uiLog(struct Tag tag, enum UIHeat heat, const wchar_t *line) {
|
||||||
struct View *view = viewTag(tag);
|
struct Window *win = windowTag(tag);
|
||||||
int lines = 1;
|
int lines = 1;
|
||||||
waddch(view->log, '\n');
|
waddch(win->log, '\n');
|
||||||
|
|
||||||
if (view->mark && heat > UICold) {
|
if (win->mark && heat > UICold) {
|
||||||
if (!view->unread++) {
|
if (!win->unread++) {
|
||||||
lines++;
|
lines++;
|
||||||
waddch(view->log, '\n');
|
waddch(win->log, '\n');
|
||||||
}
|
}
|
||||||
if (heat > UIWarm) {
|
if (heat > UIWarm) {
|
||||||
view->hot = true;
|
win->hot = true;
|
||||||
notify(tag, line);
|
notify(tag, line);
|
||||||
}
|
}
|
||||||
uiStatus();
|
uiStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
lines += addWrap(view->log, line);
|
lines += addWrap(win->log, line);
|
||||||
if (view->scroll != LogLines) view->scroll -= lines;
|
if (win->scroll != LogLines) win->scroll -= lines;
|
||||||
}
|
}
|
||||||
|
|
||||||
void uiFmt(struct Tag tag, enum UIHeat heat, const wchar_t *format, ...) {
|
void uiFmt(struct Tag tag, enum UIHeat heat, const wchar_t *format, ...) {
|
||||||
|
@ -419,14 +418,14 @@ void uiFmt(struct Tag tag, enum UIHeat heat, const wchar_t *format, ...) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void scrollUp(int lines) {
|
static void scrollUp(int lines) {
|
||||||
if (ui.view->scroll == logHeight()) return;
|
if (ui.window->scroll == logHeight()) return;
|
||||||
if (ui.view->scroll == LogLines) ui.view->mark = true;
|
if (ui.window->scroll == LogLines) ui.window->mark = true;
|
||||||
ui.view->scroll = MAX(ui.view->scroll - lines, logHeight());
|
ui.window->scroll = MAX(ui.window->scroll - lines, logHeight());
|
||||||
}
|
}
|
||||||
static void scrollDown(int lines) {
|
static void scrollDown(int lines) {
|
||||||
if (ui.view->scroll == LogLines) return;
|
if (ui.window->scroll == LogLines) return;
|
||||||
ui.view->scroll = MIN(ui.view->scroll + lines, LogLines);
|
ui.window->scroll = MIN(ui.window->scroll + lines, LogLines);
|
||||||
if (ui.view->scroll == LogLines) viewUnmark(ui.view);
|
if (ui.window->scroll == LogLines) windowUnmark(ui.window);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void keyCode(wchar_t ch) {
|
static void keyCode(wchar_t ch) {
|
||||||
|
@ -436,13 +435,13 @@ static void keyCode(wchar_t ch) {
|
||||||
break; case KEY_SRIGHT: scrollDown(1);
|
break; case KEY_SRIGHT: scrollDown(1);
|
||||||
break; case KEY_PPAGE: scrollUp(logHeight() / 2);
|
break; case KEY_PPAGE: scrollUp(logHeight() / 2);
|
||||||
break; case KEY_NPAGE: scrollDown(logHeight() / 2);
|
break; case KEY_NPAGE: scrollDown(logHeight() / 2);
|
||||||
break; case KEY_LEFT: edit(ui.view->tag, EditLeft, 0);
|
break; case KEY_LEFT: edit(ui.window->tag, EditLeft, 0);
|
||||||
break; case KEY_RIGHT: edit(ui.view->tag, EditRight, 0);
|
break; case KEY_RIGHT: edit(ui.window->tag, EditRight, 0);
|
||||||
break; case KEY_HOME: edit(ui.view->tag, EditHome, 0);
|
break; case KEY_HOME: edit(ui.window->tag, EditHome, 0);
|
||||||
break; case KEY_END: edit(ui.view->tag, EditEnd, 0);
|
break; case KEY_END: edit(ui.window->tag, EditEnd, 0);
|
||||||
break; case KEY_DC: edit(ui.view->tag, EditDelete, 0);
|
break; case KEY_DC: edit(ui.window->tag, EditDelete, 0);
|
||||||
break; case KEY_BACKSPACE: edit(ui.view->tag, EditBackspace, 0);
|
break; case KEY_BACKSPACE: edit(ui.window->tag, EditBackspace, 0);
|
||||||
break; case KEY_ENTER: edit(ui.view->tag, EditEnter, 0);
|
break; case KEY_ENTER: edit(ui.window->tag, EditEnter, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -452,8 +451,8 @@ static void keyChar(wchar_t ch) {
|
||||||
if (ch < 0200) {
|
if (ch < 0200) {
|
||||||
enum TermEvent event = termEvent((char)ch);
|
enum TermEvent event = termEvent((char)ch);
|
||||||
switch (event) {
|
switch (event) {
|
||||||
break; case TermFocusIn: viewUnmark(ui.view);
|
break; case TermFocusIn: windowUnmark(ui.window);
|
||||||
break; case TermFocusOut: ui.view->mark = true;
|
break; case TermFocusOut: ui.window->mark = true;
|
||||||
break; default: {}
|
break; default: {}
|
||||||
}
|
}
|
||||||
if (event) return;
|
if (event) return;
|
||||||
|
@ -470,13 +469,13 @@ static void keyChar(wchar_t ch) {
|
||||||
if (meta) {
|
if (meta) {
|
||||||
meta = false;
|
meta = false;
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
break; case L'b': edit(ui.view->tag, EditBackWord, 0);
|
break; case L'b': edit(ui.window->tag, EditBackWord, 0);
|
||||||
break; case L'f': edit(ui.view->tag, EditForeWord, 0);
|
break; case L'f': edit(ui.window->tag, EditForeWord, 0);
|
||||||
break; case L'\b': edit(ui.view->tag, EditKillBackWord, 0);
|
break; case L'\b': edit(ui.window->tag, EditKillBackWord, 0);
|
||||||
break; case L'd': edit(ui.view->tag, EditKillForeWord, 0);
|
break; case L'd': edit(ui.window->tag, EditKillForeWord, 0);
|
||||||
break; case L'm': uiLog(ui.view->tag, UICold, L"");
|
break; case L'm': uiLog(ui.window->tag, UICold, L"");
|
||||||
break; default: {
|
break; default: {
|
||||||
if (ch >= L'0' && ch <= L'9') uiViewNum(ch - L'0');
|
if (ch >= L'0' && ch <= L'9') uiWindowNum(ch - L'0');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -485,28 +484,28 @@ static void keyChar(wchar_t ch) {
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
break; case CTRL(L'L'): clearok(curscr, true);
|
break; case CTRL(L'L'): clearok(curscr, true);
|
||||||
|
|
||||||
break; case CTRL(L'A'): edit(ui.view->tag, EditHome, 0);
|
break; case CTRL(L'A'): edit(ui.window->tag, EditHome, 0);
|
||||||
break; case CTRL(L'B'): edit(ui.view->tag, EditLeft, 0);
|
break; case CTRL(L'B'): edit(ui.window->tag, EditLeft, 0);
|
||||||
break; case CTRL(L'D'): edit(ui.view->tag, EditDelete, 0);
|
break; case CTRL(L'D'): edit(ui.window->tag, EditDelete, 0);
|
||||||
break; case CTRL(L'E'): edit(ui.view->tag, EditEnd, 0);
|
break; case CTRL(L'E'): edit(ui.window->tag, EditEnd, 0);
|
||||||
break; case CTRL(L'F'): edit(ui.view->tag, EditRight, 0);
|
break; case CTRL(L'F'): edit(ui.window->tag, EditRight, 0);
|
||||||
break; case CTRL(L'K'): edit(ui.view->tag, EditKillLine, 0);
|
break; case CTRL(L'K'): edit(ui.window->tag, EditKillLine, 0);
|
||||||
break; case CTRL(L'W'): edit(ui.view->tag, EditKillBackWord, 0);
|
break; case CTRL(L'W'): edit(ui.window->tag, EditKillBackWord, 0);
|
||||||
|
|
||||||
break; case CTRL(L'C'): edit(ui.view->tag, EditInsert, IRCColor);
|
break; case CTRL(L'C'): edit(ui.window->tag, EditInsert, IRCColor);
|
||||||
break; case CTRL(L'N'): edit(ui.view->tag, EditInsert, IRCReset);
|
break; case CTRL(L'N'): edit(ui.window->tag, EditInsert, IRCReset);
|
||||||
break; case CTRL(L'O'): edit(ui.view->tag, EditInsert, IRCBold);
|
break; case CTRL(L'O'): edit(ui.window->tag, EditInsert, IRCBold);
|
||||||
break; case CTRL(L'R'): edit(ui.view->tag, EditInsert, IRCColor);
|
break; case CTRL(L'R'): edit(ui.window->tag, EditInsert, IRCColor);
|
||||||
break; case CTRL(L'T'): edit(ui.view->tag, EditInsert, IRCItalic);
|
break; case CTRL(L'T'): edit(ui.window->tag, EditInsert, IRCItalic);
|
||||||
break; case CTRL(L'U'): edit(ui.view->tag, EditInsert, IRCUnderline);
|
break; case CTRL(L'U'): edit(ui.window->tag, EditInsert, IRCUnderline);
|
||||||
break; case CTRL(L'V'): edit(ui.view->tag, EditInsert, IRCReverse);
|
break; case CTRL(L'V'): edit(ui.window->tag, EditInsert, IRCReverse);
|
||||||
|
|
||||||
break; case L'\b': edit(ui.view->tag, EditBackspace, 0);
|
break; case L'\b': edit(ui.window->tag, EditBackspace, 0);
|
||||||
break; case L'\t': edit(ui.view->tag, EditComplete, 0);
|
break; case L'\t': edit(ui.window->tag, EditComplete, 0);
|
||||||
break; case L'\n': edit(ui.view->tag, EditEnter, 0);
|
break; case L'\n': edit(ui.window->tag, EditEnter, 0);
|
||||||
|
|
||||||
break; default: {
|
break; default: {
|
||||||
if (iswprint(ch)) edit(ui.view->tag, EditInsert, ch);
|
if (iswprint(ch)) edit(ui.window->tag, EditInsert, ch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -531,13 +530,13 @@ void uiPrompt(void) {
|
||||||
// TODO: Avoid reformatting these on every read.
|
// TODO: Avoid reformatting these on every read.
|
||||||
wchar_t *prompt = NULL;
|
wchar_t *prompt = NULL;
|
||||||
int len = 0;
|
int len = 0;
|
||||||
if (isAction(ui.view->tag, input) && editTail() >= &input[4]) {
|
if (isAction(ui.window->tag, input) && editTail() >= &input[4]) {
|
||||||
input = &input[4];
|
input = &input[4];
|
||||||
len = aswprintf(
|
len = aswprintf(
|
||||||
&prompt, L"\3%d* %s\3 ",
|
&prompt, L"\3%d* %s\3 ",
|
||||||
formatColor(self.user), self.nick
|
formatColor(self.user), self.nick
|
||||||
);
|
);
|
||||||
} else if (!isCommand(ui.view->tag, input)) {
|
} else if (!isCommand(ui.window->tag, input)) {
|
||||||
len = aswprintf(
|
len = aswprintf(
|
||||||
&prompt, L"\3%d<%s>\3 ",
|
&prompt, L"\3%d<%s>\3 ",
|
||||||
formatColor(self.user), self.nick
|
formatColor(self.user), self.nick
|
||||||
|
|
Loading…
Reference in New Issue