Fossil SCM

Minor tweak to the side-by-side alignment algorithm so that it handles pure white-space lines better.

drh 2012-02-07 16:13 trunk
Commit 312590a9ee6040fd5881fe70ef217b9dfb44e7fb
1 file changed +1 -1
+1 -1
--- src/diff.c
+++ src/diff.c
@@ -555,11 +555,11 @@
555555
while( nA>0 && fossil_isspace(zA[0]) ){ nA--; zA++; }
556556
while( nA>0 && fossil_isspace(zA[nA-1]) ){ nA--; }
557557
while( nB>0 && fossil_isspace(zB[0]) ){ nB--; zB++; }
558558
while( nB>0 && fossil_isspace(zB[nB-1]) ){ nB--; }
559559
avg = (nA+nB)/2;
560
- if( avg==0 ) return 100;
560
+ if( avg==0 ) return 0;
561561
best = 0;
562562
for(i=0; i<nA-best; i++){
563563
char c = zA[i];
564564
for(j=0; j<nB-best; j++){
565565
if( c!=zB[j] ) continue;
566566
--- src/diff.c
+++ src/diff.c
@@ -555,11 +555,11 @@
555 while( nA>0 && fossil_isspace(zA[0]) ){ nA--; zA++; }
556 while( nA>0 && fossil_isspace(zA[nA-1]) ){ nA--; }
557 while( nB>0 && fossil_isspace(zB[0]) ){ nB--; zB++; }
558 while( nB>0 && fossil_isspace(zB[nB-1]) ){ nB--; }
559 avg = (nA+nB)/2;
560 if( avg==0 ) return 100;
561 best = 0;
562 for(i=0; i<nA-best; i++){
563 char c = zA[i];
564 for(j=0; j<nB-best; j++){
565 if( c!=zB[j] ) continue;
566
--- src/diff.c
+++ src/diff.c
@@ -555,11 +555,11 @@
555 while( nA>0 && fossil_isspace(zA[0]) ){ nA--; zA++; }
556 while( nA>0 && fossil_isspace(zA[nA-1]) ){ nA--; }
557 while( nB>0 && fossil_isspace(zB[0]) ){ nB--; zB++; }
558 while( nB>0 && fossil_isspace(zB[nB-1]) ){ nB--; }
559 avg = (nA+nB)/2;
560 if( avg==0 ) return 0;
561 best = 0;
562 for(i=0; i<nA-best; i++){
563 char c = zA[i];
564 for(j=0; j<nB-best; j++){
565 if( c!=zB[j] ) continue;
566

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button