Support custom colors for drawbox characters (#1251)
This commit is contained in:
1 parent
1be7d2689a
commit
3b942a8a39
8 files changed
+31
-1
No files matched your search
@@ -81,6 +81,14 @@ func parseStyles() styleMap {
|
|||||||
return sm
|
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 {
|
func applyAnsiCodes(s string, st tcell.Style) tcell.Style {
|
||||||
toks := strings.Split(s, ";")
|
toks := strings.Split(s, ";")
|
||||||
|
|
||||||
|
|||||||
@@ -116,6 +116,7 @@ var (
|
|||||||
"autoquit",
|
"autoquit",
|
||||||
"noautoquit",
|
"noautoquit",
|
||||||
"autoquit!",
|
"autoquit!",
|
||||||
|
"borderfmt",
|
||||||
"cursoractivefmt",
|
"cursoractivefmt",
|
||||||
"cursorparentfmt",
|
"cursorparentfmt",
|
||||||
"cursorpreviewfmt",
|
"cursorpreviewfmt",
|
||||||
|
|||||||
@@ -117,6 +117,7 @@ The following options can be used to customize the behavior of lf:
|
|||||||
|
|
||||||
anchorfind bool (default true)
|
anchorfind bool (default true)
|
||||||
autoquit bool (default false)
|
autoquit bool (default false)
|
||||||
|
borderfmt string (default "\033[0m")
|
||||||
cleaner string (default '')
|
cleaner string (default '')
|
||||||
cursoractivefmt string (default "\033[7m")
|
cursoractivefmt string (default "\033[7m")
|
||||||
cursorparentfmt 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.
|
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)
|
cleaner string (default '') (not called if empty)
|
||||||
|
|
||||||
Set the path of a cleaner file.
|
Set the path of a cleaner file.
|
||||||
|
|||||||
@@ -120,6 +120,7 @@ The following options can be used to customize the behavior of lf:
|
|||||||
|
|
||||||
anchorfind bool (default true)
|
anchorfind bool (default true)
|
||||||
autoquit bool (default false)
|
autoquit bool (default false)
|
||||||
|
borderfmt string (default "\033[0m")
|
||||||
cleaner string (default '')
|
cleaner string (default '')
|
||||||
cursoractivefmt string (default "\033[7m")
|
cursoractivefmt string (default "\033[7m")
|
||||||
cursorparentfmt 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.
|
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)
|
cleaner string (default '') (not called if empty)
|
||||||
|
|
||||||
Set the path of a cleaner file. The file should be executable. This file is
|
Set the path of a cleaner file. The file should be executable. This file is
|
||||||
|
|||||||
@@ -58,6 +58,8 @@ func (e *setExpr) eval(app *app, args []string) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
gOpts.autoquit = !gOpts.autoquit
|
gOpts.autoquit = !gOpts.autoquit
|
||||||
|
case "borderfmt":
|
||||||
|
gOpts.borderfmt = e.val
|
||||||
case "cleaner":
|
case "cleaner":
|
||||||
gOpts.cleaner = replaceTilde(e.val)
|
gOpts.cleaner = replaceTilde(e.val)
|
||||||
case "cursoractivefmt":
|
case "cursoractivefmt":
|
||||||
|
|||||||
@@ -136,6 +136,7 @@ The following options can be used to customize the behavior of lf:
|
|||||||
.EX
|
.EX
|
||||||
anchorfind bool (default true)
|
anchorfind bool (default true)
|
||||||
autoquit bool (default false)
|
autoquit bool (default false)
|
||||||
|
borderfmt string (default "\e033[0m")
|
||||||
cleaner string (default '')
|
cleaner string (default '')
|
||||||
cursoractivefmt string (default "\e033[7m")
|
cursoractivefmt string (default "\e033[7m")
|
||||||
cursorparentfmt 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
|
.PP
|
||||||
Automatically quit server when there are no clients left connected.
|
Automatically quit server when there are no clients left connected.
|
||||||
.PP
|
.PP
|
||||||
|
.EX
|
||||||
|
borderfmt string (default "\e033[0m")
|
||||||
|
.EE
|
||||||
|
.PP
|
||||||
|
Format string of the box drawing characters enabled by the `drawbox` option.
|
||||||
|
.PP
|
||||||
.EX
|
.EX
|
||||||
cleaner string (default '') (not called if empty)
|
cleaner string (default '') (not called if empty)
|
||||||
.EE
|
.EE
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ type sortType struct {
|
|||||||
var gOpts struct {
|
var gOpts struct {
|
||||||
anchorfind bool
|
anchorfind bool
|
||||||
autoquit bool
|
autoquit bool
|
||||||
|
borderfmt string
|
||||||
cursoractivefmt string
|
cursoractivefmt string
|
||||||
cursorparentfmt string
|
cursorparentfmt string
|
||||||
cursorpreviewfmt string
|
cursorpreviewfmt string
|
||||||
@@ -94,6 +95,7 @@ func init() {
|
|||||||
gOpts.dironly = false
|
gOpts.dironly = false
|
||||||
gOpts.dirpreviews = false
|
gOpts.dirpreviews = false
|
||||||
gOpts.drawbox = false
|
gOpts.drawbox = false
|
||||||
|
gOpts.borderfmt = "\033[0m"
|
||||||
gOpts.cursoractivefmt = "\033[7m"
|
gOpts.cursoractivefmt = "\033[7m"
|
||||||
gOpts.cursorparentfmt = "\033[7m"
|
gOpts.cursorparentfmt = "\033[7m"
|
||||||
gOpts.cursorpreviewfmt = "\033[4m"
|
gOpts.cursorpreviewfmt = "\033[4m"
|
||||||
|
|||||||
Reference in new issue
Block a user