Quoting original submitter: [...] Anyway, in auto-wrap mode, if a word I'm typing begins with a `/' (for example, /proc , /boot , /etc , etc), it will treat that word and the one before it as one word, eg, ignore any spaces between them. So if I write something like, `Here's a few semi-imaginary filesystems in Linux: /proc /run /dev /sys', it will treat the whole list as if it were one word, and I'll notice some goofy text-wrapping behaviour if I go past the right margin. [...] Fully reproducible with the example provided by reporter, in a compose window type: Here's a few semi-imaginary filesystems in Linux: /proc /run /dev /sys Then you add another " /var" which causes it to wrap, the expected wrapping would be: Here's a few semi-imaginary filesystems in Linux: /proc /run /dev /sys /var But Claws Mail produces: Here's a few semi-imaginary filesystems in Linux: /proc /run /dev /sys /var It also happens with ':' instead '/', for example, so my suspects goes to URL recognition code treating this as URLs and preventing normal wrapping. Thanks in advance,
This happens in function compose_get_line_break_pos(), because after pango_default_break() analyzes the line, the "is_line_break" flag for the '/' and ':' characters (possibly others too) is FALSE. I have no idea why pango would not want to put '/' or ':' at the beginning of line. Following small, dirty hack makes line wrapping before a '/' work fine: diff --git a/src/compose.c b/src/compose.c index 8d8e097ba..4446d75a7 100644 --- a/src/compose.c +++ b/src/compose.c @@ -4259,7 +4259,7 @@ static gboolean compose_get_line_break_pos(GtkTextBuffer *buffer, gunichar wc; gint uri_len; - if (attr->is_line_break && can_break && was_white && !prev_dont_break) + if ((*p == '/' ||attr->is_line_break) && can_break && was_white && !prev_dont_break) pos = i; was_white = attr->is_white; @@ -4280,7 +4280,7 @@ static gboolean compose_get_line_break_pos(GtkTextBuffer *buffer, wc = g_utf8_get_char(p); if (g_unichar_iswide(wc)) { col += 2; - if (prev_dont_break && can_break && attr->is_line_break) + if (prev_dont_break && can_break && (*p == '/' || attr->is_line_break)) pos = i; } else if (*p == '\t') col += 8;
Changes related to this bug have been committed. Please check latest Git and update the bug accordingly. You can also get the patch from: http://git.claws-mail.org/ ++ ChangeLog 2019-01-06 11:26:05.237644143 +0100 http://git.claws-mail.org/?p=claws.git;a=commitdiff;h=f4f722b814ad7ff6f3fa6cb5e83b330275784d97 Author: Andrej Kacian <ticho@claws-mail.org> Date: Sun Jan 6 11:23:19 2019 +0100 Improve line breaks in compose window Fixes bug #3070: misbehaving text wrapping when URL chars are present