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

a few fixes

This commit is contained in:
Jfreegman 2014-03-26 05:52:21 -04:00
parent f6db888808
commit c218e104e7
No known key found for this signature in database
GPG Key ID: 3627F3144076AE63
3 changed files with 7 additions and 7 deletions

View File

@ -51,7 +51,7 @@ void line_info_init(struct history *hst)
static void line_info_reset_start(struct history *hst) static void line_info_reset_start(struct history *hst)
{ {
struct line_info *line = hst->line_end; struct line_info *line = hst->line_end;
uint32_t start_id = hst->start_id + 1; uint32_t start_id = hst->start_id;
while (line) { while (line) {
if (line->id == start_id) { if (line->id == start_id) {
@ -110,7 +110,6 @@ void line_info_add(ToxWindow *self, uint8_t *tmstmp, uint8_t *name1, uint8_t *na
/* for type-specific formatting in print function */ /* for type-specific formatting in print function */
switch (type) { switch (type) {
case ACTION: case ACTION:
case NAME_CHANGE:
len += 3; len += 3;
break; break;
default: default:
@ -170,12 +169,13 @@ void line_info_add(ToxWindow *self, uint8_t *tmstmp, uint8_t *name1, uint8_t *na
getyx(self->chatwin->history, y, x); getyx(self->chatwin->history, y, x);
int offst = self->is_groupchat ? SIDEBAR_WIDTH : 0; /* offset width of groupchat sidebar */ int offst = self->is_groupchat ? SIDEBAR_WIDTH : 0; /* offset width of groupchat sidebar */
int lines = 1 + (len / (x2 - offst)); int lines = (1 + newlines + (len / (x2 - offst)));
hst->queue += lines;
int max_y = self->is_prompt ? y2 : y2 - CHATBOX_HEIGHT; int max_y = self->is_prompt ? y2 : y2 - CHATBOX_HEIGHT;
/* move line_start forward proportionate to the number of new lines */ /* move line_start forward proportionate to the number of new lines */
if (y >= max_y) { if (y + hst->queue - 1 >= max_y) {
while (lines > 0 && hst->line_start->next) { while (lines > 0 && hst->line_start->next) {
lines -= (1 + hst->line_start->len / (x2 - offst)); lines -= (1 + hst->line_start->len / (x2 - offst));
hst->line_start = hst->line_start->next; hst->line_start = hst->line_start->next;
@ -193,6 +193,8 @@ void line_info_print(ToxWindow *self)
int y2, x2; int y2, x2;
getmaxyx(self->window, y2, x2); getmaxyx(self->window, y2, x2);
ctx->hst->queue = 0;
if (self->is_groupchat) if (self->is_groupchat)
wmove(win, 0, 0); wmove(win, 0, 0);
else else

View File

@ -55,8 +55,7 @@ struct history {
uint32_t start_id; /* keeps track of where line_start should be when at bottom of history */ uint32_t start_id; /* keeps track of where line_start should be when at bottom of history */
uint32_t line_items; uint32_t line_items;
bool scroll_mode; bool scroll_mode;
int y; uint8_t queue; /* keeps track of lines added between window refreshes */
int old_y;
}; };
/* adds a line to history (also moves line_start and/or line_root forward if necessary) */ /* adds a line to history (also moves line_start and/or line_root forward if necessary) */

View File

@ -84,7 +84,6 @@ struct _Winthread Winthread;
void on_window_resize(int sig) void on_window_resize(int sig)
{ {
endwin();
refresh(); refresh();
clear(); clear();
} }