/////////////////////////////////////////////////////////////////////////// Set the minimum and maximum widths for the value.
| 72 | //////////////////////////////////////////////////////////////////////////////// |
| 73 | // Set the minimum and maximum widths for the value. |
| 74 | void ColumnDescription::measure(Task& task, unsigned int& minimum, unsigned int& maximum) { |
| 75 | std::string description = task.get(_name); |
| 76 | |
| 77 | // The text |
| 78 | // <indent> <date> <anno> |
| 79 | // ... |
| 80 | if (_style == "default" || _style == "combined") { |
| 81 | minimum = longestWord(description); |
| 82 | maximum = utf8_width(description); |
| 83 | |
| 84 | if (task.annotation_count) { |
| 85 | unsigned int min_anno = _indent + Datetime::length(_dateformat); |
| 86 | if (min_anno > minimum) minimum = min_anno; |
| 87 | |
| 88 | for (auto& i : task.getAnnotations()) { |
| 89 | unsigned int len = min_anno + 1 + utf8_width(i.second); |
| 90 | if (len > maximum) maximum = len; |
| 91 | } |
| 92 | } |
| 93 | } |
| 94 | |
| 95 | // Just the text |
| 96 | else if (_style == "desc") { |
| 97 | maximum = utf8_width(description); |
| 98 | minimum = longestWord(description); |
| 99 | } |
| 100 | |
| 101 | // The text <date> <anno> ... |
| 102 | else if (_style == "oneline") { |
| 103 | minimum = longestWord(description); |
| 104 | maximum = utf8_width(description); |
| 105 | |
| 106 | if (task.annotation_count) { |
| 107 | auto min_anno = Datetime::length(_dateformat); |
| 108 | for (auto& i : task.getAnnotations()) maximum += min_anno + 1 + utf8_width(i.second); |
| 109 | } |
| 110 | } |
| 111 | |
| 112 | // The te... |
| 113 | else if (_style == "truncated") { |
| 114 | minimum = 4; |
| 115 | maximum = utf8_width(description); |
| 116 | } |
| 117 | |
| 118 | // The text [2] |
| 119 | else if (_style == "count") { |
| 120 | // <description> + ' ' + '[' + <count> + ']' |
| 121 | maximum = utf8_width(description) + 1 + 1 + format(task.annotation_count).length() + 1; |
| 122 | minimum = longestWord(description); |
| 123 | } |
| 124 | |
| 125 | // The te... [2] |
| 126 | else if (_style == "truncated_count") { |
| 127 | minimum = 4; |
| 128 | maximum = utf8_width(description) + 1 + 1 + format(task.annotation_count).length() + 1; |
| 129 | } |
| 130 | } |
| 131 |
nothing calls this directly
no test coverage detected