From 2d2d59a1de48e7e763d59b154aa365357e26240c Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 24 Oct 2007 20:51:07 +0000 Subject: [PATCH] Don't justify line if it has link in it. --- src/libprs500/gui2/lrf_renderer/text.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/libprs500/gui2/lrf_renderer/text.py b/src/libprs500/gui2/lrf_renderer/text.py index 4529364c69..c10637d82d 100644 --- a/src/libprs500/gui2/lrf_renderer/text.py +++ b/src/libprs500/gui2/lrf_renderer/text.py @@ -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)