Skip to content
Myr

Add footer

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Options: --footer=STR String to print as footer --footer-border[=STYLE] Draw border around the footer section [rounded|sharp|bold|block|thinblock|double|horizontal|vertical| top|bottom|left|right|line|none] (default: line) --footer-label=LABEL Label to print on the footer border --footer-label-pos=COL Position of the footer label [POSITIVE_INTEGER: columns from left| NEGATIVE_INTEGER: columns from right][:bottom] (default: 0 or center) The default border type for footer is 'line', which draws a single separator between the footer and the list. It changes its position depending on `--layout`, so you don't have to manually switch between 'top' and 'bottom' The 'line' style is now supported by other border types as well. `--list-border` is the only exception.

authored by Junegunn Choi · committed by Junegunn Choi · parent 39db026 · Browse files · 11 files+721 added−182 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

11 files+721 added−182 removed

  • tests:+195 added−0 removed
  • other:+526 added−182 removed

11 files+721 added−182 removed

modified:man/man1/fzf.1+37 added-7 removed
19 unmodified lines
20LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,21OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN22THE SOFTWARE.23..24.TH fzf 1 "May 2025" "fzf 0.62.0" "fzf - a command-line fuzzy finder"24.TH fzf 1 "Jun 2025" "fzf 0.63.0" "fzf - a command-line fuzzy finder"2526.SH NAME27fzf - a command-line fuzzy finder28
473 unmodified lines
502.BR horizontal " Horizontal lines above and below the finder"503.br504.BR vertical " Vertical lines on each side of the finder"505.br506.BR line " Single line border (position automatically determined)"507.br508.BR top " (up)"509.br510.BR bottom " (down)"511.br
7 unmodified lines
519If you use a terminal emulator where each box-drawing character takes5202 columns, try setting \fB\-\-ambidouble\fR. If the border is still not properly521rendered, set \fB\-\-no\-unicode\fR.522523\fBline\fR style draws a single separator line at the top when \fB\-\-height\fR524is used.525526.TP527.BI "\-\-border\-label" [=LABEL]528Label to print on the horizontal border line. Should be used with one of the529following \fB\-\-border\fR options.
135 unmodified lines
665Do not display scrollbar. A synonym for \fB\-\-scrollbar=''\fB666667.TP668.BI "\-\-list\-border" [=STYLE]664Draw border around the list section669Draw border around the list section. \fBline\fR style is not supported for670this border.671672.TP673.BI "\-\-list\-label" [=LABEL]674Label to print on the list border
78 unmodified lines
753.br754\fBkill\-word\fR755.TP756.BI "\-\-input\-border" [=STYLE]751Draw border around the input section757Draw border around the input section. \fBline\fR style draws a single separator758line between the input section and the list section.759760.TP761.BI "\-\-input\-label" [=LABEL]762Label to print on the input border
91 unmodified lines
854.RE855856.TP857.BI "\-\-preview\-border" [=STYLE]851Short for \fB\-\-preview\-window=border\-STYLE\fR. In addition to the other852styles, \fBline\fR style is also supported for preview border, which draws858Short for \fB\-\-preview\-window=border\-STYLE\fR. \fBline\fR style draws859a single separator line between the preview window and the rest of the860interface.861862.TP
147 unmodified lines
1010Print header before the prompt line. When both normal header and header lines1011(\fB\-\-header\-lines\fR) are present, this applies only to the normal header.1012.TP1013.BI "\-\-header\-border" [=STYLE]1008Draw border around the header section1014Draw border around the header section. \fBline\fR style draws a single1015separator line between the header window and the list section.10161017.TP1018.BI "\-\-header\-label" [=LABEL]1019Label to print on the header border
5 unmodified lines
1025.TP1026.BI "\-\-header\-lines\-border" [=STYLE]1027Display header from \fB--header\-lines\fR with a separate border. Pass1028\fBnone\fR to still separate the header lines but without a border. To combine1022two headers, use \fB\-\-no\-header\-lines\-border\fR.1029two headers, use \fB\-\-no\-header\-lines\-border\fR. \fBline\fR style draws1030a single separator line between the header lines and the list section.10311032.SS FOOTER10331034.TP1035.BI "\-\-footer=" "STR"1036The given string will be printed as the sticky footer. The lines are displayed1037in the given order from top to bottom regardless of \fB\-\-layout\fR option, and1038are not affected by \fB\-\-with\-nth\fR. ANSI color codes are processed even when1039\fB\-\-ansi\fR is not set.10401041.TP1042.BI "\-\-footer\-border" [=STYLE]1043Draw border around the header section. \fBline\fR style draws a single1044separator line between the footer and the list section.10451046.TP1047.BI "\-\-footer\-label" [=LABEL]1048Label to print on the footer border10491050.TP1051.BI "\-\-footer\-label\-pos" [=N[:top|bottom]]1052Position of the footer label10531054.SS SCRIPTING1055.TP1056.BI "\-q, \-\-query=" "STR"1057Start the finder with the given query
925 unmodified lines
modified:src/tui/light.go+10 added-1 removed
827 unmodified lines
828 w.bg = r.theme.InputBg.Color829 case WindowHeader:830 w.fg = r.theme.Header.Color831 w.bg = r.theme.HeaderBg.Color832 case WindowFooter:833 w.fg = r.theme.Footer.Color834 w.bg = r.theme.FooterBg.Color835 case WindowPreview:836 w.fg = r.theme.PreviewFg.Color837 w.bg = r.theme.PreviewBg.Color838 }836 if erase && !w.bg.IsDefault() && w.border.shape != BorderNone {839 if erase && !w.bg.IsDefault() && w.border.shape != BorderNone && w.height > 0 {840 // fzf --color bg:blue --border --padding 1,2841 w.Erase()842 }843 w.drawBorder(false)
47 unmodified lines
891 case WindowInput:892 color = ColInputBorder893 case WindowHeader:894 color = ColHeaderBorder895 case WindowFooter:896 color = ColFooterBorder897 case WindowPreview:898 color = ColPreviewBorder899 }900 hw := runeWidth(w.border.top)
17 unmodified lines
918 case WindowInput:919 color = ColInputBorder920 case WindowHeader:921 color = ColHeaderBorder922 case WindowFooter:923 color = ColFooterBorder924 case WindowPreview:925 color = ColPreviewBorder926 }927 for y := 0; y < w.height; y++ {
19 unmodified lines
947 case WindowInput:948 color = ColInputBorder949 case WindowHeader:950 color = ColHeaderBorder951 case WindowFooter:952 color = ColFooterBorder953 case WindowPreview:954 color = ColPreviewBorder955 }956 hw := runeWidth(w.border.top)
318 unmodified lines
modified:src/tui/tcell.go+4 added
598 unmodified lines
599 case WindowList:600 normal = ColNormal601 case WindowHeader:602 normal = ColHeader603 case WindowFooter:604 normal = ColFooter605 case WindowInput:606 normal = ColInput607 case WindowPreview:608 normal = ColPreview
257 unmodified lines
866 case WindowList:867 style = ColListBorder.style()868 case WindowHeader:869 style = ColHeaderBorder.style()870 case WindowFooter:871 style = ColFooterBorder.style()872 case WindowInput:873 style = ColInputBorder.style()874 case WindowPreview:875 style = ColPreviewBorder.style()
54 unmodified lines
modified:src/tui/tui.go+41 added
357 unmodified lines
358 Header ColorAttr359 HeaderBg ColorAttr360 HeaderBorder ColorAttr361 HeaderLabel ColorAttr362 Footer ColorAttr363 FooterBg ColorAttr364 FooterBorder ColorAttr365 FooterLabel ColorAttr366 Separator ColorAttr367 Scrollbar ColorAttr368 Border ColorAttr369 PreviewBorder ColorAttr
245 unmodified lines
615 WindowList616 WindowPreview617 WindowInput618 WindowHeader619 WindowFooter620)621622type Renderer interface {623 DefaultTheme() *ColorTheme
100 unmodified lines
724 ColInfo ColorPair725 ColHeader ColorPair726 ColHeaderBorder ColorPair727 ColHeaderLabel ColorPair728 ColFooter ColorPair729 ColFooterBorder ColorPair730 ColFooterLabel ColorPair731 ColSeparator ColorPair732 ColScrollbar ColorPair733 ColGapLine ColorPair734 ColBorder ColorPair
30 unmodified lines
765 Info: ColorAttr{colUndefined, AttrUndefined},766 Cursor: ColorAttr{colUndefined, AttrUndefined},767 Marker: ColorAttr{colUndefined, AttrUndefined},768 Header: ColorAttr{colUndefined, AttrUndefined},769 Footer: ColorAttr{colUndefined, AttrUndefined},770 Border: ColorAttr{colUndefined, AttrUndefined},771 BorderLabel: ColorAttr{colUndefined, AttrUndefined},772 ListLabel: ColorAttr{colUndefined, AttrUndefined},773 ListBorder: ColorAttr{colUndefined, AttrUndefined},
12 unmodified lines
786 InputLabel: ColorAttr{colUndefined, AttrUndefined},787 HeaderBg: ColorAttr{colUndefined, AttrUndefined},788 HeaderBorder: ColorAttr{colUndefined, AttrUndefined},789 HeaderLabel: ColorAttr{colUndefined, AttrUndefined},790 FooterBg: ColorAttr{colUndefined, AttrUndefined},791 FooterBorder: ColorAttr{colUndefined, AttrUndefined},792 FooterLabel: ColorAttr{colUndefined, AttrUndefined},793 GapLine: ColorAttr{colUndefined, AttrUndefined},794 Nth: ColorAttr{colUndefined, AttrUndefined},795 }796}
39 unmodified lines
836 InputLabel: ColorAttr{colDefault, AttrUndefined},837 HeaderBg: ColorAttr{colDefault, AttrUndefined},838 HeaderBorder: ColorAttr{colDefault, AttrUndefined},839 HeaderLabel: ColorAttr{colDefault, AttrUndefined},840 FooterBg: ColorAttr{colDefault, AttrUndefined},841 FooterBorder: ColorAttr{colDefault, AttrUndefined},842 FooterLabel: ColorAttr{colDefault, AttrUndefined},843 GapLine: ColorAttr{colDefault, AttrUndefined},844 Nth: ColorAttr{colUndefined, AttrUndefined},845 }846}
19 unmodified lines
866 Info: ColorAttr{colWhite, AttrUndefined},867 Cursor: ColorAttr{colRed, AttrUndefined},868 Marker: ColorAttr{colMagenta, AttrUndefined},869 Header: ColorAttr{colCyan, AttrUndefined},870 Footer: ColorAttr{colCyan, AttrUndefined},871 Border: ColorAttr{colBlack, AttrUndefined},872 BorderLabel: ColorAttr{colWhite, AttrUndefined},873 Ghost: ColorAttr{colUndefined, Dim},874 Disabled: ColorAttr{colUndefined, AttrUndefined},
9 unmodified lines
884 Scrollbar: ColorAttr{colUndefined, AttrUndefined},885 InputBg: ColorAttr{colUndefined, AttrUndefined},886 InputBorder: ColorAttr{colUndefined, AttrUndefined},887 InputLabel: ColorAttr{colUndefined, AttrUndefined},888 HeaderBg: ColorAttr{colUndefined, AttrUndefined},889 HeaderBorder: ColorAttr{colUndefined, AttrUndefined},890 HeaderLabel: ColorAttr{colUndefined, AttrUndefined},891 FooterBg: ColorAttr{colUndefined, AttrUndefined},892 FooterBorder: ColorAttr{colUndefined, AttrUndefined},893 FooterLabel: ColorAttr{colUndefined, AttrUndefined},894 GapLine: ColorAttr{colUndefined, AttrUndefined},895 Nth: ColorAttr{colUndefined, AttrUndefined},896 }897 Dark256 = &ColorTheme{
16 unmodified lines
914 Info: ColorAttr{144, AttrUndefined},915 Cursor: ColorAttr{161, AttrUndefined},916 Marker: ColorAttr{168, AttrUndefined},917 Header: ColorAttr{109, AttrUndefined},918 Footer: ColorAttr{109, AttrUndefined},919 Border: ColorAttr{59, AttrUndefined},920 BorderLabel: ColorAttr{145, AttrUndefined},921 Ghost: ColorAttr{colUndefined, Dim},922 Disabled: ColorAttr{colUndefined, AttrUndefined},
9 unmodified lines
932 Scrollbar: ColorAttr{colUndefined, AttrUndefined},933 InputBg: ColorAttr{colUndefined, AttrUndefined},934 InputBorder: ColorAttr{colUndefined, AttrUndefined},935 InputLabel: ColorAttr{colUndefined, AttrUndefined},936 HeaderBg: ColorAttr{colUndefined, AttrUndefined},937 HeaderBorder: ColorAttr{colUndefined, AttrUndefined},938 HeaderLabel: ColorAttr{colUndefined, AttrUndefined},939 FooterBg: ColorAttr{colUndefined, AttrUndefined},940 FooterBorder: ColorAttr{colUndefined, AttrUndefined},941 FooterLabel: ColorAttr{colUndefined, AttrUndefined},942 GapLine: ColorAttr{colUndefined, AttrUndefined},943 Nth: ColorAttr{colUndefined, AttrUndefined},944 }945 Light256 = &ColorTheme{
16 unmodified lines
962 Info: ColorAttr{101, AttrUndefined},963 Cursor: ColorAttr{161, AttrUndefined},964 Marker: ColorAttr{168, AttrUndefined},965 Header: ColorAttr{31, AttrUndefined},966 Footer: ColorAttr{31, AttrUndefined},967 Border: ColorAttr{145, AttrUndefined},968 BorderLabel: ColorAttr{59, AttrUndefined},969 Ghost: ColorAttr{colUndefined, Dim},970 Disabled: ColorAttr{colUndefined, AttrUndefined},
12 unmodified lines
983 InputLabel: ColorAttr{colUndefined, AttrUndefined},984 HeaderBg: ColorAttr{colUndefined, AttrUndefined},985 HeaderBorder: ColorAttr{colUndefined, AttrUndefined},986 HeaderLabel: ColorAttr{colUndefined, AttrUndefined},987 FooterBg: ColorAttr{colUndefined, AttrUndefined},988 FooterBorder: ColorAttr{colUndefined, AttrUndefined},989 FooterLabel: ColorAttr{colUndefined, AttrUndefined},990 GapLine: ColorAttr{colUndefined, AttrUndefined},991 Nth: ColorAttr{colUndefined, AttrUndefined},992 }993}
27 unmodified lines
1021 theme.Info = o(baseTheme.Info, theme.Info)1022 theme.Cursor = o(baseTheme.Cursor, theme.Cursor)1023 theme.Marker = o(baseTheme.Marker, theme.Marker)1024 theme.Header = o(baseTheme.Header, theme.Header)1025 theme.Footer = o(baseTheme.Footer, theme.Footer)1026 theme.Border = o(baseTheme.Border, theme.Border)1027 theme.BorderLabel = o(baseTheme.BorderLabel, theme.BorderLabel)10281029 undefined := NewColorAttr()
45 unmodified lines
1075 }1076 theme.HeaderBorder = o(theme.Border, theme.HeaderBorder)1077 theme.HeaderLabel = o(theme.BorderLabel, theme.HeaderLabel)10781079 theme.FooterBg = o(theme.Bg, theme.FooterBg)1080 theme.FooterBorder = o(theme.Border, theme.FooterBorder)1081 theme.FooterLabel = o(theme.BorderLabel, theme.FooterLabel)10821083 initPalette(theme)1084}10851086func initPalette(theme *ColorTheme) {
45 unmodified lines
1132 ColInputLabel = pair(theme.InputLabel, theme.InputBg)1133 ColHeader = pair(theme.Header, theme.HeaderBg)1134 ColHeaderBorder = pair(theme.HeaderBorder, theme.HeaderBg)1135 ColHeaderLabel = pair(theme.HeaderLabel, theme.HeaderBg)1136 ColFooter = pair(theme.Footer, theme.FooterBg)1137 ColFooterBorder = pair(theme.FooterBorder, theme.FooterBg)1138 ColFooterLabel = pair(theme.FooterLabel, theme.FooterBg)1139}11401141func runeWidth(r rune) int {1142 return uniseg.StringWidth(string(r))
1 unmodified line
modified:src/util/util.go+2 added-14 removed
95 unmodified lines
96}9798// Constrain32 limits the given 32-bit integer with the upper and lower bounds99func Constrain32(val int32, min int32, max int32) int32 {100 if val < min {101 return min102 }103 if val > max {104 return max105 }106 return val100 return Max32(Min32(val, max), min)101}102103// Constrain limits the given integer with the upper and lower bounds104func Constrain(val int, min int, max int) int {111 if val < min {112 return min113 }114 if val > max {115 return max116 }117 return val105 return Max(Min(val, max), min)106}107108func AsUint16(val int) uint16 {109 if val > math.MaxUint16 {
107 unmodified lines
modified:src/actiontype_string.go+123 added-119 removed
27 unmodified lines
28 _ = x[actCancel-17]29 _ = x[actChangeBorderLabel-18]30 _ = x[actChangeGhost-19]31 _ = x[actChangeHeader-20]32 _ = x[actChangeHeaderLabel-21]33 _ = x[actChangeInputLabel-22]34 _ = x[actChangeListLabel-23]35 _ = x[actChangeMulti-24]36 _ = x[actChangeNth-25]37 _ = x[actChangePointer-26]38 _ = x[actChangePreview-27]39 _ = x[actChangePreviewLabel-28]40 _ = x[actChangePreviewWindow-29]41 _ = x[actChangePrompt-30]42 _ = x[actChangeQuery-31]43 _ = x[actClearScreen-32]44 _ = x[actClearQuery-33]45 _ = x[actClearSelection-34]46 _ = x[actClose-35]47 _ = x[actDeleteChar-36]48 _ = x[actDeleteCharEof-37]49 _ = x[actEndOfLine-38]50 _ = x[actFatal-39]51 _ = x[actForwardChar-40]52 _ = x[actForwardWord-41]53 _ = x[actKillLine-42]54 _ = x[actKillWord-43]55 _ = x[actUnixLineDiscard-44]56 _ = x[actUnixWordRubout-45]57 _ = x[actYank-46]58 _ = x[actBackwardKillWord-47]59 _ = x[actSelectAll-48]60 _ = x[actDeselectAll-49]61 _ = x[actToggle-50]62 _ = x[actToggleSearch-51]63 _ = x[actToggleAll-52]64 _ = x[actToggleDown-53]65 _ = x[actToggleUp-54]66 _ = x[actToggleIn-55]67 _ = x[actToggleOut-56]68 _ = x[actToggleTrack-57]69 _ = x[actToggleTrackCurrent-58]70 _ = x[actToggleHeader-59]71 _ = x[actToggleWrap-60]72 _ = x[actToggleMultiLine-61]73 _ = x[actToggleHscroll-62]74 _ = x[actTrackCurrent-63]75 _ = x[actToggleInput-64]76 _ = x[actHideInput-65]77 _ = x[actShowInput-66]78 _ = x[actUntrackCurrent-67]79 _ = x[actDown-68]80 _ = x[actUp-69]81 _ = x[actPageUp-70]82 _ = x[actPageDown-71]83 _ = x[actPosition-72]84 _ = x[actHalfPageUp-73]85 _ = x[actHalfPageDown-74]86 _ = x[actOffsetUp-75]87 _ = x[actOffsetDown-76]88 _ = x[actOffsetMiddle-77]89 _ = x[actJump-78]90 _ = x[actJumpAccept-79]91 _ = x[actPrintQuery-80]92 _ = x[actRefreshPreview-81]93 _ = x[actReplaceQuery-82]94 _ = x[actToggleSort-83]95 _ = x[actShowPreview-84]96 _ = x[actHidePreview-85]97 _ = x[actTogglePreview-86]98 _ = x[actTogglePreviewWrap-87]99 _ = x[actTransform-88]100 _ = x[actTransformBorderLabel-89]101 _ = x[actTransformGhost-90]102 _ = x[actTransformHeader-91]103 _ = x[actTransformHeaderLabel-92]104 _ = x[actTransformInputLabel-93]105 _ = x[actTransformListLabel-94]106 _ = x[actTransformNth-95]107 _ = x[actTransformPointer-96]108 _ = x[actTransformPreviewLabel-97]109 _ = x[actTransformPrompt-98]110 _ = x[actTransformQuery-99]111 _ = x[actTransformSearch-100]112 _ = x[actSearch-101]113 _ = x[actPreview-102]114 _ = x[actPreviewTop-103]115 _ = x[actPreviewBottom-104]116 _ = x[actPreviewUp-105]117 _ = x[actPreviewDown-106]118 _ = x[actPreviewPageUp-107]119 _ = x[actPreviewPageDown-108]120 _ = x[actPreviewHalfPageUp-109]121 _ = x[actPreviewHalfPageDown-110]122 _ = x[actPrevHistory-111]123 _ = x[actPrevSelected-112]124 _ = x[actPrint-113]125 _ = x[actPut-114]126 _ = x[actNextHistory-115]127 _ = x[actNextSelected-116]128 _ = x[actExecute-117]129 _ = x[actExecuteSilent-118]130 _ = x[actExecuteMulti-119]131 _ = x[actSigStop-120]132 _ = x[actFirst-121]133 _ = x[actLast-122]134 _ = x[actReload-123]135 _ = x[actReloadSync-124]136 _ = x[actDisableSearch-125]137 _ = x[actEnableSearch-126]138 _ = x[actSelect-127]139 _ = x[actDeselect-128]140 _ = x[actUnbind-129]141 _ = x[actRebind-130]142 _ = x[actToggleBind-131]143 _ = x[actBecome-132]144 _ = x[actShowHeader-133]145 _ = x[actHideHeader-134]146 _ = x[actBell-135]147 _ = x[actExclude-136]148 _ = x[actExcludeMulti-137]32 _ = x[actChangeFooter-21]33 _ = x[actChangeHeaderLabel-22]34 _ = x[actChangeFooterLabel-23]35 _ = x[actChangeInputLabel-24]36 _ = x[actChangeListLabel-25]37 _ = x[actChangeMulti-26]38 _ = x[actChangeNth-27]39 _ = x[actChangePointer-28]40 _ = x[actChangePreview-29]41 _ = x[actChangePreviewLabel-30]42 _ = x[actChangePreviewWindow-31]43 _ = x[actChangePrompt-32]44 _ = x[actChangeQuery-33]45 _ = x[actClearScreen-34]46 _ = x[actClearQuery-35]47 _ = x[actClearSelection-36]48 _ = x[actClose-37]49 _ = x[actDeleteChar-38]50 _ = x[actDeleteCharEof-39]51 _ = x[actEndOfLine-40]52 _ = x[actFatal-41]53 _ = x[actForwardChar-42]54 _ = x[actForwardWord-43]55 _ = x[actKillLine-44]56 _ = x[actKillWord-45]57 _ = x[actUnixLineDiscard-46]58 _ = x[actUnixWordRubout-47]59 _ = x[actYank-48]60 _ = x[actBackwardKillWord-49]61 _ = x[actSelectAll-50]62 _ = x[actDeselectAll-51]63 _ = x[actToggle-52]64 _ = x[actToggleSearch-53]65 _ = x[actToggleAll-54]66 _ = x[actToggleDown-55]67 _ = x[actToggleUp-56]68 _ = x[actToggleIn-57]69 _ = x[actToggleOut-58]70 _ = x[actToggleTrack-59]71 _ = x[actToggleTrackCurrent-60]72 _ = x[actToggleHeader-61]73 _ = x[actToggleWrap-62]74 _ = x[actToggleMultiLine-63]75 _ = x[actToggleHscroll-64]76 _ = x[actTrackCurrent-65]77 _ = x[actToggleInput-66]78 _ = x[actHideInput-67]79 _ = x[actShowInput-68]80 _ = x[actUntrackCurrent-69]81 _ = x[actDown-70]82 _ = x[actUp-71]83 _ = x[actPageUp-72]84 _ = x[actPageDown-73]85 _ = x[actPosition-74]86 _ = x[actHalfPageUp-75]87 _ = x[actHalfPageDown-76]88 _ = x[actOffsetUp-77]89 _ = x[actOffsetDown-78]90 _ = x[actOffsetMiddle-79]91 _ = x[actJump-80]92 _ = x[actJumpAccept-81]93 _ = x[actPrintQuery-82]94 _ = x[actRefreshPreview-83]95 _ = x[actReplaceQuery-84]96 _ = x[actToggleSort-85]97 _ = x[actShowPreview-86]98 _ = x[actHidePreview-87]99 _ = x[actTogglePreview-88]100 _ = x[actTogglePreviewWrap-89]101 _ = x[actTransform-90]102 _ = x[actTransformBorderLabel-91]103 _ = x[actTransformGhost-92]104 _ = x[actTransformHeader-93]105 _ = x[actTransformFooter-94]106 _ = x[actTransformHeaderLabel-95]107 _ = x[actTransformFooterLabel-96]108 _ = x[actTransformInputLabel-97]109 _ = x[actTransformListLabel-98]110 _ = x[actTransformNth-99]111 _ = x[actTransformPointer-100]112 _ = x[actTransformPreviewLabel-101]113 _ = x[actTransformPrompt-102]114 _ = x[actTransformQuery-103]115 _ = x[actTransformSearch-104]116 _ = x[actSearch-105]117 _ = x[actPreview-106]118 _ = x[actPreviewTop-107]119 _ = x[actPreviewBottom-108]120 _ = x[actPreviewUp-109]121 _ = x[actPreviewDown-110]122 _ = x[actPreviewPageUp-111]123 _ = x[actPreviewPageDown-112]124 _ = x[actPreviewHalfPageUp-113]125 _ = x[actPreviewHalfPageDown-114]126 _ = x[actPrevHistory-115]127 _ = x[actPrevSelected-116]128 _ = x[actPrint-117]129 _ = x[actPut-118]130 _ = x[actNextHistory-119]131 _ = x[actNextSelected-120]132 _ = x[actExecute-121]133 _ = x[actExecuteSilent-122]134 _ = x[actExecuteMulti-123]135 _ = x[actSigStop-124]136 _ = x[actFirst-125]137 _ = x[actLast-126]138 _ = x[actReload-127]139 _ = x[actReloadSync-128]140 _ = x[actDisableSearch-129]141 _ = x[actEnableSearch-130]142 _ = x[actSelect-131]143 _ = x[actDeselect-132]144 _ = x[actUnbind-133]145 _ = x[actRebind-134]146 _ = x[actToggleBind-135]147 _ = x[actBecome-136]148 _ = x[actShowHeader-137]149 _ = x[actHideHeader-138]150 _ = x[actBell-139]151 _ = x[actExclude-140]152 _ = x[actExcludeMulti-141]153}154151const _actionType_name = "actIgnoreactStartactClickactInvalidactBracketedPasteBeginactBracketedPasteEndactCharactMouseactBeginningOfLineactAbortactAcceptactAcceptNonEmptyactAcceptOrPrintQueryactBackwardCharactBackwardDeleteCharactBackwardDeleteCharEofactBackwardWordactCancelactChangeBorderLabelactChangeGhostactChangeHeaderactChangeHeaderLabelactChangeInputLabelactChangeListLabelactChangeMultiactChangeNthactChangePointeractChangePreviewactChangePreviewLabelactChangePreviewWindowactChangePromptactChangeQueryactClearScreenactClearQueryactClearSelectionactCloseactDeleteCharactDeleteCharEofactEndOfLineactFatalactForwardCharactForwardWordactKillLineactKillWordactUnixLineDiscardactUnixWordRuboutactYankactBackwardKillWordactSelectAllactDeselectAllactToggleactToggleSearchactToggleAllactToggleDownactToggleUpactToggleInactToggleOutactToggleTrackactToggleTrackCurrentactToggleHeaderactToggleWrapactToggleMultiLineactToggleHscrollactTrackCurrentactToggleInputactHideInputactShowInputactUntrackCurrentactDownactUpactPageUpactPageDownactPositionactHalfPageUpactHalfPageDownactOffsetUpactOffsetDownactOffsetMiddleactJumpactJumpAcceptactPrintQueryactRefreshPreviewactReplaceQueryactToggleSortactShowPreviewactHidePreviewactTogglePreviewactTogglePreviewWrapactTransformactTransformBorderLabelactTransformGhostactTransformHeaderactTransformHeaderLabelactTransformInputLabelactTransformListLabelactTransformNthactTransformPointeractTransformPreviewLabelactTransformPromptactTransformQueryactTransformSearchactSearchactPreviewactPreviewTopactPreviewBottomactPreviewUpactPreviewDownactPreviewPageUpactPreviewPageDownactPreviewHalfPageUpactPreviewHalfPageDownactPrevHistoryactPrevSelectedactPrintactPutactNextHistoryactNextSelectedactExecuteactExecuteSilentactExecuteMultiactSigStopactFirstactLastactReloadactReloadSyncactDisableSearchactEnableSearchactSelectactDeselectactUnbindactRebindactToggleBindactBecomeactShowHeaderactHideHeaderactBellactExcludeactExcludeMulti"155const _actionType_name = "actIgnoreactStartactClickactInvalidactBracketedPasteBeginactBracketedPasteEndactCharactMouseactBeginningOfLineactAbortactAcceptactAcceptNonEmptyactAcceptOrPrintQueryactBackwardCharactBackwardDeleteCharactBackwardDeleteCharEofactBackwardWordactCancelactChangeBorderLabelactChangeGhostactChangeHeaderactChangeFooteractChangeHeaderLabelactChangeFooterLabelactChangeInputLabelactChangeListLabelactChangeMultiactChangeNthactChangePointeractChangePreviewactChangePreviewLabelactChangePreviewWindowactChangePromptactChangeQueryactClearScreenactClearQueryactClearSelectionactCloseactDeleteCharactDeleteCharEofactEndOfLineactFatalactForwardCharactForwardWordactKillLineactKillWordactUnixLineDiscardactUnixWordRuboutactYankactBackwardKillWordactSelectAllactDeselectAllactToggleactToggleSearchactToggleAllactToggleDownactToggleUpactToggleInactToggleOutactToggleTrackactToggleTrackCurrentactToggleHeaderactToggleWrapactToggleMultiLineactToggleHscrollactTrackCurrentactToggleInputactHideInputactShowInputactUntrackCurrentactDownactUpactPageUpactPageDownactPositionactHalfPageUpactHalfPageDownactOffsetUpactOffsetDownactOffsetMiddleactJumpactJumpAcceptactPrintQueryactRefreshPreviewactReplaceQueryactToggleSortactShowPreviewactHidePreviewactTogglePreviewactTogglePreviewWrapactTransformactTransformBorderLabelactTransformGhostactTransformHeaderactTransformFooteractTransformHeaderLabelactTransformFooterLabelactTransformInputLabelactTransformListLabelactTransformNthactTransformPointeractTransformPreviewLabelactTransformPromptactTransformQueryactTransformSearchactSearchactPreviewactPreviewTopactPreviewBottomactPreviewUpactPreviewDownactPreviewPageUpactPreviewPageDownactPreviewHalfPageUpactPreviewHalfPageDownactPrevHistoryactPrevSelectedactPrintactPutactNextHistoryactNextSelectedactExecuteactExecuteSilentactExecuteMultiactSigStopactFirstactLastactReloadactReloadSyncactDisableSearchactEnableSearchactSelectactDeselectactUnbindactRebindactToggleBindactBecomeactShowHeaderactHideHeaderactBellactExcludeactExcludeMulti"156153var _actionType_index = [...]uint16{0, 9, 17, 25, 35, 57, 77, 84, 92, 110, 118, 127, 144, 165, 180, 201, 225, 240, 249, 269, 283, 298, 318, 337, 355, 369, 381, 397, 413, 434, 456, 471, 485, 499, 512, 529, 537, 550, 566, 578, 586, 600, 614, 625, 636, 654, 671, 678, 697, 709, 723, 732, 747, 759, 772, 783, 794, 806, 820, 841, 856, 869, 887, 903, 918, 932, 944, 956, 973, 980, 985, 994, 1005, 1016, 1029, 1044, 1055, 1068, 1083, 1090, 1103, 1116, 1133, 1148, 1161, 1175, 1189, 1205, 1225, 1237, 1260, 1277, 1295, 1318, 1340, 1361, 1376, 1395, 1419, 1437, 1454, 1472, 1481, 1491, 1504, 1520, 1532, 1546, 1562, 1580, 1600, 1622, 1636, 1651, 1659, 1665, 1679, 1694, 1704, 1720, 1735, 1745, 1753, 1760, 1769, 1782, 1798, 1813, 1822, 1833, 1842, 1851, 1864, 1873, 1886, 1899, 1906, 1916, 1931}157var _actionType_index = [...]uint16{0, 9, 17, 25, 35, 57, 77, 84, 92, 110, 118, 127, 144, 165, 180, 201, 225, 240, 249, 269, 283, 298, 313, 333, 353, 372, 390, 404, 416, 432, 448, 469, 491, 506, 520, 534, 547, 564, 572, 585, 601, 613, 621, 635, 649, 660, 671, 689, 706, 713, 732, 744, 758, 767, 782, 794, 807, 818, 829, 841, 855, 876, 891, 904, 922, 938, 953, 967, 979, 991, 1008, 1015, 1020, 1029, 1040, 1051, 1064, 1079, 1090, 1103, 1118, 1125, 1138, 1151, 1168, 1183, 1196, 1210, 1224, 1240, 1260, 1272, 1295, 1312, 1330, 1348, 1371, 1394, 1416, 1437, 1452, 1471, 1495, 1513, 1530, 1548, 1557, 1567, 1580, 1596, 1608, 1622, 1638, 1656, 1676, 1698, 1712, 1727, 1735, 1741, 1755, 1770, 1780, 1796, 1811, 1821, 1829, 1836, 1845, 1858, 1874, 1889, 1898, 1909, 1918, 1927, 1940, 1949, 1962, 1975, 1982, 1992, 2007}158159func (i actionType) String() string {160 if i < 0 || i >= actionType(len(_actionType_index)-1) {161 return "actionType(" + strconv.FormatInt(int64(i), 10) + ")"
3 unmodified lines
modified:src/core.go+1 added-1 removed
37 unmodified lines
3839// Run starts fzf40func Run(opts *Options) (int, error) {41 if opts.Filter == nil {42 if opts.Tmux != nil && len(os.Getenv("TMUX")) > 0 && opts.Tmux.index >= opts.Height.index {42 if opts.useTmux() {43 return runTmux(os.Args, opts)44 }4546 if needWinpty(opts) {
465 unmodified lines
modified:src/options.go+92 added-16 removed
81 unmodified lines
82 --margin=MARGIN Screen margin (TRBL | TB,RL | T,RL,B | T,R,B,L)83 --padding=PADDING Padding inside border (TRBL | TB,RL | T,RL,B | T,R,B,L)84 --border[=STYLE] Draw border around the finder85 [rounded|sharp|bold|block|thinblock|double|horizontal|vertical|86 top|bottom|left|right|none] (default: rounded)86 top|bottom|left|right|line|none] (default: rounded)87 --border-label=LABEL Label to print on the border88 --border-label-pos=COL Position of the border label89 [POSITIVE_INTEGER: columns from left|90 NEGATIVE_INTEGER: columns from right][:bottom]
48 unmodified lines
139 --ghost=TEXT Ghost text to display when the input is empty140 --filepath-word Make word-wise movements respect path separators141 --input-border[=STYLE] Draw border around the input section142 [rounded|sharp|bold|block|thinblock|double|horizontal|vertical|143 top|bottom|left|right|none] (default: rounded)143 top|bottom|left|right|line|none] (default: rounded)144 --input-label=LABEL Label to print on the input border145 --input-label-pos=COL Position of the input label146 [POSITIVE_INTEGER: columns from left|147 NEGATIVE_INTEGER: columns from right][:bottom]
19 unmodified lines
167 --header-lines=N The first N lines of the input are treated as header168 --header-first Print header before the prompt line169 --header-border[=STYLE] Draw border around the header section170 [rounded|sharp|bold|block|thinblock|double|horizontal|vertical|171 top|bottom|left|right|none] (default: rounded)171 top|bottom|left|right|line|none] (default: rounded)172 --header-lines-border[=STYLE]173 Display header from --header-lines with a separate border.174 Pass 'none' to still separate it but without a border.175 --header-label=LABEL Label to print on the header border
1 unmodified line
177 [POSITIVE_INTEGER: columns from left|178 NEGATIVE_INTEGER: columns from right][:bottom]179 (default: 0 or center)180181 FOOTER182 --footer=STR String to print as footer183 --footer-border[=STYLE] Draw border around the footer section184 [rounded|sharp|bold|block|thinblock|double|horizontal|vertical|185 top|bottom|left|right|line|none] (default: line)186 --footer-label=LABEL Label to print on the footer border187 --footer-label-pos=COL Position of the footer label188 [POSITIVE_INTEGER: columns from left|189 NEGATIVE_INTEGER: columns from right][:bottom]190 (default: 0 or center)191192 SCRIPTING193 -q, --query=STR Start the finder with the given query194 -1, --select-1 Automatically select the only match195 -0, --exit-0 Exit immediately when there's no match
413 unmodified lines
609 History *History610 Header []string611 HeaderLines int612 HeaderFirst bool613 Footer []string614 Gap int615 GapLine *string616 Ellipsis *string617 Scrollbar *string
3 unmodified lines
621 ListBorderShape tui.BorderShape622 InputBorderShape tui.BorderShape623 HeaderBorderShape tui.BorderShape624 HeaderLinesShape tui.BorderShape625 FooterBorderShape tui.BorderShape626 InputLabel labelOpts627 HeaderLabel labelOpts628 FooterLabel labelOpts629 BorderLabel labelOpts630 ListLabel labelOpts631 PreviewLabel labelOpts632 Unicode bool
96 unmodified lines
729 History: nil,730 Header: make([]string, 0),731 HeaderLines: 0,732 HeaderFirst: false,733 Footer: make([]string, 0),734 Gap: 0,735 Ellipsis: nil,736 Scrollbar: nil,737 Margin: defaultMargin(),
156 unmodified lines
894 }895 return nil, errors.New("invalid algorithm (expected: v1 or v2)")896}897883func parseBorder(str string, optional bool, allowLine bool) (tui.BorderShape, error) {898func parseBorder(str string, optional bool) (tui.BorderShape, error) {899 switch str {900 case "line":886 if !allowLine {887 return tui.BorderNone, errors.New("'line' is only allowed for preview border")888 }901 return tui.BorderLine, nil902 case "rounded":903 return tui.BorderRounded, nil904 case "sharp":
454 unmodified lines
1359 case "header-border":1360 mergeAttr(&theme.HeaderBorder)1361 case "header-label":1362 mergeAttr(&theme.HeaderLabel)1363 case "footer-border":1364 mergeAttr(&theme.FooterBorder)1365 case "footer-label":1366 mergeAttr(&theme.FooterLabel)1367 case "spinner":1368 mergeAttr(&theme.Spinner)1369 case "info":1370 mergeAttr(&theme.Info)
4 unmodified lines
1375 case "header", "header-fg":1376 mergeAttr(&theme.Header)1377 case "header-bg":1378 mergeAttr(&theme.HeaderBg)1379 case "footer", "footer-fg":1380 mergeAttr(&theme.Footer)1381 case "footer-bg":1382 mergeAttr(&theme.FooterBg)1383 case "gap-line":1384 mergeAttr(&theme.GapLine)1385 default:1386 fail()
47 unmodified lines
1434)14351436func init() {1437 executeRegexp = regexp.MustCompile(1418 `(?si)[:+](become|execute(?:-multi|-silent)?|reload(?:-sync)?|preview|(?:change|transform)-(?:query|prompt|(?:border|list|preview|input|header)-label|header|search|nth|pointer|ghost)|transform|change-(?:preview-window|preview|multi)|(?:re|un|toggle-)bind|pos|put|print|search)`)1438 `(?si)[:+](become|execute(?:-multi|-silent)?|reload(?:-sync)?|preview|(?:change|transform)-(?:query|prompt|(?:border|list|preview|input|header|footer)-label|header|footer|search|nth|pointer|ghost)|transform|change-(?:preview-window|preview|multi)|(?:re|un|toggle-)bind|pos|put|print|search)`)1439 splitRegexp = regexp.MustCompile("[,:]+")1440 actionNameRegexp = regexp.MustCompile("(?i)^[a-z-]+")1441}1442
376 unmodified lines
1819 case "preview":1820 return actPreview1821 case "change-header":1822 return actChangeHeader1823 case "change-footer":1824 return actChangeFooter1825 case "change-list-label":1826 return actChangeListLabel1827 case "change-border-label":1828 return actChangeBorderLabel
2 unmodified lines
1831 case "change-input-label":1832 return actChangeInputLabel1833 case "change-header-label":1834 return actChangeHeaderLabel1835 case "change-footer-label":1836 return actChangeFooterLabel1837 case "change-ghost":1838 return actChangeGhost1839 case "change-pointer":1840 return actChangePointer
32 unmodified lines
1873 case "transform-input-label":1874 return actTransformInputLabel1875 case "transform-header-label":1876 return actTransformHeaderLabel1877 case "transform-footer-label":1878 return actTransformFooterLabel1879 case "transform-footer":1880 return actTransformFooter1881 case "transform-header":1882 return actTransformHeader1883 case "transform-ghost":1884 return actTransformGhost
871 unmodified lines
2756 case "--header-lines":2757 if opts.HeaderLines, err = nextInt("number of header lines required"); err != nil {2758 return err2759 }2760 case "--no-footer":2761 opts.Footer = []string{}2762 case "--footer":2763 str, err := nextString("footer string required")2764 if err != nil {2765 return err2766 }2767 opts.Footer = strLines(str)2768 case "--header-first":2769 opts.HeaderFirst = true2770 case "--no-header-first":2771 opts.HeaderFirst = false
36 unmodified lines
2808 case "--no-preview-border":2809 opts.Preview.border = tui.BorderNone2810 case "--preview-border":2811 hasArg, arg := optionalNextString()2776 if opts.Preview.border, err = parseBorder(arg, !hasArg, true); err != nil {2812 if opts.Preview.border, err = parseBorder(arg, !hasArg); err != nil {2813 return err2814 }2815 case "--height":2816 str, err := nextString("height required: [~]HEIGHT[%]")
30 unmodified lines
2847 case "--no-border":2848 opts.BorderShape = tui.BorderNone2849 case "--border":2850 hasArg, arg := optionalNextString()2815 if opts.BorderShape, err = parseBorder(arg, !hasArg, false); err != nil {2851 if opts.BorderShape, err = parseBorder(arg, !hasArg); err != nil {2852 return err2853 }2854 case "--list-border":2855 hasArg, arg := optionalNextString()2820 if opts.ListBorderShape, err = parseBorder(arg, !hasArg, false); err != nil {2856 if opts.ListBorderShape, err = parseBorder(arg, !hasArg); err != nil {2857 return err2858 }2859 if opts.ListBorderShape == tui.BorderLine {2860 return errors.New("list border cannot be 'line'")2861 }2862 case "--no-list-border":2863 opts.ListBorderShape = tui.BorderNone2864 case "--no-list-label":2865 opts.ListLabel.label = ""
13 unmodified lines
2879 case "--no-header-border":2880 opts.HeaderBorderShape = tui.BorderNone2881 case "--header-border":2882 hasArg, arg := optionalNextString()2844 if opts.HeaderBorderShape, err = parseBorder(arg, !hasArg, false); err != nil {2883 if opts.HeaderBorderShape, err = parseBorder(arg, !hasArg); err != nil {2884 return err2885 }2886 case "--no-header-lines-border":2887 opts.HeaderLinesShape = tui.BorderNone2888 case "--header-lines-border":2889 hasArg, arg := optionalNextString()2851 if opts.HeaderLinesShape, err = parseBorder(arg, !hasArg, false); err != nil {2890 if opts.HeaderLinesShape, err = parseBorder(arg, !hasArg); err != nil {2891 return err2892 }2893 case "--no-header-label":2894 opts.HeaderLabel.label = ""
8 unmodified lines
2903 }2904 if err := parseLabelPosition(&opts.HeaderLabel, pos); err != nil {2905 return err2906 }2907 case "--no-footer-border":2908 opts.FooterBorderShape = tui.BorderNone2909 case "--footer-border":2910 hasArg, arg := optionalNextString()2911 if opts.FooterBorderShape, err = parseBorder(arg, !hasArg); err != nil {2912 return err2913 }2914 case "--no-footer-label":2915 opts.FooterLabel.label = ""2916 case "--footer-label":2917 if opts.FooterLabel.label, err = nextString("footer label required"); err != nil {2918 return err2919 }2920 case "--footer-label-pos":2921 pos, err := nextString("footer label position required (positive or negative integer or 'center')")2922 if err != nil {2923 return err2924 }2925 if err := parseLabelPosition(&opts.FooterLabel, pos); err != nil {2926 return err2927 }2928 case "--no-input-border":2929 opts.InputBorderShape = tui.BorderNone2930 case "--input-border":2931 hasArg, arg := optionalNextString()2872 if opts.InputBorderShape, err = parseBorder(arg, !hasArg, false); err != nil {2932 if opts.InputBorderShape, err = parseBorder(arg, !hasArg); err != nil {2933 return err2934 }2935 case "--no-input-label":2936 opts.InputLabel.label = ""
199 unmodified lines
3136 case "default":3137 opts.ListBorderShape = tui.BorderUndefined3138 opts.InputBorderShape = tui.BorderUndefined3139 opts.HeaderBorderShape = tui.BorderUndefined3140 opts.FooterBorderShape = tui.BorderUndefined3141 opts.Preview.border = defaultBorderShape3142 opts.Preview.info = true3143 opts.InfoStyle = infoDefault3144 opts.Theme.Gutter = tui.NewColorAttr()
3 unmodified lines
3148 case "minimal":3149 opts.ListBorderShape = tui.BorderUndefined3150 opts.InputBorderShape = tui.BorderUndefined3151 opts.HeaderBorderShape = tui.BorderUndefined3152 opts.FooterBorderShape = tui.BorderLine3153 opts.Preview.border = tui.BorderLine3154 opts.Preview.info = false3155 opts.InfoStyle = infoDefault3156 opts.Theme.Gutter = tui.ColorAttr{Color: -1, Attr: 0}
7 unmodified lines
3164 return errors.New("unsupported style preset: " + preset)3165 }3166 if len(tokens) == 2 && len(tokens[1]) > 0 {3167 var err error3106 defaultBorderShape, err = parseBorder(tokens[1], false, false)3168 defaultBorderShape, err = parseBorder(tokens[1], false)3169 if err != nil {3170 return err3171 }3172 }31733174 if defaultBorderShape != tui.BorderLine {3112 opts.ListBorderShape = defaultBorderShape3175 opts.ListBorderShape = defaultBorderShape3176 }3177 opts.InputBorderShape = defaultBorderShape3178 opts.HeaderBorderShape = defaultBorderShape3179 opts.FooterBorderShape = defaultBorderShape3180 opts.Preview.border = defaultBorderShape3181 if defaultBorderShape == tui.BorderLine {3182 opts.BorderShape = defaultBorderShape3183 }3184 opts.Preview.info = true3185 opts.InfoStyle = infoInlineRight3186 opts.Theme.Gutter = tui.NewColorAttr()3187 opts.Separator = nil
64 unmodified lines
3252 }3253 return false3254}32553256func (opts *Options) useTmux() bool {3257 return opts.Tmux != nil && len(os.Getenv("TMUX")) > 0 && opts.Tmux.index >= opts.Height.index3258}32593260func (opts *Options) noSeparatorLine() bool {3261 if opts.Inputless {3262 return true3263 }
23 unmodified lines
3287 if opts.HeaderBorderShape == tui.BorderUndefined {3288 opts.HeaderBorderShape = tui.BorderNone3289 }32903291 if opts.FooterBorderShape == tui.BorderUndefined {3292 opts.FooterBorderShape = tui.BorderLine3293 }32943295 if opts.HeaderLinesShape == tui.BorderNone {3296 opts.HeaderLinesShape = tui.BorderPhantom3297 }3298
278 unmodified lines
modified:src/terminal.go+210 added-22 removed
178 unmodified lines
179 empty bool180 other bool181}182183func (t *Terminal) inListWindow() bool {184 return t.window != t.inputWindow && t.window != t.headerWindow && t.window != t.headerLinesWindow && t.window != t.footerWindow185}186187func (t *Terminal) markEmptyLine(line int) {184 if t.window != t.inputWindow && t.window != t.headerWindow {188 if t.inListWindow() {189 t.prevLines[line] = itemLine{valid: true, firstLine: line, empty: true}190 }191}192193func (t *Terminal) markOtherLine(line int) {190 if t.window != t.inputWindow && t.window != t.headerWindow {194 if t.inListWindow() {195 t.prevLines[line] = itemLine{valid: true, firstLine: line, other: true}196 }197}198
58 unmodified lines
257 inputLabelOpts labelOpts258 headerLabel labelPrinter259 headerLabelLen int260 headerLabelOpts labelOpts261 footerLabel labelPrinter262 footerLabelLen int263 footerLabelOpts labelOpts264 pointer string265 pointerLen int266 pointerEmpty string267 marker string
39 unmodified lines
307 headerFirst bool308 headerLines int309 header []string310 header0 []string311 footer []string312 ellipsis string313 scrollbar string314 previewScrollbar string315 ansi bool
13 unmodified lines
329 listBorderShape tui.BorderShape330 inputBorderShape tui.BorderShape331 headerBorderShape tui.BorderShape332 headerLinesShape tui.BorderShape333 footerBorderShape tui.BorderShape334 listLabel labelPrinter335 listLabelLen int336 listLabelOpts labelOpts337 cleanExit bool
7 unmodified lines
345 headerWindow tui.Window346 headerBorder tui.Window347 headerLinesWindow tui.Window348 headerLinesBorder tui.Window349 footerWindow tui.Window350 footerBorder tui.Window351 wborder tui.Window352 pborder tui.Window353 pwindow tui.Window354 borderWidth int
81 unmodified lines
436const (437 reqPrompt util.EventType = iota438 reqInfo439 reqHeader440 reqFooter441 reqList442 reqJump443 reqActivate444 reqReinit445 reqFullRedraw446 reqResize447 reqRedrawInputLabel448 reqRedrawHeaderLabel449 reqRedrawFooterLabel450 reqRedrawListLabel451 reqRedrawBorderLabel452 reqRedrawPreviewLabel453 reqClose
37 unmodified lines
491 actCancel492 actChangeBorderLabel493 actChangeGhost494 actChangeHeader495 actChangeFooter496 actChangeHeaderLabel497 actChangeFooterLabel498 actChangeInputLabel499 actChangeListLabel500 actChangeMulti501 actChangeNth
62 unmodified lines
564 actTransform565 actTransformBorderLabel566 actTransformGhost567 actTransformHeader568 actTransformFooter569 actTransformHeaderLabel570 actTransformFooterLabel571 actTransformInputLabel572 actTransformListLabel573 actTransformNth574 actTransformPointer
348 unmodified lines
923 listBorderShape: opts.ListBorderShape,924 inputBorderShape: opts.InputBorderShape,925 headerBorderShape: opts.HeaderBorderShape,926 headerLinesShape: opts.HeaderLinesShape,927 footerBorderShape: opts.FooterBorderShape,928 borderWidth: 1,929 listLabel: nil,930 listLabelOpts: opts.ListLabel,931 borderLabel: nil,
3 unmodified lines
935 inputLabel: nil,936 inputLabelOpts: opts.InputLabel,937 headerLabel: nil,938 headerLabelOpts: opts.HeaderLabel,939 footerLabel: nil,940 footerLabelOpts: opts.FooterLabel,941 cleanExit: opts.ClearOnExit,942 executor: executor,943 paused: opts.Phony,944 inputless: opts.Inputless,
3 unmodified lines
948 headerFirst: opts.HeaderFirst,949 headerLines: opts.HeaderLines,950 gap: opts.Gap,951 header: []string{},952 footer: opts.Footer,953 header0: opts.Header,954 ansi: opts.Ansi,955 nthAttr: opts.Theme.Nth.Attr,956 nth: opts.Nth,
55 unmodified lines
1012 t.borderLabel, t.borderLabelLen = t.ansiLabelPrinter(opts.BorderLabel.label, &tui.ColBorderLabel, false)1013 t.previewLabel, t.previewLabelLen = t.ansiLabelPrinter(opts.PreviewLabel.label, &tui.ColPreviewLabel, false)1014 t.inputLabel, t.inputLabelLen = t.ansiLabelPrinter(opts.InputLabel.label, &tui.ColInputLabel, false)1015 t.headerLabel, t.headerLabelLen = t.ansiLabelPrinter(opts.HeaderLabel.label, &tui.ColHeaderLabel, false)1016 t.footerLabel, t.footerLabelLen = t.ansiLabelPrinter(opts.FooterLabel.label, &tui.ColFooterLabel, false)10171018 // Determine border shape1019 if t.borderShape == tui.BorderLine {1020 if t.fullscreen {1021 t.borderShape = tui.BorderNone1022 } else {1023 t.borderShape = tui.BorderTop1024 }1025 }10261027 // Determine input border shape1028 if t.inputBorderShape == tui.BorderLine {1029 if t.layout == layoutReverse {1030 t.inputBorderShape = tui.BorderBottom1031 } else {1032 t.inputBorderShape = tui.BorderTop1033 }1034 }10351036 // Determine header border shape1037 if t.headerBorderShape == tui.BorderLine {1038 if t.layout == layoutReverse {1039 t.headerBorderShape = tui.BorderBottom1040 } else {1041 t.headerBorderShape = tui.BorderTop1042 }1043 }10441045 // Determine header lines border shape1046 if t.headerLinesShape == tui.BorderLine {1047 if t.layout == layoutDefault {1048 t.headerLinesShape = tui.BorderTop1049 } else {1050 t.headerLinesShape = tui.BorderBottom1051 }1052 }10531054 // Determine footer border shape1055 if t.footerBorderShape == tui.BorderLine {1056 if t.layout == layoutReverse {1057 t.footerBorderShape = tui.BorderTop1058 } else {1059 t.footerBorderShape = tui.BorderBottom1060 }1061 }10621063 // Disable separator by default if input border is set1064 if opts.Separator == nil && !t.inputBorderShape.Visible() || opts.Separator != nil && len(*opts.Separator) > 0 {1065 bar := "─"1066 if opts.Separator != nil {
207 unmodified lines
1274 extra += borderLines(shape)1275 }1276 extra += t.headerLines1277 }1278 if len(t.footer) > 0 {1279 extra += borderLines(t.footerBorderShape)1280 extra += len(t.footer)1281 }1282 return extra1283}12841285func (t *Terminal) MaxFitAndPad() (int, int) {
259 unmodified lines
1545 t.clickHeaderColumn = 01546 return needFullRedraw1547}15481549func (t *Terminal) changeFooter(footer string) bool {1550 var lines []string1551 if len(footer) > 0 {1552 lines = strings.Split(strings.TrimSuffix(footer, "\n"), "\n")1553 }1554 needFullRedraw := len(t.footer) != len(lines)1555 t.footer = lines1556 return needFullRedraw1557}15581559// UpdateHeader updates the header1560func (t *Terminal) UpdateHeader(header []string) {1561 t.mutex.Lock()1562 t.header = header
352 unmodified lines
1915 }1916 if t.headerBorder != nil {1917 t.headerBorder = nil1918 }1919 if t.footerWindow != nil {1920 t.footerWindow = nil1921 }1922 if t.footerBorder != nil {1923 t.footerBorder = nil1924 }1925 if t.headerLinesWindow != nil {1926 t.headerLinesWindow = nil1927 }1928 if t.headerLinesBorder != nil {
46 unmodified lines
19751976 // Adjust position and size of the list window if input border is set1977 inputBorderHeight := 01978 availableLines := height19791980 shift := 01981 shrink := 01982 hasHeaderWindow := t.hasHeaderWindow()1983 hasFooterWindow := len(t.footer) > 01984 hasHeaderLinesWindow, headerLinesShape := t.determineHeaderLinesShape()1985 hasInputWindow := !t.inputless && (t.inputBorderShape.Visible() || hasHeaderWindow || hasHeaderLinesWindow)1986 inputWindowHeight := 21987 if t.noSeparatorLine() {1988 inputWindowHeight--1989 }1990 if hasInputWindow {1898 inputWindowHeight := 21899 if t.noSeparatorLine() {1900 inputWindowHeight--1901 }1902 inputBorderHeight = util.Min(availableLines, borderLines(t.inputBorderShape)+inputWindowHeight)1991 inputBorderHeight = util.Constrain(borderLines(t.inputBorderShape)+inputWindowHeight, 0, availableLines)1992 if t.layout == layoutReverse {1993 shift = inputBorderHeight1994 shrink = inputBorderHeight1995 } else {1996 shrink = inputBorderHeight1997 }1998 availableLines -= inputBorderHeight1999 } else if !t.inputless {2000 availableLines -= inputWindowHeight2001 }20022003 // FIXME: Needed?2004 if t.needPreviewWindow() {2005 _, minPreviewHeight := t.minPreviewSize(t.activePreviewOpts)2006 switch t.activePreviewOpts.position {2007 case posUp, posDown:2008 availableLines -= minPreviewHeight2009 }2010 }20112012 // Adjust position and size of the list window if header border is set2013 headerBorderHeight := 02014 if hasHeaderWindow {2015 headerWindowHeight := t.visibleHeaderLines()2016 if hasHeaderLinesWindow {2017 headerWindowHeight -= t.headerLines2018 }1919 headerBorderHeight = util.Min(availableLines, borderLines(t.headerBorderShape)+headerWindowHeight)2019 headerBorderHeight = util.Constrain(borderLines(t.headerBorderShape)+headerWindowHeight, 0, availableLines)2020 if t.layout == layoutReverse {2021 shift += headerBorderHeight2022 shrink += headerBorderHeight2023 } else {
3 unmodified lines
2027 }20282029 headerLinesHeight := 02030 if hasHeaderLinesWindow {1931 headerLinesHeight = util.Min(availableLines, borderLines(headerLinesShape)+t.headerLines)2031 headerLinesHeight = util.Constrain(borderLines(headerLinesShape)+t.headerLines, 0, availableLines)2032 if t.layout != layoutDefault {2033 shift += headerLinesHeight2034 shrink += headerLinesHeight2035 } else {
1 unmodified line
2037 }2038 availableLines -= headerLinesHeight2039 }20402041 footerBorderHeight := 02042 if hasFooterWindow {2043 // Footer lines should not take all available lines2044 footerBorderHeight = util.Constrain(borderLines(t.footerBorderShape)+len(t.footer), 0, availableLines)2045 shrink += footerBorderHeight2046 if t.layout != layoutReverse {2047 shift += footerBorderHeight2048 }2049 availableLines -= footerBorderHeight2050 }20512052 // Set up list border2053 hasListBorder := t.listBorderShape.Visible()2054 innerWidth := width2055 innerHeight := height
95 unmodified lines
2151 innerWidth++2152 width++2153 }21542044 maxPreviewLines := availableLines2045 if t.wborder != nil {2046 maxPreviewLines -= t.wborder.Height()2047 } else {2048 maxPreviewLines -= util.Max(0, innerHeight-pheight-shrink)2049 }2050 pheight = util.Min(pheight, maxPreviewLines)2155 pheight = util.Constrain(pheight, minPreviewHeight, availableLines)21562157 if previewOpts.position == posUp {2158 innerBorderFn(marginInt[0]+pheight, marginInt[3], width, height-pheight)2159 t.window = t.tui.NewWindow(2160 innerMarginInt[0]+pheight+shift, innerMarginInt[3], innerWidth, innerHeight-pheight-shrink, tui.WindowList, noBorder, true)
154 unmodified lines
2315 switch t.layout {2316 case layoutDefault:2317 btop = w.Top() + w.Height() + headerBorderHeight + headerLinesHeight2318 case layoutReverse:2213 btop = w.Top() - shrink2319 btop = w.Top() - shrink + footerBorderHeight2320 case layoutReverseList:2321 btop = w.Top() + w.Height() + headerBorderHeight2322 }2323 }
19 unmodified lines
2343 if hasHeaderWindow {2344 var btop int2345 if hasInputWindow && t.headerFirst {2346 if t.layout == layoutReverse {2241 btop = w.Top() - shrink2347 btop = w.Top() - shrink + footerBorderHeight2348 } else if t.layout == layoutReverseList {2349 btop = w.Top() + w.Height() + inputBorderHeight2350 } else {2351 btop = w.Top() + w.Height() + inputBorderHeight + headerLinesHeight
47 unmodified lines
2399 headerLinesHeight, tui.WindowHeader, tui.MakeBorderStyle(headerLinesShape, t.unicode), true)2400 t.headerLinesWindow = createInnerWindow(t.headerLinesBorder, headerLinesShape, tui.WindowHeader, 0)2401 }24022403 // Set up footer2404 if hasFooterWindow {2405 var btop int2406 if t.layout == layoutReverse {2407 btop = w.Top() + w.Height()2408 } else if t.layout == layoutReverseList {2409 btop = w.Top() - footerBorderHeight - headerLinesHeight2410 } else {2411 btop = w.Top() - footerBorderHeight2412 }2413 t.footerBorder = t.tui.NewWindow(2414 btop,2415 w.Left(),2416 w.Width(),2417 footerBorderHeight, tui.WindowFooter, tui.MakeBorderStyle(t.footerBorderShape, t.unicode), true)2418 t.footerWindow = createInnerWindow(t.footerBorder, t.footerBorderShape, tui.WindowFooter, 0)2419 }24202421 // Print border label2422 t.printLabel(t.wborder, t.listLabel, t.listLabelOpts, t.listLabelLen, t.listBorderShape, false)2423 t.printLabel(t.border, t.borderLabel, t.borderLabelOpts, t.borderLabelLen, t.borderShape, false)2424 t.printLabel(t.pborder, t.previewLabel, t.previewLabelOpts, t.previewLabelLen, t.activePreviewOpts.Border(), false)2425 t.printLabel(t.inputBorder, t.inputLabel, t.inputLabelOpts, t.inputLabelLen, t.inputBorderShape, false)2426 t.printLabel(t.headerBorder, t.headerLabel, t.headerLabelOpts, t.headerLabelLen, t.headerBorderShape, false)2427 t.printLabel(t.footerBorder, t.footerLabel, t.footerLabelOpts, t.footerLabelLen, t.footerBorderShape, false)2428}24292430func (t *Terminal) printLabel(window tui.Window, render labelPrinter, opts labelOpts, length int, borderShape tui.BorderShape, redrawBorder bool) {2431 if window == nil {
35 unmodified lines
2467 switch t.layout {2468 case layoutDefault:2469 y = h - y - 12470 case layoutReverseList:2346 if t.window == t.inputWindow || t.window == t.headerWindow {2471 if !t.inListWindow() && t.window != t.headerLinesWindow {2472 // From bottom to top2473 y = h - y - 12474 } else {2475 /*
338 unmodified lines
2814 primaryHeaderLines := allHeaderLines2815 if t.hasHeaderLinesWindow() {2816 primaryHeaderLines -= t.headerLines2817 }2818 // FIXME: Full redraw is triggered if there are too many lines in the header2819 // so that the header window cannot display all of them.2820 needHeaderLinesWindow := t.hasHeaderLinesWindow()2694 if (t.headerBorderShape.Visible() || t.hasHeaderLinesWindow()) &&2821 if (t.headerBorderShape.Visible() || needHeaderLinesWindow) &&2822 (t.headerWindow == nil && primaryHeaderLines > 0 || t.headerWindow != nil && primaryHeaderLines != t.headerWindow.Height()) ||2823 needHeaderLinesWindow && (t.headerLinesWindow == nil || t.headerLinesWindow != nil && t.headerLines != t.headerLinesWindow.Height()) ||2824 !needHeaderLinesWindow && t.headerLinesWindow != nil {2825 t.printAll()
20 unmodified lines
2846 })2847 }2848}28492850func (t *Terminal) printFooter() {2851 if len(t.footer) == 0 {2852 return2853 }2854 indentSize := t.headerIndent(t.footerBorderShape)2855 indent := strings.Repeat(" ", indentSize)2856 max := util.Min(len(t.footer), t.footerWindow.Height())28572858 // Wrapping is not supported for footer2859 wrap := t.wrap2860 t.wrap = false2861 t.withWindow(t.footerWindow, func() {2862 var state *ansiState2863 for idx, lineStr := range t.footer[:max] {2864 line := idx2865 if t.layout != layoutReverse {2866 line = max - idx - 12867 }2868 trimmed, colors, newState := extractColor(lineStr, state, nil)2869 state = newState2870 item := &Item{2871 text: util.ToChars([]byte(trimmed)),2872 colors: colors}28732874 t.printHighlighted(Result{item: item},2875 tui.ColFooter, tui.ColFooter, false, false, line, line, true,2876 func(markerClass) int {2877 t.footerWindow.Print(indent)2878 return indentSize2879 }, nil)2880 }2881 })2882 t.wrap = wrap2883}28842885func (t *Terminal) headerIndent(borderShape tui.BorderShape) int {2886 indentSize := t.pointerLen + t.markerLen2887 if t.listBorderShape.HasLeft() {2888 indentSize += 1 + t.borderWidth
64 unmodified lines
2953 t.wrap = wrap2954}29552956func (t *Terminal) canSpanMultiLines() bool {2795 return t.multiLine || t.wrap || t.gap > 02957 return (t.multiLine || t.wrap || t.gap > 0) && t.inListWindow()2958}29592960func (t *Terminal) renderBar(line int, barRange [2]int) {2961 // If the screen is not filled with the list in non-multi-line mode,
966 unmodified lines
3928 t.printList()3929 t.printPrompt()3930 t.printInfo()3931 t.printHeader()3932 t.printFooter()3933 t.printPreview()3934}39353936func (t *Terminal) flush() {
740 unmodified lines
46774678 t.reqBox.Set(reqPrompt, nil)4679 t.reqBox.Set(reqInfo, nil)4680 t.reqBox.Set(reqHeader, nil)4681 t.reqBox.Set(reqFooter, nil)4682 if t.initDelay > 0 {4683 go func() {4684 timer := time.NewTimer(t.initDelay)4685 <-timer.C
274 unmodified lines
4960 case reqHeader:4961 if !t.resizeIfNeeded() {4962 t.printHeader()4963 }4964 case reqFooter:4965 if !t.resizeIfNeeded() {4966 t.printFooter()4967 }4968 case reqActivate:4969 t.suppress = false4970 if t.hasPreviewer() {4971 t.previewBox.Set(reqPreviewReady, nil)
1 unmodified line
4973 case reqRedrawInputLabel:4974 t.printLabel(t.inputBorder, t.inputLabel, t.inputLabelOpts, t.inputLabelLen, t.inputBorderShape, true)4975 case reqRedrawHeaderLabel:4976 t.printLabel(t.headerBorder, t.headerLabel, t.headerLabelOpts, t.headerLabelLen, t.headerBorderShape, true)4977 case reqRedrawFooterLabel:4978 t.printLabel(t.footerBorder, t.footerLabel, t.footerLabelOpts, t.footerLabelLen, t.footerBorderShape, true)4979 case reqRedrawListLabel:4980 t.printLabel(t.wborder, t.listLabel, t.listLabelOpts, t.listLabelLen, t.listBorderShape, true)4981 case reqRedrawBorderLabel:4982 t.printLabel(t.border, t.borderLabel, t.borderLabelOpts, t.borderLabelLen, t.borderShape, true)
182 unmodified lines
5165 }5166 }5167 updatePreviewWindow := func(forcePreview bool) {5168 t.resizeWindows(forcePreview, false)4999 req(reqPrompt, reqList, reqInfo, reqHeader)5169 req(reqPrompt, reqList, reqInfo, reqHeader, reqFooter)5170 }5171 toggle := func() bool {5172 current := t.currentItem()5173 if current != nil && t.toggleItem(current) {
266 unmodified lines
5440 }5441 } else {5442 req(reqHeader)5443 }5444 case actChangeFooter, actTransformFooter:5445 footer := a.a5446 if a.t == actTransformFooter {5447 footer = t.captureLines(a.a)5448 }5449 if t.changeFooter(footer) {5450 req(reqFullRedraw)5451 } else {5452 req(reqFooter)5453 }5454 case actChangeHeaderLabel, actTransformHeaderLabel:5455 label := a.a5456 if a.t == actTransformHeaderLabel {5457 label = t.captureLine(a.a)5458 }5459 t.headerLabelOpts.label = label5460 t.headerLabel, t.headerLabelLen = t.ansiLabelPrinter(label, &tui.ColHeaderLabel, false)5461 req(reqRedrawHeaderLabel)5462 case actChangeFooterLabel, actTransformFooterLabel:5463 label := a.a5464 if a.t == actTransformFooterLabel {5465 label = t.captureLine(a.a)5466 }5467 t.footerLabelOpts.label = label5468 t.footerLabel, t.footerLabelLen = t.ansiLabelPrinter(label, &tui.ColFooterLabel, false)5469 req(reqRedrawFooterLabel)5470 case actChangeInputLabel, actTransformInputLabel:5471 label := a.a5472 if a.t == actTransformInputLabel {5473 label = t.captureLine(a.a)
1205 unmodified lines
modified:src/tmux.go+6 added-2 removed
9 unmodified lines
10func runTmux(args []string, opts *Options) (int, error) {11 // Prepare arguments12 fzf, rest := args[0], args[1:]13 args = []string{"--bind=ctrl-z:ignore"}14 if !opts.Tmux.border && opts.BorderShape == tui.BorderUndefined {14 if !opts.Tmux.border && (opts.BorderShape == tui.BorderUndefined || opts.BorderShape == tui.BorderLine) {15 // We append --border option at the end, because `--style=full:STYLE`16 // may have changed the default border style.17 if tui.DefaultBorderShape == tui.BorderRounded {18 rest = append(rest, "--border=rounded")19 } else {17 rest = append(rest, "--border")20 rest = append(rest, "--border=sharp")21 }22 }23 if opts.Tmux.border && opts.Margin == defaultMargin() {24 args = append(args, "--margin=0,1")25 }
47 unmodified lines
modified:test/test_layout.rb+195 added
977 unmodified lines
978 setup979 end980 end981982 def test_layout_default_with_footer983 prefix = %[984 seq 3 | #{FZF} --no-list-border --height ~100% \985 --border sharp --footer "$(seq 201 202)" --footer-label FOOT --footer-label-pos 3 \986 --header-label HEAD --header-label-pos 3:bottom \987 --bind 'space:transform-footer-label(echo foot)+change-header-label(head)'988 ].strip + ' '989 suffixes = [990 %(),991 %[--header "$(seq 101 102)"],992 %[--header "$(seq 101 102)" --header-first],993 %[--header "$(seq 101 102)" --header-lines 2],994 %[--header "$(seq 101 102)" --header-lines 2 --header-first],995 %[--header "$(seq 101 102)" --header-border sharp],996 %[--header "$(seq 101 102)" --header-border sharp --header-first],997 %[--header "$(seq 101 102)" --header-border sharp --header-lines 2],998 %[--header "$(seq 101 102)" --header-border sharp --header-lines 2 --header-lines-border sharp],999 %[--header "$(seq 101 102)" --header-border sharp --header-lines 2 --header-lines-border sharp --header-first --input-border sharp],1000 %[--header "$(seq 101 102)" --header-border sharp --header-lines 2 --header-lines-border sharp --header-first --no-input],1001 %[--header "$(seq 101 102)" --footer-border sharp --input-border line],1002 %[--header "$(seq 101 102)" --style full:sharp --header-first]1003 ]1004 output = <<~BLOCK1005 ┌──────── ┌──────── ┌──────── ┌──────── ┌──────── ┌──────── ┌──────── ┌──────── ┌──────── ┌───────── ┌──────── ┌──────── ┌─────────1006 │ 201 │ 201 │ 201 │ 201 │ 201 │ 201 │ 201 │ 201 │ 201 │ 201 │ 201 │ ┌─FOOT─ │ ┌─FOOT──1007 │ 202 │ 202 │ 202 │ 202 │ 202 │ 202 │ 202 │ 202 │ 202 │ 202 │ 202 │ │ 201 │ │ 2011008 │ ──FOOT─ │ ──FOOT─ │ ──FOOT─ │ ──FOOT─ │ ──FOOT─ │ ──FOOT─ │ ──FOOT─ │ ──FOOT─ │ ──FOOT─ │ ──FOOT── │ ──FOOT─ │ │ 202 │ │ 2021009 │ 3 │ 3 │ 3 │ > 3 │ > 3 │ 3 │ 3 │ > 3 │ > 3 │ > 3 │ > 3 │ └────── │ └───────1010 │ 2 │ 2 │ 2 │ 2 │ 2 │ 2 │ 2 │ ┌────── │ ┌────── │ ┌─────── │ ┌────── │ 3 │ ┌───────1011 │ > 1 │ > 1 │ > 1 │ 1 │ 1 │ > 1 │ > 1 │ │ 2 │ │ 2 │ │ 2 │ │ 2 │ 2 │ │ 31012 │ 3/3 ─ │ 101 │ 3/3 ─ │ 101 │ 1/1 ─ │ ┌────── │ 3/3 ─ │ │ 1 │ │ 1 │ │ 1 │ │ 1 │ > 1 │ │ 21013 │ > │ 102 │ > │ 102 │ > │ │ 101 │ > │ │ 101 │ └────── │ └─────── │ └────── │ 101 │ │ > 11014 └──────── │ 3/3 ─ │ 101 │ 1/1 ─ │ 101 │ │ 102 │ ┌────── │ │ 102 │ ┌────── │ ┌─────── │ ┌────── │ 102 │ └───────1015 │ > │ 102 │ > │ 102 │ └─HEAD─ │ │ 101 │ └─HEAD─ │ │ 101 │ │ 1/1 │ │ 101 │ ─────── │ ┌───────1016 └──────── └──────── └──────── └──────── │ 3/3 ─ │ │ 102 │ 1/1 ─ │ │ 102 │ │ > │ │ 102 │ 3/3 │ │ >1017 │ > │ └─HEAD─ │ > │ └─HEAD─ │ └─────── │ └─HEAD─ │ > │ └───────1018 └──────── └──────── └──────── │ 1/1 ─ │ ┌─────── └──────── └──────── │ ┌───────1019 │ > │ │ 101 │ │ 1011020 └──────── │ │ 102 │ │ 1021021 │ └─HEAD── │ └─HEAD──1022 └───────── └─────────1023 BLOCK10241025 expects = []1026 output.each_line.first.scan(/\S+/) do1027 offset = Regexp.last_match.offset(0)1028 expects << output.lines.filter_map { it[offset[0]...offset[1]]&.strip }.take_while { !it.empty? }.join("\n")1029 end10301031 suffixes.zip(expects).each do |suffix, block|1032 tmux.send_keys(prefix + suffix, :Enter)1033 tmux.until { assert_block(block, it) }1034 tmux.send_keys :Space1035 tmux.until { assert_block(block.downcase, it) }10361037 teardown1038 setup1039 end1040 end10411042 def test_layout_reverse_list_with_footer1043 prefix = %[1044 seq 3 | #{FZF} --layout reverse-list --no-list-border --height ~100% \1045 --border sharp --footer "$(seq 201 202)" --footer-label FOOT --footer-label-pos 3 \1046 --header-label HEAD --header-label-pos 3:bottom \1047 --bind 'space:transform-footer-label(echo foot)+change-header-label(head)'1048 ].strip + ' '1049 suffixes = [1050 %(),1051 %[--header "$(seq 101 102)"],1052 %[--header "$(seq 101 102)" --header-first],1053 %[--header "$(seq 101 102)" --header-lines 2],1054 %[--header "$(seq 101 102)" --header-lines 2 --header-first],1055 %[--header "$(seq 101 102)" --header-border sharp],1056 %[--header "$(seq 101 102)" --header-border sharp --header-first],1057 %[--header "$(seq 101 102)" --header-border sharp --header-lines 2],1058 %[--header "$(seq 101 102)" --header-border sharp --header-lines 2 --header-lines-border sharp],1059 %[--header "$(seq 101 102)" --header-border sharp --header-lines 2 --header-lines-border sharp --header-first --input-border sharp],1060 %[--header "$(seq 101 102)" --header-border sharp --header-lines 2 --header-lines-border sharp --header-first --no-input],1061 %[--header "$(seq 101 102)" --footer-border sharp --input-border line],1062 %[--header "$(seq 101 102)" --style full:sharp --header-first]1063 ]1064 output = <<~BLOCK1065 ┌──────── ┌──────── ┌──────── ┌──────── ┌──────── ┌──────── ┌──────── ┌──────── ┌──────── ┌───────── ┌──────── ┌──────── ┌─────────1066 │ 201 │ 201 │ 201 │ 201 │ 201 │ 201 │ 201 │ 201 │ 201 │ 201 │ 201 │ ┌─FOOT─ │ ┌─FOOT──1067 │ 202 │ 202 │ 202 │ 202 │ 202 │ 202 │ 202 │ 202 │ 202 │ 202 │ 202 │ │ 201 │ │ 2011068 │ ──FOOT─ │ ──FOOT─ │ ──FOOT─ │ ──FOOT─ │ ──FOOT─ │ ──FOOT─ │ ──FOOT─ │ ──FOOT─ │ ──FOOT─ │ ──FOOT── │ ──FOOT─ │ │ 202 │ │ 2021069 │ > 1 │ > 1 │ > 1 │ 1 │ 1 │ > 1 │ > 1 │ 1 │ ┌────── │ ┌─────── │ ┌────── │ └────── │ └───────1070 │ 2 │ 2 │ 2 │ 2 │ 2 │ 2 │ 2 │ 2 │ │ 1 │ │ 1 │ │ 1 │ > 1 │ ┌───────1071 │ 3 │ 3 │ 3 │ > 3 │ > 3 │ 3 │ 3 │ > 3 │ │ 2 │ │ 2 │ │ 2 │ 2 │ │ > 11072 │ 3/3 ─ │ 101 │ 3/3 ─ │ 101 │ 1/1 ─ │ ┌────── │ 3/3 ─ │ ┌────── │ └────── │ └─────── │ └────── │ 3 │ │ 21073 │ > │ 102 │ > │ 102 │ > │ │ 101 │ > │ │ 101 │ > 3 │ > 3 │ > 3 │ 101 │ │ 31074 └──────── │ 3/3 ─ │ 101 │ 1/1 ─ │ 101 │ │ 102 │ ┌────── │ │ 102 │ ┌────── │ ┌─────── │ ┌────── │ 102 │ └───────1075 │ > │ 102 │ > │ 102 │ └─HEAD─ │ │ 101 │ └─HEAD─ │ │ 101 │ │ 1/1 │ │ 101 │ ─────── │ ┌───────1076 └──────── └──────── └──────── └──────── │ 3/3 ─ │ │ 102 │ 1/1 ─ │ │ 102 │ │ > │ │ 102 │ 3/3 │ │ >1077 │ > │ └─HEAD─ │ > │ └─HEAD─ │ └─────── │ └─HEAD─ │ > │ └───────1078 └──────── └──────── └──────── │ 1/1 ─ │ ┌─────── └──────── └──────── │ ┌───────1079 │ > │ │ 101 │ │ 1011080 └──────── │ │ 102 │ │ 1021081 │ └─HEAD── │ └─HEAD──1082 └───────── └─────────1083 BLOCK10841085 expects = []1086 output.each_line.first.scan(/\S+/) do1087 offset = Regexp.last_match.offset(0)1088 expects << output.lines.filter_map { it[offset[0]...offset[1]]&.strip }.take_while { !it.empty? }.join("\n")1089 end10901091 suffixes.zip(expects).each do |suffix, block|1092 tmux.send_keys(prefix + suffix, :Enter)1093 tmux.until { assert_block(block, it) }1094 tmux.send_keys :Space1095 tmux.until { assert_block(block.downcase, it) }10961097 teardown1098 setup1099 end1100 end11011102 def test_change_header_and_label_at_once1103 tmux.send_keys %(seq 10 | #{FZF} --border sharp --header-border sharp --header-label-pos 3 --bind 'focus:change-header(header)+change-header-label(label)'), :Enter1104 block = <<~BLOCK1105 │ ┌─label──
46 unmodified lines
1152 >1153 BLOCK1154 tmux.until { assert_block(block, it) }1155 end11561157 def test_combinations1158 skip unless ENV['LONGTEST']11591160 base = [1161 '--pointer=@',1162 '--exact',1163 '--query=123',1164 '--header="$(seq 101 103)"',1165 '--header-lines=3',1166 '--footer "$(seq 201 203)"',1167 '--preview "echo foobar"'1168 ]1169 options = [1170 ['--separator==', '--no-separator'],1171 ['--info=default', '--info=inline', '--info=inline-right'],1172 ['--no-input-border', '--input-border'],1173 ['--no-header-border', '--header-border=none', '--header-border'],1174 ['--no-header-lines-border', '--header-lines-border'],1175 ['--no-footer-border', '--footer-border'],1176 ['--no-list-border', '--list-border'],1177 ['--preview-window=right', '--preview-window=up', '--preview-window=down', '--preview-window=left'],1178 ['--header-first', '--no-header-first'],1179 ['--layout=default', '--layout=reverse', '--layout=reverse-list']1180 ]1181 # Combination of all options1182 combinations = options[0].product(*options.drop(1))1183 combinations.each_with_index do |combination, index|1184 opts = base + combination1185 command = %(seq 1001 2000 | #{FZF} #{opts.join(' ')})1186 puts "# #{index + 1}/#{combinations.length}\n#{command}"1187 tmux.send_keys command, :Enter1188 tmux.until do |lines|1189 layout = combination.find { it.start_with?('--layout=') }.split('=').last1190 header_first = combination.include?('--header-first')11911192 # Input1193 input = lines.index { it.include?('> 123') }1194 assert(input)11951196 # Info1197 info = lines.index { it.include?('11/997') }1198 assert(info)11991200 assert(layout == 'reverse' ? input <= info : input >= info)12011202 # List1203 item1 = lines.index { it.include?('1230') }1204 item2 = lines.index { it.include?('1231') }1205 assert_equal(item1, layout == 'default' ? item2 + 1 : item2 - 1)12061207 # Preview1208 assert(lines.any? { it.include?('foobar') })12091210 # Header1211 header1 = lines.index { it.include?('101') }1212 header2 = lines.index { it.include?('102') }1213 assert_equal(header2, header1 + 1)1214 assert((layout == 'reverse') == header_first ? input > header1 : input < header1)12151216 # Footer1217 footer1 = lines.index { it.include?('201') }1218 footer2 = lines.index { it.include?('202') }1219 assert_equal(footer2, footer1 + 1)1220 assert(layout == 'reverse' ? footer1 > item2 : footer1 < item2)12211222 # Header lines1223 hline1 = lines.index { it.include?('1001') }1224 hline2 = lines.index { it.include?('1002') }1225 assert_equal(hline1, layout == 'default' ? hline2 + 1 : hline2 - 1)1226 assert(layout == 'reverse' ? hline1 > header1 : hline1 < header1)1227 end1228 tmux.send_keys :Enter1229 end1230 end1231end