Fossil SCM

Bug fix in the context-diff colorization.

drh 2012-02-04 20:00 UTC retro-sbsdiff
Commit ecf30837d417c03c9635bba9d183e4528ed5ed2e
1 file changed +4 -1
+4 -1
--- src/diff.c
+++ src/diff.c
@@ -152,16 +152,19 @@
152152
** Append a single line of "diff" output to pOut.
153153
*/
154154
static void appendDiffLine(Blob *pOut, char cPrefix, DLine *pLine, int html){
155155
blob_append(pOut, &cPrefix, 1);
156156
if( html ){
157
+ char *zHtml;
157158
if( cPrefix=='+' ){
158159
blob_append(pOut, "<span class=\"diffadd\">", -1);
159160
}else if( cPrefix=='-' ){
160161
blob_append(pOut, "<span class=\"diffrm\">", -1);
161162
}
162
- blob_appendf(pOut, "%.*h", (pLine->h & LENGTH_MASK), pLine->z);
163
+ zHtml = htmlize(pLine->z, (pLine->h & LENGTH_MASK));
164
+ blob_append(pOut, zHtml, -1);
165
+ fossil_free(zHtml);
163166
if( cPrefix!=' ' ){
164167
blob_append(pOut, "</span>", -1);
165168
}
166169
}else{
167170
blob_append(pOut, pLine->z, pLine->h & LENGTH_MASK);
168171
--- src/diff.c
+++ src/diff.c
@@ -152,16 +152,19 @@
152 ** Append a single line of "diff" output to pOut.
153 */
154 static void appendDiffLine(Blob *pOut, char cPrefix, DLine *pLine, int html){
155 blob_append(pOut, &cPrefix, 1);
156 if( html ){
 
157 if( cPrefix=='+' ){
158 blob_append(pOut, "<span class=\"diffadd\">", -1);
159 }else if( cPrefix=='-' ){
160 blob_append(pOut, "<span class=\"diffrm\">", -1);
161 }
162 blob_appendf(pOut, "%.*h", (pLine->h & LENGTH_MASK), pLine->z);
 
 
163 if( cPrefix!=' ' ){
164 blob_append(pOut, "</span>", -1);
165 }
166 }else{
167 blob_append(pOut, pLine->z, pLine->h & LENGTH_MASK);
168
--- src/diff.c
+++ src/diff.c
@@ -152,16 +152,19 @@
152 ** Append a single line of "diff" output to pOut.
153 */
154 static void appendDiffLine(Blob *pOut, char cPrefix, DLine *pLine, int html){
155 blob_append(pOut, &cPrefix, 1);
156 if( html ){
157 char *zHtml;
158 if( cPrefix=='+' ){
159 blob_append(pOut, "<span class=\"diffadd\">", -1);
160 }else if( cPrefix=='-' ){
161 blob_append(pOut, "<span class=\"diffrm\">", -1);
162 }
163 zHtml = htmlize(pLine->z, (pLine->h & LENGTH_MASK));
164 blob_append(pOut, zHtml, -1);
165 fossil_free(zHtml);
166 if( cPrefix!=' ' ){
167 blob_append(pOut, "</span>", -1);
168 }
169 }else{
170 blob_append(pOut, pLine->z, pLine->h & LENGTH_MASK);
171

Keyboard Shortcuts

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