talons

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

commit f4f722b814ad7ff6f3fa6cb5e83b330275784d97
parent 0b510383802dc6d6a70cf3897b7293799c1ba570
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 @@ -4256,10 +4256,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; @@ -4277,7 +4283,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)