GNOME Bugzilla – Bug 549729
Ellipsize set of strings to fit in X space while preserving uniqueness if possible
Last modified: 2018-05-22 12:43:48 UTC
There are many cases where a set of strings needs to be ellipsized to fit into graphical interface elements of a consistent size, but it is important that similar strings remain visually distinct. For example, Web pages in your browser history often have quite similar titles. Sometimes the distinctive part is near the beginning (e.g. "Setting an environment variable for all your apps » as days pass by, by Stuart Langridge"), sometimes it is near the end (e.g. "Rodrigo Moya » Blog Archive » Olympics over"), and sometimes it is near the middle (e.g. "Photos: The ultramobiles of IDF - UMPC-benq image - CNET News"). When these titles are presented in a Web browser's Go/History menu, none of Pango's existing ellipsization options -- PANGO_ELLIPSIZE_UNIQUE_START, PANGO_ELLIPSIZE_MIDDLE, or PANGO_ELLIPSIZE_UNIQUE_END -- will result in unique menu items as often as they could. Other examples of this problem include: * Nautilus's icon view <http://blogs.gnome.org/cneumair/2008/08/16/before-after> * the Name column in Nautilus's list view * the Subject column in a mail program's message list * Pidgin's Accounts menu <http://developer.pidgin.im/ticket/6824#comment:3> * the recent files listed in Totem's "Movie" menu * a window manager's title bars * gnome-panel's window list buttons (bug 99604). For the last example, in bug 99604 comment 7, I devised an algorithm that would produce unique ellipsized names more often than the existing ellipsization options would. The same algorithm could be applied to all these cases, and it is a little tricky to implement, so I suggest it be made available in GTK. If it was fast enough, the algorithm could even be applied to all GTK menus by default. Most menu items wouldn't change, but very long ones would be ellipsized in a useful way without any programmer effort.
See also bug 147608. Thanks to Johan Dahlin for technical advice on this report.
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/pango/issues/140.