1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-11-26 16:03:27 +01:00

put help message in chatwindow box when in scroll mode

This commit is contained in:
Jfreegman 2014-03-27 05:08:48 -04:00
parent bd5453002e
commit 1b3c40b539
No known key found for this signature in database
GPG Key ID: 3627F3144076AE63
4 changed files with 41 additions and 23 deletions

View File

@ -688,13 +688,15 @@ static void chat_onDraw(ToxWindow *self, Tox *m)
ChatContext *ctx = self->chatwin; ChatContext *ctx = self->chatwin;
if (!ctx->hst->scroll_mode) line_info_print(self);
wclear(ctx->linewin);
if (ctx->hst->scroll_mode) {
line_info_onDraw(self);
} else {
curs_set(1); curs_set(1);
wclear(ctx->linewin); if (ctx->len > 0 && !ctx->hst->scroll_mode) {
line_info_print(self);
if (ctx->len > 0) {
uint8_t line[MAX_STR_SIZE]; uint8_t line[MAX_STR_SIZE];
if (wcs_to_mbs_buf(line, ctx->line, MAX_STR_SIZE) == -1) { if (wcs_to_mbs_buf(line, ctx->line, MAX_STR_SIZE) == -1) {
@ -704,6 +706,7 @@ static void chat_onDraw(ToxWindow *self, Tox *m)
mvwprintw(ctx->linewin, 1, 0, "%s", line); mvwprintw(ctx->linewin, 1, 0, "%s", line);
} }
} }
}
/* Draw status bar */ /* Draw status bar */
StatusBar *statusbar = self->stb; StatusBar *statusbar = self->stb;

View File

@ -538,11 +538,13 @@ static void groupchat_onDraw(ToxWindow *self, Tox *m)
ChatContext *ctx = self->chatwin; ChatContext *ctx = self->chatwin;
if (!ctx->hst->scroll_mode)
scrollok(ctx->history, 1);
wclear(ctx->linewin);
line_info_print(self); line_info_print(self);
wclear(ctx->linewin);
if (ctx->hst->scroll_mode) {
line_info_onDraw(self);
} else {
curs_set(1);
if (ctx->len > 0) { if (ctx->len > 0) {
uint8_t line[MAX_STR_SIZE]; uint8_t line[MAX_STR_SIZE];
@ -554,6 +556,7 @@ static void groupchat_onDraw(ToxWindow *self, Tox *m)
mvwprintw(ctx->linewin, 1, 0, "%s", line); mvwprintw(ctx->linewin, 1, 0, "%s", line);
} }
} }
}
wclear(ctx->sidebar); wclear(ctx->sidebar);
mvwhline(ctx->linewin, 0, 0, ACS_HLINE, x2); mvwhline(ctx->linewin, 0, 0, ACS_HLINE, x2);

View File

@ -392,6 +392,17 @@ void line_info_onKey(ToxWindow *self, wint_t key)
} }
} }
void line_info_onDraw(ToxWindow *self)
{
ChatContext *ctx = self->chatwin;
wattron(ctx->linewin, A_BOLD | COLOR_PAIR(BLUE));
mvwprintw(ctx->linewin, 1, 0, "Scroll mode:\n");
wattroff(ctx->linewin, A_BOLD | COLOR_PAIR(BLUE));
mvwprintw(ctx->linewin, 1, 13, "Use up/down arrows, page up/page down, and home/end to navigate.\n"
" ESC to exit.\n");
}
void line_info_clear(struct history *hst) void line_info_clear(struct history *hst)
{ {
hst->line_start = hst->line_end; hst->line_start = hst->line_end;

View File

@ -79,3 +79,4 @@ void line_info_clear(struct history *hst);
void line_info_init(struct history *hst); void line_info_init(struct history *hst);
void line_info_onKey(ToxWindow *self, wint_t key); void line_info_onKey(ToxWindow *self, wint_t key);
void line_info_onDraw(ToxWindow *self);