Skip to content
Myr

Border around the input section (prompt + info)

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

Close #4154

authored by Junegunn Choi · committed by Junegunn Choi · parent fd513f8 · Browse files · 10 files+743 added−372 removed
This commit

State

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

Diff stats

10 files+743 added−372 removed

  • tests:+76 added−1 removed
  • other:+667 added−371 removed

10 files+743 added−372 removed

modified:man/man1/fzf-tmux.1+1 added-1 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\-tmux 1 "Dec 2024" "fzf 0.57.0" "fzf\-tmux - open fzf in tmux split pane"24.TH fzf\-tmux 1 "Jan 2025" "fzf 0.58.0" "fzf\-tmux - open fzf in tmux split pane"2526.SH NAME27fzf\-tmux - open fzf in tmux split pane28
40 unmodified lines
modified:man/man1/fzf.1+13 added-4 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 "Dec 2024" "fzf 0.57.0" "fzf - a command-line fuzzy finder"24.TH fzf 1 "Jan 2025" "fzf 0.58.0" "fzf - a command-line fuzzy finder"2526.SH NAME27fzf - a command-line fuzzy finder28
527 unmodified lines
556 \fBlist\-fg \fRText in the list section557 \fBselected\-fg \fRSelected line text558 \fBpreview\-fg \fRPreview window text559 \fBbg \fRBackground560 \fBlist\-bg \fRBackground in the list section560 \fBlist\-bg \fRList section background561 \fBselected\-bg \fRSelected line background562 \fBpreview\-bg \fRPreview window background563 \fBinput\-bg \fRInput section background564 \fBhl \fRHighlighted substrings565 \fBselected\-hl \fRHighlighted substrings in the selected line566 \fBcurrent\-fg (fg+) \fRText (current line)567 \fBcurrent\-bg (bg+) \fRBackground (current line)568 \fBgutter \fRGutter on the left569 \fBcurrent\-hl (hl+) \fRHighlighted substrings (current line)569 \fBquery \fRQuery string570 \fBquery (input\-fg) \fRQuery string571 \fBdisabled \fRQuery string when search is disabled (\fB\-\-disabled\fR)572 \fBinfo \fRInfo line (match counters)573 \fBborder \fRBorder around the window (\fB\-\-border\fR and \fB\-\-preview\fR)574 \fBlist\-border \fRBorder around the list section (\fB\-\-list\-border\fR)575 \fBscrollbar \fRScrollbar576 \fBseparator \fRHorizontal separator on info line577 \fBpreview\-border \fRBorder around the preview window (\fB\-\-preview\fR)578 \fBpreview\-scrollbar \fRScrollbar579 \fBinput\-border \fRBorder around the input section (\fB\-\-input\-border\fR)578 \fBlabel \fRBorder label (\fB\-\-border\-label\fR, \fB\-\-list\-label\fR, and \fB\-\-preview\-label\fR)580 \fBlabel \fRBorder label (\fB\-\-border\-label\fR, \fB\-\-list\-label\fR, \fB\-\-input\-label\fR, and \fB\-\-preview\-label\fR)581 \fBlist\-label \fRBorder label of the list section (\fB\-\-list\-label\fR)582 \fBpreview\-label \fRBorder label of the preview window (\fB\-\-preview\-label\fR)583 \fBinput\-label \fRBorder label of the input section (\fB\-\-input\-label\fR)584 \fBprompt \fRPrompt585 \fBpointer \fRPointer to the current line586 \fBmarker \fRMulti\-select marker587 \fBspinner \fRStreaming input indicator
143 unmodified lines
731732.RE733734.TP735.BI "\-\-preview\-border" [=STYLE]736Short for \fB\-\-preview\-window=border\-STYLE\fR737738.TP739.BI "\-\-preview\-label" [=LABEL]740Label to print on the horizontal border line of the preview window.741Should be used with one of the following \fB\-\-preview\-window\fR options.742
707 unmodified lines
1450 \fBbeginning\-of\-line\fR \fIctrl\-a home\fR1451 \fBcancel\fR (clear query string if not empty, abort fzf otherwise)1452 \fBchange\-border\-label(...)\fR (change \fB\-\-border\-label\fR to the given string)1453 \fBchange\-header(...)\fR (change header to the given string; doesn't affect \fB\-\-header\-lines\fR)1454 \fBchange\-input\-label(...)\fR (change \fB\-\-input\-label\fR to the given string)1455 \fBchange\-list\-label(...)\fR (change \fB\-\-list\-label\fR to the given string)1456 \fBchange\-multi\fR (enable multi-select mode with no limit)1457 \fBchange\-multi(...)\fR (enable multi-select mode with a limit or disable it with 0)1458 \fBchange\-preview(...)\fR (change \fB\-\-preview\fR option)
77 unmodified lines
1536 \fBtrack\-current\fR (track the current item; automatically disabled if focus changes)1537 \fBtransform(...)\fR (transform states using the output of an external command)1538 \fBtransform\-border\-label(...)\fR (transform border label using an external command)1539 \fBtransform\-header(...)\fR (transform header using an external command)1540 \fBtransform\-input\-label(...)\fR (transform input label using an external command)1541 \fBtransform\-list\-label(...)\fR (transform list label using an external command)1542 \fBtransform\-preview\-label(...)\fR (transform preview label using an external command)1543 \fBtransform\-prompt(...)\fR (transform prompt string using an external command)1544 \fBtransform\-query(...)\fR (transform query string using an external command)
179 unmodified lines
modified:src/tui/light.go+14 added
778 unmodified lines
779 return r.height780}781782func (r *LightRenderer) NewWindow(top int, left int, width int, height int, windowType WindowType, borderStyle BorderStyle, erase bool) Window {783 width = util.Max(0, width)784 height = util.Max(0, height)785 w := &LightWindow{786 renderer: r,787 colored: r.theme.Colored,788 windowType: windowType,
11 unmodified lines
800 w.bg = r.theme.Bg.Color801 case WindowList:802 w.fg = r.theme.ListFg.Color803 w.bg = r.theme.ListBg.Color804 case WindowInput:805 w.fg = r.theme.Input.Color806 w.bg = r.theme.InputBg.Color807 case WindowPreview:808 w.fg = r.theme.PreviewFg.Color809 w.bg = r.theme.PreviewBg.Color810 }
13 unmodified lines
824 w.drawBorder(true)825}826827func (w *LightWindow) drawBorder(onlyHorizontal bool) {828 if w.height == 0 {829 return830 }831 switch w.border.shape {832 case BorderRounded, BorderSharp, BorderBold, BorderBlock, BorderThinBlock, BorderDouble:833 w.drawBorderAround(onlyHorizontal)834 case BorderHorizontal:
24 unmodified lines
859 color := ColBorder860 switch w.windowType {861 case WindowList:862 color = ColListBorder863 case WindowInput:864 color = ColInputBorder865 case WindowPreview:866 color = ColPreviewBorder867 }868 hw := runeWidth(w.border.top)
13 unmodified lines
882 color := ColBorder883 switch w.windowType {884 case WindowList:885 color = ColListBorder886 case WindowInput:887 color = ColInputBorder888 case WindowPreview:889 color = ColPreviewBorder890 }891 for y := 0; y < w.height; y++ {
15 unmodified lines
907 color := ColBorder908 switch w.windowType {909 case WindowList:910 color = ColListBorder911 case WindowInput:912 color = ColInputBorder913 case WindowPreview:914 color = ColPreviewBorder915 }916 hw := runeWidth(w.border.top)
282 unmodified lines
modified:src/tui/tcell.go+9 added
549 unmodified lines
550 _screen.Show()551}552553func (r *FullscreenRenderer) NewWindow(top int, left int, width int, height int, windowType WindowType, borderStyle BorderStyle, erase bool) Window {554 width = util.Max(0, width)555 height = util.Max(0, height)556 normal := ColBorder557 switch windowType {558 case WindowList:559 normal = ColListBorder560 case WindowInput:561 normal = ColInputBorder562 case WindowPreview:563 normal = ColPreviewBorder564 }565 w := &TcellWindow{
205 unmodified lines
771 w.drawBorder(true)772}773774func (w *TcellWindow) drawBorder(onlyHorizontal bool) {775 if w.height == 0 {776 return777 }778 shape := w.borderStyle.shape779 if shape == BorderNone {780 return781 }
9 unmodified lines
791 case WindowBase:792 style = ColBorder.style()793 case WindowList:794 style = ColListBorder.style()795 case WindowInput:796 style = ColInputBorder.style()797 case WindowPreview:798 style = ColPreviewBorder.style()799 }800 } else {
52 unmodified lines
modified:src/tui/tui.go+31 added-5 removed
311 unmodified lines
312 PreviewBg ColorAttr313 DarkBg ColorAttr314 Gutter ColorAttr315 Prompt ColorAttr316 InputBg ColorAttr317 InputBorder ColorAttr318 InputLabel ColorAttr319 Match ColorAttr320 Current ColorAttr321 CurrentMatch ColorAttr322 Spinner ColorAttr
218 unmodified lines
541const (542 WindowBase WindowType = iota543 WindowList544 WindowPreview545 WindowInput546)547548type Renderer interface {549 DefaultTheme() *ColorTheme
99 unmodified lines
649 ColPreviewScrollbar ColorPair650 ColPreviewSpinner ColorPair651 ColListBorder ColorPair652 ColListLabel ColorPair653 ColInputBorder ColorPair654 ColInputLabel ColorPair655)656657func EmptyTheme() *ColorTheme {658 return &ColorTheme{
28 unmodified lines
687 PreviewScrollbar: ColorAttr{colUndefined, AttrUndefined},688 PreviewLabel: ColorAttr{colUndefined, AttrUndefined},689 Separator: ColorAttr{colUndefined, AttrUndefined},690 Scrollbar: ColorAttr{colUndefined, AttrUndefined},691 InputBg: ColorAttr{colUndefined, AttrUndefined},692 InputBorder: ColorAttr{colUndefined, AttrUndefined},693 InputLabel: ColorAttr{colUndefined, AttrUndefined},694 }695}696697func NoColorTheme() *ColorTheme {
29 unmodified lines
727 ListLabel: ColorAttr{colDefault, AttrUndefined},728 ListBorder: ColorAttr{colDefault, AttrUndefined},729 Separator: ColorAttr{colDefault, AttrUndefined},730 Scrollbar: ColorAttr{colDefault, AttrUndefined},731 InputBg: ColorAttr{colDefault, AttrUndefined},732 InputBorder: ColorAttr{colDefault, AttrUndefined},733 InputLabel: ColorAttr{colDefault, AttrUndefined},734 }735}736737func init() {
29 unmodified lines
767 ListLabel: ColorAttr{colUndefined, AttrUndefined},768 ListBorder: ColorAttr{colUndefined, AttrUndefined},769 Separator: ColorAttr{colUndefined, AttrUndefined},770 Scrollbar: ColorAttr{colUndefined, AttrUndefined},771 InputBg: ColorAttr{colUndefined, AttrUndefined},772 InputBorder: ColorAttr{colUndefined, AttrUndefined},773 InputLabel: ColorAttr{colUndefined, AttrUndefined},774 }775 Dark256 = &ColorTheme{776 Colored: true,777 Input: ColorAttr{colDefault, AttrUndefined},
26 unmodified lines
804 ListLabel: ColorAttr{colUndefined, AttrUndefined},805 ListBorder: ColorAttr{colUndefined, AttrUndefined},806 Separator: ColorAttr{colUndefined, AttrUndefined},807 Scrollbar: ColorAttr{colUndefined, AttrUndefined},808 InputBg: ColorAttr{colUndefined, AttrUndefined},809 InputBorder: ColorAttr{colUndefined, AttrUndefined},810 InputLabel: ColorAttr{colUndefined, AttrUndefined},811 }812 Light256 = &ColorTheme{813 Colored: true,814 Input: ColorAttr{colDefault, AttrUndefined},
26 unmodified lines
841 ListLabel: ColorAttr{colUndefined, AttrUndefined},842 ListBorder: ColorAttr{colUndefined, AttrUndefined},843 Separator: ColorAttr{colUndefined, AttrUndefined},844 Scrollbar: ColorAttr{colUndefined, AttrUndefined},845 InputBg: ColorAttr{colUndefined, AttrUndefined},846 InputBorder: ColorAttr{colUndefined, AttrUndefined},847 InputLabel: ColorAttr{colUndefined, AttrUndefined},848 }849}850851func InitTheme(theme *ColorTheme, baseTheme *ColorTheme, forceBlack bool) {
43 unmodified lines
895 theme.ListBorder = o(theme.Border, theme.ListBorder)896 theme.Separator = o(theme.ListBorder, theme.Separator)897 theme.Scrollbar = o(theme.ListBorder, theme.Scrollbar)898 theme.PreviewScrollbar = o(theme.PreviewBorder, theme.PreviewScrollbar)899 theme.InputBg = o(theme.Bg, o(theme.ListBg, theme.InputBg))900 theme.InputBorder = o(theme.Border, theme.InputBorder)901 theme.InputLabel = o(theme.BorderLabel, theme.InputLabel)902903 initPalette(theme)904}905
6 unmodified lines
912 }913 blank := theme.ListFg914 blank.Attr = AttrRegular915892 ColPrompt = pair(theme.Prompt, theme.ListBg)916 ColPrompt = pair(theme.Prompt, theme.InputBg)917 ColNormal = pair(theme.ListFg, theme.ListBg)918 ColSelected = pair(theme.SelectedFg, theme.SelectedBg)895 ColInput = pair(theme.Input, theme.ListBg)919 ColInput = pair(theme.Input, theme.InputBg)920 ColDisabled = pair(theme.Disabled, theme.ListBg)921 ColMatch = pair(theme.Match, theme.ListBg)922 ColSelectedMatch = pair(theme.SelectedMatch, theme.SelectedBg)923 ColCursor = pair(theme.Cursor, theme.Gutter)
8 unmodified lines
932 ColCurrentCursor = pair(theme.Cursor, theme.DarkBg)933 ColCurrentCursorEmpty = pair(blank, theme.DarkBg)934 ColCurrentMarker = pair(theme.Marker, theme.DarkBg)935 ColCurrentSelectedEmpty = pair(blank, theme.DarkBg)912 ColSpinner = pair(theme.Spinner, theme.ListBg)913 ColInfo = pair(theme.Info, theme.ListBg)936 ColSpinner = pair(theme.Spinner, theme.InputBg)937 ColInfo = pair(theme.Info, theme.InputBg)938 ColHeader = pair(theme.Header, theme.ListBg)915 ColSeparator = pair(theme.Separator, theme.ListBg)939 ColSeparator = pair(theme.Separator, theme.InputBg)940 ColScrollbar = pair(theme.Scrollbar, theme.ListBg)941 ColBorder = pair(theme.Border, theme.Bg)942 ColBorderLabel = pair(theme.BorderLabel, theme.Bg)943 ColPreviewLabel = pair(theme.PreviewLabel, theme.PreviewBg)
2 unmodified lines
946 ColPreviewScrollbar = pair(theme.PreviewScrollbar, theme.PreviewBg)947 ColPreviewSpinner = pair(theme.Spinner, theme.PreviewBg)948 ColListLabel = pair(theme.ListLabel, theme.ListBg)949 ColListBorder = pair(theme.ListBorder, theme.ListBg)950 ColInputBorder = pair(theme.InputBorder, theme.InputBg)951 ColInputLabel = pair(theme.InputLabel, theme.InputBg)952}953954func runeWidth(r rune) int {955 return uniseg.StringWidth(string(r))
1 unmodified line
modified:src/actiontype_string.go+103 added-101 removed
24 unmodified lines
25 _ = x[actBackwardWord-14]26 _ = x[actCancel-15]27 _ = x[actChangeBorderLabel-16]28 _ = x[actChangeListLabel-17]29 _ = x[actChangeHeader-18]30 _ = x[actChangeMulti-19]31 _ = x[actChangePreviewLabel-20]32 _ = x[actChangePrompt-21]33 _ = x[actChangeQuery-22]34 _ = x[actClearScreen-23]35 _ = x[actClearQuery-24]36 _ = x[actClearSelection-25]37 _ = x[actClose-26]38 _ = x[actDeleteChar-27]39 _ = x[actDeleteCharEof-28]40 _ = x[actEndOfLine-29]41 _ = x[actFatal-30]42 _ = x[actForwardChar-31]43 _ = x[actForwardWord-32]44 _ = x[actKillLine-33]45 _ = x[actKillWord-34]46 _ = x[actUnixLineDiscard-35]47 _ = x[actUnixWordRubout-36]48 _ = x[actYank-37]49 _ = x[actBackwardKillWord-38]50 _ = x[actSelectAll-39]51 _ = x[actDeselectAll-40]52 _ = x[actToggle-41]53 _ = x[actToggleSearch-42]54 _ = x[actToggleAll-43]55 _ = x[actToggleDown-44]56 _ = x[actToggleUp-45]57 _ = x[actToggleIn-46]58 _ = x[actToggleOut-47]59 _ = x[actToggleTrack-48]60 _ = x[actToggleTrackCurrent-49]61 _ = x[actToggleHeader-50]62 _ = x[actToggleWrap-51]63 _ = x[actToggleMultiLine-52]64 _ = x[actToggleHscroll-53]65 _ = x[actTrackCurrent-54]66 _ = x[actUntrackCurrent-55]67 _ = x[actDown-56]68 _ = x[actUp-57]69 _ = x[actPageUp-58]70 _ = x[actPageDown-59]71 _ = x[actPosition-60]72 _ = x[actHalfPageUp-61]73 _ = x[actHalfPageDown-62]74 _ = x[actOffsetUp-63]75 _ = x[actOffsetDown-64]76 _ = x[actOffsetMiddle-65]77 _ = x[actJump-66]78 _ = x[actJumpAccept-67]79 _ = x[actPrintQuery-68]80 _ = x[actRefreshPreview-69]81 _ = x[actReplaceQuery-70]82 _ = x[actToggleSort-71]83 _ = x[actShowPreview-72]84 _ = x[actHidePreview-73]85 _ = x[actTogglePreview-74]86 _ = x[actTogglePreviewWrap-75]87 _ = x[actTransform-76]88 _ = x[actTransformBorderLabel-77]89 _ = x[actTransformListLabel-78]90 _ = x[actTransformHeader-79]91 _ = x[actTransformPreviewLabel-80]92 _ = x[actTransformPrompt-81]93 _ = x[actTransformQuery-82]94 _ = x[actPreview-83]95 _ = x[actChangePreview-84]96 _ = x[actChangePreviewWindow-85]97 _ = x[actPreviewTop-86]98 _ = x[actPreviewBottom-87]99 _ = x[actPreviewUp-88]100 _ = x[actPreviewDown-89]101 _ = x[actPreviewPageUp-90]102 _ = x[actPreviewPageDown-91]103 _ = x[actPreviewHalfPageUp-92]104 _ = x[actPreviewHalfPageDown-93]105 _ = x[actPrevHistory-94]106 _ = x[actPrevSelected-95]107 _ = x[actPrint-96]108 _ = x[actPut-97]109 _ = x[actNextHistory-98]110 _ = x[actNextSelected-99]111 _ = x[actExecute-100]112 _ = x[actExecuteSilent-101]113 _ = x[actExecuteMulti-102]114 _ = x[actSigStop-103]115 _ = x[actFirst-104]116 _ = x[actLast-105]117 _ = x[actReload-106]118 _ = x[actReloadSync-107]119 _ = x[actDisableSearch-108]120 _ = x[actEnableSearch-109]121 _ = x[actSelect-110]122 _ = x[actDeselect-111]123 _ = x[actUnbind-112]124 _ = x[actRebind-113]125 _ = x[actBecome-114]126 _ = x[actShowHeader-115]127 _ = x[actHideHeader-116]29 _ = x[actChangeInputLabel-18]30 _ = x[actChangeHeader-19]31 _ = x[actChangeMulti-20]32 _ = x[actChangePreviewLabel-21]33 _ = x[actChangePrompt-22]34 _ = x[actChangeQuery-23]35 _ = x[actClearScreen-24]36 _ = x[actClearQuery-25]37 _ = x[actClearSelection-26]38 _ = x[actClose-27]39 _ = x[actDeleteChar-28]40 _ = x[actDeleteCharEof-29]41 _ = x[actEndOfLine-30]42 _ = x[actFatal-31]43 _ = x[actForwardChar-32]44 _ = x[actForwardWord-33]45 _ = x[actKillLine-34]46 _ = x[actKillWord-35]47 _ = x[actUnixLineDiscard-36]48 _ = x[actUnixWordRubout-37]49 _ = x[actYank-38]50 _ = x[actBackwardKillWord-39]51 _ = x[actSelectAll-40]52 _ = x[actDeselectAll-41]53 _ = x[actToggle-42]54 _ = x[actToggleSearch-43]55 _ = x[actToggleAll-44]56 _ = x[actToggleDown-45]57 _ = x[actToggleUp-46]58 _ = x[actToggleIn-47]59 _ = x[actToggleOut-48]60 _ = x[actToggleTrack-49]61 _ = x[actToggleTrackCurrent-50]62 _ = x[actToggleHeader-51]63 _ = x[actToggleWrap-52]64 _ = x[actToggleMultiLine-53]65 _ = x[actToggleHscroll-54]66 _ = x[actTrackCurrent-55]67 _ = x[actUntrackCurrent-56]68 _ = x[actDown-57]69 _ = x[actUp-58]70 _ = x[actPageUp-59]71 _ = x[actPageDown-60]72 _ = x[actPosition-61]73 _ = x[actHalfPageUp-62]74 _ = x[actHalfPageDown-63]75 _ = x[actOffsetUp-64]76 _ = x[actOffsetDown-65]77 _ = x[actOffsetMiddle-66]78 _ = x[actJump-67]79 _ = x[actJumpAccept-68]80 _ = x[actPrintQuery-69]81 _ = x[actRefreshPreview-70]82 _ = x[actReplaceQuery-71]83 _ = x[actToggleSort-72]84 _ = x[actShowPreview-73]85 _ = x[actHidePreview-74]86 _ = x[actTogglePreview-75]87 _ = x[actTogglePreviewWrap-76]88 _ = x[actTransform-77]89 _ = x[actTransformBorderLabel-78]90 _ = x[actTransformListLabel-79]91 _ = x[actTransformInputLabel-80]92 _ = x[actTransformHeader-81]93 _ = x[actTransformPreviewLabel-82]94 _ = x[actTransformPrompt-83]95 _ = x[actTransformQuery-84]96 _ = x[actPreview-85]97 _ = x[actChangePreview-86]98 _ = x[actChangePreviewWindow-87]99 _ = x[actPreviewTop-88]100 _ = x[actPreviewBottom-89]101 _ = x[actPreviewUp-90]102 _ = x[actPreviewDown-91]103 _ = x[actPreviewPageUp-92]104 _ = x[actPreviewPageDown-93]105 _ = x[actPreviewHalfPageUp-94]106 _ = x[actPreviewHalfPageDown-95]107 _ = x[actPrevHistory-96]108 _ = x[actPrevSelected-97]109 _ = x[actPrint-98]110 _ = x[actPut-99]111 _ = x[actNextHistory-100]112 _ = x[actNextSelected-101]113 _ = x[actExecute-102]114 _ = x[actExecuteSilent-103]115 _ = x[actExecuteMulti-104]116 _ = x[actSigStop-105]117 _ = x[actFirst-106]118 _ = x[actLast-107]119 _ = x[actReload-108]120 _ = x[actReloadSync-109]121 _ = x[actDisableSearch-110]122 _ = x[actEnableSearch-111]123 _ = x[actSelect-112]124 _ = x[actDeselect-113]125 _ = x[actUnbind-114]126 _ = x[actRebind-115]127 _ = x[actBecome-116]128 _ = x[actShowHeader-117]129 _ = x[actHideHeader-118]130}131130const _actionType_name = "actIgnoreactStartactClickactInvalidactCharactMouseactBeginningOfLineactAbortactAcceptactAcceptNonEmptyactAcceptOrPrintQueryactBackwardCharactBackwardDeleteCharactBackwardDeleteCharEofactBackwardWordactCancelactChangeBorderLabelactChangeListLabelactChangeHeaderactChangeMultiactChangePreviewLabelactChangePromptactChangeQueryactClearScreenactClearQueryactClearSelectionactCloseactDeleteCharactDeleteCharEofactEndOfLineactFatalactForwardCharactForwardWordactKillLineactKillWordactUnixLineDiscardactUnixWordRuboutactYankactBackwardKillWordactSelectAllactDeselectAllactToggleactToggleSearchactToggleAllactToggleDownactToggleUpactToggleInactToggleOutactToggleTrackactToggleTrackCurrentactToggleHeaderactToggleWrapactToggleMultiLineactToggleHscrollactTrackCurrentactUntrackCurrentactDownactUpactPageUpactPageDownactPositionactHalfPageUpactHalfPageDownactOffsetUpactOffsetDownactOffsetMiddleactJumpactJumpAcceptactPrintQueryactRefreshPreviewactReplaceQueryactToggleSortactShowPreviewactHidePreviewactTogglePreviewactTogglePreviewWrapactTransformactTransformBorderLabelactTransformListLabelactTransformHeaderactTransformPreviewLabelactTransformPromptactTransformQueryactPreviewactChangePreviewactChangePreviewWindowactPreviewTopactPreviewBottomactPreviewUpactPreviewDownactPreviewPageUpactPreviewPageDownactPreviewHalfPageUpactPreviewHalfPageDownactPrevHistoryactPrevSelectedactPrintactPutactNextHistoryactNextSelectedactExecuteactExecuteSilentactExecuteMultiactSigStopactFirstactLastactReloadactReloadSyncactDisableSearchactEnableSearchactSelectactDeselectactUnbindactRebindactBecomeactShowHeaderactHideHeader"132const _actionType_name = "actIgnoreactStartactClickactInvalidactCharactMouseactBeginningOfLineactAbortactAcceptactAcceptNonEmptyactAcceptOrPrintQueryactBackwardCharactBackwardDeleteCharactBackwardDeleteCharEofactBackwardWordactCancelactChangeBorderLabelactChangeListLabelactChangeInputLabelactChangeHeaderactChangeMultiactChangePreviewLabelactChangePromptactChangeQueryactClearScreenactClearQueryactClearSelectionactCloseactDeleteCharactDeleteCharEofactEndOfLineactFatalactForwardCharactForwardWordactKillLineactKillWordactUnixLineDiscardactUnixWordRuboutactYankactBackwardKillWordactSelectAllactDeselectAllactToggleactToggleSearchactToggleAllactToggleDownactToggleUpactToggleInactToggleOutactToggleTrackactToggleTrackCurrentactToggleHeaderactToggleWrapactToggleMultiLineactToggleHscrollactTrackCurrentactUntrackCurrentactDownactUpactPageUpactPageDownactPositionactHalfPageUpactHalfPageDownactOffsetUpactOffsetDownactOffsetMiddleactJumpactJumpAcceptactPrintQueryactRefreshPreviewactReplaceQueryactToggleSortactShowPreviewactHidePreviewactTogglePreviewactTogglePreviewWrapactTransformactTransformBorderLabelactTransformListLabelactTransformInputLabelactTransformHeaderactTransformPreviewLabelactTransformPromptactTransformQueryactPreviewactChangePreviewactChangePreviewWindowactPreviewTopactPreviewBottomactPreviewUpactPreviewDownactPreviewPageUpactPreviewPageDownactPreviewHalfPageUpactPreviewHalfPageDownactPrevHistoryactPrevSelectedactPrintactPutactNextHistoryactNextSelectedactExecuteactExecuteSilentactExecuteMultiactSigStopactFirstactLastactReloadactReloadSyncactDisableSearchactEnableSearchactSelectactDeselectactUnbindactRebindactBecomeactShowHeaderactHideHeader"133132var _actionType_index = [...]uint16{0, 9, 17, 25, 35, 42, 50, 68, 76, 85, 102, 123, 138, 159, 183, 198, 207, 227, 245, 260, 274, 295, 310, 324, 338, 351, 368, 376, 389, 405, 417, 425, 439, 453, 464, 475, 493, 510, 517, 536, 548, 562, 571, 586, 598, 611, 622, 633, 645, 659, 680, 695, 708, 726, 742, 757, 774, 781, 786, 795, 806, 817, 830, 845, 856, 869, 884, 891, 904, 917, 934, 949, 962, 976, 990, 1006, 1026, 1038, 1061, 1082, 1100, 1124, 1142, 1159, 1169, 1185, 1207, 1220, 1236, 1248, 1262, 1278, 1296, 1316, 1338, 1352, 1367, 1375, 1381, 1395, 1410, 1420, 1436, 1451, 1461, 1469, 1476, 1485, 1498, 1514, 1529, 1538, 1549, 1558, 1567, 1576, 1589, 1602}134var _actionType_index = [...]uint16{0, 9, 17, 25, 35, 42, 50, 68, 76, 85, 102, 123, 138, 159, 183, 198, 207, 227, 245, 264, 279, 293, 314, 329, 343, 357, 370, 387, 395, 408, 424, 436, 444, 458, 472, 483, 494, 512, 529, 536, 555, 567, 581, 590, 605, 617, 630, 641, 652, 664, 678, 699, 714, 727, 745, 761, 776, 793, 800, 805, 814, 825, 836, 849, 864, 875, 888, 903, 910, 923, 936, 953, 968, 981, 995, 1009, 1025, 1045, 1057, 1080, 1101, 1123, 1141, 1165, 1183, 1200, 1210, 1226, 1248, 1261, 1277, 1289, 1303, 1319, 1337, 1357, 1379, 1393, 1408, 1416, 1422, 1436, 1451, 1461, 1477, 1492, 1502, 1510, 1517, 1526, 1539, 1555, 1570, 1579, 1590, 1599, 1608, 1617, 1630, 1643}135136func (i actionType) String() string {137 if i < 0 || i >= actionType(len(_actionType_index)-1) {138 return "actionType(" + strconv.FormatInt(int64(i), 10) + ")"
3 unmodified lines
modified:src/options.go+285 added-226 removed
25 unmodified lines
2627Usage: fzf [options]2829 Search30 -x, --extended Extended-search mode31 (enabled by default; +x or --no-extended to disable)32 -e, --exact Enable Exact-match33 -i, --ignore-case Case-insensitive match (default: smart-case match)34 +i, --no-ignore-case Case-sensitive match35 --scheme=SCHEME Scoring scheme [default|path|history]36 --literal Do not normalize latin script letters before matching37 -n, --nth=N[,..] Comma-separated list of field index expressions38 for limiting search scope. Each can be a non-zero39 integer or a range expression ([BEGIN]..[END]).40 --with-nth=N[,..] Transform the presentation of each line using41 field index expressions42 -d, --delimiter=STR Field delimiter regex (default: AWK-style)43 +s, --no-sort Do not sort the result44 --tail=NUM Maximum number of items to keep in memory45 --track Track the current selection when the result is updated46 --tac Reverse the order of the input47 --disabled Do not perform search48 --tiebreak=CRI[,..] Comma-separated list of sort criteria to apply49 when the scores are tied [length|chunk|begin|end|index]50 (default: length)30 -x, --extended Extended-search mode31 (enabled by default; +x or --no-extended to disable)32 -e, --exact Enable Exact-match33 -i, --ignore-case Case-insensitive match (default: smart-case match)34 +i, --no-ignore-case Case-sensitive match35 --scheme=SCHEME Scoring scheme [default|path|history]36 --literal Do not normalize latin script letters before matching37 -n, --nth=N[,..] Comma-separated list of field index expressions38 for limiting search scope. Each can be a non-zero39 integer or a range expression ([BEGIN]..[END]).40 --with-nth=N[,..] Transform the presentation of each line using41 field index expressions42 -d, --delimiter=STR Field delimiter regex (default: AWK-style)43 +s, --no-sort Do not sort the result44 --tail=NUM Maximum number of items to keep in memory45 --track Track the current selection when the result is updated46 --tac Reverse the order of the input47 --disabled Do not perform search48 --tiebreak=CRI[,..] Comma-separated list of sort criteria to apply49 when the scores are tied [length|chunk|begin|end|index]50 (default: length)51 Interface52 -m, --multi[=MAX] Enable multi-select with tab/shift-tab53 --no-mouse Disable mouse54 --bind=KEYBINDS Custom key bindings. Refer to the man page.55 --cycle Enable cyclic scroll56 --wrap Enable line wrap57 --wrap-sign=STR Indicator for wrapped lines58 --no-multi-line Disable multi-line display of items when using --read059 --gap[=N] Render empty lines between each item60 --keep-right Keep the right end of the line visible on overflow61 --scroll-off=LINES Number of screen lines to keep above or below when62 scrolling to the top or to the bottom (default: 0)63 --no-hscroll Disable horizontal scroll64 --hscroll-off=COLS Number of screen columns to keep to the right of the65 highlighted substring (default: 10)66 --filepath-word Make word-wise movements respect path separators67 --jump-labels=CHARS Label characters for jump mode52 -m, --multi[=MAX] Enable multi-select with tab/shift-tab53 --no-mouse Disable mouse54 --bind=KEYBINDS Custom key bindings. Refer to the man page.55 --cycle Enable cyclic scroll56 --wrap Enable line wrap57 --wrap-sign=STR Indicator for wrapped lines58 --no-multi-line Disable multi-line display of items when using --read059 --gap[=N] Render empty lines between each item60 --keep-right Keep the right end of the line visible on overflow61 --scroll-off=LINES Number of screen lines to keep above or below when62 scrolling to the top or to the bottom (default: 0)63 --no-hscroll Disable horizontal scroll64 --hscroll-off=COLS Number of screen columns to keep to the right of the65 highlighted substring (default: 10)66 --filepath-word Make word-wise movements respect path separators67 --jump-labels=CHARS Label characters for jump mode6869 Layout70 --height=[~]HEIGHT[%] Display fzf window below the cursor with the given71 height instead of using fullscreen.72 A negative value is calculated as the terminal height73 minus the given value.74 If prefixed with '~', fzf will determine the height75 according to the input size.76 --min-height=HEIGHT Minimum height when --height is given in percent77 (default: 10)78 --tmux[=OPTS] Start fzf in a tmux popup (requires tmux 3.3+)79 [center|top|bottom|left|right][,SIZE[%]][,SIZE[%]]80 (default: center,50%)81 --layout=LAYOUT Choose layout: [default|reverse|reverse-list]82 --border[=STYLE] Draw border around the finder83 [rounded|sharp|bold|block|thinblock|double|horizontal|vertical|84 top|bottom|left|right|none] (default: rounded)85 --border-label=LABEL Label to print on the border86 --border-label-pos=COL Position of the border label87 [POSITIVE_INTEGER: columns from left|88 NEGATIVE_INTEGER: columns from right][:bottom]89 (default: 0 or center)90 --list-border[=STYLE] Draw border around the list section91 [rounded|sharp|bold|block|thinblock|double|horizontal|vertical|92 top|bottom|left|right|none] (default: none)93 --list-label=LABEL Label to print on the list border94 --list-label-pos=COL Position of the list label95 [POSITIVE_INTEGER: columns from left|96 NEGATIVE_INTEGER: columns from right][:bottom]97 (default: 0 or center)98 --margin=MARGIN Screen margin (TRBL | TB,RL | T,RL,B | T,R,B,L)99 --padding=PADDING Padding inside border (TRBL | TB,RL | T,RL,B | T,R,B,L)100 --info=STYLE Finder info style101 [default|right|hidden|inline[-right][:PREFIX]]102 --info-command=COMMAND Command to generate info line103 --separator=STR String to form horizontal separator on info line104 --no-separator Hide info line separator105 --scrollbar[=C1[C2]] Scrollbar character(s) (each for main and preview window)106 --no-scrollbar Hide scrollbar107 --prompt=STR Input prompt (default: '> ')108 --pointer=STR Pointer to the current line (default: '▌' or '>')109 --marker=STR Multi-select marker (default: '┃' or '>')110 --marker-multi-line=STR Multi-select marker for multi-line entries;111 3 elements for top, middle, and bottom (default: '╻┃╹')112 --header=STR String to print as header113 --header-lines=N The first N lines of the input are treated as header114 --header-first Print header before the prompt line115 --ellipsis=STR Ellipsis to show when line is truncated (default: '··')70 --height=[~]HEIGHT[%] Display fzf window below the cursor with the given71 height instead of using fullscreen.72 A negative value is calculated as the terminal height73 minus the given value.74 If prefixed with '~', fzf will determine the height75 according to the input size.76 --min-height=HEIGHT Minimum height when --height is given in percent77 (default: 10)78 --tmux[=OPTS] Start fzf in a tmux popup (requires tmux 3.3+)79 [center|top|bottom|left|right][,SIZE[%]][,SIZE[%]]80 (default: center,50%)81 --layout=LAYOUT Choose layout: [default|reverse|reverse-list]82 --border[=STYLE] Draw border around the finder83 [rounded|sharp|bold|block|thinblock|double|horizontal|vertical|84 top|bottom|left|right|none] (default: rounded)85 --border-label=LABEL Label to print on the border86 --border-label-pos=COL Position of the border label87 [POSITIVE_INTEGER: columns from left|88 NEGATIVE_INTEGER: columns from right][:bottom]89 (default: 0 or center)90 --list-border[=STYLE] Draw border around the list section91 [rounded|sharp|bold|block|thinblock|double|horizontal|vertical|92 top|bottom|left|right|none] (default: none)93 --list-label=LABEL Label to print on the list border94 --list-label-pos=COL Position of the list label95 [POSITIVE_INTEGER: columns from left|96 NEGATIVE_INTEGER: columns from right][:bottom]97 (default: 0 or center)98 --margin=MARGIN Screen margin (TRBL | TB,RL | T,RL,B | T,R,B,L)99 --padding=PADDING Padding inside border (TRBL | TB,RL | T,RL,B | T,R,B,L)100 --info=STYLE Finder info style101 [default|right|hidden|inline[-right][:PREFIX]]102 --info-command=COMMAND Command to generate info line103 --separator=STR String to form horizontal separator on info line104 --no-separator Hide info line separator105 --scrollbar[=C1[C2]] Scrollbar character(s) (each for main and preview window)106 --no-scrollbar Hide scrollbar107 --prompt=STR Input prompt (default: '> ')108 --pointer=STR Pointer to the current line (default: '▌' or '>')109 --marker=STR Multi-select marker (default: '┃' or '>')110 --marker-multi-line=STR Multi-select marker for multi-line entries;111 3 elements for top, middle, and bottom (default: '╻┃╹')112 --header=STR String to print as header113 --header-lines=N The first N lines of the input are treated as header114 --header-first Print header before the prompt line115 --ellipsis=STR Ellipsis to show when line is truncated (default: '··')116117 Display118 --ansi Enable processing of ANSI color codes119 --tabstop=SPACES Number of spaces for a tab character (default: 8)120 --color=COLSPEC Base scheme (dark|light|16|bw) and/or custom colors121 --highlight-line Highlight the whole current line122 --no-bold Do not use bold text118 --ansi Enable processing of ANSI color codes119 --tabstop=SPACES Number of spaces for a tab character (default: 8)120 --color=COLSPEC Base scheme (dark|light|16|bw) and/or custom colors121 --highlight-line Highlight the whole current line122 --no-bold Do not use bold text123124 History125 --history=FILE History file126 --history-size=N Maximum number of history entries (default: 1000)125 --history=FILE History file126 --history-size=N Maximum number of history entries (default: 1000)127128 Preview129 --preview=COMMAND Command to preview highlighted line ({})130 --preview-window=OPT Preview window layout (default: right:50%)131 [up|down|left|right][,SIZE[%]]132 [,[no]wrap][,[no]cycle][,[no]follow][,[no]info]133 [,[no]hidden][,border-BORDER_OPT]134 [,+SCROLL[OFFSETS][/DENOM]][,~HEADER_LINES]135 [,default][,<SIZE_THRESHOLD(ALTERNATIVE_LAYOUT)]129 --preview=COMMAND Command to preview highlighted line ({})130 --preview-window=OPT Preview window layout (default: right:50%)131 [up|down|left|right][,SIZE[%]]132 [,[no]wrap][,[no]cycle][,[no]follow][,[no]info]133 [,[no]hidden][,border-BORDER_OPT]134 [,+SCROLL[OFFSETS][/DENOM]][,~HEADER_LINES]135 [,default][,<SIZE_THRESHOLD(ALTERNATIVE_LAYOUT)]136 --preview-border[=STYLE] Short for --preview-window=border-STYLE137 --preview-label=LABEL137 --preview-label-pos=N Same as --border-label and --border-label-pos,138 but for preview window138 --preview-label-pos=N Same as --border-label and --border-label-pos,139 but for preview window140141 Scripting141 -q, --query=STR Start the finder with the given query142 -1, --select-1 Automatically select the only match143 -0, --exit-0 Exit immediately when there's no match144 -f, --filter=STR Filter mode. Do not start interactive finder.145 --print-query Print query as the first line146 --expect=KEYS Comma-separated list of keys to complete fzf147 --read0 Read input delimited by ASCII NUL characters148 --print0 Print output delimited by ASCII NUL characters149 --sync Synchronous search for multi-staged filtering150 --with-shell=STR Shell command and flags to start child processes with151 --listen[=[ADDR:]PORT] Start HTTP server to receive actions (POST /)152 (To allow remote process execution, use --listen-unsafe)142 -q, --query=STR Start the finder with the given query143 -1, --select-1 Automatically select the only match144 -0, --exit-0 Exit immediately when there's no match145 -f, --filter=STR Filter mode. Do not start interactive finder.146 --print-query Print query as the first line147 --expect=KEYS Comma-separated list of keys to complete fzf148 --read0 Read input delimited by ASCII NUL characters149 --print0 Print output delimited by ASCII NUL characters150 --sync Synchronous search for multi-staged filtering151 --with-shell=STR Shell command and flags to start child processes with152 --listen[=[ADDR:]PORT] Start HTTP server to receive actions (POST /)153 (To allow remote process execution, use --listen-unsafe)154154 Directory traversal (Only used when $FZF_DEFAULT_COMMAND is not set)155 --walker=OPTS [file][,dir][,follow][,hidden] (default: file,follow,hidden)156 --walker-root=DIR [...] List of directories to walk (default: .)157 --walker-skip=DIRS Comma-separated list of directory names to skip158 (default: .git,node_modules)155 Directory traversal (Only used when $FZF_DEFAULT_COMMAND is not set)156 --walker=OPTS [file][,dir][,follow][,hidden] (default: file,follow,hidden)157 --walker-root=DIR [...] List of directories to walk (default: .)158 --walker-skip=DIRS Comma-separated list of directory names to skip159 (default: .git,node_modules)160161 Shell integration161 --bash Print script to set up Bash shell integration162 --zsh Print script to set up Zsh shell integration163 --fish Print script to set up Fish shell integration162 --bash Print script to set up Bash shell integration163 --zsh Print script to set up Zsh shell integration164 --fish Print script to set up Fish shell integration165166 Help166 --version Display version information and exit167 --help Show this message168 --man Show man page167 --version Display version information and exit168 --help Show this message169 --man Show man page170171 Environment variables171 FZF_DEFAULT_COMMAND Default command to use when input is tty172 FZF_DEFAULT_OPTS Default options (e.g. '--layout=reverse --info=inline')173 FZF_DEFAULT_OPTS_FILE Location of the file to read default options from174 FZF_API_KEY X-API-Key header for HTTP server (--listen)172 FZF_DEFAULT_COMMAND Default command to use when input is tty173 FZF_DEFAULT_OPTS Default options (e.g. '--layout=reverse --info=inline')174 FZF_DEFAULT_OPTS_FILE Location of the file to read default options from175 FZF_API_KEY X-API-Key header for HTTP server (--listen)176177`178179const defaultInfoPrefix = " < "
264 unmodified lines
444}445446// Options stores the values of command-line options447type Options struct {447 Input chan string448 Output chan string449 NoWinpty bool450 Tmux *tmuxOptions451 ForceTtyIn bool452 ProxyScript string453 Bash bool454 Zsh bool455 Fish bool456 Man bool457 Fuzzy bool458 FuzzyAlgo algo.Algo459 Scheme string460 Extended bool461 Phony bool462 Case Case463 Normalize bool464 Nth []Range465 WithNth []Range466 Delimiter Delimiter467 Sort int468 Track trackOption469 Tac bool470 Tail int471 Criteria []criterion472 Multi int473 Ansi bool474 Mouse bool475 Theme *tui.ColorTheme476 Black bool477 Bold bool478 Height heightSpec479 MinHeight int480 Layout layoutType481 Cycle bool482 Wrap bool483 WrapSign *string484 MultiLine bool485 CursorLine bool486 KeepRight bool487 Hscroll bool488 HscrollOff int489 ScrollOff int490 FileWord bool491 InfoStyle infoStyle492 InfoPrefix string493 InfoCommand string494 Separator *string495 JumpLabels string496 Prompt string497 Pointer *string498 Marker *string499 MarkerMulti *[3]string500 Query string501 Select1 bool502 Exit0 bool503 Filter *string504 ToggleSort bool505 Expect map[tui.Event]string506 Keymap map[tui.Event][]*action507 Preview previewOpts508 PrintQuery bool509 ReadZero bool510 Printer func(string)511 PrintSep string512 Sync bool513 History *History514 Header []string515 HeaderLines int516 HeaderFirst bool517 Gap int518 Ellipsis *string519 Scrollbar *string520 Margin [4]sizeSpec521 Padding [4]sizeSpec522 BorderShape tui.BorderShape523 ListBorderShape tui.BorderShape524 BorderLabel labelOpts525 ListLabel labelOpts526 PreviewLabel labelOpts527 Unicode bool528 Ambidouble bool529 Tabstop int530 WithShell string531 ListenAddr *listenAddress532 Unsafe bool533 ClearOnExit bool534 WalkerOpts walkerOpts535 WalkerRoot []string536 WalkerSkip []string537 Version bool538 Help bool539 CPUProfile string540 MEMProfile string541 BlockProfile string542 MutexProfile string448 Input chan string449 Output chan string450 NoWinpty bool451 Tmux *tmuxOptions452 ForceTtyIn bool453 ProxyScript string454 Bash bool455 Zsh bool456 Fish bool457 Man bool458 Fuzzy bool459 FuzzyAlgo algo.Algo460 Scheme string461 Extended bool462 Phony bool463 Case Case464 Normalize bool465 Nth []Range466 WithNth []Range467 Delimiter Delimiter468 Sort int469 Track trackOption470 Tac bool471 Tail int472 Criteria []criterion473 Multi int474 Ansi bool475 Mouse bool476 Theme *tui.ColorTheme477 Black bool478 Bold bool479 Height heightSpec480 MinHeight int481 Layout layoutType482 Cycle bool483 Wrap bool484 WrapSign *string485 MultiLine bool486 CursorLine bool487 KeepRight bool488 Hscroll bool489 HscrollOff int490 ScrollOff int491 FileWord bool492 InfoStyle infoStyle493 InfoPrefix string494 InfoCommand string495 Separator *string496 JumpLabels string497 Prompt string498 Pointer *string499 Marker *string500 MarkerMulti *[3]string501 Query string502 Select1 bool503 Exit0 bool504 Filter *string505 ToggleSort bool506 Expect map[tui.Event]string507 Keymap map[tui.Event][]*action508 Preview previewOpts509 PrintQuery bool510 ReadZero bool511 Printer func(string)512 PrintSep string513 Sync bool514 History *History515 Header []string516 HeaderLines int517 HeaderFirst bool518 Gap int519 Ellipsis *string520 Scrollbar *string521 Margin [4]sizeSpec522 Padding [4]sizeSpec523 BorderShape tui.BorderShape524 ListBorderShape tui.BorderShape525 InputBorderShape tui.BorderShape526 InputLabel labelOpts527 BorderLabel labelOpts528 ListLabel labelOpts529 PreviewLabel labelOpts530 Unicode bool531 Ambidouble bool532 Tabstop int533 WithShell string534 ListenAddr *listenAddress535 Unsafe bool536 ClearOnExit bool537 WalkerOpts walkerOpts538 WalkerRoot []string539 WalkerSkip []string540 Version bool541 Help bool542 CPUProfile string543 MEMProfile string544 BlockProfile string545 MutexProfile string546}547548func filterNonEmpty(input []string) []string {549 output := make([]string, 0, len(input))
620 unmodified lines
1170 }1171 }1172 }1173 switch components[0] {1171 case "query", "input":1174 case "query", "input", "input-fg":1175 mergeAttr(&theme.Input)1176 case "disabled":1177 mergeAttr(&theme.Disabled)1178 case "fg":
43 unmodified lines
1222 case "preview-label":1223 mergeAttr(&theme.PreviewLabel)1224 case "prompt":1225 mergeAttr(&theme.Prompt)1226 case "input-bg":1227 mergeAttr(&theme.InputBg)1228 case "input-border":1229 mergeAttr(&theme.InputBorder)1230 case "input-label":1231 mergeAttr(&theme.InputLabel)1232 case "spinner":1233 mergeAttr(&theme.Spinner)1234 case "info":1235 mergeAttr(&theme.Info)
55 unmodified lines
1291)12921293func init() {1294 executeRegexp = regexp.MustCompile(1286 `(?si)[:+](become|execute(?:-multi|-silent)?|reload(?:-sync)?|preview|(?:change|transform)-(?:header|query|prompt|border-label|list-label|preview-label)|transform|change-(?:preview-window|preview|multi)|(?:re|un)bind|pos|put|print)`)1295 `(?si)[:+](become|execute(?:-multi|-silent)?|reload(?:-sync)?|preview|(?:change|transform)-(?:header|query|prompt|border-label|list-label|preview-label|input-label)|transform|change-(?:preview-window|preview|multi)|(?:re|un)bind|pos|put|print)`)1296 splitRegexp = regexp.MustCompile("[,:]+")1297 actionNameRegexp = regexp.MustCompile("(?i)^[a-z-]+")1298}1299
347 unmodified lines
1647 case "rebind":1648 return actRebind1649 case "preview":1650 return actPreview1651 case "change-header":1652 return actChangeHeader1653 case "change-list-label":1654 return actChangeListLabel1655 case "change-border-label":1656 return actChangeBorderLabel1646 case "change-header":1647 return actChangeHeader1657 case "change-preview-label":1658 return actChangePreviewLabel1659 case "change-input-label":1660 return actChangeInputLabel1661 case "change-preview-window":1662 return actChangePreviewWindow1663 case "change-preview":1664 return actChangePreview
22 unmodified lines
1687 case "transform-border-label":1688 return actTransformBorderLabel1689 case "transform-preview-label":1690 return actTransformPreviewLabel1691 case "transform-input-label":1692 return actTransformInputLabel1693 case "transform-header":1694 return actTransformHeader1695 case "transform-prompt":1696 return actTransformPrompt
768 unmodified lines
2465 }2466 if err := parsePreviewWindow(&opts.Preview, str); err != nil {2467 return err2468 }2469 case "--no-preview-border":2470 opts.Preview.border = tui.BorderNone2471 case "--preview-border":2472 hasArg, arg := optionalNextString(allArgs, &i)2473 if opts.Preview.border, err = parseBorder(arg, !hasArg); err != nil {2474 return err2475 }2476 case "--height":2477 str, err := nextString(allArgs, &i, "height required: [~]HEIGHT[%]")2478 if err != nil {2479 return err
39 unmodified lines
2519 }2520 if err := parseLabelPosition(&opts.ListLabel, pos); err != nil {2521 return err2522 }2523 case "--no-input-border":2524 opts.InputBorderShape = tui.BorderNone2525 case "--input-border":2526 hasArg, arg := optionalNextString(allArgs, &i)2527 if opts.InputBorderShape, err = parseBorder(arg, !hasArg); err != nil {2528 return err2529 }2530 case "--no-input-label":2531 opts.InputLabel.label = ""2532 case "--input-label":2533 if opts.InputLabel.label, err = nextString(allArgs, &i, "input label required"); err != nil {2534 return err2535 }2536 case "--input-label-pos":2537 pos, err := nextString(allArgs, &i, "input label position required (positive or negative integer or 'center')")2538 if err != nil {2539 return err2540 }2541 if err := parseLabelPosition(&opts.InputLabel, pos); err != nil {2542 return err2543 }2544 case "--no-border-label":2545 opts.BorderLabel.label = ""2546 case "--border-label":2547 opts.BorderLabel.label, err = nextString(allArgs, &i, "label required")
129 unmodified lines
2677 } else if match, value := optString(arg, "--border="); match {2678 if opts.BorderShape, err = parseBorder(value, false); err != nil {2679 return err2680 }2681 } else if match, value := optString(arg, "--preview-border="); match {2682 if opts.Preview.border, err = parseBorder(value, false); err != nil {2683 return err2684 }2685 } else if match, value := optString(arg, "--list-border="); match {2686 if opts.ListBorderShape, err = parseBorder(value, false); err != nil {2687 return err2688 }
2 unmodified lines
2691 } else if match, value := optString(arg, "--list-label-pos="); match {2692 if err := parseLabelPosition(&opts.ListLabel, value); err != nil {2693 return err2694 }2695 } else if match, value := optString(arg, "--input-border="); match {2696 if opts.InputBorderShape, err = parseBorder(value, false); err != nil {2697 return err2698 }2699 } else if match, value := optString(arg, "--input-label="); match {2700 opts.InputLabel.label = value2701 } else if match, value := optString(arg, "--input-label-pos="); match {2702 if err := parseLabelPosition(&opts.InputLabel, value); err != nil {2703 return err2704 }2705 } else if match, value := optString(arg, "--border-label="); match {2706 opts.BorderLabel.label = value2707 } else if match, value := optString(arg, "--border-label-pos="); match {2708 if err := parseLabelPosition(&opts.BorderLabel, value); err != nil {
267 unmodified lines
2976 if opts.ListBorderShape == tui.BorderUndefined {2977 opts.ListBorderShape = tui.BorderNone2978 }29792980 if opts.InputBorderShape == tui.BorderUndefined {2981 opts.InputBorderShape = tui.BorderNone2982 }29832984 if opts.Pointer == nil {2985 defaultPointer := "▌"2986 if !opts.Unicode {2987 defaultPointer = ">"
201 unmodified lines
modified:src/terminal.go+194 added-33 removed
162 unmodified lines
163 err error164}165166type itemLine struct {167 valid bool168 firstLine int169 numLines int170 cy int171 current bool
7 unmodified lines
179 other bool180}181182func (t *Terminal) markEmptyLine(line int) {183 if t.window != t.inputWindow {182 t.prevLines[line] = itemLine{firstLine: line, empty: true}184 t.prevLines[line] = itemLine{valid: true, firstLine: line, empty: true}185 }186}187188func (t *Terminal) markOtherLine(line int) {189 if t.window != t.inputWindow {186 t.prevLines[line] = itemLine{firstLine: line, other: true}190 t.prevLines[line] = itemLine{valid: true, firstLine: line, other: true}191 }192}193194type fitpad struct {195 fit int
49 unmodified lines
245 borderLabelOpts labelOpts246 previewLabel labelPrinter247 previewLabelLen int248 previewLabelOpts labelOpts249 inputLabel labelPrinter250 inputLabelLen int251 inputLabelOpts labelOpts252 pointer string253 pointerLen int254 pointerEmpty string255 marker string
49 unmodified lines
305 listener net.Listener306 listenUnsafe bool307 borderShape tui.BorderShape308 listBorderShape tui.BorderShape309 inputBorderShape tui.BorderShape310 listLabel labelPrinter311 listLabelLen int312 listLabelOpts labelOpts313 cleanExit bool314 executor *util.Executor315 paused bool316 border tui.Window317 window tui.Window318 inputWindow tui.Window319 inputBorder tui.Window320 wborder tui.Window321 pborder tui.Window322 pwindow tui.Window323 borderWidth int
80 unmodified lines
404 reqActivate405 reqReinit406 reqFullRedraw407 reqResize408 reqRedrawInputLabel409 reqRedrawListLabel410 reqRedrawBorderLabel411 reqRedrawPreviewLabel412 reqClose
34 unmodified lines
447 actBackwardWord448 actCancel449 actChangeBorderLabel450 actChangeListLabel451 actChangeInputLabel452 actChangeHeader453 actChangeMulti454 actChangePreviewLabel455 actChangePrompt
53 unmodified lines
509 actTogglePreviewWrap510 actTransform511 actTransformBorderLabel512 actTransformListLabel513 actTransformInputLabel514 actTransformHeader515 actTransformPreviewLabel516 actTransformPrompt517 actTransformQuery
327 unmodified lines
845 listenAddr: opts.ListenAddr,846 listenUnsafe: opts.Unsafe,847 borderShape: opts.BorderShape,848 listBorderShape: opts.ListBorderShape,849 inputBorderShape: opts.InputBorderShape,850 borderWidth: 1,851 listLabel: nil,852 listLabelOpts: opts.ListLabel,853 borderLabel: nil,854 borderLabelOpts: opts.BorderLabel,855 previewLabel: nil,856 previewLabelOpts: opts.PreviewLabel,857 inputLabel: nil,858 inputLabelOpts: opts.InputLabel,859 cleanExit: opts.ClearOnExit,860 executor: executor,861 paused: opts.Phony,862 cycle: opts.Cycle,
55 unmodified lines
918 t.markerEmpty = strings.Repeat(" ", t.markerLen)919 t.listLabel, t.listLabelLen = t.ansiLabelPrinter(opts.ListLabel.label, &tui.ColListLabel, false)920 t.borderLabel, t.borderLabelLen = t.ansiLabelPrinter(opts.BorderLabel.label, &tui.ColBorderLabel, false)921 t.previewLabel, t.previewLabelLen = t.ansiLabelPrinter(opts.PreviewLabel.label, &tui.ColPreviewLabel, false)905 if opts.Separator == nil || len(*opts.Separator) > 0 {922 t.inputLabel, t.inputLabelLen = t.ansiLabelPrinter(opts.InputLabel.label, &tui.ColInputLabel, false)923924 // Disable separator by default if input border is set925 if opts.Separator == nil && !t.inputBorderShape.Visible() || opts.Separator != nil && len(*opts.Separator) > 0 {926 bar := "─"927 if opts.Separator != nil {928 bar = *opts.Separator929 } else if !t.unicode {
209 unmodified lines
1139 }1140 return printFn, length1141}11421143// Temporarily switch 'window' so that we can use the existing windows with1144// a different window1145func (t *Terminal) withInputWindow(f func()) {1146 prevWindow := t.window1147 if t.inputWindow != nil {1148 t.window = t.inputWindow1149 }1150 f()1151 t.window = prevWindow1152}11531154func (t *Terminal) parsePrompt(prompt string) (func(), int) {1155 var state *ansiState1156 prompt = firstLine(prompt)1157 trimmed, colors, _ := extractColor(prompt, state, nil)
17 unmodified lines
1175 item.colors = &colors1176 }1177 }1178 output := func() {1148 line := t.promptLine()1179 wrap := t.wrap1180 t.wrap = false1181 t.withInputWindow(func() {1182 line := t.promptLine()1151 t.printHighlighted(1152 Result{item: item}, tui.ColPrompt, tui.ColPrompt, false, false, line, line, true, nil, nil)1183 t.printHighlighted(1184 Result{item: item}, tui.ColPrompt, tui.ColPrompt, false, false, line, line, true, nil, nil)1185 })1186 t.wrap = wrap1187 }1188 _, promptLen := t.processTabs([]rune(trimmed), 0)1189
408 unmodified lines
1598 }1599 if t.wborder != nil {1600 t.wborder = nil1601 }1602 if t.inputWindow != nil {1603 t.inputWindow = nil1604 }1605 if t.inputBorder != nil {1606 t.inputBorder = nil1607 }1608 if t.pborder != nil {1609 t.pborder = nil1610 }1611 hadPreviewWindow := t.hasPreviewWindow()
31 unmodified lines
1643 }1644 width -= paddingInt[1] + paddingInt[3]1645 height -= paddingInt[0] + paddingInt[2]16461647 // Adjust position and size of the list window if input border is set1648 inputWindowHeight := 01649 inputBorderHeight := 01650 shift := 01651 shrink := 01652 hasInputWindow := t.inputBorderShape.Visible()1653 if hasInputWindow {1654 inputWindowHeight = 21655 if t.noSeparatorLine() {1656 inputWindowHeight--1657 }1658 inputBorderHeight = borderLines(t.inputBorderShape) + inputWindowHeight1659 if t.layout == layoutReverse {1660 shift = inputBorderHeight1661 shrink = inputBorderHeight1662 } else {1663 shift = 01664 shrink = inputBorderHeight1665 }1666 }16671668 hasListBorder := t.listBorderShape.Visible()1669 innerWidth := width1670 innerHeight := height1671 innerMarginInt := marginInt1672 innerBorderFn := func(top int, left int, width int, height int) {1673 if hasListBorder {1674 t.wborder = t.tui.NewWindow(1615 top, left, width, height, tui.WindowList, tui.MakeBorderStyle(t.listBorderShape, t.unicode), false)1675 top+shift, left, width, height-shrink, tui.WindowList, tui.MakeBorderStyle(t.listBorderShape, t.unicode), false)1676 }1677 }1678 if hasListBorder {1679 if t.listBorderShape.HasTop() {
76 unmodified lines
1756 }1757 if previewOpts.position == posUp {1758 innerBorderFn(marginInt[0]+pheight, marginInt[3], width, height-pheight)1759 t.window = t.tui.NewWindow(1700 innerMarginInt[0]+pheight, innerMarginInt[3], innerWidth, innerHeight-pheight, tui.WindowList, noBorder, true)1760 innerMarginInt[0]+pheight+shift, innerMarginInt[3], innerWidth, innerHeight-pheight-shrink, tui.WindowList, noBorder, true)1761 createPreviewWindow(marginInt[0], marginInt[3], width, pheight)1762 } else {1763 innerBorderFn(marginInt[0], marginInt[3], width, height-pheight)1764 t.window = t.tui.NewWindow(1705 innerMarginInt[0], innerMarginInt[3], innerWidth, innerHeight-pheight, tui.WindowList, noBorder, true)1765 innerMarginInt[0]+shift, innerMarginInt[3], innerWidth, innerHeight-pheight-shrink, tui.WindowList, noBorder, true)1766 createPreviewWindow(marginInt[0]+height-pheight, marginInt[3], width, pheight)1767 }1768 case posLeft, posRight:1769 minListWidth := minWidth
30 unmodified lines
1800 if !hasListBorder {1801 m = 11802 }1803 t.window = t.tui.NewWindow(1744 innerMarginInt[0], innerMarginInt[3]+pwidth+m, innerWidth-pwidth-m, innerHeight, tui.WindowList, noBorder, true)1804 innerMarginInt[0]+shift, innerMarginInt[3]+pwidth+m, innerWidth-pwidth-m, innerHeight-shrink, tui.WindowList, noBorder, true)18051806 // Clear characters on the margin1807 // fzf --bind 'space:preview(seq 100)' --preview-window left,11808 if !hasListBorder {
13 unmodified lines
1822 width++1823 }1824 innerBorderFn(marginInt[0], marginInt[3], width-pwidth, height)1825 t.window = t.tui.NewWindow(1766 innerMarginInt[0], innerMarginInt[3], innerWidth-pwidth, innerHeight, tui.WindowList, noBorder, true)1826 innerMarginInt[0]+shift, innerMarginInt[3], innerWidth-pwidth, innerHeight-shrink, tui.WindowList, noBorder, true)1827 x := marginInt[3] + width - pwidth1828 createPreviewWindow(marginInt[0], x, pwidth, height)1829 }1830 }
29 unmodified lines
1860 width++1861 }1862 innerBorderFn(marginInt[0], marginInt[3], width, height)1863 t.window = t.tui.NewWindow(1804 innerMarginInt[0],1864 innerMarginInt[0]+shift,1865 innerMarginInt[3],1866 innerWidth,1807 innerHeight, tui.WindowList, noBorder, true)1867 innerHeight-shrink, tui.WindowList, noBorder, true)1868 }18691870 // Set up input border1871 if hasInputWindow {1872 w := t.wborder1873 if t.wborder == nil {1874 w = t.window1875 }1876 if t.layout == layoutReverse {1877 t.inputBorder = t.tui.NewWindow(1878 w.Top()-shrink,1879 w.Left(),1880 w.Width(),1881 util.Min(shrink, screenHeight), tui.WindowInput, tui.MakeBorderStyle(t.inputBorderShape, t.unicode), true)1882 } else {1883 t.inputBorder = t.tui.NewWindow(1884 w.Top()+w.Height(),1885 w.Left(),1886 w.Width(),1887 util.Min(shrink, screenHeight), tui.WindowInput, tui.MakeBorderStyle(t.inputBorderShape, t.unicode), true)1888 }1889 top := t.inputBorder.Top()1890 left := t.inputBorder.Left()1891 if t.inputBorderShape.HasTop() {1892 top++1893 }1894 if t.inputBorderShape.HasLeft() {1895 left += t.borderWidth + 11896 }1897 width := t.inputBorder.Width() - borderColumns(t.inputBorderShape, t.borderWidth)1898 if t.inputBorderShape.HasRight() {1899 width++1900 }1901 t.inputWindow = t.tui.NewWindow(1902 top,1903 left,1904 width,1905 t.inputBorder.Height()-borderLines(t.inputBorderShape),1906 tui.WindowInput, noBorder, true)1907 }19081909 // Print border label1910 t.printLabel(t.wborder, t.listLabel, t.listLabelOpts, t.listLabelLen, t.listBorderShape, false)1911 t.printLabel(t.border, t.borderLabel, t.borderLabelOpts, t.borderLabelLen, t.borderShape, false)1912 t.printLabel(t.pborder, t.previewLabel, t.previewLabelOpts, t.previewLabelLen, t.activePreviewOpts.border, false)1913 t.printLabel(t.inputBorder, t.inputLabel, t.inputLabelOpts, t.inputLabelLen, t.inputBorderShape, false)1914}19151916func (t *Terminal) printLabel(window tui.Window, render labelPrinter, opts labelOpts, length int, borderShape tui.BorderShape, redrawBorder bool) {1917 if window == nil {
55 unmodified lines
1973 t.cx = util.Constrain(t.cx, 0, len(t.input))1974}19751976func (t *Terminal) updatePromptOffset() ([]rune, []rune) {1977 w := t.window1978 if t.inputWindow != nil {1979 w = t.inputWindow1980 }1877 maxWidth := util.Max(1, t.window.Width()-t.promptLen-1)1981 maxWidth := util.Max(1, w.Width()-t.promptLen-1)19821983 _, overflow := t.trimLeft(t.input[:t.cx], maxWidth)1984 minOffset := int(overflow)1985 maxOffset := minOffset + (maxWidth-util.Max(0, maxWidth-t.cx))/2
6 unmodified lines
1992 return before, after1993}19941995func (t *Terminal) promptLine() int {1996 if t.inputWindow != nil {1997 return 01998 }1999 if t.headerFirst {2000 max := t.window.Height() - 12001 if max <= 0 { // Extremely short terminal2002 return 0
6 unmodified lines
2009 return 02010}20112012func (t *Terminal) placeCursor() {2013 if t.inputWindow != nil {2014 y := t.inputWindow.Height() - 12015 if t.layout == layoutReverse {2016 y = 02017 }2018 t.inputWindow.Move(y, t.promptLen+t.queryLen[0])2019 return2020 }2021 t.move(t.promptLine(), t.promptLen+t.queryLen[0], false)2022}20232024func (t *Terminal) printPrompt() {2025 w := t.window2026 if t.inputWindow != nil {2027 w = t.inputWindow2028 }2029 if w.Height() == 0 {2030 return2031 }2032 t.prompt()20332034 before, after := t.updatePromptOffset()2035 color := tui.ColInput2036 if t.paused {2037 color = tui.ColDisabled2038 }1917 t.window.CPrint(color, string(before))1918 t.window.CPrint(color, string(after))2039 w.CPrint(color, string(before))2040 w.CPrint(color, string(after))2041}20422043func (t *Terminal) trimMessage(message string, maxWidth int) string {2044 if len(message) <= maxWidth {
3 unmodified lines
2048 return string(runes) + strings.Repeat(".", util.Constrain(maxWidth, 0, 2))2049}20502051func (t *Terminal) printInfo() {2052 t.withInputWindow(func() {2053 t.printInfoImpl()2054 })2055}20562057func (t *Terminal) printInfoImpl() {2058 if t.window.Width() <= 1 {2059 return2060 }2061 pos := 0
189 unmodified lines
2251 if t.visibleHeaderLines() == 0 {2252 return2253 }2254 max := t.window.Height()2127 if t.headerFirst {2255 if t.inputWindow == nil && t.headerFirst {2256 max--2257 if !t.noSeparatorLine() {2258 max--2259 }
11 unmodified lines
2271 line := idx2272 if needReverse && idx < len(t.header0) {2273 line = len(t.header0) - idx - 12274 }2147 if !t.headerFirst {2275 if t.inputWindow == nil && !t.headerFirst {2276 line++2277 if !t.noSeparatorLine() {2278 line++2279 }
36 unmodified lines
2316 maxy := t.maxItems() - 12317 count := t.merger.Length() - t.offset23182319 // Start line2192 startLine := 2 + t.visibleHeaderLines()2193 if t.noSeparatorLine() {2194 startLine--2195 }2320 startLine := t.promptLines() + t.visibleHeaderLines()2321 maxy += startLine23222323 barRange := [2]int{startLine + barStart, startLine + barStart + barLength}2324 for line, itemCount := startLine, 0; line <= maxy; line, itemCount = line+1, itemCount+1 {
32 unmodified lines
2357 }23582359 // Avoid unnecessary redraw2360 numLines, _ := t.numItemLines(item, maxLine-line+1)2236 newLine := itemLine{firstLine: line, numLines: numLines, cy: index + t.offset, current: current, selected: selected, label: label,2361 newLine := itemLine{valid: true, firstLine: line, numLines: numLines, cy: index + t.offset, current: current, selected: selected, label: label,2362 result: result, queryLen: len(t.input), width: 0, hasBar: line >= barRange[0] && line < barRange[1]}2363 prevLine := t.prevLines[line]2239 forceRedraw := prevLine.other || prevLine.firstLine != newLine.firstLine2364 forceRedraw := !prevLine.valid || prevLine.other || prevLine.firstLine != newLine.firstLine2365 printBar := func(lineNum int, forceRedraw bool) bool {2366 return t.printBar(lineNum, forceRedraw, barRange)2367 }2368
1717 unmodified lines
4086 t.suppress = false4087 if t.hasPreviewer() {4088 t.previewBox.Set(reqPreviewReady, nil)4089 }4090 case reqRedrawInputLabel:4091 t.printLabel(t.inputBorder, t.inputLabel, t.inputLabelOpts, t.inputLabelLen, t.inputBorderShape, true)4092 case reqRedrawListLabel:4093 t.printLabel(t.wborder, t.listLabel, t.listLabelOpts, t.listLabelLen, t.listBorderShape, true)4094 case reqRedrawBorderLabel:4095 t.printLabel(t.border, t.borderLabel, t.borderLabelOpts, t.borderLabelLen, t.borderShape, true)
375 unmodified lines
4471 req(reqHeader, reqList, reqPrompt, reqInfo)4472 } else {4473 req(reqHeader)4474 }4475 case actChangeInputLabel:4476 t.inputLabelOpts.label = a.a4477 if t.inputBorder != nil {4478 t.inputLabel, t.inputLabelLen = t.ansiLabelPrinter(a.a, &tui.ColInputLabel, false)4479 req(reqRedrawInputLabel)4480 }4481 case actChangeListLabel:4482 t.listLabelOpts.label = a.a4483 if t.wborder != nil {4484 t.listLabel, t.listLabelLen = t.ansiLabelPrinter(a.a, &tui.ColListLabel, false)
15 unmodified lines
4500 body := t.executeCommand(a.a, false, true, true, false, "")4501 if actions, err := parseSingleActionList(strings.Trim(body, "\r\n")); err == nil {4502 return doActions(actions)4503 }4504 case actTransformInputLabel:4505 label := t.executeCommand(a.a, false, true, true, true, "")4506 t.inputLabelOpts.label = label4507 if t.inputBorder != nil {4508 t.inputLabel, t.inputLabelLen = t.ansiLabelPrinter(label, &tui.ColInputLabel, false)4509 req(reqRedrawInputLabel)4510 }4511 case actTransformListLabel:4512 label := t.executeCommand(a.a, false, true, true, true, "")4513 t.listLabelOpts.label = label4514 if t.wborder != nil {
551 unmodified lines
5066 req(reqPreviewRefresh)5067 break5068 }50695070 // Inside the input window5071 if t.inputWindow != nil && t.inputWindow.Enclose(my, mx) {5072 mx -= t.inputWindow.Left()5073 my -= t.inputWindow.Top()5074 y := t.inputWindow.Height() - 15075 if t.layout == layoutReverse {5076 y = 05077 }5078 mxCons := util.Constrain(mx-t.promptLen, 0, len(t.input))5079 if my == y && mxCons >= 0 {5080 t.cx = mxCons + t.xoffset5081 }5082 break5083 }50845085 // Ignored5086 if !t.window.Enclose(my, mx) && !barDragging {5087 break5088 }50895090 // Translate coordinates5091 mx -= t.window.Left()5092 my -= t.window.Top()4938 min := 2 + t.visibleHeaderLines()4939 if t.noSeparatorLine() {4940 min--4941 }5093 min := t.promptLines() + t.visibleHeaderLines()5094 h := t.window.Height()5095 switch t.layout {5096 case layoutDefault:5097 my = h - my - 1
43 unmodified lines
5141 }51425143 if me.Down {5144 mxCons := util.Constrain(mx-t.promptLen, 0, len(t.input))4993 if my == t.promptLine() && mxCons >= 0 {5145 if t.inputWindow == nil && my == t.promptLine() && mxCons >= 0 {5146 // Prompt5147 t.cx = mxCons + t.xoffset5148 } else if my >= min {5149 t.vset(cy)
12 unmodified lines
5162 } else if t.headerVisible {5163 // Header5164 numLines := t.visibleHeaderLines()5165 lineOffset := 05014 if !t.headerFirst {5166 if t.inputWindow == nil && !t.headerFirst {5167 // offset for info line5168 if t.noSeparatorLine() {5169 lineOffset = 15170 } else {
319 unmodified lines
5490 t.cy = util.Constrain(o, 0, t.merger.Length()-1)5491 return t.cy == o5492}54935342func (t *Terminal) maxItems() int {5343 max := t.window.Height() - 2 - t.visibleHeaderLines()5494// Number of prompt lines in the list window5495func (t *Terminal) promptLines() int {5496 if t.inputWindow != nil {5497 return 05498 }5499 if t.noSeparatorLine() {5345 max++5500 return 15501 }5502 return 25503}55045505// Number of item lines in the list window5506func (t *Terminal) maxItems() int {5507 max := t.window.Height() - t.visibleHeaderLines() - t.promptLines()5508 return util.Max(max, 0)5509}55105511func (t *Terminal) dumpItem(i *Item) StatusItem {
65 unmodified lines
modified:test/test_go.rb+76 added-1 removed
2644 unmodified lines
2645 end2646 end26472648 def test_change_preview_window2649 tmux.send_keys "seq 1000 | #{FZF} --preview 'echo [[{}]]' --preview-window border-none --bind '" \2649 tmux.send_keys "seq 1000 | #{FZF} --preview 'echo [[{}]]' --no-preview-border --bind '" \2650 'a:change-preview(echo __{}__),' \2651 'b:change-preview-window(down)+change-preview(echo =={}==)+change-preview-window(up),' \2652 'c:change-preview(),d:change-preview-window(hidden),' \2653 "e:preview(printf ::%${FZF_PREVIEW_COLUMNS}s{})+change-preview-window(up),f:change-preview-window(up,wrap)'", :Enter
794 unmodified lines
3448 │ 33449 BLOCK3450 tmux.until { assert_block(block, _1) }3451 end345234533454 def test_list_border_and_label3455 tmux.send_keys %(seq 100 | #{FZF} --border rounded --list-border double --list-label list --list-label-pos 2:bottom --header-lines 3 --query 1 --padding 1,2), :Enter3456 block = <<~BLOCK3457 │ ║ 113458 │ ║ > 103459 │ ║ 33460 │ ║ 23461 │ ║ 13462 │ ║ 19/97 ─3463 │ ║ > 13464 │ ╚list══════3465 │3466 ╰──────────────3467 BLOCK3468 tmux.until { assert_block(block, _1) }3469 end34703471 def test_input_border_and_label3472 tmux.send_keys %(seq 100 | #{FZF} --border rounded --input-border bold --input-label input --input-label-pos 2 --header-lines 3 --query 1 --padding 1,2), :Enter3473 block = <<~BLOCK3474 │ 113475 │ > 103476 │ 33477 │ 23478 │ 13479 │ ┏input━━━━━3480 │ ┃ 19/973481 │ ┃ > 13482 │ ┗━━━━━━━━━━3483 │3484 ╰──────────────3485 BLOCK3486 tmux.until { assert_block(block, _1) }3487 end34883489 def test_list_input_border_and_label3490 tmux.send_keys %(3491 seq 100 | #{FZF} --border rounded --list-border double --input-border bold --list-label-pos 2:bottom --input-label-pos 2 --header-lines 3 --query 1 --padding 1,2 \3492 --bind 'start:transform-input-label(echo INPUT)+transform-list-label(echo LIST)' \3493 --bind 'space:change-input-label( input )+change-list-label( list )'3494 ).strip, :Enter3495 block = <<~BLOCK3496 │ ║ 113497 │ ║ > 103498 │ ║ 33499 │ ║ 23500 │ ║ 13501 │ ╚LIST═════3502 │ ┏INPUT━━━━3503 │ ┃ 19/973504 │ ┃ > 13505 │ ┗━━━━━━━━━3506 │3507 ╰─────────────3508 BLOCK3509 tmux.until { assert_block(block, _1) }3510 tmux.send_keys :Space3511 block = <<~BLOCK3512 │ ║ 113513 │ ║ > 103514 │ ║ 33515 │ ║ 23516 │ ║ 13517 │ ╚ list ═══3518 │ ┏ input ━━3519 │ ┃ 19/973520 │ ┃ > 13521 │ ┗━━━━━━━━━3522 │3523 ╰─────────────3524 BLOCK3525 tmux.until { assert_block(block, _1) }3526 end3527end35283529module TestShell3530 def setup
537 unmodified lines
modified:CHANGELOG.md+17 added-1 removed
1 unmodified line
2=========340.58.05------6- Additional border and label for the list section6- Border and label for the list section7 - Options8 - `--list-border[=STYLE]`9 - `--list-label=LABEL`10 - `--list-label-pos=COL[:bottom]`
4 unmodified lines
15 - `list-label`16 - Actions17 - `change-list-label`18 - `transform-list-label`19- Border and label for the input section (prompt and info)20 - Options21 - `--input-border[=STYLE]`22 - `--input-label=LABEL`23 - `--input-label-pos=COL[:bottom]`24 - Colors25 - `input-fg` (`query`)26 - `input-bg`27 - `input-border`28 - `input-label`29 - Actions30 - `change-input-label`31 - `transform-input-label`32- Added `--preview-border[=STYLE]` as short for `--preview-window=border-[STYLE]`33- Added `toggle-multi-line` action34- Added `toggle-hscroll` action35360.57.037------38- You can now resize the preview window by dragging the border
2326 unmodified lines