diff --git a/client/utils/Table.cc b/client/utils/Table.cc index 4056e3f8..81e1293c 100644 --- a/client/utils/Table.cc +++ b/client/utils/Table.cc @@ -262,6 +262,17 @@ namespace snapper } + bool + Table::has_id(Id id) const + { + for (size_t i = 0; i < ids.size(); ++i) + if (ids[i] == id) + return true; + + return false; + } + + size_t Table::id_to_index(Id id) const { diff --git a/client/utils/Table.h b/client/utils/Table.h index 308ce3bd..cc97e6ea 100644 --- a/client/utils/Table.h +++ b/client/utils/Table.h @@ -141,6 +141,8 @@ namespace snapper const vector get_rows() const { return rows; } + bool has_id(Id id) const; + void set_show_header(bool show_header) { Table::show_header = show_header; } void set_show_grid(bool show_grid) { Table::show_grid = show_grid; } void set_style(Style style) { Table::style = style; } diff --git a/client/utils/TableFormatter.cc b/client/utils/TableFormatter.cc index b2141ff1..435d28f1 100644 --- a/client/utils/TableFormatter.cc +++ b/client/utils/TableFormatter.cc @@ -37,7 +37,8 @@ namespace snapper table.set_style(table_formatter.style); for (Id id : table_formatter._abbrev) - table.set_abbreviate(id, true); + if (table.has_id(id)) + table.set_abbreviate(id, true); for (const vector& row : table_formatter._rows) {