1
0
mirror of https://github.com/irssi/irssi.git synced 2024-09-01 04:14:16 -04:00

get_max_column_count() didn't return correct value in save_column_widths

when it returned only one column.


git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1510 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2001-05-21 23:46:48 +00:00 committed by cras
parent 24e88a6772
commit 666f4b2463

View File

@ -628,7 +628,7 @@ int get_max_column_count(GSList *items, COLUMN_LEN_FUNC len_func,
GSList *tmp;
int **columns, *columns_width, *columns_rows;
int item_pos, items_count;
int ret, len, n, col;
int ret, len, max_len, n, col;
items_count = g_slist_length(items);
if (items_count == 0) {
@ -654,9 +654,12 @@ int get_max_column_count(GSList *items, COLUMN_LEN_FUNC len_func,
/* for each possible column count, save the column widths and
find the biggest column count that fits to screen. */
item_pos = 0;
item_pos = 0; max_len = 0;
for (tmp = items; tmp != NULL; tmp = tmp->next) {
len = item_extra+len_func(tmp->data);
len = item_extra+len_func(tmp->data);
if (max_len < len)
max_len = len;
for (n = 1; n < max_columns; n++) {
if (columns_width[n] > max_width)
continue; /* too wide */
@ -680,7 +683,7 @@ int get_max_column_count(GSList *items, COLUMN_LEN_FUNC len_func,
*save_column_widths = g_new(int, ret);
if (ret == 1) {
**save_column_widths = item_extra+len_func(items->data);
**save_column_widths = max_len;
*rows = 1;
} else {
memcpy(*save_column_widths, columns[ret-1], sizeof(int)*ret);