From 875e7cfcfd571be7e0a5dfb2c13b784fc60b2f51 Mon Sep 17 00:00:00 2001 From: German Laullon Date: Thu, 9 Dec 2010 13:59:22 -0800 Subject: [PATCH] new diff style --- GLFileView.m | 12 +++++----- html/views/diff/diffWindow.css | 41 +++++++++++++++++++++++++--------- 2 files changed, 37 insertions(+), 16 deletions(-) diff --git a/GLFileView.m b/GLFileView.m index bfc9ea0..d45f969 100644 --- a/GLFileView.m +++ b/GLFileView.m @@ -226,16 +226,17 @@ - (NSString *) parseDiff:(NSString *)txt { txt=[self parseHTML:txt]; - + NSArray *lines = [txt componentsSeparatedByString:@"\n"]; NSString *line; NSMutableString *res=[NSMutableString string]; - [res appendString:@""]; + [res appendString:@"
"]; int l_int,l_count,l_line; int r_int,r_count,r_line; @@ -252,12 +253,11 @@ r_line=r_int=[[pos_r objectAtIndex:0]integerValue]; r_count=[[pos_r objectAtIndex:1]integerValue]; - [res appendString:[NSString stringWithFormat:@"",line]]; + [res appendString:[NSString stringWithFormat:@"",line]]; do{ line=[lines objectAtIndex:++i]; NSString *s=[line substringToIndex:1]; - line=[line substringFromIndex:1]; if([s isEqualToString:@" "]){ [res appendString:[NSString stringWithFormat:@"",l_line++,r_line++]]; @@ -269,10 +269,12 @@ [res appendString:[NSString stringWithFormat:@"",line]]; }while(l_line<(l_int+l_count) && r_line<(r_int+r_count)); + }else{ + [res appendString:[NSString stringWithFormat:@"

%@

",line]]; } i++; } - [res appendString:@"
"]; int i=0; while(i<[lines count]){ line=[lines objectAtIndex:i]; if([[line substringToIndex:2] isEqualToString:@"@@"]){ + [res appendString:@"
%@
%@
%d%d%@
"]; + [res appendString:@""]; return res; } diff --git a/html/views/diff/diffWindow.css b/html/views/diff/diffWindow.css index 7f86fdb..fbe0f9e 100644 --- a/html/views/diff/diffWindow.css +++ b/html/views/diff/diffWindow.css @@ -1,45 +1,64 @@ -table.diff{ +table.diff { + font-family: Menlo, Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; border: 1px solid #8f8f8f; width: 100%; border-collapse: collapse; - margin-left: 5px; margin-right: 5px; + margin-left: 5px; } -table.diff tr td{ - font-family: Menlo, Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; + +table.diff tr td { font-size: 11px; white-space: pre; padding-left: 5px; padding-right: 5px; } -table.diff td.code{ +table.diff td.code { width: 100%; border-left: 2px solid #d0d0d0; } -table.diff tr.header td{ +table.diff tr.header td { border: 1px solid #8f8f8f; padding: 5px; } -table.diff tr td.r{ +table.diff tr td.r { border-left: 1px solid #909090; } -table.diff tr.r{ +table.diff tr.r { background-color: rgba(0,255,0,0.1); } -table.diff tr.l{ +table.diff tr.l { background-color: rgba(255,0,0,0.1); } -table.diff tr.r td.code{ +table.diff tr.r td.code { border-left-color: rgba(0,255,0,0.2); } -table.diff tr.l td.code{ +table.diff tr.l td.code { border-left-color: rgba(255,0,0,0.2); } +table.diff thead tr td p { + margin: 0; +} + +#diff table.diff thead { + background-image: -webkit-gradient(linear,left top,left bottom, color-stop(0, rgba(244, 244, 244,1)), color-stop(1, rgba(215,215,215,1))); +} + +#diff table.diff thead tr td { + padding: 5px; +} + +#diff table.diff tbody tr.header { + background-image: -webkit-gradient(linear,left top,left bottom, color-stop(0, rgba(206,206,206,1)), color-stop(1, rgba(166,166,166,1))); +/* Saf4 + ++, Chrome */ +} \ No newline at end of file