Summary: Wrap long lines in Messages tab
                 Project: Freeciv
            Submitted by: jtn
            Submitted on: Mon Sep  9 22:49:01 2013
                Category: client-gtk-3.0
                Severity: 1 - Wish
                Priority: 5 - Normal
                  Status: None
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
        Operating System: Any
         Planned Release: 



Currently, a long line in the Messages tab of the Gtk clients will cause a
horizontal scrollbar to appear.

This is particularly annoying if the (default) "Arrange widgets for small
displays" option is set, and the "Message and Chat reports location" is set to
"Separate" or "Split", as this leads to a tall thin Messages window (on the
right-hand side), which many quite reasonable messages will not fit in without
a scrollbar.

The obvious desire is to enable word-wrap for messages in the Messages window.
I can't see any downside to that.

However, it turns out to be surprisingly involved.
* Gtk2's layout engine doesn't really handle the complex interplay of
negotiations necessary to make this do the right thing. I think its
GtkCellRendererText "wrap-width" property sets a fixed width to wrap at, you
can't say "wrap to fit container".
** It might be possible to hook up a resize handler to set "wrap-width" for
the renderer dynamically according to the widget's size allocation, but I
suspect fighting Gtk in this way will cause trouble (the examples I saw had
nasty fudge factors). I suspect we might have to give up on Gtk2.
* Gtk3 has a shiny new layout engine that can handle this properly (search for
"height-for-width", GtkSizeRequest). This is reflected in its documentation
for GtkCellRendererText "wrap-width", which is now "the *minimum* width at
which the text is wrapped."
** Unfortunately, GtkTreeView doesn't yet handle this correctly: bug 653108
<https://bugzilla.gnome.org/show_bug.cgi?id=653108>. If you enable this (as in
the attached patch) your cells get extra vertical space. The Gtk developers
don't seem to be in a hurry to fix this. StackOverflow refers
and has some bodges.


File Attachments:

Date: Mon Sep  9 22:49:01 2013  Name: S2_4-messagewin-wrap.patch  Size: 653B  
By: jtn
S2_4 r23327


Reply to this item at:


  Message sent via/by Gna!

Freeciv-dev mailing list

Reply via email to