##// END OF EJS Templates
Only use alignment specification if it's the first...
walter.doerwald -
Show More
@@ -291,30 +291,8 b' class _BrowserLevel(object):'
291 291 value = exc
292 292 # only store attribute if it exists (or we got an exception)
293 293 if value is not ipipe.noitem:
294 parts = []
295 totallength = 0
296 align = None
297 full = True
298 # Collect parts until we have enough
299 for part in ipipe.xrepr(value, "cell"):
300 # part gives (alignment, stop)
301 # instead of (style, text)
302 if isinstance(part[0], int):
303 # only consider the first occurence
304 if align is None:
305 align = part[0]
306 full = part[1]
307 else:
308 parts.append(part)
309 totallength += len(part[1])
310 if totallength >= self.browser.maxattrlength and not full:
311 parts.append((astyle.style_ellisis, "..."))
312 totallength += 3
313 break
314 if align is None:
315 align = -1
316 # remember alignment, length and colored parts
317 row[attrname] = (align, totallength, parts)
294 # remember alignment, length and colored text
295 row[attrname] = ipipe.xformat(value, "cell", self.browser.maxattrlength)
318 296 return row
319 297
320 298 def calcwidths(self):
@@ -1616,17 +1616,20 b' def xformat(value, mode, maxlength):'
1616 1616 full = True
1617 1617 width = 0
1618 1618 text = astyle.Text()
1619 for part in xrepr(value, mode):
1620 # part is (alignment, stop)
1621 if isinstance(part[0], int):
1622 # only consider the first occurence
1623 if align is None:
1624 align = part[0]
1625 full = part[1]
1626 # part is (style, text)
1627 else:
1628 text.append(part)
1629 width += len(part[1])
1619 for (style, part) in xrepr(value, mode):
1620 # only consider the first result
1621 if align is None:
1622 if isinstance(style, int):
1623 # (style, text) really is (alignment, stop)
1624 align = style
1625 full = part
1626 continue
1627 else:
1628 align = -1
1629 full = True
1630 if not isinstance(style, int):
1631 text.append((style, part))
1632 width += len(part)
1630 1633 if width >= maxlength and not full:
1631 1634 text.append((astyle.style_ellisis, "..."))
1632 1635 width += 3
General Comments 0
You need to be logged in to leave comments. Login now