Semantic fixes.
This commit is contained in:
parent
81ed5c4bee
commit
bf11ad19ea
1 changed files with 11 additions and 11 deletions
|
@ -19,31 +19,31 @@ import (
|
||||||
"github.com/Unknwon/com"
|
"github.com/Unknwon/com"
|
||||||
"golang.org/x/net/html/charset"
|
"golang.org/x/net/html/charset"
|
||||||
"golang.org/x/text/transform"
|
"golang.org/x/text/transform"
|
||||||
|
"github.com/sergi/go-diff/diffmatchpatch"
|
||||||
|
|
||||||
"github.com/gogits/git-module"
|
"github.com/gogits/git-module"
|
||||||
|
|
||||||
"github.com/gogits/gogs/modules/base"
|
"github.com/gogits/gogs/modules/base"
|
||||||
"github.com/gogits/gogs/modules/log"
|
"github.com/gogits/gogs/modules/log"
|
||||||
"github.com/gogits/gogs/modules/process"
|
"github.com/gogits/gogs/modules/process"
|
||||||
"github.com/sergi/go-diff/diffmatchpatch"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type DiffLineType uint8
|
type DiffLineType uint8
|
||||||
|
|
||||||
const (
|
const (
|
||||||
DIFF_LINE_PLAIN DiffLineType = iota + 1
|
DIFF_LINE_PLAIN DiffLineType = iota + 1
|
||||||
DIFF_LINE_ADD DiffLineType = iota + 1
|
DIFF_LINE_ADD
|
||||||
DIFF_LINE_DEL DiffLineType = iota + 1
|
DIFF_LINE_DEL
|
||||||
DIFF_LINE_SECTION DiffLineType = iota + 1
|
DIFF_LINE_SECTION
|
||||||
)
|
)
|
||||||
|
|
||||||
type DiffFileType uint8
|
type DiffFileType uint8
|
||||||
|
|
||||||
const (
|
const (
|
||||||
DIFF_FILE_ADD DiffFileType = iota + 1
|
DIFF_FILE_ADD DiffFileType = iota + 1
|
||||||
DIFF_FILE_CHANGE DiffFileType = iota + 1
|
DIFF_FILE_CHANGE
|
||||||
DIFF_FILE_DEL DiffFileType = iota + 1
|
DIFF_FILE_DEL
|
||||||
DIFF_FILE_RENAME DiffFileType = iota + 1
|
DIFF_FILE_RENAME
|
||||||
)
|
)
|
||||||
|
|
||||||
type DiffLine struct {
|
type DiffLine struct {
|
||||||
|
@ -80,7 +80,7 @@ func diffToHtml(diffRecord []diffmatchpatch.Diff, lineType DiffLineType) templat
|
||||||
func (diffSection *DiffSection) GetLeftLine(idx int, sliceIdx int) *DiffLine {
|
func (diffSection *DiffSection) GetLeftLine(idx int, sliceIdx int) *DiffLine {
|
||||||
for i, diffLine := range diffSection.Lines {
|
for i, diffLine := range diffSection.Lines {
|
||||||
if diffLine.LeftIdx == idx && diffLine.RightIdx == 0 {
|
if diffLine.LeftIdx == idx && diffLine.RightIdx == 0 {
|
||||||
// ignore the the lines are too far from each other
|
// ignore if the lines are too far from each other
|
||||||
if i > sliceIdx-5 && i < sliceIdx+5 {
|
if i > sliceIdx-5 && i < sliceIdx+5 {
|
||||||
return diffLine
|
return diffLine
|
||||||
} else {
|
} else {
|
||||||
|
@ -94,7 +94,7 @@ func (diffSection *DiffSection) GetLeftLine(idx int, sliceIdx int) *DiffLine {
|
||||||
func (diffSection *DiffSection) GetRightLine(idx int, sliceIdx int) *DiffLine {
|
func (diffSection *DiffSection) GetRightLine(idx int, sliceIdx int) *DiffLine {
|
||||||
for i, diffLine := range diffSection.Lines {
|
for i, diffLine := range diffSection.Lines {
|
||||||
if diffLine.RightIdx == idx && diffLine.LeftIdx == 0 {
|
if diffLine.RightIdx == idx && diffLine.LeftIdx == 0 {
|
||||||
// ignore the the lines are too far from each other
|
// ignore if the lines are too far from each other
|
||||||
if i > sliceIdx-5 && i < sliceIdx+5 {
|
if i > sliceIdx-5 && i < sliceIdx+5 {
|
||||||
return diffLine
|
return diffLine
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue