diff --git a/src/obiview.c b/src/obiview.c index e3dfda3..c9a64ea 100644 --- a/src/obiview.c +++ b/src/obiview.c @@ -990,7 +990,7 @@ char* view_check_quality_matches_seq_column(Obiview_p view) // TODO Print error seq_column = obi_view_get_column(view, ((qual_column->header)->associated_column).column_name); //seq_column = obi_open_column(view->dms, ((qual_column->header)->associated_column).column_name, ((qual_column->header)->associated_column).version); - // TODO discuss the fact that it's opened outside of the context of the view or not + // TODO discuss the fact that it's opened outside of the context of the view or not -> problem if alias. Open from full refs maybe // TODO if outside of view, make function that opens a column from a column reference structure? if (seq_column == NULL) @@ -1688,7 +1688,7 @@ int obi_view_add_column(Obiview_p view, return -1; } - // If there is a line selection and a new column is created, clone the columns to delete the line selection + // If there is a line selection , clone the columns to delete the line selection if (create && (view->line_selection != NULL)) { for (i=0; i<((view->infos)->column_count); i++) @@ -1705,7 +1705,6 @@ int obi_view_add_column(Obiview_p view, obidebug(1, "\nError cloning a column to replace in a view"); return -1; } - // Close old cloned column obi_close_column(column_buffer); } @@ -1750,9 +1749,15 @@ int obi_view_add_column(Obiview_p view, obidebug(1, "\nError opening a column to add to a view"); return -1; } - // Check that the column's line count is equal to the view's line count if there is no line selection. - // TODO But what if there is a line selection ??? imo should just check that col_line_count > line_selection_count - //if () + // Check that the column's line count is at least the view's line count if there's a line selection + // TODO rediscuss. This can't be more stringent because when cloning a view, if there's a line selection associated, + // when re-adding the columns to the cloned view, it is normal that the columns have a line count greater than the view's. + if ((column->header)->line_count < (view->infos)->line_count) + { + obi_set_errno(OBIVIEW_ERROR); + obidebug(1, "\nError adding an existing column to a view: the column's line count (%lld) must be at least the view's (%lld) (when there is a line selection)", (column->header)->line_count, (view->infos)->line_count); + return -1; + } } // Store column pointer in the view structure