Factor out uiPrompt to call on nick change
parent
835d3a452a
commit
3e2a9c2056
1
chat.h
1
chat.h
|
@ -111,6 +111,7 @@ void uiHide(void);
|
||||||
void uiExit(void);
|
void uiExit(void);
|
||||||
void uiDraw(void);
|
void uiDraw(void);
|
||||||
void uiRead(void);
|
void uiRead(void);
|
||||||
|
void uiPrompt(void);
|
||||||
|
|
||||||
void uiViewTag(struct Tag tag);
|
void uiViewTag(struct Tag tag);
|
||||||
void uiViewNum(int num);
|
void uiViewNum(int num);
|
||||||
|
|
5
handle.c
5
handle.c
|
@ -315,7 +315,10 @@ static void handleNick(char *prefix, char *params) {
|
||||||
char *prev, *user, *next;
|
char *prev, *user, *next;
|
||||||
shift(prefix, &prev, &user, NULL, params, 1, 0, &next);
|
shift(prefix, &prev, &user, NULL, params, 1, 0, &next);
|
||||||
|
|
||||||
if (isSelf(prev, user)) selfNick(next);
|
if (isSelf(prev, user)) {
|
||||||
|
selfNick(next);
|
||||||
|
uiPrompt();
|
||||||
|
}
|
||||||
|
|
||||||
struct Tag tag;
|
struct Tag tag;
|
||||||
while (TagNone.id != (tag = tabTag(prev)).id) {
|
while (TagNone.id != (tag = tabTag(prev)).id) {
|
||||||
|
|
32
ui.c
32
ui.c
|
@ -329,7 +329,8 @@ static void uiView(struct View *view) {
|
||||||
if (ui.view) ui.view->mark = true;
|
if (ui.view) ui.view->mark = true;
|
||||||
viewUnmark(view);
|
viewUnmark(view);
|
||||||
ui.view = view;
|
ui.view = view;
|
||||||
uiRead();
|
uiStatus();
|
||||||
|
uiPrompt();
|
||||||
}
|
}
|
||||||
|
|
||||||
void uiViewTag(struct Tag tag) {
|
void uiViewTag(struct Tag tag) {
|
||||||
|
@ -504,23 +505,10 @@ static bool isCommand(struct Tag tag, const wchar_t *input) {
|
||||||
return !extra || (space && extra > space);
|
return !extra || (space && extra > space);
|
||||||
}
|
}
|
||||||
|
|
||||||
void uiRead(void) {
|
void uiPrompt(void) {
|
||||||
uiShow();
|
|
||||||
|
|
||||||
int ret;
|
|
||||||
wint_t ch;
|
|
||||||
while (ERR != (ret = wget_wch(ui.input, &ch))) {
|
|
||||||
if (ret == KEY_CODE_YES) {
|
|
||||||
keyCode(ch);
|
|
||||||
} else {
|
|
||||||
keyChar(ch);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const wchar_t *input = editHead();
|
const wchar_t *input = editHead();
|
||||||
|
|
||||||
// TODO: Avoid reformatting these on every read.
|
// TODO: Avoid reformatting these on every read.
|
||||||
// FIXME: Reformat when nick changes. Wouldn't FRP be nice?
|
|
||||||
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.view->tag, input) && editTail() >= &input[4]) {
|
||||||
|
@ -552,3 +540,17 @@ void uiRead(void) {
|
||||||
wclrtoeol(ui.input);
|
wclrtoeol(ui.input);
|
||||||
wmove(ui.input, 0, x);
|
wmove(ui.input, 0, x);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void uiRead(void) {
|
||||||
|
uiShow();
|
||||||
|
int ret;
|
||||||
|
wint_t ch;
|
||||||
|
while (ERR != (ret = wget_wch(ui.input, &ch))) {
|
||||||
|
if (ret == KEY_CODE_YES) {
|
||||||
|
keyCode(ch);
|
||||||
|
} else {
|
||||||
|
keyChar(ch);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
uiPrompt();
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue