Fossil

Check-in [07a0ade926]
Login

Check-in [07a0ade926]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Bug fix in the handling of tabs on a side-by-side diff.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 07a0ade926f3bd8af3d1a2cd55b095d6967d8c18
User & Date: drh 2012-02-05 00:22:04.706
Context
2012-02-05
02:43
Fix another bug in table handling for side-by-side diffs. ... (check-in: db1365bc3b user: drh tags: trunk)
00:22
Bug fix in the handling of tabs on a side-by-side diff. ... (check-in: 07a0ade926 user: drh tags: trunk)
2012-02-04
21:40
Fix a harmless compiler warning. ... (check-in: 5bbe190a8c user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/diff.c.
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
/*
** Write up to width characters of pLine into z[].  Translate tabs into
** spaces.  Add a newline if SBS_NEWLINE is set.  Translate HTML characters
** if SBS_HTML is set.  Pad the rendering out width bytes if SBS_PAD is set.
*/
static void sbsWriteText(SbsLine *p, DLine *pLine, unsigned flags){
  int n = pLine->h & LENGTH_MASK;
  int i, j;
  const char *zIn = pLine->z;
  char *z = &p->zLine[p->n];
  int w = p->width;
  if( n>w ) n = w;
  for(i=j=0; i<n; i++){
    char c = zIn[i];
    if( c=='\t' ){
      z[j++] = ' ';
      while( (j&7)!=0 && j<n ) z[j++] = ' ';
    }else if( c=='\r' || c=='\f' ){
      z[j++] = ' ';
    }else if( c=='<' && p->escHtml ){
      memcpy(&z[j], "&lt;", 4);
      j += 4;
    }else if( c=='&' && p->escHtml ){
      memcpy(&z[j], "&amp;", 5);
      j += 5;
    }else if( c=='>' && p->escHtml ){
      memcpy(&z[j], "&gt;", 4);
      j += 4;
    }else{
      z[j++] = c;
    }
  }
  if( (flags & SBS_ENDSPAN) && p->escHtml ){
    memcpy(&z[j], "</span>", 7);
    j += 7;
  }
  if( (flags & SBS_PAD)!=0 ){
    while( i<w ){ i++;  z[j++] = ' '; }
  }
  if( flags & SBS_NEWLINE ){
    z[j++] = '\n';
  }
  p->n += j;
}








|




|



|




















|







382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
/*
** Write up to width characters of pLine into z[].  Translate tabs into
** spaces.  Add a newline if SBS_NEWLINE is set.  Translate HTML characters
** if SBS_HTML is set.  Pad the rendering out width bytes if SBS_PAD is set.
*/
static void sbsWriteText(SbsLine *p, DLine *pLine, unsigned flags){
  int n = pLine->h & LENGTH_MASK;
  int i, j, k;
  const char *zIn = pLine->z;
  char *z = &p->zLine[p->n];
  int w = p->width;
  if( n>w ) n = w;
  for(i=j=k=0; k<n; i++, k++){
    char c = zIn[i];
    if( c=='\t' ){
      z[j++] = ' ';
      while( (k&7)!=0 && k<n ){ z[j++] = ' '; k++; }
    }else if( c=='\r' || c=='\f' ){
      z[j++] = ' ';
    }else if( c=='<' && p->escHtml ){
      memcpy(&z[j], "&lt;", 4);
      j += 4;
    }else if( c=='&' && p->escHtml ){
      memcpy(&z[j], "&amp;", 5);
      j += 5;
    }else if( c=='>' && p->escHtml ){
      memcpy(&z[j], "&gt;", 4);
      j += 4;
    }else{
      z[j++] = c;
    }
  }
  if( (flags & SBS_ENDSPAN) && p->escHtml ){
    memcpy(&z[j], "</span>", 7);
    j += 7;
  }
  if( (flags & SBS_PAD)!=0 ){
    while( k<w ){ k++;  z[j++] = ' '; }
  }
  if( flags & SBS_NEWLINE ){
    z[j++] = '\n';
  }
  p->n += j;
}