Little refactoring of diff highlight.

Moving cache variable to template instead of in the struct.
This commit is contained in:
Andrey Nering 2016-02-21 18:45:24 -03:00
parent 8ac04a3f29
commit d160c7e565
2 changed files with 5 additions and 8 deletions

View file

@ -161,7 +161,6 @@ type DiffFile struct {
IsBin bool
IsRenamed bool
Sections []*DiffSection
HighlightClass string
}
func (diffFile *DiffFile) GetType() int {
@ -169,10 +168,7 @@ func (diffFile *DiffFile) GetType() int {
}
func (diffFile *DiffFile) GetHighlightClass() string {
if diffFile.HighlightClass == "" {
diffFile.HighlightClass = highlight.FileNameToHighlightClass(diffFile.Name)
}
return diffFile.HighlightClass
return highlight.FileNameToHighlightClass(diffFile.Name)
}
type Diff struct {