diff --git a/complete.go b/complete.go index ad20780..5d57da4 100644 --- a/complete.go +++ b/complete.go @@ -108,6 +108,9 @@ var ( "wrapscan", "nowrapscan", "wrapscan!", + "wrapscroll", + "nowrapscroll", + "wrapscroll!", "number", "nonumber", "number!", diff --git a/doc.go b/doc.go index f394e58..fab4f24 100644 --- a/doc.go +++ b/doc.go @@ -111,6 +111,7 @@ The following options can be used to customize the behavior of lf: smartcase boolean (default on) smartdia boolean (default off) wrapscan boolean (default on) + wrapscroll boolean (default off) number boolean (default off) relativenumber boolean (default off) findlen integer (default 1) (zero to prompt until single match) diff --git a/docstring.go b/docstring.go index 23ff8d8..49ba930 100644 --- a/docstring.go +++ b/docstring.go @@ -114,6 +114,7 @@ The following options can be used to customize the behavior of lf: smartcase boolean (default on) smartdia boolean (default off) wrapscan boolean (default on) + wrapscroll boolean (default off) number boolean (default off) relativenumber boolean (default off) findlen integer (default 1) (zero to prompt until single match) diff --git a/eval.go b/eval.go index 33415d1..241101f 100644 --- a/eval.go +++ b/eval.go @@ -143,6 +143,12 @@ func (e *setExpr) eval(app *app, args []string) { gOpts.wrapscan = false case "wrapscan!": gOpts.wrapscan = !gOpts.wrapscan + case "wrapscroll": + gOpts.wrapscroll = true + case "nowrapscroll": + gOpts.wrapscroll = false + case "wrapscroll!": + gOpts.wrapscroll = !gOpts.wrapscroll case "number": gOpts.number = true case "nonumber": diff --git a/lf.1 b/lf.1 index d51661e..9b5bc57 100644 --- a/lf.1 +++ b/lf.1 @@ -126,6 +126,7 @@ The following options can be used to customize the behavior of lf: smartcase boolean (default on) smartdia boolean (default off) wrapscan boolean (default on) + wrapscroll boolean (default off) number boolean (default off) relativenumber boolean (default off) findlen integer (default 1) (zero to prompt until single match) diff --git a/nav.go b/nav.go index 4507d0c..21a629d 100644 --- a/nav.go +++ b/nav.go @@ -445,6 +445,9 @@ func (nav *nav) up(dist int) { dir := nav.currDir() if dir.ind == 0 { + if gOpts.wrapscroll { + nav.bottom() + } return } @@ -462,6 +465,9 @@ func (nav *nav) down(dist int) { maxind := len(dir.files) - 1 if dir.ind >= maxind { + if gOpts.wrapscroll { + nav.top() + } return } diff --git a/opts.go b/opts.go index f391489..2d8a7e2 100644 --- a/opts.go +++ b/opts.go @@ -37,6 +37,7 @@ var gOpts struct { ignoredia bool smartdia bool wrapscan bool + wrapscroll bool number bool relativenumber bool findlen int @@ -72,6 +73,7 @@ func init() { gOpts.ignoredia = false gOpts.smartdia = false gOpts.wrapscan = true + gOpts.wrapscroll = false gOpts.number = false gOpts.relativenumber = false gOpts.findlen = 1