@@ -782,7 +782,7 @@ func NewTerminal(opts *Options, eventBox *util.EventBox, executor *util.Executor
782
782
// Minimum height required to render fzf excluding margin and padding
783
783
effectiveMinHeight := minHeight
784
784
if previewBox != nil && opts .Preview .aboveOrBelow () {
785
- effectiveMinHeight += 1 + borderLines (opts .Preview .border )
785
+ effectiveMinHeight += 1 + borderLines (opts .Preview .Border () )
786
786
}
787
787
if noSeparatorLine (opts .InfoStyle , opts .Separator == nil || uniseg .StringWidth (* opts .Separator ) > 0 ) {
788
788
effectiveMinHeight --
@@ -1521,12 +1521,12 @@ func calculateSize(base int, size sizeSpec, occupied int, minSize int) int {
1521
1521
}
1522
1522
1523
1523
func (t * Terminal ) minPreviewSize (opts * previewOpts ) (int , int ) {
1524
- minPreviewWidth := 1 + borderColumns (opts .border , t .borderWidth )
1525
- minPreviewHeight := 1 + borderLines (opts .border )
1524
+ minPreviewWidth := 1 + borderColumns (opts .Border () , t .borderWidth )
1525
+ minPreviewHeight := 1 + borderLines (opts .Border () )
1526
1526
1527
1527
switch opts .position {
1528
1528
case posLeft , posRight :
1529
- if len (t .scrollbar ) > 0 && ! opts .HasBorderRight () {
1529
+ if len (t .scrollbar ) > 0 && ! opts .Border (). HasRight () {
1530
1530
// Need a column to show scrollbar
1531
1531
minPreviewWidth ++
1532
1532
}
@@ -1773,19 +1773,7 @@ func (t *Terminal) resizeWindows(forcePreview bool, redrawBorder bool) {
1773
1773
createPreviewWindow := func (y int , x int , w int , h int ) {
1774
1774
pwidth := w
1775
1775
pheight := h
1776
- shape := previewOpts .border
1777
- if shape == tui .BorderLine {
1778
- switch previewOpts .position {
1779
- case posUp :
1780
- shape = tui .BorderBottom
1781
- case posDown :
1782
- shape = tui .BorderTop
1783
- case posLeft :
1784
- shape = tui .BorderRight
1785
- case posRight :
1786
- shape = tui .BorderLeft
1787
- }
1788
- }
1776
+ shape := previewOpts .Border ()
1789
1777
previewBorder := tui .MakeBorderStyle (shape , t .unicode )
1790
1778
t .pborder = t .tui .NewWindow (y , x , w , h , tui .WindowPreview , previewBorder , false )
1791
1779
pwidth -= borderColumns (shape , bw )
@@ -1830,7 +1818,7 @@ func (t *Terminal) resizeWindows(forcePreview bool, redrawBorder bool) {
1830
1818
return
1831
1819
}
1832
1820
1833
- listStickToRight = listStickToRight && ! previewOpts .HasBorderRight ()
1821
+ listStickToRight = listStickToRight && ! previewOpts .Border (). HasRight ()
1834
1822
if listStickToRight {
1835
1823
innerWidth ++
1836
1824
width ++
@@ -1908,7 +1896,7 @@ func (t *Terminal) resizeWindows(forcePreview bool, redrawBorder bool) {
1908
1896
// fzf --preview 'seq 500' --preview-window border-left --border
1909
1897
// fzf --preview 'seq 500' --preview-window border-left --border --list-border
1910
1898
// fzf --preview 'seq 500' --preview-window border-left --border --input-border
1911
- listStickToRight = t .borderShape .HasRight () && ! previewOpts .HasBorderRight ()
1899
+ listStickToRight = t .borderShape .HasRight () && ! previewOpts .Border (). HasRight ()
1912
1900
if listStickToRight {
1913
1901
innerWidth ++
1914
1902
width ++
@@ -2031,9 +2019,7 @@ func (t *Terminal) resizeWindows(forcePreview bool, redrawBorder bool) {
2031
2019
// Print border label
2032
2020
t .printLabel (t .wborder , t .listLabel , t .listLabelOpts , t .listLabelLen , t .listBorderShape , false )
2033
2021
t .printLabel (t .border , t .borderLabel , t .borderLabelOpts , t .borderLabelLen , t .borderShape , false )
2034
- if t .pborder != nil && t .pwindow .Height () != t .pborder .Height () { // To address --preview-border=line with different positions
2035
- t .printLabel (t .pborder , t .previewLabel , t .previewLabelOpts , t .previewLabelLen , t .activePreviewOpts .border , false )
2036
- }
2022
+ t .printLabel (t .pborder , t .previewLabel , t .previewLabelOpts , t .previewLabelLen , t .activePreviewOpts .Border (), false )
2037
2023
t .printLabel (t .inputBorder , t .inputLabel , t .inputLabelOpts , t .inputLabelLen , t .inputBorderShape , false )
2038
2024
t .printLabel (t .headerBorder , t .headerLabel , t .headerLabelOpts , t .headerLabelLen , t .headerBorderShape , false )
2039
2025
}
@@ -2048,7 +2034,7 @@ func (t *Terminal) printLabel(window tui.Window, render labelPrinter, opts label
2048
2034
}
2049
2035
2050
2036
switch borderShape {
2051
- case tui .BorderHorizontal , tui .BorderTop , tui .BorderBottom , tui .BorderRounded , tui .BorderSharp , tui .BorderBold , tui .BorderBlock , tui .BorderThinBlock , tui .BorderDouble , tui . BorderLine :
2037
+ case tui .BorderHorizontal , tui .BorderTop , tui .BorderBottom , tui .BorderRounded , tui .BorderSharp , tui .BorderBold , tui .BorderBlock , tui .BorderThinBlock , tui .BorderDouble :
2052
2038
if redrawBorder {
2053
2039
window .DrawHBorder ()
2054
2040
}
@@ -3231,11 +3217,11 @@ func (t *Terminal) renderPreviewScrollbar(yoff int, barLength int, barStart int)
3231
3217
t .previewer .xw = xw
3232
3218
}
3233
3219
xshift := - 1 - t .borderWidth
3234
- if ! t .activePreviewOpts .HasBorderRight () {
3220
+ if ! t .activePreviewOpts .Border (). HasRight () {
3235
3221
xshift = - 1
3236
3222
}
3237
3223
yshift := 1
3238
- if ! t .activePreviewOpts .HasBorderTop () {
3224
+ if ! t .activePreviewOpts .Border (). HasTop () {
3239
3225
yshift = 0
3240
3226
}
3241
3227
for i := yoff ; i < height ; i ++ {
@@ -3897,13 +3883,13 @@ func (t *Terminal) Loop() error {
3897
3883
if t .activePreviewOpts .aboveOrBelow () {
3898
3884
if t .activePreviewOpts .size .percent {
3899
3885
newContentHeight := int (float64 (contentHeight ) * 100. / (100. - t .activePreviewOpts .size .size ))
3900
- contentHeight = util .Max (contentHeight + 1 + borderLines (t .activePreviewOpts .border ), newContentHeight )
3886
+ contentHeight = util .Max (contentHeight + 1 + borderLines (t .activePreviewOpts .Border () ), newContentHeight )
3901
3887
} else {
3902
- contentHeight += int (t .activePreviewOpts .size .size ) + borderLines (t .activePreviewOpts .border )
3888
+ contentHeight += int (t .activePreviewOpts .size .size ) + borderLines (t .activePreviewOpts .Border () )
3903
3889
}
3904
3890
} else {
3905
3891
// Minimum height if preview window can appear
3906
- contentHeight = util .Max (contentHeight , 1 + borderLines (t .activePreviewOpts .border ))
3892
+ contentHeight = util .Max (contentHeight , 1 + borderLines (t .activePreviewOpts .Border () ))
3907
3893
}
3908
3894
}
3909
3895
return util .Min (termHeight , contentHeight + pad )
@@ -4257,7 +4243,7 @@ func (t *Terminal) Loop() error {
4257
4243
case reqRedrawBorderLabel :
4258
4244
t .printLabel (t .border , t .borderLabel , t .borderLabelOpts , t .borderLabelLen , t .borderShape , true )
4259
4245
case reqRedrawPreviewLabel :
4260
- t .printLabel (t .pborder , t .previewLabel , t .previewLabelOpts , t .previewLabelLen , t .activePreviewOpts .border , true )
4246
+ t .printLabel (t .pborder , t .previewLabel , t .previewLabelOpts , t .previewLabelLen , t .activePreviewOpts .Border () , true )
4261
4247
case reqReinit :
4262
4248
t .tui .Resume (t .fullscreen , true )
4263
4249
t .fullRedraw ()
0 commit comments