diff --git a/source/Ox.UI/js/List/Ox.IconItem.js b/source/Ox.UI/js/List/Ox.IconItem.js
index e7faa0bf..d2853550 100644
--- a/source/Ox.UI/js/List/Ox.IconItem.js
+++ b/source/Ox.UI/js/List/Ox.IconItem.js
@@ -159,17 +159,17 @@ Ox.IconItem = function(options, self) {
function formatText(text, maxLines, maxLength) {
text = Ox.isArray(text) ? text.join(', ') : text;
var lines = Ox.wordwrap(text, maxLength, '\n', true, false).split('\n');
+ // if the text has too many lines, replace the last line with the
+ // truncated rest (including the last line) and discard all extra lines
+ if (lines.length > maxLines) {
+ lines[maxLines - 1] = Ox.truncate(
+ lines.slice(maxLines - 1).join(' '), maxLength, '...', 'center'
+ );
+ lines = lines.slice(0, maxLines);
+ }
return Ox.highlightHTML(
- lines.slice(0, maxLines).map(function(line, i) {
- return i < maxLines - 1 || lines.length == maxLines
- ? line
- : Ox.truncate(
- lines.slice(maxLines).join(' '),
- maxLength, '...', 'center'
- );
- }).join('
'),
- self.options.find, 'OxHighlight', ['br']
- ).replace(/ (<.*?>)?
/g, ' $1
');
+ lines.join('
'), self.options.find, 'OxHighlight', true
+ );
}
function load() {