changeset 862:e5b80f7085a1

Add %nowrap% to facilitate more complex formatting.
author Ben Schmidt
date Mon, 12 Mar 2012 15:46:20 +1100
parents 331115b58da4
children cb9f1f0bea32
files ChangeLog README.listtexts src/prepstdreply.c
diffstat 3 files changed, 22 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sun Mar 11 23:09:58 2012 +1100
+++ b/ChangeLog	Mon Mar 12 15:46:20 2012 +1100
@@ -1,3 +1,4 @@
+ o Add %nowrap% to facilitate more complex formatting
  o Add subscription ability to php-admin
  o Add ability to except characters from width reckoning (and be zero-width)
    to facilitate wrapping even more languages well
--- a/README.listtexts	Sun Mar 11 23:09:58 2012 +1100
+++ b/README.listtexts	Mon Mar 12 15:46:20 2012 +1100
@@ -251,12 +251,20 @@
 
 - %wrap%
 - %wrap W%
-  concatenate and rewrap lines until the next empty or whitespace-only line to
-  a width of W (or 76 if W is omitted); second and later lines are preceded
-  with as many spaces as the width preceding the directive; the width is
-  reckoned including any text preceding the directive and any indentation
-  preserved from a file which included the current one, so it is an absolute
-  maximum width
+  concatenate and rewrap lines until the next empty line, whitespace-only line,
+  or %nowrap% directive to a width of W (or 76 if W is omitted); second and
+  later lines are preceded with as many spaces as the width preceding the
+  directive; the width is reckoned including any text preceding the directive
+  and any indentation preserved from a file which included the current one, so
+  it is an absolute maximum width
+
+To turn off wrapping before the end of a paragraph, use:
+
+- %nowrap%
+  stop wrapping; usually placed at the end of a line so the following line
+  break is honoured but all preceding text is properly wrapped; if you want
+  wrapping to continue after the break, you need to use %wrap% to turn it on
+  again on the following line
 
 To cater for various languages, there are a number of different wrapping modes
 that can be set. These can be set either before or after wrapping is specified,
--- a/src/prepstdreply.c	Sun Mar 11 23:09:58 2012 +1100
+++ b/src/prepstdreply.c	Mon Mar 12 15:46:20 2012 +1100
@@ -969,6 +969,13 @@
 			*line_p = line;
 			return 0;
 		}
+	} else if(strcmp(token, "nowrap") == 0) {
+		txt->wrapwidth = 0;
+		line = concatstr(2, line, endpos + 1);
+		*pos_p = line + (*pos_p - *line_p);
+		myfree(*line_p);
+		*line_p = line;
+		return 0;
 	} else if(strcmp(token, "ww") == 0 ||
 			strcmp(token, "wordwrap") == 0 ||
 			strcmp(token, "cw") == 0 ||