Fixed a problem where a view would have a wrong line count after adding
a first column to it if there was already a Line selection associated (happening when cloning), and fixed a bad error check.
This commit is contained in:
@ -879,18 +879,21 @@ static int update_lines(Obiview_p view, index_t line_count)
|
||||
// Clone the column first if needed
|
||||
if (!(column->writable))
|
||||
{
|
||||
if (clone_column_in_view(view, (((view->infos)->column_references)[i]).alias) < 0)
|
||||
column = clone_column_in_view(view, (((view->infos)->column_references)[i]).alias);
|
||||
if (column == NULL)
|
||||
{
|
||||
obidebug(1, "\nError cloning a column in a view when updating its line count");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
// Enlarge the column if needed
|
||||
while (line_count > (column->header)->line_count)
|
||||
{
|
||||
if (obi_enlarge_column(column) < 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Set the number of lines used to the new view line count
|
||||
(column->header)->lines_used = line_count;
|
||||
}
|
||||
@ -2247,8 +2250,8 @@ int obi_view_add_column(Obiview_p view,
|
||||
// Save column alias
|
||||
strcpy((((view->infos)->column_references)[(view->infos)->column_count]).alias, alias);
|
||||
|
||||
// If it's the first column of the view, set the view's line count to the column's line count
|
||||
if ((view->infos)->column_count == 0)
|
||||
// If it's the first column of the view, set the view's line count to the column's line count, except if there's a line selection associated
|
||||
if (((view->infos)->column_count == 0) && (view->line_selection == NULL))
|
||||
(view->infos)->line_count = (column->header)->lines_used;
|
||||
|
||||
// Update column count in view
|
||||
|
Reference in New Issue
Block a user