After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 659633 - Line wrapping is broken
Line wrapping is broken
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: message-tray
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
Depends on:
Blocks:
 
 
Reported: 2011-09-20 18:25 UTC by drago01
Modified: 2011-09-20 20:06 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
clutter-text: Print get_preferred_height on click (1.72 KB, patch)
2011-09-20 18:30 UTC, Jasper St. Pierre (not reading bugmail)
none Details | Review
messageTray: Fix line wrapping (1.48 KB, patch)
2011-09-20 19:54 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review

Description drago01 2011-09-20 18:25:55 UTC
When running gnome-shell with clutter git (aka 1.8) text is not line wrapper but simply cut off and the rest not painted.

Best to reproduce with doing notify-send $longtext and viewing the notification.

I bisected it and it lead to:

--------------
359ed2b29fdc4f692e6cb6ff310c41ed7796139a is the first bad commit
commit 359ed2b29fdc4f692e6cb6ff310c41ed7796139a
Author: Emmanuele Bassi <ebassi@linux.intel.com>
Date:   Sun Sep 4 17:57:50 2011 +0100

    text: Make :line-wrap actually work
    
    When we paint a ClutterText we ask the actor for a PangoLayout that fits
    inside the actor's allocation - both width and height.
    
    Sadly, whenever a height is set on a PangoLayout, Pango will wrap its
    contents - regardless of whether the layout should actually wrap or not.
    
    This means that in certain easy to exploit cases, Clutter will paint a
    Text actor with its contents wrapping even if the :wrap property is set
    to FALSE.
    
    In order to fix this we need to encode some more cases inside the
    ::paint implementation of ClutterText, and ask the cache for a layout
    that is sized as the allocation's width, but not as its height; we also
    need to perform a clip if we detect that the PangoLayout's logical size
    is going to overflow the allocated size. This clip might cause some
    performance issue, given that clipping breaks batching in the Cogl
    journal; hopefully all clips for text are going to be screen-aligned, so
    at the end of the batch it'll just scissor them out.
    
    http://bugzilla.clutter-project.org/show_bug.cgi?id=2339

:040000 040000 0e599b1538a8ac78e738a5f8fb5fa84d6413edea f2aa892e0dd7faaa594b502db28b7a4744537dad M	clutter
-------------

Wasn't the commit supposed to make it work? Here it seems to have achieved the opposite ;)
Comment 1 Jasper St. Pierre (not reading bugmail) 2011-09-20 18:30:21 UTC
Created attachment 197105 [details] [review]
clutter-text: Print get_preferred_height on click

(In reply to comment #0)
> When running gnome-shell with clutter git (aka 1.8) text is not line wrapper
> but simply cut off and the rest not painted.
> 
> Best to reproduce with doing notify-send $longtext and viewing the
> notification.
> 

The problem seems to be that the preferred height/width isn't taking line
wrappiing into account. Simple patch to test-text to test it.
Comment 2 Emmanuele Bassi (:ebassi) 2011-09-20 19:45:34 UTC
(In reply to comment #0)
> When running gnome-shell with clutter git (aka 1.8) text is not line wrapper
> but simply cut off and the rest not painted.

are you setting the line-wrap property to TRUE in the first place?

if you're not, then the only sane behaviour we can provide is to clip to the allocated area. please, read the original bug on clutter-project.org.

if I remember correctly, the Shell is using :clip-to-allocation to work around the bug in other places, like the message tray.

> Wasn't the commit supposed to make it work? Here it seems to have achieved the
> opposite ;)

it works as best as it can given the circumstances.

(In reply to comment #1)
> The problem seems to be that the preferred height/width isn't taking line
> wrappiing into account. Simple patch to test-text to test it.

if you pass -1 as the width for get_preferred_height() then the Text actor will not wrap — and it is the intended behaviour: you're asking the PangoLayout to give you it's preferred height for an unlimited width.
Comment 3 Jasper St. Pierre (not reading bugmail) 2011-09-20 19:54:27 UTC
Created attachment 197108 [details] [review]
messageTray: Fix line wrapping

Clutter 1.4 had a bug where it would wrap when it wasn't supposed to, and we
were unknowingly relying on it. Explicitly pass the available width/height
to get a perfect allocation.
Comment 4 drago01 2011-09-20 19:57:15 UTC
Review of attachment 197108 [details] [review]:

Makes sense and works for me.

Re commit message ... are you sure about the 1.4 part? The same code was in use for 1.6. I'd rather mention it was there pre 1.8
Comment 5 Jasper St. Pierre (not reading bugmail) 2011-09-20 20:06:28 UTC
Attachment 197108 [details] pushed as 7e70dfd - messageTray: Fix line wrapping