mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-23 01:33:02 +01:00
a few fixes
This commit is contained in:
parent
f6db888808
commit
c218e104e7
@ -51,7 +51,7 @@ void line_info_init(struct history *hst)
|
||||
static void line_info_reset_start(struct history *hst)
|
||||
{
|
||||
struct line_info *line = hst->line_end;
|
||||
uint32_t start_id = hst->start_id + 1;
|
||||
uint32_t start_id = hst->start_id;
|
||||
|
||||
while (line) {
|
||||
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 */
|
||||
switch (type) {
|
||||
case ACTION:
|
||||
case NAME_CHANGE:
|
||||
len += 3;
|
||||
break;
|
||||
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);
|
||||
|
||||
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;
|
||||
|
||||
/* 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) {
|
||||
lines -= (1 + hst->line_start->len / (x2 - offst));
|
||||
hst->line_start = hst->line_start->next;
|
||||
@ -193,6 +193,8 @@ void line_info_print(ToxWindow *self)
|
||||
int y2, x2;
|
||||
getmaxyx(self->window, y2, x2);
|
||||
|
||||
ctx->hst->queue = 0;
|
||||
|
||||
if (self->is_groupchat)
|
||||
wmove(win, 0, 0);
|
||||
else
|
||||
|
@ -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 line_items;
|
||||
bool scroll_mode;
|
||||
int y;
|
||||
int old_y;
|
||||
uint8_t queue; /* keeps track of lines added between window refreshes */
|
||||
};
|
||||
|
||||
/* adds a line to history (also moves line_start and/or line_root forward if necessary) */
|
||||
|
@ -84,7 +84,6 @@ struct _Winthread Winthread;
|
||||
|
||||
void on_window_resize(int sig)
|
||||
{
|
||||
endwin();
|
||||
refresh();
|
||||
clear();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user