Refactor --preview-border=line

This commit is contained in:
Junegunn Choi
2025-01-11 19:34:13 +09:00
parent 9030b67e4f
commit 4fdc07927f
2 changed files with 30 additions and 35 deletions

View File

@@ -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 {