From ddea7bff1bc61fbee2326f28a7b5378a06a15fd1 Mon Sep 17 00:00:00 2001 From: Joe Lim <50560759+joelim-work@users.noreply.github.com> Date: Mon, 8 Jul 2024 10:09:13 +1000 Subject: [PATCH] Remove deprecated `ruler` option (#1766) * Remove deprecated `ruler` option * Remove unused variable --- doc.md | 15 --------------- doc.txt | 20 -------------------- eval.go | 19 ------------------- lf.1 | 30 +----------------------------- opts.go | 2 -- ui.go | 47 ----------------------------------------------- 6 files changed, 1 insertion(+), 132 deletions(-) diff --git a/doc.md b/doc.md index eed6e0c0..0adf63ed 100644 --- a/doc.md +++ b/doc.md @@ -181,7 +181,6 @@ The following options can be used to customize the behavior of lf: relativenumber bool (default false) reverse bool (default false) roundbox bool (default false) - ruler []string (default 'acc:progress:selection:filter:ind') rulerfmt string (default " %a| %p| \033[7;31m %m \033[0m| \033[7;33m %c \033[0m| \033[7;35m %s \033[0m| \033[7;34m %f \033[0m| %i/%t") scrolloff int (default 0) selectfmt string (default "\033[7;35m") @@ -892,20 +891,6 @@ Reverse the direction of sort. Draw rounded outer corners when the `drawbox` option is enabled. -## ruler ([]string) (default `acc:progress:selection:filter:ind`) - -This option is deprecated in favor of using the `rulerfmt` option (see below). -List of information shown in status line ruler. -Currently supported information types are `acc`, `progress`, `selection`, `filter`, `ind`, `df` and names starting with `lf_`. -`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. -Names starting with `lf_` show the value of environment variables exported by lf. This is useful for displaying the current settings (e.g. `lf_selmode` displays the current setting for the `selmode` option). -User-defined options starting with `lf_user_` are also supported, so it is possible to display information set from external sources. - ## rulerfmt (string) (default ` %a| %p| \033[7;31m %m \033[0m| \033[7;33m %c \033[0m| \033[7;35m %s \033[0m| \033[7;34m %f \033[0m| %i/%t`) Format string of the ruler shown in the bottom right corner. diff --git a/doc.txt b/doc.txt index 97364f2f..f9a8b966 100644 --- a/doc.txt +++ b/doc.txt @@ -171,7 +171,6 @@ The following options can be used to customize the behavior of lf: relativenumber bool (default false) reverse bool (default false) roundbox bool (default false) - ruler []string (default 'acc:progress:selection:filter:ind') rulerfmt string (default " %a| %p| \033[7;31m %m \033[0m| \033[7;33m %c \033[0m| \033[7;35m %s \033[0m| \033[7;34m %f \033[0m| %i/%t") scrolloff int (default 0) selectfmt string (default "\033[7;35m") @@ -962,25 +961,6 @@ roundbox (bool) (default false) Draw rounded outer corners when the drawbox option is enabled. -ruler ([]string) (default acc:progress:selection:filter:ind) - -This option is deprecated in favor of using the rulerfmt option (see -below). List of information shown in status line ruler. Currently -supported information types are acc, progress, selection, filter, ind, -df and names starting with lf_. 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. Names starting with lf_ show the value of -environment variables exported by lf. This is useful for displaying the -current settings (e.g. lf_selmode displays the current setting for the -selmode option). User-defined options starting with lf_user_ are also -supported, so it is possible to display information set from external -sources. - rulerfmt (string) (default %a| %p| \033[7;31m %m \033[0m| \033[7;33m %c \033[0m| \033[7;35m %s \033[0m| \033[7;34m %f \033[0m| %i/%t) Format string of the ruler shown in the bottom right corner. Special diff --git a/eval.go b/eval.go index df8b2720..23a6be5e 100644 --- a/eval.go +++ b/eval.go @@ -267,25 +267,6 @@ func (e *setExpr) eval(app *app, args []string) { } } gOpts.info = toks - case "ruler": - if e.val == "" { - gOpts.ruler = nil - return - } - toks := strings.Split(e.val, ":") - for _, s := range toks { - switch s { - case "df", "acc", "progress", "selection", "filter", "ind": - default: - if !strings.HasPrefix(s, "lf_") { - app.ui.echoerr("ruler: should consist of 'df', 'acc', 'progress', 'selection', 'filter', 'ind' or 'lf_' separated with colon") - return - } - } - } - gOpts.ruler = toks - app.ui.echoerr("option 'ruler' is deprecated, use 'rulerfmt' instead") - return case "rulerfmt": gOpts.rulerfmt = e.val case "preserve": diff --git a/lf.1 b/lf.1 index c826a930..c3484a83 100644 --- a/lf.1 +++ b/lf.1 @@ -1,6 +1,6 @@ .\" Automatically generated by Pandoc 2.11.4 .\" -.TH "LF" "1" "2024-06-30" "" "DOCUMENTATION" +.TH "LF" "1" "2024-07-01" "" "DOCUMENTATION" .hy .SH NAME .PP @@ -189,7 +189,6 @@ ratios []int (default \[aq]1:2:3\[aq]) relativenumber bool (default false) reverse bool (default false) roundbox bool (default false) -ruler []string (default \[aq]acc:progress:selection:filter:ind\[aq]) rulerfmt string (default \[dq] %a| %p| \[rs]033[7;31m %m \[rs]033[0m| \[rs]033[7;33m %c \[rs]033[0m| \[rs]033[7;35m %s \[rs]033[0m| \[rs]033[7;34m %f \[rs]033[0m| %i/%t\[dq]) scrolloff int (default 0) selectfmt string (default \[dq]\[rs]033[7;35m\[dq]) @@ -977,33 +976,6 @@ Reverse the direction of sort. .SS roundbox (bool) (default false) .PP Draw rounded outer corners when the \f[C]drawbox\f[R] option is enabled. -.SS ruler ([]string) (default \f[C]acc:progress:selection:filter:ind\f[R]) -.PP -This option is deprecated in favor of using the \f[C]rulerfmt\f[R] -option (see below). -List of information shown in status line ruler. -Currently supported information types are \f[C]acc\f[R], -\f[C]progress\f[R], \f[C]selection\f[R], \f[C]filter\f[R], -\f[C]ind\f[R], \f[C]df\f[R] and names starting with \f[C]lf_\f[R]. -\f[C]acc\f[R] shows the pressed keys (e.g. -for bindings with multiple key presses or counts given to bindings). -\f[C]progress\f[R] shows the progress of file operations (e.g. -copying a large directory). -\f[C]selection\f[R] shows the number of files that are selected, or -designated for being cut/copied. -\f[C]filter\f[R] shows \f[C]F\f[R] if a filter is currently being -applied. -\f[C]ind\f[R] shows the current position of the cursor as well as the -number of files in the current directory. -\f[C]df\f[R] shows the amount of free disk space remaining. -Names starting with \f[C]lf_\f[R] show the value of environment -variables exported by lf. -This is useful for displaying the current settings (e.g. -\f[C]lf_selmode\f[R] displays the current setting for the -\f[C]selmode\f[R] option). -User-defined options starting with \f[C]lf_user_\f[R] are also -supported, so it is possible to display information set from external -sources. .SS rulerfmt (string) (default \f[C] %a| %p| \[rs]033[7;31m %m \[rs]033[0m| \[rs]033[7;33m %c \[rs]033[0m| \[rs]033[7;35m %s \[rs]033[0m| \[rs]033[7;34m %f \[rs]033[0m| %i/%t\f[R]) .PP Format string of the ruler shown in the bottom right corner. diff --git a/opts.go b/opts.go index 8e52baf2..50db7b15 100644 --- a/opts.go +++ b/opts.go @@ -91,7 +91,6 @@ var gOpts struct { hiddenfiles []string history bool info []string - ruler []string rulerfmt string preserve []string shellopts []string @@ -238,7 +237,6 @@ func init() { gOpts.hiddenfiles = gDefaultHiddenFiles gOpts.history = true gOpts.info = nil - gOpts.ruler = nil gOpts.rulerfmt = " %a| %p| \033[7;31m %m \033[0m| \033[7;33m %c \033[0m| \033[7;35m %s \033[0m| \033[7;34m %f \033[0m| %i/%t" gOpts.preserve = []string{"mode"} gOpts.shellopts = nil diff --git a/ui.go b/ui.go index 70d02d92..d3a77e68 100644 --- a/ui.go +++ b/ui.go @@ -848,8 +848,6 @@ func (ui *ui) drawRuler(nav *nav) { hid := len(dir.allFiles) - tot acc := string(ui.keyCount) + string(ui.keyAcc) - selection := []string{} - copy := 0 move := 0 if len(nav.saves) > 0 { @@ -860,21 +858,9 @@ func (ui *ui) drawRuler(nav *nav) { move++ } } - if copy > 0 { - copyStr := fmt.Sprintf(optionToFmtstr(gOpts.copyfmt), fmt.Sprintf(" %d ", copy)) - selection = append(selection, copyStr) - } - if move > 0 { - moveStr := fmt.Sprintf(optionToFmtstr(gOpts.cutfmt), fmt.Sprintf(" %d ", move)) - selection = append(selection, moveStr) - } } currSelections := nav.currSelections() - if len(currSelections) > 0 { - selectStr := fmt.Sprintf(optionToFmtstr(gOpts.selectfmt), fmt.Sprintf(" %d ", len(currSelections))) - selection = append(selection, selectStr) - } progress := []string{} @@ -893,39 +879,6 @@ func (ui *ui) drawRuler(nav *nav) { opts := getOptsMap() - // 'ruler' option is deprecated and can be removed in future - if len(gOpts.ruler) > 0 { - ruler := []string{} - for _, s := range gOpts.ruler { - switch s { - case "df": - df := diskFree(dir.path) - if df != "" { - ruler = append(ruler, df) - } - case "acc": - ruler = append(ruler, acc) - case "progress": - 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)) - default: - if val, ok := opts[s]; ok { - ruler = append(ruler, formatRulerOpt(s, val)) - } - } - } - - ui.msgWin.printRight(ui.screen, 0, st, strings.Join(ruler, " ")) - return - } - rulerfmt := strings.ReplaceAll(gOpts.rulerfmt, "|", "\x1f") rulerfmt = reRulerSub.ReplaceAllStringFunc(rulerfmt, func(s string) string { var result string