summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJ-Kappes <87168492+J-Kappes@users.noreply.github.com>2024-04-07 13:36:54 +0000
committerGitHub <noreply@github.com>2024-04-07 15:36:54 +0200
commit647fa469fb4a65a15d335ca981808c3e2a344a6e (patch)
treefd24a9e308b27750fab6d03274f2254c70ddd953
parentf507b618c931592daf74f291471daeafe2410a07 (diff)
Rounded Corners (#1653)
* add option to draw outer corners rounded * gofmt --------- Co-authored-by: Gökçehan Kara <gokcehankara@gmail.com>
-rw-r--r--doc.md5
-rw-r--r--doc.txt5
-rw-r--r--eval.go2
-rw-r--r--lf.14
-rw-r--r--opts.go2
-rw-r--r--ui.go15
6 files changed, 29 insertions, 4 deletions
diff --git a/doc.md b/doc.md
index e608e71..d84e7bd 100644
--- a/doc.md
+++ b/doc.md
@@ -181,6 +181,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)
+ 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)
@@ -889,6 +890,10 @@ When `number` is enabled, the current line shows the absolute position, otherwis
Reverse the direction of sort.
+## 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).
diff --git a/doc.txt b/doc.txt
index fd90003..64c41a6 100644
--- a/doc.txt
+++ b/doc.txt
@@ -171,6 +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)
+ 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)
@@ -959,6 +960,10 @@ reverse (bool) (default false)
Reverse the direction of sort.
+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
diff --git a/eval.go b/eval.go
index c3282b3..64308f7 100644
--- a/eval.go
+++ b/eval.go
@@ -176,6 +176,8 @@ func (e *setExpr) eval(app *app, args []string) {
app.nav.sort()
app.ui.sort()
}
+ case "roundbox", "noroundbox", "roundbox!":
+ err = applyBoolOpt(&gOpts.roundbox, e)
case "sixel", "nosixel", "sixel!":
err = applyBoolOpt(&gOpts.sixel, e)
case "smartcase", "nosmartcase", "smartcase!":
diff --git a/lf.1 b/lf.1
index 41f5f9c..cff175a 100644
--- a/lf.1
+++ b/lf.1
@@ -189,6 +189,7 @@ promptfmt string (default \[dq]\[rs]033[32;1m%u\[at]%h\[rs]033[0m:\
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)
@@ -974,6 +975,9 @@ position, otherwise nothing is shown.
.SS reverse (bool) (default false)
.PP
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]
diff --git a/opts.go b/opts.go
index 681673b..035de65 100644
--- a/opts.go
+++ b/opts.go
@@ -59,6 +59,7 @@ var gOpts struct {
preview bool
relativenumber bool
reverse bool
+ roundbox bool
selectfmt string
sixel bool
sortby sortMethod
@@ -205,6 +206,7 @@ func init() {
gOpts.preview = true
gOpts.relativenumber = false
gOpts.reverse = false
+ gOpts.roundbox = false
gOpts.selectfmt = "\033[7;35m"
gOpts.sixel = false
gOpts.sortby = naturalSort
diff --git a/ui.go b/ui.go
index 10c0f90..5aabf66 100644
--- a/ui.go
+++ b/ui.go
@@ -980,10 +980,17 @@ func (ui *ui) drawBox() {
ui.screen.SetContent(w-1, i, tcell.RuneVLine, nil, st)
}
- ui.screen.SetContent(0, 1, tcell.RuneULCorner, nil, st)
- ui.screen.SetContent(w-1, 1, tcell.RuneURCorner, nil, st)
- ui.screen.SetContent(0, h-2, tcell.RuneLLCorner, nil, st)
- ui.screen.SetContent(w-1, h-2, tcell.RuneLRCorner, nil, st)
+ if gOpts.roundbox {
+ ui.screen.SetContent(0, 1, '╭', nil, st)
+ ui.screen.SetContent(w-1, 1, '╮', nil, st)
+ ui.screen.SetContent(0, h-2, '╰', nil, st)
+ ui.screen.SetContent(w-1, h-2, '╯', nil, st)
+ } else {
+ ui.screen.SetContent(0, 1, tcell.RuneULCorner, nil, st)
+ ui.screen.SetContent(w-1, 1, tcell.RuneURCorner, nil, st)
+ ui.screen.SetContent(0, h-2, tcell.RuneLLCorner, nil, st)
+ ui.screen.SetContent(w-1, h-2, tcell.RuneLRCorner, nil, st)
+ }
wacc := 0
for wind := 0; wind < len(ui.wins)-1; wind++ {