Skip to content

Commit a78a2c2

Browse files
committed
blame cosmetics
save the html for debug and CSS edit
1 parent cbf7cd3 commit a78a2c2

File tree

4 files changed

+28
-2
lines changed

4 files changed

+28
-2
lines changed

GLFileView.m

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,12 @@ - (void) showFile
7777
id script = [view windowScriptObject];
7878
[script callWebScriptMethod:@"showFile" withArguments:[NSArray arrayWithObject:fileTxt]];
7979
}
80+
81+
#ifdef DEBUG
82+
NSString *dom=[[[[view mainFrame] DOMDocument] documentElement] outerHTML];
83+
NSString *tmpFile=@"~/tmp/test.html";
84+
[dom writeToFile:[tmpFile stringByExpandingTildeInPath] atomically:true encoding:NSUTF8StringEncoding error:nil];
85+
#endif
8086
}
8187

8288
#pragma mark JavaScript log.js methods
@@ -147,6 +153,7 @@ - (void) didLoad
147153

148154
- (NSString *) parseHTML:(NSString *)txt
149155
{
156+
txt=[txt stringByReplacingOccurrencesOfString:@"&" withString:@"&"];
150157
txt=[txt stringByReplacingOccurrencesOfString:@"<" withString:@"&lt;"];
151158
txt=[txt stringByReplacingOccurrencesOfString:@">" withString:@"&gt;"];
152159

@@ -180,7 +187,16 @@ - (NSString *) parseBlame:(NSString *)txt
180187
summary=[line stringByReplacingOccurrencesOfString:@"summary" withString:@""];
181188
}
182189
}
183-
NSString *block=[NSString stringWithFormat:@"<td><p class='author'>%@</p><p class='summary'>%@</p></td>\n<td>\n",author,summary];
190+
NSRange trunc={0,30};
191+
NSString *truncate_a=author;
192+
if([author length]>30){
193+
truncate_a=[author substringWithRange:trunc];
194+
}
195+
NSString *truncate_s=summary;
196+
if([summary length]>30){
197+
truncate_s=[summary substringWithRange:trunc];
198+
}
199+
NSString *block=[NSString stringWithFormat:@"<td><p class='author'>%@</p><p class='summary'>%@</p></td>\n<td>\n",truncate_a,truncate_s];
184200
[headers setObject:block forKey:[header objectAtIndex:0]];
185201
}
186202
[res appendString:[headers objectForKey:[header objectAtIndex:0]]];
@@ -189,6 +205,7 @@ - (NSString *) parseBlame:(NSString *)txt
189205
do{
190206
line=[lines objectAtIndex:i++];
191207
}while([line characterAtIndex:0]!='\t');
208+
line=[line substringFromIndex:1];
192209
line=[line stringByReplacingOccurrencesOfString:@"\t" withString:@"&nbsp;&nbsp;&nbsp;&nbsp;"];
193210
[code appendString:line];
194211
[code appendString:@"\n"];

GitX.xcodeproj/project.pbxproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1590,6 +1590,7 @@
15901590
buildSettings = {
15911591
ARCHS = "$(NATIVE_ARCH_ACTUAL)";
15921592
GCC_ENABLE_OBJC_GC = required;
1593+
GCC_PREPROCESSOR_DEFINITIONS = DEBUG;
15931594
GCC_PREPROCESSOR_DEFINITIONS_NOT_USED_IN_PRECOMPS = DEBUG_BUILD;
15941595
GCC_WARN_ABOUT_RETURN_TYPE = YES;
15951596
GCC_WARN_UNUSED_VARIABLE = YES;

html/css/shThemeGitX.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838
}
3939
.syntaxhighlighter .gutter .line {
4040
border-right: 3px solid #6ce26c !important;
41+
display: block !important;
42+
width: 30px !important;
4143
}
4244
.syntaxhighlighter .gutter .line.highlighted {
4345
background-color: #6ce26c !important;

html/views/blame/blame.css

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,19 @@ body,th, td {
1313
background: transparent !important;
1414
}
1515

16+
p.summary {
17+
}
18+
1619
p{
1720
margin: 0 !important;
1821
padding: 0 !important;
22+
font-size: 11px;
23+
font-family: Menlo, Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;
24+
white-space: nowrap;
1925
}
2026

21-
tr.block.l2 p.summary,
2227
tr.block.l3 p.summary,
28+
tr.block.l2 p.summary,
2329
tr.block.l1 p.summary{
2430
display: none !important;
2531
}

0 commit comments

Comments
 (0)