Fossil SCM
Fix a bug (already present on trunk) with the (non-legacy) comment printing algorithm, detected while running the regression tests from test/comment.test with UTF-8 text: the function to print the indent (modified to a calculate-only function on this branch) was handed a pointer to the current line index and the current line index, thus performing checks at (current line index * 2), causing random increments of the current line index.
Commit
70dd8f744f22c897a4b090321a958c811ff269ae
Parent
2dca9b82d943d36…
1 file changed
+1
-2
+1
-2
| --- src/comformat.c | ||
| +++ src/comformat.c | ||
| @@ -257,12 +257,11 @@ | ||
| 257 | 257 | }else{ |
| 258 | 258 | if( origBreak && index>0 ){ |
| 259 | 259 | const char *zCurrent = &zLine[index]; |
| 260 | 260 | if( comment_check_orig(zOrigText, zCurrent, &charCnt, &lineCnt) ){ |
| 261 | 261 | zBuf[iBuf++] = '\n'; |
| 262 | - comment_calc_indent(zCurrent, origIndent, trimCrLf, trimSpace, | |
| 263 | - &index); | |
| 262 | + comment_calc_indent(zLine, origIndent, trimCrLf, trimSpace, &index); | |
| 264 | 263 | for( i=0; i<origIndent; i++ ){ |
| 265 | 264 | zBuf[iBuf++] = ' '; |
| 266 | 265 | } |
| 267 | 266 | maxChars = lineChars; |
| 268 | 267 | } |
| 269 | 268 |
| --- src/comformat.c | |
| +++ src/comformat.c | |
| @@ -257,12 +257,11 @@ | |
| 257 | }else{ |
| 258 | if( origBreak && index>0 ){ |
| 259 | const char *zCurrent = &zLine[index]; |
| 260 | if( comment_check_orig(zOrigText, zCurrent, &charCnt, &lineCnt) ){ |
| 261 | zBuf[iBuf++] = '\n'; |
| 262 | comment_calc_indent(zCurrent, origIndent, trimCrLf, trimSpace, |
| 263 | &index); |
| 264 | for( i=0; i<origIndent; i++ ){ |
| 265 | zBuf[iBuf++] = ' '; |
| 266 | } |
| 267 | maxChars = lineChars; |
| 268 | } |
| 269 |
| --- src/comformat.c | |
| +++ src/comformat.c | |
| @@ -257,12 +257,11 @@ | |
| 257 | }else{ |
| 258 | if( origBreak && index>0 ){ |
| 259 | const char *zCurrent = &zLine[index]; |
| 260 | if( comment_check_orig(zOrigText, zCurrent, &charCnt, &lineCnt) ){ |
| 261 | zBuf[iBuf++] = '\n'; |
| 262 | comment_calc_indent(zLine, origIndent, trimCrLf, trimSpace, &index); |
| 263 | for( i=0; i<origIndent; i++ ){ |
| 264 | zBuf[iBuf++] = ' '; |
| 265 | } |
| 266 | maxChars = lineChars; |
| 267 | } |
| 268 |