This commit is contained in:
Gokcehan 2019-01-31 21:51:17 +03:00
parent 90f0339fa9
commit ec5fac3274

22
ui.go
View File

@ -267,11 +267,11 @@ func (win *win) printDir(dir *dir, selections map[string]int, saves map[string]b
return return
} }
var lnwidth int = 0; var lnwidth int = 0
var lnformat string = ""; var lnformat string = ""
if (gOpts.number || gOpts.relativenumber) { if gOpts.number || gOpts.relativenumber {
lnwidth = 1; lnwidth = 1
for j := 10; j < len(dir.files); j *= 10 { for j := 10; j < len(dir.files); j *= 10 {
lnwidth++ lnwidth++
} }
@ -281,16 +281,16 @@ func (win *win) printDir(dir *dir, selections map[string]int, saves map[string]b
for i, f := range dir.files[beg:end] { for i, f := range dir.files[beg:end] {
fg, bg = colors.get(f) fg, bg = colors.get(f)
if (lnwidth > 0) { if lnwidth > 0 {
var ln string var ln string
if (gOpts.number && (!gOpts.relativenumber || i == dir.pos)) { if gOpts.number && (!gOpts.relativenumber || i == dir.pos) {
ln = fmt.Sprintf(lnformat, i + 1 + beg) ln = fmt.Sprintf(lnformat, i+1+beg)
} else if (gOpts.relativenumber) { } else if gOpts.relativenumber {
if (i < dir.pos) { if i < dir.pos {
ln = fmt.Sprintf(lnformat, dir.pos - i) ln = fmt.Sprintf(lnformat, dir.pos-i)
} else { } else {
ln = fmt.Sprintf(lnformat, i - dir.pos) ln = fmt.Sprintf(lnformat, i-dir.pos)
} }
} }