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

Rounded Corners #1653

Merged
merged 3 commits into from
Apr 7, 2024
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
5 changes: 5 additions & 0 deletions doc.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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).
Expand Down
5 changes: 5 additions & 0 deletions doc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions eval.go
Original file line number Diff line number Diff line change
Expand Up @@ -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!":
Expand Down
4 changes: 4 additions & 0 deletions lf.1
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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]
Expand Down
2 changes: 2 additions & 0 deletions opts.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ var gOpts struct {
preview bool
relativenumber bool
reverse bool
roundbox bool
selectfmt string
sixel bool
sortby sortMethod
Expand Down Expand Up @@ -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
Expand Down
15 changes: 11 additions & 4 deletions ui.go
Original file line number Diff line number Diff line change
Expand Up @@ -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++ {
Expand Down