mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-26 22:13:26 +01:00
move to page end after pressing return
This commit is contained in:
parent
00cccad22c
commit
3a176e1cab
@ -928,6 +928,7 @@ static void chat_onKey(ToxWindow *self, Tox *m, wint_t key, bool ltr)
|
|||||||
|
|
||||||
wclear(ctx->linewin);
|
wclear(ctx->linewin);
|
||||||
wmove(self->window, y2 - CURS_Y_OFFSET, 0);
|
wmove(self->window, y2 - CURS_Y_OFFSET, 0);
|
||||||
|
line_info_reset_start(self, ctx->hst);
|
||||||
reset_buf(ctx);
|
reset_buf(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1013,7 +1014,7 @@ static void chat_onDraw(ToxWindow *self, Tox *m)
|
|||||||
self->x = x2;
|
self->x = x2;
|
||||||
|
|
||||||
/* Truncate note if it doesn't fit in statusbar */
|
/* Truncate note if it doesn't fit in statusbar */
|
||||||
uint16_t maxlen = x2 - getcurx(statusbar->topline) - (KEY_IDENT_DIGITS * 2) - 3;
|
uint16_t maxlen = x2 - getcurx(statusbar->topline) - (KEY_IDENT_DIGITS * 2) - 6;
|
||||||
|
|
||||||
if (statusbar->statusmsg_len > maxlen) {
|
if (statusbar->statusmsg_len > maxlen) {
|
||||||
statusbar->statusmsg[maxlen - 3] = '\0';
|
statusbar->statusmsg[maxlen - 3] = '\0';
|
||||||
|
@ -426,6 +426,7 @@ static void groupchat_onKey(ToxWindow *self, Tox *m, wint_t key, bool ltr)
|
|||||||
|
|
||||||
wclear(ctx->linewin);
|
wclear(ctx->linewin);
|
||||||
wmove(self->window, y2 - CURS_Y_OFFSET, 0);
|
wmove(self->window, y2 - CURS_Y_OFFSET, 0);
|
||||||
|
line_info_reset_start(self, ctx->hst);
|
||||||
reset_buf(ctx);
|
reset_buf(ctx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,8 +48,8 @@ void line_info_init(struct history *hst)
|
|||||||
hst->queue_sz = 0;
|
hst->queue_sz = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* resets line_start (page end) */
|
/* resets line_start (moves to end of chat history) */
|
||||||
static void line_info_reset_start(ToxWindow *self, struct history *hst)
|
void line_info_reset_start(ToxWindow *self, struct history *hst)
|
||||||
{
|
{
|
||||||
struct line_info *line = hst->line_end;
|
struct line_info *line = hst->line_end;
|
||||||
|
|
||||||
@ -111,13 +111,13 @@ static void line_info_root_fwd(struct history *hst)
|
|||||||
hst->line_root = tmp;
|
hst->line_root = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* returns ptr to queue item 0 and removes it from queue */
|
/* returns ptr to queue item 0 and removes it from queue. Returns NULL if queue is empty. */
|
||||||
static struct line_info *line_info_ret_queue(struct history *hst)
|
static struct line_info *line_info_ret_queue(struct history *hst)
|
||||||
{
|
{
|
||||||
if (hst->queue_sz <= 0)
|
if (hst->queue_sz <= 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
struct line_info *ret = hst->queue[0];
|
struct line_info *line = hst->queue[0];
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -126,7 +126,7 @@ static struct line_info *line_info_ret_queue(struct history *hst)
|
|||||||
|
|
||||||
--hst->queue_sz;
|
--hst->queue_sz;
|
||||||
|
|
||||||
return ret;
|
return line;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* creates new line_info line and puts it in the queue. */
|
/* creates new line_info line and puts it in the queue. */
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
#define MAX_HISTORY 100000
|
#define MAX_HISTORY 100000
|
||||||
#define MIN_HISTORY 40
|
#define MIN_HISTORY 40
|
||||||
#define MAX_LINE_INFO_QUEUE 512
|
#define MAX_LINE_INFO_QUEUE 1024
|
||||||
#define MAX_LINE_INFO_MSG_SIZE MAX_STR_SIZE + TOXIC_MAX_NAME_LENGTH + 32 /* needs extra room for log loading */
|
#define MAX_LINE_INFO_MSG_SIZE MAX_STR_SIZE + TOXIC_MAX_NAME_LENGTH + 32 /* needs extra room for log loading */
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
@ -89,6 +89,9 @@ void line_info_clear(struct history *hst);
|
|||||||
/* puts msg in specified line_info msg buffer */
|
/* puts msg in specified line_info msg buffer */
|
||||||
void line_info_set(ToxWindow *self, uint32_t id, char *msg);
|
void line_info_set(ToxWindow *self, uint32_t id, char *msg);
|
||||||
|
|
||||||
|
/* resets line_start (moves to end of chat history) */
|
||||||
|
void line_info_reset_start(ToxWindow *self, struct history *hst);
|
||||||
|
|
||||||
void line_info_init(struct history *hst);
|
void line_info_init(struct history *hst);
|
||||||
bool line_info_onKey(ToxWindow *self, wint_t key); /* returns true if key is a match */
|
bool line_info_onKey(ToxWindow *self, wint_t key); /* returns true if key is a match */
|
||||||
|
|
||||||
|
@ -212,6 +212,7 @@ static void prompt_onKey(ToxWindow *self, Tox *m, wint_t key, bool ltr)
|
|||||||
|
|
||||||
wclear(ctx->linewin);
|
wclear(ctx->linewin);
|
||||||
wmove(self->window, y2 - CURS_Y_OFFSET, 0);
|
wmove(self->window, y2 - CURS_Y_OFFSET, 0);
|
||||||
|
line_info_reset_start(self, ctx->hst);
|
||||||
reset_buf(ctx);
|
reset_buf(ctx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user