Don't justify line if it has link in it.

This commit is contained in:
Kovid Goyal 2007-10-24 20:51:07 +00:00
parent e209b79519
commit 2d2d59a1de

View File

@ -460,7 +460,13 @@ class Line(QGraphicsItem):
self.current_width = self.line_length
def finalize(self, baselineskip, linespace, vdebug):
if self.current_width >= 0.85 * self.line_length:
if self.current_link is not None:
self.end_link()
# We justify is line is small and it doesn't have links in it
# If it has links, justification would cause the boundingrect of the link to
# be too small
if self.current_width >= 0.85 * self.line_length and len(self.links) == 0:
self.justify()
self.width = float(self.current_width)
@ -470,8 +476,6 @@ class Line(QGraphicsItem):
self.vdebug = vdebug
if self.current_link is not None:
self.end_link()
for link in self.links:
Link(self, *link)