Index: src/bisect.c ================================================================== --- src/bisect.c +++ src/bisect.c @@ -390,11 +390,11 @@ for(i=0; i #else # include #endif +#if INTERFACE +#define COMMENT_PRINT_NONE ((u32)0x00000000) /* No flags. */ +#define COMMENT_PRINT_LEGACY ((u32)0x00000001) /* Use legacy algorithm. */ +#define COMMENT_PRINT_TRIM_SPACE ((u32)0x00000002) /* Trim leading/trailing. */ +#define COMMENT_PRINT_WORD_BREAK ((u32)0x00000004) /* Break lines on words. */ +#define COMMENT_PRINT_DEFAULT (COMMENT_PRINT_TRIM_SPACE) /* Defaults. */ +#endif + /* ** This is the previous value used by most external callers when they ** needed to specify a default maximum line length to be used with the ** comment_print() function. */ @@ -35,40 +43,164 @@ #ifndef COMMENT_LEGACY_LINE_LENGTH # define COMMENT_LEGACY_LINE_LENGTH (78) #endif /* -** Given a comment string zText, format that string for printing -** on a TTY. Assume that the output cursors is indent spaces from -** the left margin and that a single line can contain no more than -** lineLength characters. Indent all subsequent lines by indent. +** This is the number of spaces to print when a tab character is seen. +*/ +#ifndef COMMENT_TAB_WIDTH +# define COMMENT_TAB_WIDTH (8) +#endif + +/* +** This function scans the specified comment line starting just after the +** initial index and returns the index of the next spacing character -OR- +** zero if such a character cannot be found. For the purposes of this +** algorithm, the NUL character is treated the same as a spacing character. +*/ +static int comment_next_space( + const char *zLine, /* [in] The comment line being printed. */ + int index /* [in] The current character index being handled. */ +){ + int nextIndex = index + 1; + for(;;){ + char c = zLine[nextIndex]; + if( c==0 || fossil_isspace(c) ){ + return nextIndex; + } + nextIndex++; + } + return 0; /* NOT REACHED */ +} + +/* +** This function is called when printing a logical comment line to perform +** the necessary indenting. +*/ +static void comment_print_indent( + const char *zLine, /* [in] The comment line being printed. */ + int indent, /* [in] Number of spaces to indent, zero for none. */ + int trimSpace, /* [in] Non-zero to trim leading/trailing spaces. */ + int *piIndex /* [in/out] Pointer to first non-space character. */ +){ + if( indent>0 ){ + fossil_print("%*s", indent, ""); + if( trimSpace && zLine && piIndex ){ + int index = *piIndex; + while( fossil_isspace(zLine[index]) ){ index++; } + *piIndex = index; + } + } +} + +/* +** This function prints one logical line of a comment, stopping when it hits +** a new line -OR- runs out of space on the logical line. +*/ +static void comment_print_line( + const char *zLine, /* [in] The comment line to print. */ + int indent, /* [in] Number of spaces to indent, zero for none. */ + int lineChars, /* [in] Maximum number of characters to print. */ + int trimSpace, /* [in] Non-zero to trim leading/trailing spaces. */ + int wordBreak, /* [in] Non-zero to try breaking on word boundaries. */ + int *pLineCnt, /* [in/out] Pointer to the total line count. */ + const char **pzLine /* [out] Pointer to the end of the logical line. */ +){ + int index = 0, charCnt = 0, lineCnt = 0, maxChars; + if( !zLine ) return; + if( lineChars<=0 ) return; + comment_print_indent(zLine, indent, trimSpace, &index); + maxChars = lineChars; + for(;;){ + char c = zLine[index]; + if( c==0 ){ + break; + }else{ + index++; + } + if( c=='\n' ){ + charCnt = 0; + lineCnt++; + }else if( c=='\t' ){ + int nextIndex = comment_next_space(zLine, index); + if( nextIndex<=0 || (nextIndex-index)>maxChars ){ + break; + } + charCnt++; + if( maxCharsmaxChars ){ + break; + } + charCnt++; + maxChars--; + }else{ + charCnt++; + maxChars--; + } + fossil_print("%c", c); + if( maxChars==0 ) break; + if( c=='\n' ) break; + } + if( charCnt>0 ){ + fossil_print("\n"); + lineCnt++; + } + if( pLineCnt ){ + *pLineCnt += lineCnt; + } + if( pzLine ){ + *pzLine = zLine + index; + } +} + +/* +** This is the legacy comment printing algorithm. Currently, it is being +** retained primarily for testing and comparison purposes. +** +** Given a comment string, format that string for printing on a TTY. +** Assume that the output cursors is indent spaces from the left margin +** and that a single line can contain no more than width characters. +** Indent all subsequent lines by indent. ** -** Return the number of newlines that are output. +** Returns the number of new lines emitted. */ -int comment_print(const char *zText, int indent, int lineLength){ - int tlen = lineLength - indent; - int len = 0, doIndent = 0, lineCnt = 0; - const char *zLine; +static int comment_print_legacy( + const char *zText, /* The comment text to be printed. */ + int indent, /* Number of spaces to indent each non-initial line. */ + int width /* Maximum number of characters per line. */ +){ + int tlen = width - indent; + int si, sk, i, k; + int doIndent = 0; + char *zBuf; + char zBuffer[400]; + int lineCnt = 0; #if defined(_WIN32) - if( lineLength<0 ){ + if( width<0 ){ CONSOLE_SCREEN_BUFFER_INFO csbi; memset(&csbi, 0, sizeof(CONSOLE_SCREEN_BUFFER_INFO)); if( GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi) ){ tlen = csbi.srWindow.Right - csbi.srWindow.Left - indent; } } #elif defined(TIOCGWINSZ) - if( lineLength<0 ){ + if( width<0 ){ struct winsize w; memset(&w, 0, sizeof(struct winsize)); if( ioctl(0, TIOCGWINSZ, &w)!=-1 ){ tlen = w.ws_col - indent; } } #else - if( lineLength<0 ){ + if( width<0 ){ /* ** Fallback to using more-or-less the "legacy semantics" of hard-coding ** the maximum line length to a value reasonable for the vast majority ** of supported systems. */ @@ -77,42 +209,125 @@ #endif if( zText==0 ) zText = "(NULL)"; if( tlen<=0 ){ tlen = strlen(zText); } - while( fossil_isspace(zText[0]) ){ zText++; } - if( zText[0]==0 ){ - if( !doIndent ){ - fossil_print("\n"); - lineCnt++; + if( tlen >= (sizeof(zBuffer)) ){ + zBuf = fossil_malloc(tlen+1); + }else{ + zBuf = zBuffer; + } + for(;;){ + while( fossil_isspace(zText[0]) ){ zText++; } + if( zText[0]==0 ){ + if( doIndent==0 ){ + fossil_print("\n"); + lineCnt = 1; + } + if( zBuf!=zBuffer) fossil_free(zBuf); + return lineCnt; + } + for(sk=si=i=k=0; zText[i] && k0 && fossil_isalpha(zBuf[k-1]) ){ + si = i+1; + sk = k+1; + } + k++; + } + } + if( doIndent ){ + fossil_print("%*s", indent, ""); + } + doIndent = 1; + if( sk>0 && zText[i] ){ + zText += si; + zBuf[sk] = 0; + }else{ + zText += i; + zBuf[k] = 0; + } + fossil_print("%s\n", zBuf); + lineCnt++; + } +} + +/* +** Given a comment string, format that string for printing on a TTY. +** Assume that the output cursors is indent spaces from the left margin +** and that a single line can contain no more than width characters. +** Indent all subsequent lines by indent. +** +** Returns the number of new lines emitted. +*/ +int comment_print( + const char *zText, /* The comment text to be printed. */ + int indent, /* Number of spaces to indent each non-initial line. */ + int width, /* Maximum number of characters per line. */ + int flags /* Zero or more "COMMENT_PRINT_*" flags, see above. */ +){ + int maxChars = width - indent; + int legacy = flags & COMMENT_PRINT_LEGACY; + int trimSpace = flags & COMMENT_PRINT_TRIM_SPACE; + int wordBreak = flags & COMMENT_PRINT_WORD_BREAK; + int lineCnt = 0; + const char *zLine; + + if( legacy ){ + return comment_print_legacy(zText, indent, width); + } +#if defined(_WIN32) + if( width<0 ){ + CONSOLE_SCREEN_BUFFER_INFO csbi; + memset(&csbi, 0, sizeof(CONSOLE_SCREEN_BUFFER_INFO)); + if( GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi) ){ + maxChars = csbi.srWindow.Right - csbi.srWindow.Left - indent; + } + } +#elif defined(TIOCGWINSZ) + if( width<0 ){ + struct winsize w; + memset(&w, 0, sizeof(struct winsize)); + if( ioctl(0, TIOCGWINSZ, &w)!=-1 ){ + maxChars = w.ws_col - indent; } + } +#else + if( width<0 ){ + /* + ** Fallback to using more-or-less the "legacy semantics" of hard-coding + ** the maximum line length to a value reasonable for the vast majority + ** of supported systems. + */ + maxChars = COMMENT_LEGACY_LINE_LENGTH - indent; + } +#endif + if( zText==0 ) zText = "(NULL)"; + if( maxChars<=0 ){ + maxChars = strlen(zText); + } + if( trimSpace ){ + while( fossil_isspace(zText[0]) ){ zText++; } + } + if( zText[0]==0 ){ + fossil_print("\n"); + lineCnt++; return lineCnt; } zLine = zText; for(;;){ - if( zText[0]==0 ){ - if( doIndent ){ - fossil_print("%*s", indent, ""); - } - fossil_print("%.*s\n", (int)(zText - zLine), zLine); - lineCnt++; - break; - } - len += ((zText[0]=='\t') ? 8 : 1); - if( zText[0]=='\n' || len>=tlen ){ - if( doIndent ){ - fossil_print("%*s", indent, ""); - } - doIndent = 1; - while( !fossil_isspace(zText[0]) ){ zText--; } - fossil_print("%.*s\n", (int)(zText - zLine), zLine); - lineCnt++; - zLine = zText; - if( !zLine++ ) break; - len = 0; - } - zText++; + comment_print_line(zLine, zLine>zText ? indent : 0, maxChars, + trimSpace, wordBreak, &lineCnt, &zLine); + if( !zLine || !zLine[0] ) break; } return lineCnt; } /* @@ -124,18 +339,29 @@ ** Test comment formatting and printing. Use for testing only. ** ** Options: ** --decode Decode the text using the same method used when ** handling the value of a C-card from a manifest. -** --wordbreak This does nothing and is ignored. +** --legacy Use the legacy comment printing algorithm. +** --trimspace Enable trimming of leading/trailing spaces. +** --wordbreak Attempt to break lines on word boundaries. */ void test_comment_format(void){ const char *zPrefix; char *zText; int indent, width; int decode = find_option("decode", 0, 0)!=0; - find_option("wordbreak", 0, 0); /* NOT USED */ + int flags = COMMENT_PRINT_NONE; + if( find_option("legacy", 0, 0) ){ + flags |= COMMENT_PRINT_LEGACY; + } + if( find_option("trimspace", 0, 0) ){ + flags |= COMMENT_PRINT_TRIM_SPACE; + } + if( find_option("wordbreak", 0, 0) ){ + flags |= COMMENT_PRINT_WORD_BREAK; + } if( g.argc!=4 && g.argc!=5 ){ usage("PREFIX TEXT ?WIDTH?"); } zPrefix = g.argv[2]; if( decode ){ @@ -151,8 +377,9 @@ width = -1; /* automatic */ } if( indent>0 ){ fossil_print("%s", zPrefix); } - fossil_print("(%d lines output)\n", comment_print(zText, indent, width)); + fossil_print("(%d lines output)\n", + comment_print(zText, indent, width, flags)); if( zText!=g.argv[3] ) fossil_free(zText); } Index: src/descendants.c ================================================================== --- src/descendants.c +++ src/descendants.c @@ -407,11 +407,11 @@ } n++; sqlite3_snprintf(sizeof(zLineNo), zLineNo, "(%d)", n); fossil_print("%6s ", zLineNo); z = mprintf("%s [%.10s] %s", zDate, zId, zCom); - comment_print(z, 7, width); + comment_print(z, 7, width, COMMENT_PRINT_DEFAULT); fossil_free(z); } fossil_free(zLastBr); db_finalize(&q); } Index: src/finfo.c ================================================================== --- src/finfo.c +++ src/finfo.c @@ -202,20 +202,20 @@ if( iBrief ){ fossil_print("%s ", zDate); zOut = sqlite3_mprintf( "[%.10s] %s (user: %s, artifact: [%.10s], branch: %s)", zCiUuid, zCom, zUser, zFileUuid, zBr); - comment_print(zOut, 11, iWidth); + comment_print(zOut, 11, iWidth, COMMENT_PRINT_DEFAULT); sqlite3_free(zOut); }else{ blob_reset(&line); blob_appendf(&line, "%.10s ", zCiUuid); blob_appendf(&line, "%.10s ", zDate); blob_appendf(&line, "%8.8s ", zUser); blob_appendf(&line, "%8.8s ", zBr); blob_appendf(&line,"%-39.39s", zCom ); - comment_print(blob_str(&line), 0, iWidth); + comment_print(blob_str(&line), 0, iWidth, COMMENT_PRINT_DEFAULT); } } db_finalize(&q); blob_reset(&fname); } Index: src/info.c ================================================================== --- src/info.c +++ src/info.c @@ -132,11 +132,11 @@ fossil_print("tags: %s\n", zTags); } free(zTags); if( zComment ){ fossil_print("comment: "); - comment_print(zComment, 14, -1); + comment_print(zComment, 14, -1, COMMENT_PRINT_DEFAULT); free(zComment); } } /* Index: src/main.c ================================================================== --- src/main.c +++ src/main.c @@ -30,14 +30,14 @@ #if defined(_WIN32) # include #else # include /* errno global */ #endif -#include "zlib.h" #ifdef FOSSIL_ENABLE_SSL # include "openssl/crypto.h" #endif +#include "zlib.h" #if INTERFACE #ifdef FOSSIL_ENABLE_TCL # include "tcl.h" #endif #ifdef FOSSIL_ENABLE_JSON Index: src/merge.c ================================================================== --- src/merge.c +++ src/merge.c @@ -47,11 +47,11 @@ indent-1, zLabel, db_column_text(&q, 3), db_column_text(&q, 1), db_column_text(&q, 0), indent, ""); - comment_print(zCom, indent, -1); + comment_print(zCom, indent, -1, COMMENT_PRINT_DEFAULT); fossil_free(zCom); } db_finalize(&q); } @@ -210,11 +210,11 @@ ); if( db_step(&q)==SQLITE_ROW ){ char *zCom = mprintf("Merging fork [%S] at %s by %s: \"%s\"", db_column_text(&q, 0), db_column_text(&q, 1), db_column_text(&q, 3), db_column_text(&q, 2)); - comment_print(zCom, 0, -1); + comment_print(zCom, 0, -1, COMMENT_PRINT_DEFAULT); fossil_free(zCom); } db_finalize(&q); }else{ usage("?OPTIONS? ?VERSION?"); Index: src/name.c ================================================================== --- src/name.c +++ src/name.c @@ -582,11 +582,11 @@ default: zType = "Unknown"; break; } fossil_print("type: %s by %s on %s\n", zType, db_column_text(&q,2), db_column_text(&q, 1)); fossil_print("comment: "); - comment_print(db_column_text(&q,3), 12, -1); + comment_print(db_column_text(&q,3), 12, -1, COMMENT_PRINT_DEFAULT); } db_finalize(&q); /* Check to see if this object is used as a file in a check-in */ db_prepare(&q, @@ -604,11 +604,11 @@ fossil_print(" part of [%.10s] by %s on %s\n", db_column_text(&q, 1), db_column_text(&q, 3), db_column_text(&q, 2)); fossil_print(" "); - comment_print(db_column_text(&q,4), 12, -1); + comment_print(db_column_text(&q,4), 12, -1, COMMENT_PRINT_DEFAULT); } db_finalize(&q); /* Check to see if this object is used as an attachment */ db_prepare(&q, @@ -639,11 +639,11 @@ db_column_text(&q,7)); } fossil_print(" by user %s on %s\n", db_column_text(&q,2), db_column_text(&q,3)); fossil_print(" "); - comment_print(db_column_text(&q,1), 12, -1); + comment_print(db_column_text(&q,1), 12, -1, COMMENT_PRINT_DEFAULT); } db_finalize(&q); } /* Index: src/printf.c ================================================================== --- src/printf.c +++ src/printf.c @@ -862,12 +862,16 @@ /* ** Force the standard output cursor to move to the beginning ** of a line, if it is not there already. */ -void fossil_force_newline(void){ - if( g.cgiOutput==0 && stdoutAtBOL==0 ) fossil_puts("\n", 0); +int fossil_force_newline(void){ + if( g.cgiOutput==0 && stdoutAtBOL==0 ){ + fossil_puts("\n", 0); + return 1; + } + return 0; } /* ** Indicate that the cursor has moved to the start of a line by means ** other than writing to standard output. Index: src/rss.c ================================================================== --- src/rss.c +++ src/rss.c @@ -204,10 +204,12 @@ } } /* ** COMMAND: rss +** +** Usage: %fossil rss ?OPTIONS? ** ** The CLI variant of the /timeline.rss page, this produces an RSS ** feed of the timeline to stdout. Options: ** ** -type|y FLAG Index: src/stash.c ================================================================== --- src/stash.c +++ src/stash.c @@ -552,11 +552,11 @@ db_column_text(&q, 3) ); zCom = db_column_text(&q, 2); if( zCom && zCom[0] ){ fossil_print(" "); - comment_print(zCom, 7, width); + comment_print(zCom, 7, width, COMMENT_PRINT_DEFAULT); } if( verboseFlag ){ db_bind_int(&q2, "$id", stashid); while( db_step(&q2)==SQLITE_ROW ){ int isAdded = db_column_int(&q2, 0); Index: src/timeline.c ================================================================== --- src/timeline.c +++ src/timeline.c @@ -1610,11 +1610,12 @@ if( fossil_strcmp(zCurrentUuid,zId)==0 ){ sqlite3_snprintf(sizeof(zPrefix)-n, &zPrefix[n], "*CURRENT* "); n += strlen(zPrefix); } zFree = sqlite3_mprintf("[%.10s] %s%s", zUuid, zPrefix, zCom); - nLine += comment_print(zFree, 9, width); /* record another X lines */ + /* record another X lines */ + nLine += comment_print(zFree, 9, width, COMMENT_PRINT_DEFAULT); sqlite3_free(zFree); if(verboseFlag){ if( !fchngQueryInit ){ db_prepare(&fchngQuery, @@ -1971,11 +1972,11 @@ /* ** Set by stats_report_init_view() to one of the y=XXXX values ** accepted by /timeline?y=XXXX. */ -static char const * statsReportTimelineYFlag = NULL; +static const char * statsReportTimelineYFlag = NULL; /* ** Creates a TEMP VIEW named v_reports which is a wrapper around the ** EVENT table filtered on event.type. It looks for the request ** parameter 'type' (reminder: we "should" use 'y' for consistency @@ -1992,12 +1993,12 @@ ** Returns one of: 'c', 'w', 'g', 't', 'e', representing the type of ** filter it applies, or '*' if no filter is applied (i.e. if "all" is ** used). */ static int stats_report_init_view(){ - char const * zType = PD("type","*"); /* analog to /timeline?y=... */ - char const * zRealType = NULL; /* normalized form of zType */ + const char * zType = PD("type","*"); /* analog to /timeline?y=... */ + const char * zRealType = NULL; /* normalized form of zType */ int rc = 0; /* result code */ assert( !statsReportType && "Must not be called more than once." ); switch( (zType && *zType) ? *zType : 0 ){ case 'c': case 'C': @@ -2046,11 +2047,11 @@ ** Returns a string suitable (for a given value of suitable) for ** use in a label with the header of the /reports pages, dependent ** on the 'type' flag. See stats_report_init_view(). ** The returned bytes are static. */ -static char const * stats_report_label_for_type(){ +static const char * stats_report_label_for_type(){ assert( statsReportType && "Must call stats_report_init_view() first." ); switch( statsReportType ){ case 'c': return "checkins"; case 'w': @@ -2071,12 +2072,12 @@ ** time this is called. e.g. if called from the 'byuser' view then ** zCurrentViewName must be "byuser". Any URL parameters which need to ** be added to the generated URLs should be passed in zParam. The ** caller is expected to have already encoded any zParam in the %T or ** %t encoding. */ -static void stats_report_event_types_menu(char const * zCurrentViewName, - char const * zParam){ +static void stats_report_event_types_menu(const char * zCurrentViewName, + const char * zParam){ char * zTop; if(zParam && !*zParam){ zParam = NULL; } zTop = mprintf("%s/reports?view=%s%s%s", g.zTop, zCurrentViewName, @@ -2296,11 +2297,11 @@ @ Yearly total: %d(nEventsPerYear) @ } @ if(nEventTotal){ - char const * zAvgLabel = includeMonth ? "month" : "year"; + const char * zAvgLabel = includeMonth ? "month" : "year"; int nAvg = iterations ? (nEventTotal/iterations) : 0; @
Total events: %d(nEventTotal) @
Average per active %s(zAvgLabel): %d(nAvg) @
} @@ -2386,15 +2387,15 @@ int rowClass = 0; /* counter for alternating row colors */ Blob sql = empty_blob; /* SQL */ int nMaxEvents = 1; /* max number of events for all rows. */ - static char const * daysOfWeek[] = { + static const char * const daysOfWeek[] = { "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" }; - + stats_report_init_view(); stats_report_event_types_menu("byweekday", NULL); blob_append(&sql, "SELECT cast(mtime %% 7 AS INTEGER) dow, " "COUNT(*) AS eventCount " Index: src/tkt.c ================================================================== --- src/tkt.c +++ src/tkt.c @@ -1264,11 +1264,11 @@ fossil_print(" Change "); } fossil_print("%h: ",z); if( blob_size(&val)>50 || contains_newline(&val)) { fossil_print("\n ",blob_str(&val)); - comment_print(blob_str(&val),4,-1); + comment_print(blob_str(&val),4,-1,COMMENT_PRINT_DEFAULT); }else{ fossil_print("%s\n",blob_str(&val)); } blob_reset(&val); } Index: test/comment.test ================================================================== --- test/comment.test +++ test/comment.test @@ -37,42 +37,39 @@ test comment-4 {$RESULT eq " this is a short comment.\n(1 lines output)"} ############################################################################### fossil test-comment-format "*PREFIX* " "this is a short comment." 26 -test comment-5 {$RESULT eq "*PREFIX* this is a short\n comment.\n(2 lines output)"} +test comment-5 {$RESULT eq "*PREFIX* this is a short c\n omment.\n(2 lines output)"} ############################################################################### fossil test-comment-format --decode "*PREFIX* " "this is a short comment." 26 -test comment-6 {$RESULT eq "*PREFIX* this is a short\n comment.\n(2 lines output)"} +test comment-6 {$RESULT eq "*PREFIX* this is a short c\n omment.\n(2 lines output)"} ############################################################################### -# FIXME: Fails with what appears to be garbage output after the text. -fossil test-comment-format "" "this\\sis\\sa\\sshort\\scomment." -test comment-7 {$RESULT eq "this\\sis\\sa\\sshort\\scomment.\n(1 lines output)"} +fossil test-comment-format "" "this\\sis\\sa\\sshort\\scomment." 26 +test comment-7 {$RESULT eq "this\\sis\\sa\\sshort\\scommen\nt.\n(2 lines output)"} ############################################################################### fossil test-comment-format --decode "" "this\\sis\\sa\\sshort\\scomment." 26 test comment-8 {$RESULT eq "this is a short comment.\n(1 lines output)"} ############################################################################### -fossil test-comment-format --decode "HH:MM:SS " "this is a long comment that should span multiple lines if the test is working correctly." 78 -test comment-9 {$RESULT eq "HH:MM:SS this is a long comment that should span multiple lines if the test\n is working correctly.\n(2 lines output)"} +fossil test-comment-format --decode --trimspace "HH:MM:SS " "this is a long comment that should span multiple lines if the test is working correctly." 78 +test comment-9 {$RESULT eq "HH:MM:SS this is a long comment that should span multiple lines if the test is\n working correctly.\n(2 lines output)"} ############################################################################### -# FIXME: Crash. -fossil test-comment-format --decode "HH:MM:SS " "this is a long comment that should span multiple lines if the test is working correctly. more text here describing the issue.\\nanother line here..................................................................................*" 78 +fossil test-comment-format --decode --trimspace "HH:MM:SS " "this is a long comment that should span multiple lines if the test is working correctly. more text here describing the issue.\\nanother line here..................................................................................*" 78 test comment-10 {$RESULT eq "HH:MM:SS this is a long comment that should span multiple lines if the test is\n working correctly. more text here describing the issue.\n another line here....................................................\n ..............................*\n(4 lines output)"} ############################################################################### -# FIXME: Fails with what appears to be garbage output after the text. fossil test-comment-format "HH:MM:SS " "....................................................................................*" 78 test comment-11 {$RESULT eq "HH:MM:SS .....................................................................\n ...............*\n(2 lines output)"} ############################################################################### @@ -80,40 +77,36 @@ test comment-12 {$RESULT eq "HH:MM:SS .....................................................................\n *\n(2 lines output)"} ############################################################################### fossil test-comment-format "*TEST* " "this\tis a test." 26 -test comment-13 {$RESULT eq "*TEST* this is a\n test.\n(2 lines output)"} +test comment-13 {$RESULT eq "*TEST* this\tis a te\n st.\n(2 lines output)"} ############################################################################### -# FIXME: Crash. fossil test-comment-format "*TEST* " "this is a test......................................................................................................................." 60 -test comment-14 {$RESULT eq "*TEST* this is a\n test.................................................\n .....................................................\n .................\n(4 lines output)"} +test comment-14 {$RESULT eq "*TEST* this is a test.......................................\n .....................................................\n ...........................\n(3 lines output)"} ############################################################################### -# FIXME: Crash. fossil test-comment-format --wordbreak "*TEST* " "this is a test......................................................................................................................." 60 test comment-15 {$RESULT eq "*TEST* this is a\n test.................................................\n .....................................................\n .................\n(4 lines output)"} ############################################################################### -# FIXME: Crash. fossil test-comment-format "*TEST* " "this is a test......................................................................................................................." 60 -test comment-16 {$RESULT eq "*TEST* this is a\n test.................................................\n .....................................................\n .................\n(4 lines output)"} +test comment-16 {$RESULT eq "*TEST* this is a\n test.................................................\n .....................................................\n .................\n(4 lines output)"} ############################################################################### -# FIXME: Crash. fossil test-comment-format --wordbreak "*TEST* " "this is a test......................................................................................................................." 60 -test comment-17 {$RESULT eq "*TEST* this is a\n test.................................................\n .....................................................\n .................\n(4 lines output)"} +test comment-17 {$RESULT eq "*TEST* this is a\n test.................................................\n .....................................................\n .................\n(4 lines output)"} ############################################################################### fossil test-comment-format "*TEST* " "one two three four five six seven eight nine ten eleven twelve" 60 -test comment-18 {$RESULT eq "*TEST* one two three four five six seven eight nine ten\n eleven twelve\n(2 lines output)"} +test comment-18 {$RESULT eq "*TEST* one two three four five six seven eight nine ten elev\n en twelve\n(2 lines output)"} ############################################################################### fossil test-comment-format --wordbreak "*TEST* " "one two three four five six seven eight nine ten eleven twelve" 60 test comment-19 {$RESULT eq "*TEST* one two three four five six seven eight nine ten\n eleven twelve\n(2 lines output)"}