diff --git a/colors.go b/colors.go index e76e5d89..6dd910b2 100644 --- a/colors.go +++ b/colors.go @@ -81,6 +81,14 @@ func parseStyles() styleMap { return sm } +func parseEscapeSequence(s string) tcell.Style { + s = strings.TrimPrefix(s, "\033[") + if i := strings.IndexByte(s, 'm'); i >= 0 { + s = s[:i] + } + return applyAnsiCodes(s, tcell.StyleDefault) +} + func applyAnsiCodes(s string, st tcell.Style) tcell.Style { toks := strings.Split(s, ";") diff --git a/complete.go b/complete.go index b2698e3f..97ad9f84 100644 --- a/complete.go +++ b/complete.go @@ -116,6 +116,7 @@ var ( "autoquit", "noautoquit", "autoquit!", + "borderfmt", "cursoractivefmt", "cursorparentfmt", "cursorpreviewfmt", diff --git a/doc.go b/doc.go index 66508620..ad63b495 100644 --- a/doc.go +++ b/doc.go @@ -117,6 +117,7 @@ The following options can be used to customize the behavior of lf: anchorfind bool (default true) autoquit bool (default false) + borderfmt string (default "\033[0m") cleaner string (default '') cursoractivefmt string (default "\033[7m") cursorparentfmt string (default "\033[7m") @@ -633,6 +634,10 @@ When this option is enabled, find command starts matching patterns from the begi Automatically quit server when there are no clients left connected. + borderfmt string (default "\033[0m") + +Format string of the box drawing characters enabled by the `drawbox` option. + cleaner string (default '') (not called if empty) Set the path of a cleaner file. diff --git a/docstring.go b/docstring.go index b160b177..b5b659e1 100644 --- a/docstring.go +++ b/docstring.go @@ -120,6 +120,7 @@ The following options can be used to customize the behavior of lf: anchorfind bool (default true) autoquit bool (default false) + borderfmt string (default "\033[0m") cleaner string (default '') cursoractivefmt string (default "\033[7m") cursorparentfmt string (default "\033[7m") @@ -664,6 +665,10 @@ beginning of file names, otherwise, it can match at an arbitrary position. Automatically quit server when there are no clients left connected. + borderfmt string (default "\033[0m") + +Format string of the box drawing characters enabled by the 'drawbox' option. + cleaner string (default '') (not called if empty) Set the path of a cleaner file. The file should be executable. This file is diff --git a/eval.go b/eval.go index 0a6ca6ed..66a443cf 100644 --- a/eval.go +++ b/eval.go @@ -58,6 +58,8 @@ func (e *setExpr) eval(app *app, args []string) { return } gOpts.autoquit = !gOpts.autoquit + case "borderfmt": + gOpts.borderfmt = e.val case "cleaner": gOpts.cleaner = replaceTilde(e.val) case "cursoractivefmt": diff --git a/lf.1 b/lf.1 index 03a43b0f..a2f0eca0 100644 --- a/lf.1 +++ b/lf.1 @@ -136,6 +136,7 @@ The following options can be used to customize the behavior of lf: .EX anchorfind bool (default true) autoquit bool (default false) + borderfmt string (default "\e033[0m") cleaner string (default '') cursoractivefmt string (default "\e033[7m") cursorparentfmt string (default "\e033[7m") @@ -776,6 +777,12 @@ When this option is enabled, find command starts matching patterns from the begi .PP Automatically quit server when there are no clients left connected. .PP +.EX + borderfmt string (default "\e033[0m") +.EE +.PP +Format string of the box drawing characters enabled by the `drawbox` option. +.PP .EX cleaner string (default '') (not called if empty) .EE diff --git a/opts.go b/opts.go index 301a3641..063dc6d6 100644 --- a/opts.go +++ b/opts.go @@ -30,6 +30,7 @@ type sortType struct { var gOpts struct { anchorfind bool autoquit bool + borderfmt string cursoractivefmt string cursorparentfmt string cursorpreviewfmt string @@ -94,6 +95,7 @@ func init() { gOpts.dironly = false gOpts.dirpreviews = false gOpts.drawbox = false + gOpts.borderfmt = "\033[0m" gOpts.cursoractivefmt = "\033[7m" gOpts.cursorparentfmt = "\033[7m" gOpts.cursorpreviewfmt = "\033[4m" diff --git a/ui.go b/ui.go index 259071cd..542465b8 100644 --- a/ui.go +++ b/ui.go @@ -883,7 +883,7 @@ func (ui *ui) drawStatLine(nav *nav) { } func (ui *ui) drawBox() { - st := tcell.StyleDefault + st := parseEscapeSequence(gOpts.borderfmt) w, h := ui.screen.Size()