talons

Fork of Claws Mail https://www.claws-mail
Log | Files | Refs | README | LICENSE

commit af9f8c535c6875f53522365269ed294629de7238
parent cd9b61fbae9681cd069d08751ddf3f13516a1819
Author: Andrej Kacian <ticho@claws-mail.org>
Date:   Sun,  6 Jan 2019 11:23:19 +0100

Improve line breaks in compose window

Fixes bug #3070: misbehaving text wrapping when URL chars are present

Diffstat:
Msrc/compose.c | 11++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/compose.c b/src/compose.c @@ -4258,10 +4258,16 @@ static gboolean compose_get_line_break_pos(GtkTextBuffer *buffer, for (; *p != '\0' && i < len; i++) { PangoLogAttr *attr = attrs + i; - gunichar wc; + gunichar wc = g_utf8_get_char(p); gint uri_len; - if (attr->is_line_break && can_break && was_white && !prev_dont_break) + /* attr->is_line_break will be false for some characters that + * we want to break a line before, like '/' or ':', so we + * also allow breaking on any non-wide character. The + * mentioned pango attribute is still useful to decide on + * line breaks when wide characters are involved. */ + if ((!g_unichar_iswide(wc) || attr->is_line_break) + && can_break && was_white && !prev_dont_break) pos = i; was_white = attr->is_white; @@ -4279,7 +4285,6 @@ static gboolean compose_get_line_break_pos(GtkTextBuffer *buffer, continue; } - wc = g_utf8_get_char(p); if (g_unichar_iswide(wc)) { col += 2; if (prev_dont_break && can_break && attr->is_line_break)