GNOME Bugzilla – Bug 308126
GtkTextView in GTK_WRAP_WORD_CHAR does not break lines with ? symbols correctly
Last modified: 2018-05-22 12:10:11 UTC
Please describe the problem: In a GtkTextView in GTK_WRAP_WORD_CHAR mode, contained in a GtkScrolledWindow, if there is a line with many "?" characters in sequence, with no space between them, so many that the line does not fit the width, the line is not broken and the horizontal scroll bar must be used to view the entire line. Steps to reproduce: 1. I'll attach a small program showing the bug. Actual results: The line is not wrapped, being wider than the GtkTextView width. Expected results: The line should be broken even in the middle of the "word", I believe the GTK_WRAP_WORD_CHAR mode means that lines will be broken even inside words if necessary, so that horizontal scrolling is never necessary. Does this happen every time? Yes. Other information:
Created attachment 47930 [details] This small program shows the bug.
Confirming on pango/gtk+ CVS HEAD. I'm experiencing this problem in one of my applications as well. Pretty annoying if you want to be ensured that no horizontal scrollbar appears, but it still does. I suspect the big row of question marks (or period marks, or quite some others) is considered one whole grapheme by pango?
*** This bug has been marked as a duplicate of 131625 ***
To me, this isn't the same issue as 131625; 131625 is mostly about white space and contains considerably discussion of the WRAP_WORD case as well. This bug is more simple ... the question is; does WRAP_CHAR mean: A) Break anywhere Or B) Allow breaks inside words (in other words, use Asian-style line breaking for all languages.) Apparently it means B), but I'm not sure when that's useful. If it is useful, then we might want WRAP_ANYWHERE or something like that as an API addition.
Owen hit the core of my problem with his question. I'd like to add a specific use-case concerning the chosen answer. I'm attaching my test-case program and a diagram of my bug demonstrated with the test-case program. Compile the test-case program with: gcc `pkg-config --cflags --libs gtk+-2.0` main.c The test-case program uses a monospace font with PANGO_WRAP_CHAR to layout the entire paragraph of text. Steps to recreate bug: 1. This bug is easily produced using the first line of text. Any line lower makes this more difficult. 2. Resize the window so the first line ends with a period. Many other punctuation marks reproduce this bug as well, but not all. 3. Now, resize the window so the period's checker cell is partially obscured. This will force the period to the next line. The bug occurs when the period drags the single character before it to the next line, leaving an empty space at the end of the previous line.
Created attachment 85624 [details] Diagram of character wrap bug Diagram demonstrates bug using subsequently attached test-case program.
Created attachment 85625 [details] Test-case program Test-case program of PANGO_WRAP_CHAR bug.
Moving to Pango
-- 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/26.