##// END OF EJS Templates
Only use alignment specification if it's the first...
walter.doerwald -
r282:e7006b3e
parent child
Show More
@@ -291,30 +291,8 class _BrowserLevel(object):
291 value = exc
291 value = exc
292 # only store attribute if it exists (or we got an exception)
292 # only store attribute if it exists (or we got an exception)
293 if value is not ipipe.noitem:
293 if value is not ipipe.noitem:
294 parts = []
294 # remember alignment, length and colored text
295 totallength = 0
295 row[attrname] = ipipe.xformat(value, "cell", self.browser.maxattrlength)
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)
318 return row
296 return row
319
297
320 def calcwidths(self):
298 def calcwidths(self):
@@ -1616,17 +1616,20 def xformat(value, mode, maxlength):
1616 full = True
1616 full = True
1617 width = 0
1617 width = 0
1618 text = astyle.Text()
1618 text = astyle.Text()
1619 for part in xrepr(value, mode):
1619 for (style, part) in xrepr(value, mode):
1620 # part is (alignment, stop)
1620 # only consider the first result
1621 if isinstance(part[0], int):
1621 if align is None:
1622 # only consider the first occurence
1622 if isinstance(style, int):
1623 if align is None:
1623 # (style, text) really is (alignment, stop)
1624 align = part[0]
1624 align = style
1625 full = part[1]
1625 full = part
1626 # part is (style, text)
1626 continue
1627 else:
1627 else:
1628 text.append(part)
1628 align = -1
1629 width += len(part[1])
1629 full = True
1630 if not isinstance(style, int):
1631 text.append((style, part))
1632 width += len(part)
1630 if width >= maxlength and not full:
1633 if width >= maxlength and not full:
1631 text.append((astyle.style_ellisis, "..."))
1634 text.append((astyle.style_ellisis, "..."))
1632 width += 3
1635 width += 3
General Comments 0
You need to be logged in to leave comments. Login now