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

Fix bug causing file transfer status bars to be truncated

This commit is contained in:
jfreegman 2020-11-26 15:35:04 -05:00
parent 8d9d51640c
commit 0434ac186a
No known key found for this signature in database
GPG Key ID: 3627F3144076AE63
2 changed files with 8 additions and 3 deletions

View File

@ -60,13 +60,15 @@ void print_progress_bar(ToxWindow *self, double bps, double pct_done, uint32_t l
return; return;
} }
char pct_str[STR_BUF_SIZE] = {0}; char pct_str[STR_BUF_SIZE];
snprintf(pct_str, sizeof(pct_str), "%.1f%%", pct_done); snprintf(pct_str, sizeof(pct_str), "%.1f%%", pct_done);
char bps_str[STR_BUF_SIZE] = {0}; char bps_str[STR_BUF_SIZE];
bytes_convert_str(bps_str, sizeof(bps_str), bps); bytes_convert_str(bps_str, sizeof(bps_str), bps);
char prog_line[NUM_PROG_MARKS + 1] = {0}; char prog_line[NUM_PROG_MARKS + 1];
prog_line[0] = 0;
int n = pct_done / (100 / NUM_PROG_MARKS); int n = pct_done / (100 / NUM_PROG_MARKS);
int i, j; int i, j;

View File

@ -683,6 +683,9 @@ void line_info_set(ToxWindow *self, uint32_t id, char *msg)
while (line) { while (line) {
if (line->id == id) { if (line->id == id) {
size_t new_len = strlen(msg);
line->len = line->len - line->msg_len + new_len;
line->msg_len = new_len;
snprintf(line->msg, sizeof(line->msg), "%s", msg); snprintf(line->msg, sizeof(line->msg), "%s", msg);
return; return;
} }