From 4fdc07927f1ba247563f6d9630b47536c305be75 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Sat, 11 Jan 2025 19:34:13 +0900 Subject: Refactor --preview-border=line --- src/options.go | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'src/options.go') diff --git a/src/options.go b/src/options.go index 04fd736b..404958c7 100644 --- a/src/options.go +++ b/src/options.go @@ -332,12 +332,21 @@ func (o *previewOpts) Toggle() { o.hidden = !o.hidden } -func (o *previewOpts) HasBorderRight() bool { - return o.border.HasRight() || o.border == tui.BorderLine && o.position == posLeft -} - -func (o *previewOpts) HasBorderTop() bool { - return o.border.HasTop() || o.border == tui.BorderLine && o.position == posDown +func (o *previewOpts) Border() tui.BorderShape { + shape := o.border + if shape == tui.BorderLine { + switch o.position { + case posUp: + shape = tui.BorderBottom + case posDown: + shape = tui.BorderTop + case posLeft: + shape = tui.BorderRight + case posRight: + shape = tui.BorderLeft + } + } + return shape } func defaultTmuxOptions(index int) *tmuxOptions { -- cgit v1.2.3