Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch respectformatting Excluding Merge-Ins
This is equivalent to a diff from e3df30f45c to 1f2eac618c
|
2014-06-22
| ||
| 02:59 | "Usage" info for "fossil help rss", per mailing list request. (thx Michai Ramakers) ... (check-in: bc30d829ab user: bch tags: trunk) | |
|
2014-06-20
| ||
| 20:56 | Merge updates from trunk. ... (check-in: 265a48d3ec user: mistachkin tags: experimental) | |
| 20:55 | Merge updates from trunk. ... (Closed-Leaf check-in: 1f2eac618c user: mistachkin tags: respectformatting) | |
| 20:54 | Make sure the --width option is honored by all calls into print_timeline(). ... (check-in: e3df30f45c user: mistachkin tags: trunk) | |
| 19:48 | Update comment tests. ... (check-in: fcbfd8b5a1 user: mistachkin tags: respectformatting) | |
| 19:11 | Add and adjust comment tests from the experimental branch. ... (check-in: 2920e7df00 user: mistachkin tags: trunk) | |
Changes to src/comformat.c.
| ︙ | ︙ | |||
42 43 44 45 46 47 48 |
** the left margin and that a single line can contain no more than
** lineLength characters. Indent all subsequent lines by indent.
**
** Return the number of newlines that are output.
*/
int comment_print(const char *zText, int indent, int lineLength){
int tlen = lineLength - indent;
| < | | < < | 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
** the left margin and that a single line can contain no more than
** lineLength characters. Indent all subsequent lines by indent.
**
** Return the number of newlines that are output.
*/
int comment_print(const char *zText, int indent, int lineLength){
int tlen = lineLength - indent;
int len = 0, doIndent = 0, lineCnt = 0;
const char *zLine;
#if defined(_WIN32)
if( lineLength<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;
|
| ︙ | ︙ | |||
78 79 80 81 82 83 84 |
tlen = COMMENT_LEGACY_LINE_LENGTH - indent;
}
#endif
if( zText==0 ) zText = "(NULL)";
if( tlen<=0 ){
tlen = strlen(zText);
}
| < < < < < < | | | | | | < | | | > | | | < < < | > > < < < < < < | | < > > | | | | | | < | | > | < | > | 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
tlen = COMMENT_LEGACY_LINE_LENGTH - indent;
}
#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++;
}
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++;
}
return lineCnt;
}
/*
**
** COMMAND: test-comment-format
**
** Usage: %fossil test-comment-format ?OPTIONS? PREFIX TEXT ?WIDTH?
|
| ︙ | ︙ |
Changes to test/comment.test.
| ︙ | ︙ | |||
34 35 36 37 38 39 40 |
###############################################################################
fossil test-comment-format --decode " " "this is a short comment." 26
test comment-4 {$RESULT eq " this is a short comment.\n(1 lines output)"}
###############################################################################
| | | > | | > | > | > > > > | | | 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
###############################################################################
fossil test-comment-format --decode " " "this is a short comment." 26
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)"}
###############################################################################
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)"}
###############################################################################
# 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 --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)"}
###############################################################################
# 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
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)"}
###############################################################################
fossil test-comment-format "HH:MM:SS " ".....................................................................*" 78
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)"}
###############################################################################
# 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)"}
###############################################################################
# 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)"}
###############################################################################
# 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)"}
###############################################################################
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)"}
###############################################################################
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)"}
###############################################################################
fossil test-comment-format "*TEST* " "one two three four five six seven eight nine ten eleven twelve" 60
test comment-20 {$RESULT eq "*TEST* one two three four five\n six seven eight nine ten\n eleven twelve\n(3 lines output)"}
###############################################################################
fossil test-comment-format --wordbreak "*TEST* " "one two three four five six seven eight nine ten eleven twelve" 60
test comment-21 {$RESULT eq "*TEST* one two three four five\n six seven eight nine ten\n eleven twelve\n(3 lines output)"}
|