Package: tin
Version: 1:2.1.1-1
Severity: wishlist
Tags: patch

Dear Maintainer,
tin should wrap lines between and not within words, except when a single word
is longer than a line. The attached patch probably does this.

Best regards,
Tilmann Hentze.

-- System Information:
Debian Release: 7.0
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'stable')
Architecture: i386 (i686)

Kernel: Linux 3.2.0-4-686-pae (SMP w/1 CPU core)
Locale: LANG=POSIX, LC_CTYPE=de_AT.utf-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages tin depends on:
ii  cdebconf [debconf-2.0]  0.181
ii  debconf [debconf-2.0]   1.5.49
ii  libc6                   2.13-37
ii  libcanlock2             2b-6
ii  libicu48                4.8.1.1-10
ii  libncursesw5            5.9-10
ii  libpcre3                1:8.30-5
ii  libtinfo5               5.9-10
ii  libuu0                  0.5.20-3.3

Versions of packages tin recommends:
ii  postfix [mail-transport-agent]  2.9.3-2.1

Versions of packages tin suggests:
ii  gnupg   1.4.12-7
ii  ispell  3.3.02-6

-- Configuration Files:
/etc/tin/tin.defaults changed [not included]

-- debconf information excluded
--- a/src/cook.c
+++ b/src/cook.c
@@ -210,6 +210,7 @@ put_cooked(
 	char *p, *bufp, *buf;
 	int wrap_column;
 	int space;
+	char *blank_p = NULL;
 /*	static int overflow = 0; */ /* TODO: we don't use it (anymore?) */
 	static int saved_flags = 0;
 	va_list ap;
@@ -244,16 +245,22 @@ put_cooked(
 			while (space > 0 && *p && *p != '\n') {
 #if defined(MULTIBYTE_ABLE) && !defined(NO_LOCALE)
 				if ((bytes = mbtowc((wchar_t *) wp, p, MB_CUR_MAX)) > 0) {
+					if (iswspace(*wp)) blank_p = p;
 					if ((space -= wcwidth(*wp)) < 0)
 						break;
 					p += bytes;
 				} else
 					p++;
 #else
+				if (isspace(*p)) blank_p = p;
 				p++;
 				space--;
 #endif /* MULTIBYTE_ABLE && !NO_LOCALE */
 			}
+		  	if (blank_p != NULL && *p != '\n') {
+				p = blank_p + 1;
+				blank_p = NULL;
+			}
 		} else {
 			while (*p && *p != '\n')
 				p++;

Reply via email to