summaryrefslogtreecommitdiff
path: root/pith/string.c
diff options
context:
space:
mode:
authorEduardo Chappa <chappa@washington.edu>2015-04-09 00:28:00 -0600
committerEduardo Chappa <chappa@washington.edu>2015-04-09 00:28:00 -0600
commitbf49fb6584bfd8c4cfae5bab4c5f46b155bcb5a7 (patch)
treefd2331aed583538bab27f28dca105ee37b654327 /pith/string.c
parentec605304db0b92d68e151574ab0f80babee6d4a6 (diff)
downloadalpine-bf49fb6584bfd8c4cfae5bab4c5f46b155bcb5a7.tar.xz
* When sending a message, allow for 512 characters of consecutive non-white
space before folding the subject line.
Diffstat (limited to 'pith/string.c')
-rw-r--r--pith/string.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/pith/string.c b/pith/string.c
index b3413561..c7ef310c 100644
--- a/pith/string.c
+++ b/pith/string.c
@@ -1588,6 +1588,18 @@ fold(char *src, int width, int maxwidth, char *first_indent, char *indent, unsig
}
}
+ if(winner == -1 && (flags & FLD_NEXTSPC)){
+ for(i = starting_point; winner == -1 && i <= strlen(next_piece) != '\0' && i < 512; i++){
+ endptr = utf8_count_forw_width(next_piece, i, &got_width);
+ if(endptr && got_width == i && isspace((unsigned char) *endptr))
+ winner = (int) i;
+ }
+ if(winner == -1){
+ winner = got_width < 512 ? got_width : 512;
+ endptr = NULL;
+ }
+ }
+
if(winner == -1){ /* if no good folding spot, fold at width */
winner = starting_point;
endptr = NULL;
@@ -1652,6 +1664,18 @@ fold(char *src, int width, int maxwidth, char *first_indent, char *indent, unsig
}
}
+ if(winner == -1 && (flags & FLD_NEXTSPC)){
+ for(i = starting_point; winner == -1 && i <= strlen(next_piece) && i < 512; i++){
+ endptr = utf8_count_forw_width(next_piece, i, &got_width);
+ if(endptr && got_width == i && isspace((unsigned char) *endptr))
+ winner = (int) i;
+ }
+ if(winner == -1){
+ winner = got_width < 512 ? got_width : 512;
+ endptr = NULL;
+ }
+ }
+
if(winner == -1){ /* if no good folding spot, fold at width */
winner = starting_point;
endptr = NULL;