Fix wrapping for good.

This commit is contained in:
Darko Koruga 2001-10-29 14:36:12 +00:00
parent abbfe2d32e
commit 0d0796e4dc
3 changed files with 46 additions and 35 deletions

View file

@ -1,3 +1,13 @@
2001-10-29 [darko]
* src/compose.c
fix wrapping for good
2001-10-29 [darko]
* src/compose.c
undo previous change as it broke the smart wrapping
2001-10-29 [darko] 2001-10-29 [darko]
* src/compose.c * src/compose.c

View file

@ -8,7 +8,7 @@ MINOR_VERSION=6
MICRO_VERSION=4 MICRO_VERSION=4
INTERFACE_AGE=0 INTERFACE_AGE=0
BINARY_AGE=0 BINARY_AGE=0
EXTRA_VERSION=claws13 EXTRA_VERSION=claws14
VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
dnl dnl

View file

@ -2399,20 +2399,16 @@ static void compose_wrap_line_all(Compose *compose)
if (cur_len + ch_len > linewrap_len) { if (cur_len + ch_len > linewrap_len) {
gint tlen; gint tlen;
if (line_len == 0 || line_pos != prev_line_pos) {
/* don't wrap URLs */
if (is_url_string(text, line_pos, text_len))
goto dontwrapurl;
line_len = cur_pos - line_pos;
line_pos = cur_pos;
}
if (text->use_wchar) if (text->use_wchar)
tlen = wctomb(cbuf, (wchar_t)GTK_STEXT_INDEX(text, line_pos - 1)); tlen = wctomb(cbuf, (wchar_t)GTK_STEXT_INDEX(text, line_pos - 1));
else { else {
cbuf[0] = GTK_STEXT_INDEX(text, line_pos - 1); cbuf[0] = GTK_STEXT_INDEX(text, line_pos - 1);
tlen = 1; tlen = 1;
} }
if ((line_pos - prev_line_pos == indent_len) &&
!is_url_string(text, line_pos, text_len))
line_pos = cur_pos;
if (!is_url_string(text, line_pos, text_len)) {
if (tlen == 1 && isspace(*cbuf)) { if (tlen == 1 && isspace(*cbuf)) {
gtk_stext_set_point(text, line_pos); gtk_stext_set_point(text, line_pos);
gtk_stext_backward_delete(text, 1); gtk_stext_backward_delete(text, 1);
@ -2431,12 +2427,15 @@ static void compose_wrap_line_all(Compose *compose)
line_pos++; line_pos++;
cur_len = cur_len - line_len + ch_len; cur_len = cur_len - line_len + ch_len;
line_len = 0; line_len = 0;
}
if (linewrap_quote && quote_len) { if (linewrap_quote && quote_len) {
/* only if line is not already quoted */ /* only if line is not already quoted
if this is long line force wrapping */
if (!gtkstext_str_strcmp(text, line_pos, if (!gtkstext_str_strcmp(text, line_pos,
text_len, quote_fmt)) { text_len, quote_fmt)) {
guint i_len; guint i_len;
if (line_pos - prev_line_pos > indent_len) {
i_len = insert_quote(text, quote_len, i_len = insert_quote(text, quote_len,
indent_len, indent_len,
prev_line_pos, prev_line_pos,
@ -2445,6 +2444,9 @@ static void compose_wrap_line_all(Compose *compose)
gtk_stext_compact_buffer(text); gtk_stext_compact_buffer(text);
text_len += i_len; text_len += i_len;
}
else
continue;
/* for loop above will increase it */ /* for loop above will increase it */
cur_pos = line_pos - 1; cur_pos = line_pos - 1;
cur_len = 0; cur_len = 0;
@ -2457,7 +2459,6 @@ static void compose_wrap_line_all(Compose *compose)
continue; continue;
} }
dontwrapurl:
if (ch_len > 1) { if (ch_len > 1) {
line_pos = cur_pos + 1; line_pos = cur_pos + 1;
line_len = cur_len + ch_len; line_len = cur_len + ch_len;