summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2001-05-21 23:46:48 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2001-05-21 23:46:48 +0000
commit666f4b246307ce08da6316b7d3a06e0990a92138 (patch)
treed117e4d1bde7825a582adb5dcfa467cde2fb1d90 /src/core
parent24e88a67723eaa34cf2d6799c6f4f5d3e37b177c (diff)
downloadirssi-666f4b246307ce08da6316b7d3a06e0990a92138.zip
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
Diffstat (limited to 'src/core')
-rw-r--r--src/core/misc.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/core/misc.c b/src/core/misc.c
index ebbd34cd..7a2c54d2 100644
--- a/src/core/misc.c
+++ b/src/core/misc.c
@@ -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);