Fossil SCM

Add another flag to the new comment printing algorithm capable of stripping superfluous CR/LFs while preserving other spacing.

mistachkin 2014-07-24 21:27 trunk
Commit d7d265502a660e1dc5ef41fbe6978f32f507a00e
2 files changed +39 -15 +30 -1
+39 -15
--- src/comformat.c
+++ src/comformat.c
@@ -31,13 +31,14 @@
3131
#endif
3232
3333
#if INTERFACE
3434
#define COMMENT_PRINT_NONE ((u32)0x00000000) /* No flags. */
3535
#define COMMENT_PRINT_LEGACY ((u32)0x00000001) /* Use legacy algorithm. */
36
-#define COMMENT_PRINT_TRIM_SPACE ((u32)0x00000002) /* Trim leading/trailing. */
37
-#define COMMENT_PRINT_WORD_BREAK ((u32)0x00000004) /* Break lines on words. */
38
-#define COMMENT_PRINT_ORIG_BREAK ((u32)0x00000008) /* Break before original. */
36
+#define COMMENT_PRINT_TRIM_CRLF ((u32)0x00000002) /* Trim leading CR/LF. */
37
+#define COMMENT_PRINT_TRIM_SPACE ((u32)0x00000004) /* Trim leading/trailing. */
38
+#define COMMENT_PRINT_WORD_BREAK ((u32)0x00000008) /* Break lines on words. */
39
+#define COMMENT_PRINT_ORIG_BREAK ((u32)0x00000010) /* Break before original. */
3940
#define COMMENT_PRINT_DEFAULT (COMMENT_PRINT_LEGACY) /* Defaults. */
4041
#endif
4142
4243
/*
4344
** This is the previous value used by most external callers when they
@@ -142,19 +143,25 @@
142143
** the necessary indenting.
143144
*/
144145
static void comment_print_indent(
145146
const char *zLine, /* [in] The comment line being printed. */
146147
int indent, /* [in] Number of spaces to indent, zero for none. */
148
+ int trimCrLf, /* [in] Non-zero to trim leading/trailing CR/LF. */
147149
int trimSpace, /* [in] Non-zero to trim leading/trailing spaces. */
148150
int *piIndex /* [in/out] Pointer to first non-space character. */
149151
){
150152
if( indent>0 ){
151153
fossil_print("%*s", indent, "");
152154
}
153
- if( trimSpace && zLine && piIndex ){
155
+ if( zLine && piIndex ){
154156
int index = *piIndex;
155
- while( fossil_isspace(zLine[index]) ){ index++; }
157
+ if( trimCrLf ){
158
+ while( zLine[index]=='\r' || zLine[index]=='\n' ){ index++; }
159
+ }
160
+ if( trimSpace ){
161
+ while( fossil_isspace(zLine[index]) ){ index++; }
162
+ }
156163
*piIndex = index;
157164
}
158165
}
159166
160167
/*
@@ -167,20 +174,21 @@
167174
int origIndent, /* [in] Number of spaces to indent before the original
168175
** comment. */
169176
int indent, /* [in] Number of spaces to indent, before the line
170177
** to print. */
171178
int lineChars, /* [in] Maximum number of characters to print. */
179
+ int trimCrLf, /* [in] Non-zero to trim leading/trailing CR/LF. */
172180
int trimSpace, /* [in] Non-zero to trim leading/trailing spaces. */
173181
int wordBreak, /* [in] Non-zero to try breaking on word boundaries. */
174182
int origBreak, /* [in] Non-zero to break before original comment. */
175183
int *pLineCnt, /* [in/out] Pointer to the total line count. */
176184
const char **pzLine /* [out] Pointer to the end of the logical line. */
177185
){
178186
int index = 0, charCnt = 0, lineCnt = 0, maxChars;
179187
if( !zLine ) return;
180188
if( lineChars<=0 ) return;
181
- comment_print_indent(zLine, indent, trimSpace, &index);
189
+ comment_print_indent(zLine, indent, trimCrLf, trimSpace, &index);
182190
maxChars = lineChars;
183191
for(;;){
184192
int useChars = 1;
185193
char c = zLine[index];
186194
if( c==0 ){
@@ -187,11 +195,12 @@
187195
break;
188196
}else{
189197
if( origBreak && index>0 ){
190198
const char *zCurrent = &zLine[index];
191199
if( comment_check_orig(zOrigText, zCurrent, &charCnt, &lineCnt) ){
192
- comment_print_indent(zCurrent, origIndent, trimSpace, &index);
200
+ comment_print_indent(zCurrent, origIndent, trimCrLf, trimSpace,
201
+ &index);
193202
maxChars = lineChars;
194203
}
195204
}
196205
index++;
197206
}
@@ -324,16 +333,26 @@
324333
**
325334
** COMMENT_PRINT_LEGACY: Forces use of the legacy comment printing
326335
** algorithm. For backward compatibility,
327336
** this is the default.
328337
**
329
-** COMMENT_PRINT_TRIM_SPACE: Trims leading and trailing spaces where
330
-** they do not materially impact formatting
331
-** (i.e. at the start of the comment string
332
-** -AND- right before each line indentation).
338
+** COMMENT_PRINT_TRIM_CRLF: Trims leading and trailing carriage-returns
339
+** and line-feeds where they do not materially
340
+** impact pre-existing formatting (i.e. at the
341
+** start of the comment string -AND- right
342
+** before line indentation). This flag does
343
+** not apply to the legacy comment printing
344
+** algorithm. This flag may be combined with
345
+** COMMENT_PRINT_TRIM_SPACE.
346
+**
347
+** COMMENT_PRINT_TRIM_SPACE: Trims leading and trailing spaces where they
348
+** do not materially impact the pre-existing
349
+** formatting (i.e. at the start of the comment
350
+** string -AND- right before line indentation).
333351
** This flag does not apply to the legacy
334
-** comment printing algorithm.
352
+** comment printing algorithm. This flag may
353
+** be combined with COMMENT_PRINT_TRIM_CRLF.
335354
**
336355
** COMMENT_PRINT_WORD_BREAK: Attempts to break lines on word boundaries
337356
** while honoring the logical line length.
338357
** If this flag is not specified, honoring the
339358
** logical line length may result in breaking
@@ -342,11 +361,11 @@
342361
** printing algorithm.
343362
**
344363
** COMMENT_PRINT_ORIG_BREAK: Looks for the original comment text within
345364
** the text being printed. Upon matching, a
346365
** new line will be emitted, thus preserving
347
-** more of the existing formatting.
366
+** more of the pre-existing formatting.
348367
**
349368
** Given a comment string, format that string for printing on a TTY.
350369
** Assume that the output cursors is indent spaces from the left margin
351370
** and that a single line can contain no more than 'width' characters.
352371
** Indent all subsequent lines by 'indent'.
@@ -360,10 +379,11 @@
360379
int width, /* Maximum number of characters per line. */
361380
int flags /* Zero or more "COMMENT_PRINT_*" flags. */
362381
){
363382
int maxChars = width - indent;
364383
int legacy = flags & COMMENT_PRINT_LEGACY;
384
+ int trimCrLf = flags & COMMENT_PRINT_TRIM_CRLF;
365385
int trimSpace = flags & COMMENT_PRINT_TRIM_SPACE;
366386
int wordBreak = flags & COMMENT_PRINT_WORD_BREAK;
367387
int origBreak = flags & COMMENT_PRINT_ORIG_BREAK;
368388
int lineCnt = 0;
369389
const char *zLine;
@@ -387,12 +407,12 @@
387407
return lineCnt;
388408
}
389409
zLine = zText;
390410
for(;;){
391411
comment_print_line(zOrigText, zLine, indent, zLine>zText ? indent : 0,
392
- maxChars, trimSpace, wordBreak, origBreak, &lineCnt,
393
- &zLine);
412
+ maxChars, trimCrLf, trimSpace, wordBreak, origBreak,
413
+ &lineCnt, &zLine);
394414
if( !zLine || !zLine[0] ) break;
395415
}
396416
return lineCnt;
397417
}
398418
@@ -408,10 +428,11 @@
408428
** --file The comment text is really just a file name to
409429
** read it from.
410430
** --decode Decode the text using the same method used when
411431
** handling the value of a C-card from a manifest.
412432
** --legacy Use the legacy comment printing algorithm.
433
+** --trimcrlf Enable trimming of leading/trailing CR/LF.
413434
** --trimspace Enable trimming of leading/trailing spaces.
414435
** --wordbreak Attempt to break lines on word boundaries.
415436
** --origbreak Attempt to break when the original comment text
416437
** is detected.
417438
** --indent Number of spaces to indent (default (-1) is to
@@ -429,10 +450,13 @@
429450
int fromFile = find_option("file", 0, 0)!=0;
430451
int decode = find_option("decode", 0, 0)!=0;
431452
int flags = COMMENT_PRINT_NONE;
432453
if( find_option("legacy", 0, 0) ){
433454
flags |= COMMENT_PRINT_LEGACY;
455
+ }
456
+ if( find_option("trimcrlf", 0, 0) ){
457
+ flags |= COMMENT_PRINT_TRIM_CRLF;
434458
}
435459
if( find_option("trimspace", 0, 0) ){
436460
flags |= COMMENT_PRINT_TRIM_SPACE;
437461
}
438462
if( find_option("wordbreak", 0, 0) ){
439463
--- src/comformat.c
+++ src/comformat.c
@@ -31,13 +31,14 @@
31 #endif
32
33 #if INTERFACE
34 #define COMMENT_PRINT_NONE ((u32)0x00000000) /* No flags. */
35 #define COMMENT_PRINT_LEGACY ((u32)0x00000001) /* Use legacy algorithm. */
36 #define COMMENT_PRINT_TRIM_SPACE ((u32)0x00000002) /* Trim leading/trailing. */
37 #define COMMENT_PRINT_WORD_BREAK ((u32)0x00000004) /* Break lines on words. */
38 #define COMMENT_PRINT_ORIG_BREAK ((u32)0x00000008) /* Break before original. */
 
39 #define COMMENT_PRINT_DEFAULT (COMMENT_PRINT_LEGACY) /* Defaults. */
40 #endif
41
42 /*
43 ** This is the previous value used by most external callers when they
@@ -142,19 +143,25 @@
142 ** the necessary indenting.
143 */
144 static void comment_print_indent(
145 const char *zLine, /* [in] The comment line being printed. */
146 int indent, /* [in] Number of spaces to indent, zero for none. */
 
147 int trimSpace, /* [in] Non-zero to trim leading/trailing spaces. */
148 int *piIndex /* [in/out] Pointer to first non-space character. */
149 ){
150 if( indent>0 ){
151 fossil_print("%*s", indent, "");
152 }
153 if( trimSpace && zLine && piIndex ){
154 int index = *piIndex;
155 while( fossil_isspace(zLine[index]) ){ index++; }
 
 
 
 
 
156 *piIndex = index;
157 }
158 }
159
160 /*
@@ -167,20 +174,21 @@
167 int origIndent, /* [in] Number of spaces to indent before the original
168 ** comment. */
169 int indent, /* [in] Number of spaces to indent, before the line
170 ** to print. */
171 int lineChars, /* [in] Maximum number of characters to print. */
 
172 int trimSpace, /* [in] Non-zero to trim leading/trailing spaces. */
173 int wordBreak, /* [in] Non-zero to try breaking on word boundaries. */
174 int origBreak, /* [in] Non-zero to break before original comment. */
175 int *pLineCnt, /* [in/out] Pointer to the total line count. */
176 const char **pzLine /* [out] Pointer to the end of the logical line. */
177 ){
178 int index = 0, charCnt = 0, lineCnt = 0, maxChars;
179 if( !zLine ) return;
180 if( lineChars<=0 ) return;
181 comment_print_indent(zLine, indent, trimSpace, &index);
182 maxChars = lineChars;
183 for(;;){
184 int useChars = 1;
185 char c = zLine[index];
186 if( c==0 ){
@@ -187,11 +195,12 @@
187 break;
188 }else{
189 if( origBreak && index>0 ){
190 const char *zCurrent = &zLine[index];
191 if( comment_check_orig(zOrigText, zCurrent, &charCnt, &lineCnt) ){
192 comment_print_indent(zCurrent, origIndent, trimSpace, &index);
 
193 maxChars = lineChars;
194 }
195 }
196 index++;
197 }
@@ -324,16 +333,26 @@
324 **
325 ** COMMENT_PRINT_LEGACY: Forces use of the legacy comment printing
326 ** algorithm. For backward compatibility,
327 ** this is the default.
328 **
329 ** COMMENT_PRINT_TRIM_SPACE: Trims leading and trailing spaces where
330 ** they do not materially impact formatting
331 ** (i.e. at the start of the comment string
332 ** -AND- right before each line indentation).
 
 
 
 
 
 
 
 
 
333 ** This flag does not apply to the legacy
334 ** comment printing algorithm.
 
335 **
336 ** COMMENT_PRINT_WORD_BREAK: Attempts to break lines on word boundaries
337 ** while honoring the logical line length.
338 ** If this flag is not specified, honoring the
339 ** logical line length may result in breaking
@@ -342,11 +361,11 @@
342 ** printing algorithm.
343 **
344 ** COMMENT_PRINT_ORIG_BREAK: Looks for the original comment text within
345 ** the text being printed. Upon matching, a
346 ** new line will be emitted, thus preserving
347 ** more of the existing formatting.
348 **
349 ** Given a comment string, format that string for printing on a TTY.
350 ** Assume that the output cursors is indent spaces from the left margin
351 ** and that a single line can contain no more than 'width' characters.
352 ** Indent all subsequent lines by 'indent'.
@@ -360,10 +379,11 @@
360 int width, /* Maximum number of characters per line. */
361 int flags /* Zero or more "COMMENT_PRINT_*" flags. */
362 ){
363 int maxChars = width - indent;
364 int legacy = flags & COMMENT_PRINT_LEGACY;
 
365 int trimSpace = flags & COMMENT_PRINT_TRIM_SPACE;
366 int wordBreak = flags & COMMENT_PRINT_WORD_BREAK;
367 int origBreak = flags & COMMENT_PRINT_ORIG_BREAK;
368 int lineCnt = 0;
369 const char *zLine;
@@ -387,12 +407,12 @@
387 return lineCnt;
388 }
389 zLine = zText;
390 for(;;){
391 comment_print_line(zOrigText, zLine, indent, zLine>zText ? indent : 0,
392 maxChars, trimSpace, wordBreak, origBreak, &lineCnt,
393 &zLine);
394 if( !zLine || !zLine[0] ) break;
395 }
396 return lineCnt;
397 }
398
@@ -408,10 +428,11 @@
408 ** --file The comment text is really just a file name to
409 ** read it from.
410 ** --decode Decode the text using the same method used when
411 ** handling the value of a C-card from a manifest.
412 ** --legacy Use the legacy comment printing algorithm.
 
413 ** --trimspace Enable trimming of leading/trailing spaces.
414 ** --wordbreak Attempt to break lines on word boundaries.
415 ** --origbreak Attempt to break when the original comment text
416 ** is detected.
417 ** --indent Number of spaces to indent (default (-1) is to
@@ -429,10 +450,13 @@
429 int fromFile = find_option("file", 0, 0)!=0;
430 int decode = find_option("decode", 0, 0)!=0;
431 int flags = COMMENT_PRINT_NONE;
432 if( find_option("legacy", 0, 0) ){
433 flags |= COMMENT_PRINT_LEGACY;
 
 
 
434 }
435 if( find_option("trimspace", 0, 0) ){
436 flags |= COMMENT_PRINT_TRIM_SPACE;
437 }
438 if( find_option("wordbreak", 0, 0) ){
439
--- src/comformat.c
+++ src/comformat.c
@@ -31,13 +31,14 @@
31 #endif
32
33 #if INTERFACE
34 #define COMMENT_PRINT_NONE ((u32)0x00000000) /* No flags. */
35 #define COMMENT_PRINT_LEGACY ((u32)0x00000001) /* Use legacy algorithm. */
36 #define COMMENT_PRINT_TRIM_CRLF ((u32)0x00000002) /* Trim leading CR/LF. */
37 #define COMMENT_PRINT_TRIM_SPACE ((u32)0x00000004) /* Trim leading/trailing. */
38 #define COMMENT_PRINT_WORD_BREAK ((u32)0x00000008) /* Break lines on words. */
39 #define COMMENT_PRINT_ORIG_BREAK ((u32)0x00000010) /* Break before original. */
40 #define COMMENT_PRINT_DEFAULT (COMMENT_PRINT_LEGACY) /* Defaults. */
41 #endif
42
43 /*
44 ** This is the previous value used by most external callers when they
@@ -142,19 +143,25 @@
143 ** the necessary indenting.
144 */
145 static void comment_print_indent(
146 const char *zLine, /* [in] The comment line being printed. */
147 int indent, /* [in] Number of spaces to indent, zero for none. */
148 int trimCrLf, /* [in] Non-zero to trim leading/trailing CR/LF. */
149 int trimSpace, /* [in] Non-zero to trim leading/trailing spaces. */
150 int *piIndex /* [in/out] Pointer to first non-space character. */
151 ){
152 if( indent>0 ){
153 fossil_print("%*s", indent, "");
154 }
155 if( zLine && piIndex ){
156 int index = *piIndex;
157 if( trimCrLf ){
158 while( zLine[index]=='\r' || zLine[index]=='\n' ){ index++; }
159 }
160 if( trimSpace ){
161 while( fossil_isspace(zLine[index]) ){ index++; }
162 }
163 *piIndex = index;
164 }
165 }
166
167 /*
@@ -167,20 +174,21 @@
174 int origIndent, /* [in] Number of spaces to indent before the original
175 ** comment. */
176 int indent, /* [in] Number of spaces to indent, before the line
177 ** to print. */
178 int lineChars, /* [in] Maximum number of characters to print. */
179 int trimCrLf, /* [in] Non-zero to trim leading/trailing CR/LF. */
180 int trimSpace, /* [in] Non-zero to trim leading/trailing spaces. */
181 int wordBreak, /* [in] Non-zero to try breaking on word boundaries. */
182 int origBreak, /* [in] Non-zero to break before original comment. */
183 int *pLineCnt, /* [in/out] Pointer to the total line count. */
184 const char **pzLine /* [out] Pointer to the end of the logical line. */
185 ){
186 int index = 0, charCnt = 0, lineCnt = 0, maxChars;
187 if( !zLine ) return;
188 if( lineChars<=0 ) return;
189 comment_print_indent(zLine, indent, trimCrLf, trimSpace, &index);
190 maxChars = lineChars;
191 for(;;){
192 int useChars = 1;
193 char c = zLine[index];
194 if( c==0 ){
@@ -187,11 +195,12 @@
195 break;
196 }else{
197 if( origBreak && index>0 ){
198 const char *zCurrent = &zLine[index];
199 if( comment_check_orig(zOrigText, zCurrent, &charCnt, &lineCnt) ){
200 comment_print_indent(zCurrent, origIndent, trimCrLf, trimSpace,
201 &index);
202 maxChars = lineChars;
203 }
204 }
205 index++;
206 }
@@ -324,16 +333,26 @@
333 **
334 ** COMMENT_PRINT_LEGACY: Forces use of the legacy comment printing
335 ** algorithm. For backward compatibility,
336 ** this is the default.
337 **
338 ** COMMENT_PRINT_TRIM_CRLF: Trims leading and trailing carriage-returns
339 ** and line-feeds where they do not materially
340 ** impact pre-existing formatting (i.e. at the
341 ** start of the comment string -AND- right
342 ** before line indentation). This flag does
343 ** not apply to the legacy comment printing
344 ** algorithm. This flag may be combined with
345 ** COMMENT_PRINT_TRIM_SPACE.
346 **
347 ** COMMENT_PRINT_TRIM_SPACE: Trims leading and trailing spaces where they
348 ** do not materially impact the pre-existing
349 ** formatting (i.e. at the start of the comment
350 ** string -AND- right before line indentation).
351 ** This flag does not apply to the legacy
352 ** comment printing algorithm. This flag may
353 ** be combined with COMMENT_PRINT_TRIM_CRLF.
354 **
355 ** COMMENT_PRINT_WORD_BREAK: Attempts to break lines on word boundaries
356 ** while honoring the logical line length.
357 ** If this flag is not specified, honoring the
358 ** logical line length may result in breaking
@@ -342,11 +361,11 @@
361 ** printing algorithm.
362 **
363 ** COMMENT_PRINT_ORIG_BREAK: Looks for the original comment text within
364 ** the text being printed. Upon matching, a
365 ** new line will be emitted, thus preserving
366 ** more of the pre-existing formatting.
367 **
368 ** Given a comment string, format that string for printing on a TTY.
369 ** Assume that the output cursors is indent spaces from the left margin
370 ** and that a single line can contain no more than 'width' characters.
371 ** Indent all subsequent lines by 'indent'.
@@ -360,10 +379,11 @@
379 int width, /* Maximum number of characters per line. */
380 int flags /* Zero or more "COMMENT_PRINT_*" flags. */
381 ){
382 int maxChars = width - indent;
383 int legacy = flags & COMMENT_PRINT_LEGACY;
384 int trimCrLf = flags & COMMENT_PRINT_TRIM_CRLF;
385 int trimSpace = flags & COMMENT_PRINT_TRIM_SPACE;
386 int wordBreak = flags & COMMENT_PRINT_WORD_BREAK;
387 int origBreak = flags & COMMENT_PRINT_ORIG_BREAK;
388 int lineCnt = 0;
389 const char *zLine;
@@ -387,12 +407,12 @@
407 return lineCnt;
408 }
409 zLine = zText;
410 for(;;){
411 comment_print_line(zOrigText, zLine, indent, zLine>zText ? indent : 0,
412 maxChars, trimCrLf, trimSpace, wordBreak, origBreak,
413 &lineCnt, &zLine);
414 if( !zLine || !zLine[0] ) break;
415 }
416 return lineCnt;
417 }
418
@@ -408,10 +428,11 @@
428 ** --file The comment text is really just a file name to
429 ** read it from.
430 ** --decode Decode the text using the same method used when
431 ** handling the value of a C-card from a manifest.
432 ** --legacy Use the legacy comment printing algorithm.
433 ** --trimcrlf Enable trimming of leading/trailing CR/LF.
434 ** --trimspace Enable trimming of leading/trailing spaces.
435 ** --wordbreak Attempt to break lines on word boundaries.
436 ** --origbreak Attempt to break when the original comment text
437 ** is detected.
438 ** --indent Number of spaces to indent (default (-1) is to
@@ -429,10 +450,13 @@
450 int fromFile = find_option("file", 0, 0)!=0;
451 int decode = find_option("decode", 0, 0)!=0;
452 int flags = COMMENT_PRINT_NONE;
453 if( find_option("legacy", 0, 0) ){
454 flags |= COMMENT_PRINT_LEGACY;
455 }
456 if( find_option("trimcrlf", 0, 0) ){
457 flags |= COMMENT_PRINT_TRIM_CRLF;
458 }
459 if( find_option("trimspace", 0, 0) ){
460 flags |= COMMENT_PRINT_TRIM_SPACE;
461 }
462 if( find_option("wordbreak", 0, 0) ){
463
--- test/comment.test
+++ test/comment.test
@@ -268,11 +268,10 @@
268268
test comment-50 {$RESULT eq "xxxx xx xxxxxxx xxxx xxxxxx xxxxxxx, xxxxxxx, x xxxx xxxxxx xx xxxx xxxx\nxxxxxxx xxxxx xxxx xxxx xx xxxxxxx xxxxxxx (xxxxxx xxxxxxxxx x xxxxx).\nxxx'x xxx xxx xx xxxxx xxxx xxx xxx --xxxxxxxxxxx xxxxxx xx xx xxxx. x\nxxxxx x xxxxxx xxxx xxxx xxxx xxxx xxxx x xxxxx xx xxx x xxxxxxxx\nxxxxxxx.\n(5 lines output)"}
269269
270270
###############################################################################
271271
272272
fossil test-comment-format --width 72 --decode --trimspace --origbreak "" "00:00:00 \[0000000000\] *CURRENT* $orig" $orig
273
-puts $RESULT
274273
test comment-51 {$RESULT eq "00:00:00 \[0000000000\] *CURRENT* \nxxxx xx xxxxxxx xxxx xxxxxx xxxxxxx, xxxxxxx, x xxxx xxxxxx xx xxxx xxxx\nxxxxxxx xxxxx xxxx xxxx xx xxxxxxx xxxxxxx (xxxxxx xxxxxxxxx x xxxxx).\nxxx'x xxx xxx xx xxxxx xxxx xxx xxx --xxxxxxxxxxx xxxxxx xx xx xxxx. x\nxxxxx x xxxxxx xxxx xxxx xxxx xxxx xxxx x xxxxx xx xxx x xxxxxxxx\nxxxxxxx.\n(6 lines output)"}
275274
276275
###############################################################################
277276
278277
fossil test-comment-format --width 81 --indent 9 --decode --trimspace --origbreak " " $orig
@@ -285,5 +284,35 @@
285284
286285
###############################################################################
287286
288287
fossil test-comment-format --width 81 --indent 9 --decode --trimspace --origbreak "00:00:00 " "\[0000000000\] *CURRENT* $orig" $orig
289288
test comment-54 {$RESULT eq "00:00:00 \[0000000000\] *CURRENT* \n xxxx xx xxxxxxx xxxx xxxxxx xxxxxxx, xxxxxxx, x xxxx xxxxxx xx xxxx xxxx\n xxxxxxx xxxxx xxxx xxxx xx xxxxxxx xxxxxxx (xxxxxx xxxxxxxxx x xxxxx).\n xxx'x xxx xxx xx xxxxx xxxx xxx xxx --xxxxxxxxxxx xxxxxx xx xx xxxx. x\n xxxxx x xxxxxx xxxx xxxx xxxx xxxx xxxx x xxxxx xx xxx x xxxxxxxx\n xxxxxxx.\n(6 lines output)"}
289
+
290
+###############################################################################
291
+
292
+fossil test-comment-format --width 72 --decode --trimcrlf --origbreak "" $orig
293
+test comment-55 {$RESULT eq "xxxx xx xxxxxxx xxxx xxxxxx xxxxxxx, xxxxxxx, x xxxx xxxxxx xx xxxx xxxx\nxxxxxxx xxxxx xxxx xxxx xx xxxxxxx xxxxxxx (xxxxxx xxxxxxxxx x xxxxx).\nxxx'x xxx xxx xx xxxxx xxxx xxx xxx --xxxxxxxxxxx xxxxxx xx xx xxxx. x\nxxxxx x xxxxxx xxxx xxxx xxxx xxxx xxxx x xxxxx xx xxx x xxxxxxxx\nxxxxxxx.\n(5 lines output)"}
294
+
295
+###############################################################################
296
+
297
+fossil test-comment-format --width 72 --decode --trimcrlf --origbreak "" $orig $orig
298
+test comment-56 {$RESULT eq "xxxx xx xxxxxxx xxxx xxxxxx xxxxxxx, xxxxxxx, x xxxx xxxxxx xx xxxx xxxx\nxxxxxxx xxxxx xxxx xxxx xx xxxxxxx xxxxxxx (xxxxxx xxxxxxxxx x xxxxx).\nxxx'x xxx xxx xx xxxxx xxxx xxx xxx --xxxxxxxxxxx xxxxxx xx xx xxxx. x\nxxxxx x xxxxxx xxxx xxxx xxxx xxxx xxxx x xxxxx xx xxx x xxxxxxxx\nxxxxxxx.\n(5 lines output)"}
299
+
300
+###############################################################################
301
+
302
+fossil test-comment-format --width 72 --decode --trimcrlf --origbreak "" "00:00:00 \[0000000000\] *CURRENT* $orig" $orig
303
+test comment-57 {$RESULT eq "00:00:00 \[0000000000\] *CURRENT* \nxxxx xx xxxxxxx xxxx xxxxxx xxxxxxx, xxxxxxx, x xxxx xxxxxx xx xxxx xxxx\nxxxxxxx xxxxx xxxx xxxx xx xxxxxxx xxxxxxx (xxxxxx xxxxxxxxx x xxxxx).\nxxx'x xxx xxx xx xxxxx xxxx xxx xxx --xxxxxxxxxxx xxxxxx xx xx xxxx. x\nxxxxx x xxxxxx xxxx xxxx xxxx xxxx xxxx x xxxxx xx xxx x xxxxxxxx\nxxxxxxx.\n(6 lines output)"}
304
+
305
+###############################################################################
306
+
307
+fossil test-comment-format --width 81 --indent 9 --decode --trimcrlf --origbreak " " $orig
308
+test comment-58 {$RESULT eq " xxxx xx xxxxxxx xxxx xxxxxx xxxxxxx, xxxxxxx, x xxxx xxxxxx xx xxxx xxxx\n xxxxxxx xxxxx xxxx xxxx xx xxxxxxx xxxxxxx (xxxxxx xxxxxxxxx x xxxxx).\n xxx'x xxx xxx xx xxxxx xxxx xxx xxx --xxxxxxxxxxx xxxxxx xx xx xxxx. x\n xxxxx x xxxxxx xxxx xxxx xxxx xxxx xxxx x xxxxx xx xxx x xxxxxxxx\n xxxxxxx.\n(5 lines output)"}
309
+
310
+###############################################################################
311
+
312
+fossil test-comment-format --width 81 --indent 9 --decode --trimcrlf --origbreak " " $orig $orig
313
+test comment-59 {$RESULT eq " xxxx xx xxxxxxx xxxx xxxxxx xxxxxxx, xxxxxxx, x xxxx xxxxxx xx xxxx xxxx\n xxxxxxx xxxxx xxxx xxxx xx xxxxxxx xxxxxxx (xxxxxx xxxxxxxxx x xxxxx).\n xxx'x xxx xxx xx xxxxx xxxx xxx xxx --xxxxxxxxxxx xxxxxx xx xx xxxx. x\n xxxxx x xxxxxx xxxx xxxx xxxx xxxx xxxx x xxxxx xx xxx x xxxxxxxx\n xxxxxxx.\n(5 lines output)"}
314
+
315
+###############################################################################
316
+
317
+fossil test-comment-format --width 81 --indent 9 --decode --trimcrlf --origbreak "00:00:00 " "\[0000000000\] *CURRENT* $orig" $orig
318
+test comment-60 {$RESULT eq "00:00:00 \[0000000000\] *CURRENT* \n xxxx xx xxxxxxx xxxx xxxxxx xxxxxxx, xxxxxxx, x xxxx xxxxxx xx xxxx xxxx\n xxxxxxx xxxxx xxxx xxxx xx xxxxxxx xxxxxxx (xxxxxx xxxxxxxxx x xxxxx).\n xxx'x xxx xxx xx xxxxx xxxx xxx xxx --xxxxxxxxxxx xxxxxx xx xx xxxx. x\n xxxxx x xxxxxx xxxx xxxx xxxx xxxx xxxx x xxxxx xx xxx x xxxxxxxx\n xxxxxxx.\n(6 lines output)"}
290319
--- test/comment.test
+++ test/comment.test
@@ -268,11 +268,10 @@
268 test comment-50 {$RESULT eq "xxxx xx xxxxxxx xxxx xxxxxx xxxxxxx, xxxxxxx, x xxxx xxxxxx xx xxxx xxxx\nxxxxxxx xxxxx xxxx xxxx xx xxxxxxx xxxxxxx (xxxxxx xxxxxxxxx x xxxxx).\nxxx'x xxx xxx xx xxxxx xxxx xxx xxx --xxxxxxxxxxx xxxxxx xx xx xxxx. x\nxxxxx x xxxxxx xxxx xxxx xxxx xxxx xxxx x xxxxx xx xxx x xxxxxxxx\nxxxxxxx.\n(5 lines output)"}
269
270 ###############################################################################
271
272 fossil test-comment-format --width 72 --decode --trimspace --origbreak "" "00:00:00 \[0000000000\] *CURRENT* $orig" $orig
273 puts $RESULT
274 test comment-51 {$RESULT eq "00:00:00 \[0000000000\] *CURRENT* \nxxxx xx xxxxxxx xxxx xxxxxx xxxxxxx, xxxxxxx, x xxxx xxxxxx xx xxxx xxxx\nxxxxxxx xxxxx xxxx xxxx xx xxxxxxx xxxxxxx (xxxxxx xxxxxxxxx x xxxxx).\nxxx'x xxx xxx xx xxxxx xxxx xxx xxx --xxxxxxxxxxx xxxxxx xx xx xxxx. x\nxxxxx x xxxxxx xxxx xxxx xxxx xxxx xxxx x xxxxx xx xxx x xxxxxxxx\nxxxxxxx.\n(6 lines output)"}
275
276 ###############################################################################
277
278 fossil test-comment-format --width 81 --indent 9 --decode --trimspace --origbreak " " $orig
@@ -285,5 +284,35 @@
285
286 ###############################################################################
287
288 fossil test-comment-format --width 81 --indent 9 --decode --trimspace --origbreak "00:00:00 " "\[0000000000\] *CURRENT* $orig" $orig
289 test comment-54 {$RESULT eq "00:00:00 \[0000000000\] *CURRENT* \n xxxx xx xxxxxxx xxxx xxxxxx xxxxxxx, xxxxxxx, x xxxx xxxxxx xx xxxx xxxx\n xxxxxxx xxxxx xxxx xxxx xx xxxxxxx xxxxxxx (xxxxxx xxxxxxxxx x xxxxx).\n xxx'x xxx xxx xx xxxxx xxxx xxx xxx --xxxxxxxxxxx xxxxxx xx xx xxxx. x\n xxxxx x xxxxxx xxxx xxxx xxxx xxxx xxxx x xxxxx xx xxx x xxxxxxxx\n xxxxxxx.\n(6 lines output)"}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
290
--- test/comment.test
+++ test/comment.test
@@ -268,11 +268,10 @@
268 test comment-50 {$RESULT eq "xxxx xx xxxxxxx xxxx xxxxxx xxxxxxx, xxxxxxx, x xxxx xxxxxx xx xxxx xxxx\nxxxxxxx xxxxx xxxx xxxx xx xxxxxxx xxxxxxx (xxxxxx xxxxxxxxx x xxxxx).\nxxx'x xxx xxx xx xxxxx xxxx xxx xxx --xxxxxxxxxxx xxxxxx xx xx xxxx. x\nxxxxx x xxxxxx xxxx xxxx xxxx xxxx xxxx x xxxxx xx xxx x xxxxxxxx\nxxxxxxx.\n(5 lines output)"}
269
270 ###############################################################################
271
272 fossil test-comment-format --width 72 --decode --trimspace --origbreak "" "00:00:00 \[0000000000\] *CURRENT* $orig" $orig
 
273 test comment-51 {$RESULT eq "00:00:00 \[0000000000\] *CURRENT* \nxxxx xx xxxxxxx xxxx xxxxxx xxxxxxx, xxxxxxx, x xxxx xxxxxx xx xxxx xxxx\nxxxxxxx xxxxx xxxx xxxx xx xxxxxxx xxxxxxx (xxxxxx xxxxxxxxx x xxxxx).\nxxx'x xxx xxx xx xxxxx xxxx xxx xxx --xxxxxxxxxxx xxxxxx xx xx xxxx. x\nxxxxx x xxxxxx xxxx xxxx xxxx xxxx xxxx x xxxxx xx xxx x xxxxxxxx\nxxxxxxx.\n(6 lines output)"}
274
275 ###############################################################################
276
277 fossil test-comment-format --width 81 --indent 9 --decode --trimspace --origbreak " " $orig
@@ -285,5 +284,35 @@
284
285 ###############################################################################
286
287 fossil test-comment-format --width 81 --indent 9 --decode --trimspace --origbreak "00:00:00 " "\[0000000000\] *CURRENT* $orig" $orig
288 test comment-54 {$RESULT eq "00:00:00 \[0000000000\] *CURRENT* \n xxxx xx xxxxxxx xxxx xxxxxx xxxxxxx, xxxxxxx, x xxxx xxxxxx xx xxxx xxxx\n xxxxxxx xxxxx xxxx xxxx xx xxxxxxx xxxxxxx (xxxxxx xxxxxxxxx x xxxxx).\n xxx'x xxx xxx xx xxxxx xxxx xxx xxx --xxxxxxxxxxx xxxxxx xx xx xxxx. x\n xxxxx x xxxxxx xxxx xxxx xxxx xxxx xxxx x xxxxx xx xxx x xxxxxxxx\n xxxxxxx.\n(6 lines output)"}
289
290 ###############################################################################
291
292 fossil test-comment-format --width 72 --decode --trimcrlf --origbreak "" $orig
293 test comment-55 {$RESULT eq "xxxx xx xxxxxxx xxxx xxxxxx xxxxxxx, xxxxxxx, x xxxx xxxxxx xx xxxx xxxx\nxxxxxxx xxxxx xxxx xxxx xx xxxxxxx xxxxxxx (xxxxxx xxxxxxxxx x xxxxx).\nxxx'x xxx xxx xx xxxxx xxxx xxx xxx --xxxxxxxxxxx xxxxxx xx xx xxxx. x\nxxxxx x xxxxxx xxxx xxxx xxxx xxxx xxxx x xxxxx xx xxx x xxxxxxxx\nxxxxxxx.\n(5 lines output)"}
294
295 ###############################################################################
296
297 fossil test-comment-format --width 72 --decode --trimcrlf --origbreak "" $orig $orig
298 test comment-56 {$RESULT eq "xxxx xx xxxxxxx xxxx xxxxxx xxxxxxx, xxxxxxx, x xxxx xxxxxx xx xxxx xxxx\nxxxxxxx xxxxx xxxx xxxx xx xxxxxxx xxxxxxx (xxxxxx xxxxxxxxx x xxxxx).\nxxx'x xxx xxx xx xxxxx xxxx xxx xxx --xxxxxxxxxxx xxxxxx xx xx xxxx. x\nxxxxx x xxxxxx xxxx xxxx xxxx xxxx xxxx x xxxxx xx xxx x xxxxxxxx\nxxxxxxx.\n(5 lines output)"}
299
300 ###############################################################################
301
302 fossil test-comment-format --width 72 --decode --trimcrlf --origbreak "" "00:00:00 \[0000000000\] *CURRENT* $orig" $orig
303 test comment-57 {$RESULT eq "00:00:00 \[0000000000\] *CURRENT* \nxxxx xx xxxxxxx xxxx xxxxxx xxxxxxx, xxxxxxx, x xxxx xxxxxx xx xxxx xxxx\nxxxxxxx xxxxx xxxx xxxx xx xxxxxxx xxxxxxx (xxxxxx xxxxxxxxx x xxxxx).\nxxx'x xxx xxx xx xxxxx xxxx xxx xxx --xxxxxxxxxxx xxxxxx xx xx xxxx. x\nxxxxx x xxxxxx xxxx xxxx xxxx xxxx xxxx x xxxxx xx xxx x xxxxxxxx\nxxxxxxx.\n(6 lines output)"}
304
305 ###############################################################################
306
307 fossil test-comment-format --width 81 --indent 9 --decode --trimcrlf --origbreak " " $orig
308 test comment-58 {$RESULT eq " xxxx xx xxxxxxx xxxx xxxxxx xxxxxxx, xxxxxxx, x xxxx xxxxxx xx xxxx xxxx\n xxxxxxx xxxxx xxxx xxxx xx xxxxxxx xxxxxxx (xxxxxx xxxxxxxxx x xxxxx).\n xxx'x xxx xxx xx xxxxx xxxx xxx xxx --xxxxxxxxxxx xxxxxx xx xx xxxx. x\n xxxxx x xxxxxx xxxx xxxx xxxx xxxx xxxx x xxxxx xx xxx x xxxxxxxx\n xxxxxxx.\n(5 lines output)"}
309
310 ###############################################################################
311
312 fossil test-comment-format --width 81 --indent 9 --decode --trimcrlf --origbreak " " $orig $orig
313 test comment-59 {$RESULT eq " xxxx xx xxxxxxx xxxx xxxxxx xxxxxxx, xxxxxxx, x xxxx xxxxxx xx xxxx xxxx\n xxxxxxx xxxxx xxxx xxxx xx xxxxxxx xxxxxxx (xxxxxx xxxxxxxxx x xxxxx).\n xxx'x xxx xxx xx xxxxx xxxx xxx xxx --xxxxxxxxxxx xxxxxx xx xx xxxx. x\n xxxxx x xxxxxx xxxx xxxx xxxx xxxx xxxx x xxxxx xx xxx x xxxxxxxx\n xxxxxxx.\n(5 lines output)"}
314
315 ###############################################################################
316
317 fossil test-comment-format --width 81 --indent 9 --decode --trimcrlf --origbreak "00:00:00 " "\[0000000000\] *CURRENT* $orig" $orig
318 test comment-60 {$RESULT eq "00:00:00 \[0000000000\] *CURRENT* \n xxxx xx xxxxxxx xxxx xxxxxx xxxxxxx, xxxxxxx, x xxxx xxxxxx xx xxxx xxxx\n xxxxxxx xxxxx xxxx xxxx xx xxxxxxx xxxxxxx (xxxxxx xxxxxxxxx x xxxxx).\n xxx'x xxx xxx xx xxxxx xxxx xxx xxx --xxxxxxxxxxx xxxxxx xx xx xxxx. x\n xxxxx x xxxxxx xxxx xxxx xxxx xxxx xxxx x xxxxx xx xxx x xxxxxxxx\n xxxxxxx.\n(6 lines output)"}
319

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button