Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separate filter from selections in the ui ruler #1223

Merged
merged 1 commit into from
May 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ The following options can be used to customize the behavior of lf:
ratios []int (default '1:2:3')
relativenumber bool (default false)
reverse bool (default false)
ruler []string (default 'acc:progress:selection:ind')
ruler []string (default 'acc:progress:selection:filter:ind')
scrolloff int (default 0)
selmode string (default 'all')
shell string (default 'sh' for Unix and 'cmd' for Windows)
Expand Down Expand Up @@ -819,10 +819,16 @@ When 'number' is enabled, current line shows the absolute position, otherwise no

Reverse the direction of sort.

ruler []string (default 'acc:progress:selection:ind')
ruler []string (default 'acc:progress:selection:filter:ind')

List of information shown in status line ruler.
Currently supported information types are 'acc', 'progress', 'selection', 'ind' and 'df'.
`acc` shows the pressed keys (e.g. for bindings with multiple key presses or counts given to bindings).
`progress` shows the progress of file operations (e.g. copying a large directory).
`selection` shows the number of files that are selected, or designated for being cut/copied.
`filter` shows 'F' if a filter is currently being applied.
`ind` shows the current position of the cursor as well as the number of files in the current directory.
`df` shows the amount of free disk space remaining.

selmode string (default 'all')

Expand Down
13 changes: 10 additions & 3 deletions docstring.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions eval.go
Original file line number Diff line number Diff line change
Expand Up @@ -490,9 +490,9 @@ func (e *setExpr) eval(app *app, args []string) {
toks := strings.Split(e.val, ":")
for _, s := range toks {
switch s {
case "df", "acc", "progress", "selection", "ind":
case "df", "acc", "progress", "selection", "filter", "ind":
default:
app.ui.echoerr("ruler: should consist of 'df', 'acc', 'progress', 'selection', or 'ind' separated with colon")
app.ui.echoerr("ruler: should consist of 'df', 'acc', 'progress', 'selection', 'filter' or 'ind' separated with colon")
return
}
}
Expand Down
6 changes: 3 additions & 3 deletions lf.1
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ The following options can be used to customize the behavior of lf:
ratios []int (default '1:2:3')
relativenumber bool (default false)
reverse bool (default false)
ruler []string (default 'acc:progress:selection:ind')
ruler []string (default 'acc:progress:selection:filter:ind')
scrolloff int (default 0)
selmode string (default 'all')
shell string (default 'sh' for Unix and 'cmd' for Windows)
Expand Down Expand Up @@ -984,10 +984,10 @@ Show the position number relative to the current line. When 'number' is enabled,
Reverse the direction of sort.
.PP
.EX
ruler []string (default 'acc:progress:selection:ind')
ruler []string (default 'acc:progress:selection:filter:ind')
.EE
.PP
List of information shown in status line ruler. Currently supported information types are 'acc', 'progress', 'selection', 'ind' and 'df'.
List of information shown in status line ruler. Currently supported information types are 'acc', 'progress', 'selection', 'ind' and 'df'. `acc` shows the pressed keys (e.g. for bindings with multiple key presses or counts given to bindings). `progress` shows the progress of file operations (e.g. copying a large directory). `selection` shows the number of files that are selected, or designated for being cut/copied. `filter` shows 'F' if a filter is currently being applied. `ind` shows the current position of the cursor as well as the number of files in the current directory. `df` shows the amount of free disk space remaining.
.PP
.EX
selmode string (default 'all')
Expand Down
2 changes: 1 addition & 1 deletion opts.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ func init() {
gOpts.hiddenfiles = []string{".*"}
gOpts.history = true
gOpts.info = nil
gOpts.ruler = []string{"acc", "progress", "selection", "ind"}
gOpts.ruler = []string{"acc", "progress", "selection", "filter", "ind"}
gOpts.shellopts = nil
gOpts.sortType = sortType{naturalSort, dirfirstSort}
gOpts.tempmarks = "'"
Expand Down
8 changes: 4 additions & 4 deletions ui.go
Original file line number Diff line number Diff line change
Expand Up @@ -840,10 +840,6 @@ func (ui *ui) drawStatLine(nav *nav) {
selection = append(selection, fmt.Sprintf("\033[35;7m %d \033[0m", len(currSelections)))
}

if len(dir.filter) != 0 {
selection = append(selection, "\033[34;7m F \033[0m")
}

progress := []string{}

if nav.copyTotal > 0 {
Expand Down Expand Up @@ -873,6 +869,10 @@ func (ui *ui) drawStatLine(nav *nav) {
ruler = append(ruler, progress...)
case "selection":
ruler = append(ruler, selection...)
case "filter":
if len(dir.filter) != 0 {
ruler = append(ruler, "\033[34;7m F \033[0m")
}
case "ind":
ruler = append(ruler, fmt.Sprintf("%d/%d", ind, tot))
}
Expand Down