aboutsummaryrefslogtreecommitdiffstats
path: root/composer
diff options
context:
space:
mode:
Diffstat (limited to 'composer')
-rw-r--r--composer/ChangeLog7
-rw-r--r--composer/e-msg-composer.c24
2 files changed, 26 insertions, 5 deletions
diff --git a/composer/ChangeLog b/composer/ChangeLog
index 8a26689642..e5ed7fcb51 100644
--- a/composer/ChangeLog
+++ b/composer/ChangeLog
@@ -1,3 +1,10 @@
+2000-06-12 Dan Winship <danw@helixcode.com>
+
+ * e-msg-composer.c (format_text): Don't break on non-breaking
+ spaces, don't keep non-breaking spaces that fall after a line
+ wrap, and translate non-breaking spaces to regular ones after
+ wrapping.
+
2000-06-05 Dan Winship <danw@helixcode.com>
* e-msg-composer.c (e_msg_composer_attach): New convenience
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index 7be0994fa0..48eb7cf15b 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -161,19 +161,33 @@ format_text (char *text)
while (*s) {
len = strcspn (s, "\n");
if (len > LINE_LEN) {
+ /* If we can break anywhere between s and
+ * s + LINE_LEN, do that. We can break between
+ * space and anything but &nbsp;
+ */
space = s + LINE_LEN;
- while (*space != ' ' && space > s)
+ while (space > s && (*space != ' '
+ || (*(space + 1) == '\240')
+ || (*(space - 1) == '\240')))
space--;
if (space != s)
len = space - s;
}
- memcpy (d, s, len);
- s += len;
- if (*s)
+ /* Copy the line... */
+ while (len--) {
+ *d++ = (*s == '\240' ? ' ' : *s);
s++;
- d += len;
+ }
+
+ /* Eat whitespace... */
+ while (*s == ' ' || *s == '\240')
+ s++;
+ if (*s == '\n')
+ s++;
+
+ /* And end the line. */
*d++ = '\n';
}