@@ -550,6 +550,8 @@ - (NSString *) parseBlame:(NSString *)txt
550550 NSMutableDictionary *headers=[NSMutableDictionary dictionary ];
551551 NSMutableString *res=[NSMutableString string ];
552552
553+ NSDateFormatter * dateFormatter = [[NSDateFormatter alloc ] initWithDateFormat: @" %Y-%m-%d %H:%M:%S " allowNaturalLanguage: NO ];
554+
553555 [res appendString: @" <table class='blocks'>\n " ];
554556 int i=0 ;
555557 while (i<[lines count ]){
@@ -561,12 +563,32 @@ - (NSString *) parseBlame:(NSString *)txt
561563 [res appendFormat: @" <tr class='block l%d '>\n " ,nLines];
562564 line=[lines objectAtIndex: ++i];
563565 if ([[[line componentsSeparatedByString: @" " ] objectAtIndex: 0 ] isEqual: @" author" ]){
564- NSString *author=[line stringByReplacingOccurrencesOfString: @" author" withString: @" " ];
566+ NSString *author=[line stringByReplacingOccurrencesOfString: @" author " withString: @" " ];
567+
568+ NSString *timestamp=nil ;
569+ while (timestamp==nil ){
570+ line=[lines objectAtIndex: i++];
571+ if ([[[line componentsSeparatedByString: @" " ] objectAtIndex: 0 ] isEqual: @" author-time" ]){
572+ timestamp=[line stringByReplacingOccurrencesOfString: @" author-time " withString: @" " ];
573+ }
574+ }
575+
576+ NSString *timezone=nil ;
577+ while (timezone==nil ){
578+ line=[lines objectAtIndex: i++];
579+ if ([[[line componentsSeparatedByString: @" " ] objectAtIndex: 0 ] isEqual: @" author-tz" ]){
580+ timezone=[line stringByReplacingOccurrencesOfString: @" author-tz " withString: @" " ];
581+ }
582+ }
583+
584+ NSDate *date = [NSDate dateWithTimeIntervalSince1970: [timestamp doubleValue ]];
585+ NSString *dateString = [NSString stringWithFormat: @" %@ %@ " ,[dateFormatter stringFromDate: date],timezone];
586+
565587 NSString *summary=nil ;
566588 while (summary==nil ){
567589 line=[lines objectAtIndex: i++];
568590 if ([[[line componentsSeparatedByString: @" " ] objectAtIndex: 0 ] isEqual: @" summary" ]){
569- summary=[line stringByReplacingOccurrencesOfString: @" summary" withString: @" " ];
591+ summary=[line stringByReplacingOccurrencesOfString: @" summary " withString: @" " ];
570592 }
571593 }
572594 NSRange trunc_c={0 ,7 };
@@ -583,7 +605,8 @@ - (NSString *) parseBlame:(NSString *)txt
583605 if ([summary length ]>30 ){
584606 truncate_s=[summary substringWithRange: trunc];
585607 }
586- NSString *block=[NSString stringWithFormat: @" <td><p class='author'><a href='' onclick='selectCommit(\" %@ \" ); return false;'>%@ </a> %@ </p><p class='summary'>%@ </p></td>\n <td>\n " ,commitID,truncate_c,truncate_a,truncate_s];
608+ NSString *tooltip = [NSString stringWithFormat: @" %@ \n Author: %@ \n Date: %@ \n\n %@ " ,commitID,author,dateString,summary];
609+ NSString *block=[NSString stringWithFormat: @" <td><p class='author'><a title='%@ ' href='' onclick='selectCommit(\" %@ \" ); return false;'>%@ </a> %@ </p><p class='summary'>%@ </p></td>\n <td>\n " ,tooltip,commitID,truncate_c,truncate_a,truncate_s];
587610 [headers setObject: block forKey: [header objectAtIndex: 0 ]];
588611 }
589612 [res appendString: [headers objectForKey: [header objectAtIndex: 0 ]]];
@@ -703,7 +726,7 @@ - (NSString *)numberOfMatchesString
703726
704727- (void ) updateSearch
705728{
706- [view search: searchField update: YES direction: YES ];
729+ [view search: searchField update: YES grabFocus: NO direction: YES ];
707730 [self updateSearchUI ];
708731}
709732
@@ -725,7 +748,7 @@ - (IBAction)searchFieldChanged:(id)sender
725748{
726749 BOOL update=[[searchField stringValue ] isEqualToString: searchString]? NO : YES ;
727750 searchString=[searchField stringValue ];
728- [view search: searchField update: update direction: YES ];
751+ [view search: searchField update: update grabFocus: YES direction: YES ];
729752 [self updateSearchUI ];
730753}
731754
@@ -734,9 +757,9 @@ - (IBAction)stepperPressed:(id)sender {
734757 NSInteger selectedSegment = [sender selectedSegment ];
735758
736759 if (selectedSegment == 0 )
737- [view search: searchField update: NO direction: NO ];
760+ [view search: searchField update: NO grabFocus: YES direction: NO ];
738761 else
739- [view search: searchField update: NO direction: YES ];
762+ [view search: searchField update: NO grabFocus: YES direction: YES ];
740763}
741764
742765@end
0 commit comments