Fossil SCM
Improvements to the new unified diff algorithm.
Commit
2a256a4cce219e160b2d2f0f95d54897b729a5c6be156c0a031b41754de97bad
Parent
a01e46d85e8788a…
1 file changed
+9
-9
+9
-9
| --- src/diff.c | ||
| +++ src/diff.c | ||
| @@ -1897,39 +1897,39 @@ | ||
| 1897 | 1897 | static void dfunifiedCommon(DiffBuilder *p, const DLine *pLine){ |
| 1898 | 1898 | int iCol = 0; |
| 1899 | 1899 | dfunifiedEmitInsert(p); |
| 1900 | 1900 | p->lnLeft++; |
| 1901 | 1901 | p->lnRight++; |
| 1902 | - blob_appendf(p->pOut,"%6d %6d\n", p->lnLeft, p->lnRight); | |
| 1902 | + blob_appendf(p->pOut,"%6d %6d \n", p->lnLeft, p->lnRight); | |
| 1903 | 1903 | jsonize_to_blob(&p->aCol[0], pLine->z, (int)pLine->n, &iCol); |
| 1904 | 1904 | blob_append_char(&p->aCol[0], '\n'); |
| 1905 | 1905 | } |
| 1906 | 1906 | static void dfunifiedInsert(DiffBuilder *p, const DLine *pLine){ |
| 1907 | 1907 | int iCol = 0; |
| 1908 | 1908 | p->lnRight++; |
| 1909 | - blob_appendf(&p->aCol[1]," <ins>%6d</ins>\n", p->lnRight); | |
| 1910 | - blob_append(&p->aCol[2],"<ins>",-1); | |
| 1909 | + blob_appendf(&p->aCol[1],"<ins> %6d </ins>\n", p->lnRight); | |
| 1910 | + blob_append(&p->aCol[2],"<ins><mark>",-1); | |
| 1911 | 1911 | jsonize_to_blob(&p->aCol[2], pLine->z, (int)pLine->n, &iCol); |
| 1912 | - blob_append(&p->aCol[2], "</ins>\n", -1); | |
| 1912 | + blob_append(&p->aCol[2], "</mark></ins>\n", -1); | |
| 1913 | 1913 | } |
| 1914 | 1914 | static void dfunifiedDelete(DiffBuilder *p, const DLine *pLine){ |
| 1915 | 1915 | int iCol = 0; |
| 1916 | 1916 | p->lnLeft++; |
| 1917 | - blob_appendf(p->pOut,"<del>%6d</del> \n", p->lnLeft); | |
| 1918 | - blob_append(&p->aCol[0],"<del>",-1); | |
| 1917 | + blob_appendf(p->pOut,"<del>%6d </del>\n", p->lnLeft); | |
| 1918 | + blob_append(&p->aCol[0],"<del><mark>",-1); | |
| 1919 | 1919 | jsonize_to_blob(&p->aCol[0], pLine->z, (int)pLine->n, &iCol); |
| 1920 | - blob_append(&p->aCol[0], "</del>\n", -1); | |
| 1920 | + blob_append(&p->aCol[0], "</mark></del>\n", -1); | |
| 1921 | 1921 | } |
| 1922 | 1922 | static void dfunifiedEdit(DiffBuilder *p, const DLine *pX, const DLine *pY){ |
| 1923 | 1923 | int i; |
| 1924 | 1924 | int x; |
| 1925 | 1925 | int iCol; |
| 1926 | 1926 | ChangeSpan span; |
| 1927 | 1927 | oneLineChange(pX, pY, &span); |
| 1928 | 1928 | p->lnLeft++; |
| 1929 | 1929 | p->lnRight++; |
| 1930 | - blob_appendf(p->pOut,"<del>%6d</del> \n", p->lnLeft); | |
| 1930 | + blob_appendf(p->pOut,"<del>%6d </del>\n", p->lnLeft); | |
| 1931 | 1931 | blob_append(&p->aCol[0], "<del>", -1); |
| 1932 | 1932 | for(i=x=iCol=0; i<span.n; i++){ |
| 1933 | 1933 | int ofst = span.a[i].iStart1; |
| 1934 | 1934 | int len = span.a[i].iLen1; |
| 1935 | 1935 | if( len ){ |
| @@ -1941,11 +1941,11 @@ | ||
| 1941 | 1941 | blob_append(&p->aCol[0], "</mark>", 7); |
| 1942 | 1942 | } |
| 1943 | 1943 | } |
| 1944 | 1944 | if( x<pX->n ) jsonize_to_blob(&p->aCol[0], pX->z+x, pX->n - x, &iCol); |
| 1945 | 1945 | blob_append(&p->aCol[0], "</del>\n", -1); |
| 1946 | - blob_appendf(&p->aCol[1]," <ins>%6d</ins>\n", p->lnRight); | |
| 1946 | + blob_appendf(&p->aCol[1],"<ins> %6d </ins>\n", p->lnRight); | |
| 1947 | 1947 | blob_append(&p->aCol[2], "<ins>", -1); |
| 1948 | 1948 | for(i=x=iCol=0; i<span.n; i++){ |
| 1949 | 1949 | int ofst = span.a[i].iStart2; |
| 1950 | 1950 | int len = span.a[i].iLen2; |
| 1951 | 1951 | if( len ){ |
| 1952 | 1952 |
| --- src/diff.c | |
| +++ src/diff.c | |
| @@ -1897,39 +1897,39 @@ | |
| 1897 | static void dfunifiedCommon(DiffBuilder *p, const DLine *pLine){ |
| 1898 | int iCol = 0; |
| 1899 | dfunifiedEmitInsert(p); |
| 1900 | p->lnLeft++; |
| 1901 | p->lnRight++; |
| 1902 | blob_appendf(p->pOut,"%6d %6d\n", p->lnLeft, p->lnRight); |
| 1903 | jsonize_to_blob(&p->aCol[0], pLine->z, (int)pLine->n, &iCol); |
| 1904 | blob_append_char(&p->aCol[0], '\n'); |
| 1905 | } |
| 1906 | static void dfunifiedInsert(DiffBuilder *p, const DLine *pLine){ |
| 1907 | int iCol = 0; |
| 1908 | p->lnRight++; |
| 1909 | blob_appendf(&p->aCol[1]," <ins>%6d</ins>\n", p->lnRight); |
| 1910 | blob_append(&p->aCol[2],"<ins>",-1); |
| 1911 | jsonize_to_blob(&p->aCol[2], pLine->z, (int)pLine->n, &iCol); |
| 1912 | blob_append(&p->aCol[2], "</ins>\n", -1); |
| 1913 | } |
| 1914 | static void dfunifiedDelete(DiffBuilder *p, const DLine *pLine){ |
| 1915 | int iCol = 0; |
| 1916 | p->lnLeft++; |
| 1917 | blob_appendf(p->pOut,"<del>%6d</del> \n", p->lnLeft); |
| 1918 | blob_append(&p->aCol[0],"<del>",-1); |
| 1919 | jsonize_to_blob(&p->aCol[0], pLine->z, (int)pLine->n, &iCol); |
| 1920 | blob_append(&p->aCol[0], "</del>\n", -1); |
| 1921 | } |
| 1922 | static void dfunifiedEdit(DiffBuilder *p, const DLine *pX, const DLine *pY){ |
| 1923 | int i; |
| 1924 | int x; |
| 1925 | int iCol; |
| 1926 | ChangeSpan span; |
| 1927 | oneLineChange(pX, pY, &span); |
| 1928 | p->lnLeft++; |
| 1929 | p->lnRight++; |
| 1930 | blob_appendf(p->pOut,"<del>%6d</del> \n", p->lnLeft); |
| 1931 | blob_append(&p->aCol[0], "<del>", -1); |
| 1932 | for(i=x=iCol=0; i<span.n; i++){ |
| 1933 | int ofst = span.a[i].iStart1; |
| 1934 | int len = span.a[i].iLen1; |
| 1935 | if( len ){ |
| @@ -1941,11 +1941,11 @@ | |
| 1941 | blob_append(&p->aCol[0], "</mark>", 7); |
| 1942 | } |
| 1943 | } |
| 1944 | if( x<pX->n ) jsonize_to_blob(&p->aCol[0], pX->z+x, pX->n - x, &iCol); |
| 1945 | blob_append(&p->aCol[0], "</del>\n", -1); |
| 1946 | blob_appendf(&p->aCol[1]," <ins>%6d</ins>\n", p->lnRight); |
| 1947 | blob_append(&p->aCol[2], "<ins>", -1); |
| 1948 | for(i=x=iCol=0; i<span.n; i++){ |
| 1949 | int ofst = span.a[i].iStart2; |
| 1950 | int len = span.a[i].iLen2; |
| 1951 | if( len ){ |
| 1952 |
| --- src/diff.c | |
| +++ src/diff.c | |
| @@ -1897,39 +1897,39 @@ | |
| 1897 | static void dfunifiedCommon(DiffBuilder *p, const DLine *pLine){ |
| 1898 | int iCol = 0; |
| 1899 | dfunifiedEmitInsert(p); |
| 1900 | p->lnLeft++; |
| 1901 | p->lnRight++; |
| 1902 | blob_appendf(p->pOut,"%6d %6d \n", p->lnLeft, p->lnRight); |
| 1903 | jsonize_to_blob(&p->aCol[0], pLine->z, (int)pLine->n, &iCol); |
| 1904 | blob_append_char(&p->aCol[0], '\n'); |
| 1905 | } |
| 1906 | static void dfunifiedInsert(DiffBuilder *p, const DLine *pLine){ |
| 1907 | int iCol = 0; |
| 1908 | p->lnRight++; |
| 1909 | blob_appendf(&p->aCol[1],"<ins> %6d </ins>\n", p->lnRight); |
| 1910 | blob_append(&p->aCol[2],"<ins><mark>",-1); |
| 1911 | jsonize_to_blob(&p->aCol[2], pLine->z, (int)pLine->n, &iCol); |
| 1912 | blob_append(&p->aCol[2], "</mark></ins>\n", -1); |
| 1913 | } |
| 1914 | static void dfunifiedDelete(DiffBuilder *p, const DLine *pLine){ |
| 1915 | int iCol = 0; |
| 1916 | p->lnLeft++; |
| 1917 | blob_appendf(p->pOut,"<del>%6d </del>\n", p->lnLeft); |
| 1918 | blob_append(&p->aCol[0],"<del><mark>",-1); |
| 1919 | jsonize_to_blob(&p->aCol[0], pLine->z, (int)pLine->n, &iCol); |
| 1920 | blob_append(&p->aCol[0], "</mark></del>\n", -1); |
| 1921 | } |
| 1922 | static void dfunifiedEdit(DiffBuilder *p, const DLine *pX, const DLine *pY){ |
| 1923 | int i; |
| 1924 | int x; |
| 1925 | int iCol; |
| 1926 | ChangeSpan span; |
| 1927 | oneLineChange(pX, pY, &span); |
| 1928 | p->lnLeft++; |
| 1929 | p->lnRight++; |
| 1930 | blob_appendf(p->pOut,"<del>%6d </del>\n", p->lnLeft); |
| 1931 | blob_append(&p->aCol[0], "<del>", -1); |
| 1932 | for(i=x=iCol=0; i<span.n; i++){ |
| 1933 | int ofst = span.a[i].iStart1; |
| 1934 | int len = span.a[i].iLen1; |
| 1935 | if( len ){ |
| @@ -1941,11 +1941,11 @@ | |
| 1941 | blob_append(&p->aCol[0], "</mark>", 7); |
| 1942 | } |
| 1943 | } |
| 1944 | if( x<pX->n ) jsonize_to_blob(&p->aCol[0], pX->z+x, pX->n - x, &iCol); |
| 1945 | blob_append(&p->aCol[0], "</del>\n", -1); |
| 1946 | blob_appendf(&p->aCol[1],"<ins> %6d </ins>\n", p->lnRight); |
| 1947 | blob_append(&p->aCol[2], "<ins>", -1); |
| 1948 | for(i=x=iCol=0; i<span.n; i++){ |
| 1949 | int ofst = span.a[i].iStart2; |
| 1950 | int len = span.a[i].iLen2; |
| 1951 | if( len ){ |
| 1952 |