parent
784d80ca30
commit
8bc975a858
3
comp.go
3
comp.go
@ -59,6 +59,9 @@ var (
|
|||||||
"reverse",
|
"reverse",
|
||||||
"noreverse",
|
"noreverse",
|
||||||
"reverse!",
|
"reverse!",
|
||||||
|
"wrapscan",
|
||||||
|
"nowrapscan",
|
||||||
|
"wrapscan!",
|
||||||
"scrolloff",
|
"scrolloff",
|
||||||
"tabstop",
|
"tabstop",
|
||||||
"filesep",
|
"filesep",
|
||||||
|
1
doc.go
1
doc.go
@ -70,6 +70,7 @@ The following options can be used to customize the behavior of lf:
|
|||||||
hidden boolean (default off)
|
hidden boolean (default off)
|
||||||
preview boolean (default on)
|
preview boolean (default on)
|
||||||
reverse boolean (default off)
|
reverse boolean (default off)
|
||||||
|
wrapscan boolean (default on)
|
||||||
scrolloff integer (default 0)
|
scrolloff integer (default 0)
|
||||||
tabstop integer (default 8)
|
tabstop integer (default 8)
|
||||||
filesep string (default ":")
|
filesep string (default ":")
|
||||||
|
@ -74,6 +74,7 @@ The following options can be used to customize the behavior of lf:
|
|||||||
hidden boolean (default off)
|
hidden boolean (default off)
|
||||||
preview boolean (default on)
|
preview boolean (default on)
|
||||||
reverse boolean (default off)
|
reverse boolean (default off)
|
||||||
|
wrapscan boolean (default on)
|
||||||
scrolloff integer (default 0)
|
scrolloff integer (default 0)
|
||||||
tabstop integer (default 8)
|
tabstop integer (default 8)
|
||||||
filesep string (default ":")
|
filesep string (default ":")
|
||||||
|
6
eval.go
6
eval.go
@ -44,6 +44,12 @@ func (e *setExpr) eval(app *app, args []string) {
|
|||||||
case "reverse!":
|
case "reverse!":
|
||||||
gOpts.reverse = !gOpts.reverse
|
gOpts.reverse = !gOpts.reverse
|
||||||
app.nav.renew(app.nav.height)
|
app.nav.renew(app.nav.height)
|
||||||
|
case "wrapscan":
|
||||||
|
gOpts.wrapscan = true
|
||||||
|
case "nowrapscan":
|
||||||
|
gOpts.wrapscan = false
|
||||||
|
case "wrapscan!":
|
||||||
|
gOpts.wrapscan = !gOpts.wrapscan
|
||||||
case "scrolloff":
|
case "scrolloff":
|
||||||
n, err := strconv.Atoi(e.val)
|
n, err := strconv.Atoi(e.val)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
20
nav.go
20
nav.go
@ -372,10 +372,12 @@ func (nav *nav) searchNext() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for i := 0; i < last.ind; i++ {
|
if gOpts.wrapscan {
|
||||||
if strings.Contains(last.fi[i].Name(), nav.search) {
|
for i := 0; i < last.ind; i++ {
|
||||||
nav.up(last.ind - i)
|
if strings.Contains(last.fi[i].Name(), nav.search) {
|
||||||
return
|
nav.up(last.ind - i)
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -388,10 +390,12 @@ func (nav *nav) searchPrev() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for i := len(last.fi) - 1; i > last.ind; i-- {
|
if gOpts.wrapscan {
|
||||||
if strings.Contains(last.fi[i].Name(), nav.search) {
|
for i := len(last.fi) - 1; i > last.ind; i-- {
|
||||||
nav.down(i - last.ind)
|
if strings.Contains(last.fi[i].Name(), nav.search) {
|
||||||
return
|
nav.down(i - last.ind)
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
2
opts.go
2
opts.go
@ -7,6 +7,7 @@ var gOpts struct {
|
|||||||
hidden bool
|
hidden bool
|
||||||
preview bool
|
preview bool
|
||||||
reverse bool
|
reverse bool
|
||||||
|
wrapscan bool
|
||||||
scrolloff int
|
scrolloff int
|
||||||
tabstop int
|
tabstop int
|
||||||
filesep string
|
filesep string
|
||||||
@ -27,6 +28,7 @@ func init() {
|
|||||||
gOpts.hidden = false
|
gOpts.hidden = false
|
||||||
gOpts.preview = true
|
gOpts.preview = true
|
||||||
gOpts.reverse = false
|
gOpts.reverse = false
|
||||||
|
gOpts.wrapscan = true
|
||||||
gOpts.scrolloff = 0
|
gOpts.scrolloff = 0
|
||||||
gOpts.tabstop = 8
|
gOpts.tabstop = 8
|
||||||
gOpts.filesep = ":"
|
gOpts.filesep = ":"
|
||||||
|
Loading…
Reference in New Issue
Block a user