Differences From
Artifact [d1c60722]:
- File
src/diff.c
— part of check-in
[d1fc2f4a]
at
2012-06-20 10:57:05
on branch trunk
— Add a comment that contains multi-byte unicode characters. This will be
used for testing diff logic.
(user:
drh
size: 59506)
- File
src/diff.c
— part of check-in
[484f8d29]
at
2012-06-20 11:02:30
on branch trunk
— Account for multibyte unicode characters when computing column widths for
side-by-side diffs.
(user:
drh
size: 59537)
377 377 #define SBS_PAD 0x0002 /* Pad output to width spaces */
378 378
379 379 /*
380 380 ** Write up to width characters of pLine into p->zLine[]. Translate tabs into
381 381 ** spaces. Add a newline if SBS_NEWLINE is set. Translate HTML characters
382 382 ** if SBS_HTML is set. Pad the rendering out width bytes if SBS_PAD is set.
383 383 **
384 -** This comment contains multi-byte unicode characters (ü, Æ, ð) in order
384 +** This comment contains multibyte unicode characters (ü, Æ, ð) in order
385 385 ** to test the ability of the diff code to handle such characters.
386 386 */
387 387 static void sbsWriteText(SbsLine *p, DLine *pLine, unsigned flags){
388 388 int n = pLine->h & LENGTH_MASK;
389 389 int i; /* Number of input characters consumed */
390 390 int j; /* Number of output characters generated */
391 391 int k; /* Cursor position */
................................................................................
428 428 memcpy(&z[j], "&", 5);
429 429 j += 5;
430 430 }else if( c=='>' && p->escHtml ){
431 431 memcpy(&z[j], ">", 4);
432 432 j += 4;
433 433 }else{
434 434 z[j++] = c;
435 + if( (c&0xc0)==0x80 ) k--;
435 436 }
436 437 }
437 438 if( needEndSpan ){
438 439 memcpy(&z[j], "</span>", 7);
439 440 j += 7;
440 441 }
441 442 if( (flags & SBS_PAD)!=0 ){
................................................................................
883 884 int i, j; /* Loop counters */
884 885 int m, ma, mb;/* Number of lines to output */
885 886 int skip; /* Number of lines to skip */
886 887 int nChunk = 0; /* Number of chunks of diff output seen so far */
887 888 SbsLine s; /* Output line buffer */
888 889
889 890 memset(&s, 0, sizeof(s));
890 - s.zLine = fossil_malloc( 10*width + 200 );
891 + s.zLine = fossil_malloc( 15*width + 200 );
891 892 if( s.zLine==0 ) return;
892 893 s.width = width;
893 894 s.escHtml = escHtml;
894 895 s.iStart = -1;
895 896 s.iStart2 = 0;
896 897 s.iEnd = -1;
897 898 A = p->aFrom;