Add color names: selected-{fg,bg,hl}
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Junegunn Choi · committed by Junegunn Choi · parent 6834d17 · Browse files · 5 files·+93 added−16 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
5 files+93 added−16 removed
- other:+93 added−16 removed
Provenance
- Commit
af65aa2- Tree
c9aee65- Author
Junegunn Choi <junegunn.c@gmail.com>- Committer
Junegunn Choi <junegunn.c@gmail.com>- Parent
6834d17
5 files changed+93 added−16 removed
modified:man/man1/fzf.1+3 added
462 unmodified lines463 \fBbw \fRNo colors (equivalent to \fB--no-color\fR)464 465 .B COLOR NAMES:466 \fBfg \fRText467+ \fBselected-fg \fRSelected line text468 \fBpreview-fg \fRPreview window text469 \fBbg \fRBackground470+ \fBselected-bg \fRSelected line background471 \fBpreview-bg \fRPreview window background472 \fBhl \fRHighlighted substrings473+ \fBselected-hl \fRHighlighted substrings in the selected line474 \fBcurrent-fg (fg+) \fRText (current line)475 \fBcurrent-bg (bg+) \fRBackground (current line)476 \fBgutter \fRGutter on the left477 \fBcurrent-hl (hl+) \fRHighlighted substrings (current line)1098 unmodified linesmodified:src/tui/tui.go+39 added-10 removed
301 unmodified lines302 Input ColorAttr303 Disabled ColorAttr304 Fg ColorAttr305 Bg ColorAttr306+ SelectedFg ColorAttr307+ SelectedBg ColorAttr308+ SelectedMatch ColorAttr309 PreviewFg ColorAttr310 PreviewBg ColorAttr311 DarkBg ColorAttr312 Gutter ColorAttr3 unmodified lines316 CurrentMatch ColorAttr317 Spinner ColorAttr318 Info ColorAttr319 Cursor ColorAttr317- Selected ColorAttr320+ Marker ColorAttr321 Header ColorAttr322 Separator ColorAttr323 Scrollbar ColorAttr324 Border ColorAttr280 unmodified lines605 ColDisabled ColorPair606 ColMatch ColorPair607 ColCursor ColorPair608 ColCursorEmpty ColorPair609+ ColMarker ColorPair610 ColSelected ColorPair611+ ColSelectedMatch ColorPair612 ColCurrent ColorPair613 ColCurrentMatch ColorPair614 ColCurrentCursor ColorPair615 ColCurrentCursorEmpty ColorPair611- ColCurrentSelected ColorPair616+ ColCurrentMarker ColorPair617 ColCurrentSelectedEmpty ColorPair618 ColSpinner ColorPair619 ColInfo ColorPair620 ColHeader ColorPair13 unmodified lines634 Colored: true,635 Input: ColorAttr{colUndefined, AttrUndefined},636 Fg: ColorAttr{colUndefined, AttrUndefined},637 Bg: ColorAttr{colUndefined, AttrUndefined},638+ SelectedFg: ColorAttr{colUndefined, AttrUndefined},639+ SelectedBg: ColorAttr{colUndefined, AttrUndefined},640+ SelectedMatch: ColorAttr{colUndefined, AttrUndefined},641 DarkBg: ColorAttr{colUndefined, AttrUndefined},642 Prompt: ColorAttr{colUndefined, AttrUndefined},643 Match: ColorAttr{colUndefined, AttrUndefined},644 Current: ColorAttr{colUndefined, AttrUndefined},645 CurrentMatch: ColorAttr{colUndefined, AttrUndefined},646 Spinner: ColorAttr{colUndefined, AttrUndefined},647 Info: ColorAttr{colUndefined, AttrUndefined},648 Cursor: ColorAttr{colUndefined, AttrUndefined},641- Selected: ColorAttr{colUndefined, AttrUndefined},649+ Marker: ColorAttr{colUndefined, AttrUndefined},650 Header: ColorAttr{colUndefined, AttrUndefined},651 Border: ColorAttr{colUndefined, AttrUndefined},652 BorderLabel: ColorAttr{colUndefined, AttrUndefined},653 Disabled: ColorAttr{colUndefined, AttrUndefined},13 unmodified lines667 Colored: false,668 Input: ColorAttr{colDefault, AttrUndefined},669 Fg: ColorAttr{colDefault, AttrUndefined},670 Bg: ColorAttr{colDefault, AttrUndefined},671+ SelectedFg: ColorAttr{colDefault, AttrUndefined},672+ SelectedBg: ColorAttr{colDefault, AttrUndefined},673+ SelectedMatch: ColorAttr{colDefault, AttrUndefined},674 DarkBg: ColorAttr{colDefault, AttrUndefined},675 Prompt: ColorAttr{colDefault, AttrUndefined},676 Match: ColorAttr{colDefault, Underline},677 Current: ColorAttr{colDefault, Reverse},678 CurrentMatch: ColorAttr{colDefault, Reverse | Underline},679 Spinner: ColorAttr{colDefault, AttrUndefined},680 Info: ColorAttr{colDefault, AttrUndefined},681 Cursor: ColorAttr{colDefault, AttrUndefined},671- Selected: ColorAttr{colDefault, AttrUndefined},682+ Marker: ColorAttr{colDefault, AttrUndefined},683 Header: ColorAttr{colDefault, AttrUndefined},684 Border: ColorAttr{colDefault, AttrUndefined},685 BorderLabel: ColorAttr{colDefault, AttrUndefined},686 Disabled: ColorAttr{colDefault, AttrUndefined},13 unmodified lines700 Colored: true,701 Input: ColorAttr{colDefault, AttrUndefined},702 Fg: ColorAttr{colDefault, AttrUndefined},703 Bg: ColorAttr{colDefault, AttrUndefined},704+ SelectedFg: ColorAttr{colDefault, AttrUndefined},705+ SelectedBg: ColorAttr{colDefault, AttrUndefined},706+ SelectedMatch: ColorAttr{colDefault, AttrUndefined},707 DarkBg: ColorAttr{colBlack, AttrUndefined},708 Prompt: ColorAttr{colBlue, AttrUndefined},709 Match: ColorAttr{colGreen, AttrUndefined},710 Current: ColorAttr{colYellow, AttrUndefined},711 CurrentMatch: ColorAttr{colGreen, AttrUndefined},712 Spinner: ColorAttr{colGreen, AttrUndefined},713 Info: ColorAttr{colWhite, AttrUndefined},714 Cursor: ColorAttr{colRed, AttrUndefined},701- Selected: ColorAttr{colMagenta, AttrUndefined},715+ Marker: ColorAttr{colMagenta, AttrUndefined},716 Header: ColorAttr{colCyan, AttrUndefined},717 Border: ColorAttr{colBlack, AttrUndefined},718 BorderLabel: ColorAttr{colWhite, AttrUndefined},719 Disabled: ColorAttr{colUndefined, AttrUndefined},10 unmodified lines730 Colored: true,731 Input: ColorAttr{colDefault, AttrUndefined},732 Fg: ColorAttr{colDefault, AttrUndefined},733 Bg: ColorAttr{colDefault, AttrUndefined},734+ SelectedFg: ColorAttr{colDefault, AttrUndefined},735+ SelectedBg: ColorAttr{colDefault, AttrUndefined},736+ SelectedMatch: ColorAttr{colDefault, AttrUndefined},737 DarkBg: ColorAttr{236, AttrUndefined},738 Prompt: ColorAttr{110, AttrUndefined},739 Match: ColorAttr{108, AttrUndefined},740 Current: ColorAttr{254, AttrUndefined},741 CurrentMatch: ColorAttr{151, AttrUndefined},742 Spinner: ColorAttr{148, AttrUndefined},743 Info: ColorAttr{144, AttrUndefined},744 Cursor: ColorAttr{161, AttrUndefined},728- Selected: ColorAttr{168, AttrUndefined},745+ Marker: ColorAttr{168, AttrUndefined},746 Header: ColorAttr{109, AttrUndefined},747 Border: ColorAttr{59, AttrUndefined},748 BorderLabel: ColorAttr{145, AttrUndefined},749 Disabled: ColorAttr{colUndefined, AttrUndefined},10 unmodified lines760 Colored: true,761 Input: ColorAttr{colDefault, AttrUndefined},762 Fg: ColorAttr{colDefault, AttrUndefined},763 Bg: ColorAttr{colDefault, AttrUndefined},764+ SelectedFg: ColorAttr{colDefault, AttrUndefined},765+ SelectedBg: ColorAttr{colDefault, AttrUndefined},766+ SelectedMatch: ColorAttr{colDefault, AttrUndefined},767 DarkBg: ColorAttr{251, AttrUndefined},768 Prompt: ColorAttr{25, AttrUndefined},769 Match: ColorAttr{66, AttrUndefined},770 Current: ColorAttr{237, AttrUndefined},771 CurrentMatch: ColorAttr{23, AttrUndefined},772 Spinner: ColorAttr{65, AttrUndefined},773 Info: ColorAttr{101, AttrUndefined},774 Cursor: ColorAttr{161, AttrUndefined},755- Selected: ColorAttr{168, AttrUndefined},775+ Marker: ColorAttr{168, AttrUndefined},776 Header: ColorAttr{31, AttrUndefined},777 Border: ColorAttr{145, AttrUndefined},778 BorderLabel: ColorAttr{59, AttrUndefined},779 Disabled: ColorAttr{colUndefined, AttrUndefined},33 unmodified lines813 theme.CurrentMatch = o(baseTheme.CurrentMatch, theme.CurrentMatch)814 theme.Spinner = o(baseTheme.Spinner, theme.Spinner)815 theme.Info = o(baseTheme.Info, theme.Info)816 theme.Cursor = o(baseTheme.Cursor, theme.Cursor)797- theme.Selected = o(baseTheme.Selected, theme.Selected)817+ theme.Marker = o(baseTheme.Marker, theme.Marker)818 theme.Header = o(baseTheme.Header, theme.Header)819 theme.Border = o(baseTheme.Border, theme.Border)820 theme.BorderLabel = o(baseTheme.BorderLabel, theme.BorderLabel)821 822 // These colors are not defined in the base themes823+ theme.SelectedFg = o(theme.Fg, theme.SelectedFg)824+ theme.SelectedBg = o(theme.Bg, theme.SelectedBg)825+ theme.SelectedMatch = o(theme.CurrentMatch, theme.SelectedMatch)826 theme.Disabled = o(theme.Input, theme.Disabled)827 theme.Gutter = o(theme.DarkBg, theme.Gutter)828 theme.PreviewFg = o(theme.Fg, theme.PreviewFg)829 theme.PreviewBg = o(theme.Bg, theme.PreviewBg)17 unmodified lines847 blank.Attr = AttrRegular848 849 ColPrompt = pair(theme.Prompt, theme.Bg)850 ColNormal = pair(theme.Fg, theme.Bg)851+ ColSelected = pair(theme.SelectedFg, theme.SelectedBg)852 ColInput = pair(theme.Input, theme.Bg)853 ColDisabled = pair(theme.Disabled, theme.Bg)854 ColMatch = pair(theme.Match, theme.Bg)855+ ColSelectedMatch = pair(theme.SelectedMatch, theme.SelectedBg)856 ColCursor = pair(theme.Cursor, theme.Gutter)857 ColCursorEmpty = pair(blank, theme.Gutter)833- ColSelected = pair(theme.Selected, theme.Gutter)858+ if theme.SelectedBg.Color != theme.Bg.Color {859+ ColMarker = pair(theme.Marker, theme.SelectedBg)860+ } else {861+ ColMarker = pair(theme.Marker, theme.Gutter)862+ }863 ColCurrent = pair(theme.Current, theme.DarkBg)864 ColCurrentMatch = pair(theme.CurrentMatch, theme.DarkBg)865 ColCurrentCursor = pair(theme.Cursor, theme.DarkBg)866 ColCurrentCursorEmpty = pair(blank, theme.DarkBg)838- ColCurrentSelected = pair(theme.Selected, theme.DarkBg)867+ ColCurrentMarker = pair(theme.Marker, theme.DarkBg)868 ColCurrentSelectedEmpty = pair(blank, theme.DarkBg)869 ColSpinner = pair(theme.Spinner, theme.Bg)870 ColInfo = pair(theme.Info, theme.Bg)871 ColHeader = pair(theme.Header, theme.Bg)14 unmodified linesmodified:src/options.go+7 added-1 removed
984 unmodified lines985 case "current-fg", "fg+":986 mergeAttr(&theme.Current)987 case "current-bg", "bg+":988 mergeAttr(&theme.DarkBg)989+ case "selected-fg":990+ mergeAttr(&theme.SelectedFg)991+ case "selected-bg":992+ mergeAttr(&theme.SelectedBg)993 case "gutter":994 mergeAttr(&theme.Gutter)995 case "hl":996 mergeAttr(&theme.Match)997 case "current-hl", "hl+":998 mergeAttr(&theme.CurrentMatch)999+ case "selected-hl":1000+ mergeAttr(&theme.SelectedMatch)1001 case "border":1002 mergeAttr(&theme.Border)1003 case "preview-border":1004 mergeAttr(&theme.PreviewBorder)15 unmodified lines1020 mergeAttr(&theme.Info)1021 case "pointer":1022 mergeAttr(&theme.Cursor)1023 case "marker":1018- mergeAttr(&theme.Selected)1024+ mergeAttr(&theme.Marker)1025 case "header":1026 mergeAttr(&theme.Header)1027 default:1028 fail()1612 unmodified linesmodified:src/terminal.go+17 added-5 removed
1900 unmodified lines1901 } else {1902 t.window.CPrint(tui.ColCurrentCursor, label)1903 }1904 if selected {1905- t.window.CPrint(tui.ColCurrentSelected, t.marker)1905+ t.window.CPrint(tui.ColCurrentMarker, t.marker)1906 } else {1907 t.window.CPrint(tui.ColCurrentSelectedEmpty, t.markerEmpty)1908 }1909 newLine.width = t.printHighlighted(result, tui.ColCurrent, tui.ColCurrentMatch, true, true)3 unmodified lines1913 } else {1914 t.window.CPrint(tui.ColCursor, label)1915 }1916 if selected {1917- t.window.CPrint(tui.ColSelected, t.marker)1917+ t.window.CPrint(tui.ColMarker, t.marker)1918 } else {1919 t.window.Print(t.markerEmpty)1920 }1921+ var base, match tui.ColorPair1922+ if selected {1923+ base = tui.ColSelected1924+ match = tui.ColSelectedMatch1925+ } else {1926+ base = tui.ColNormal1927+ match = tui.ColMatch1928+ }1921- newLine.width = t.printHighlighted(result, tui.ColNormal, tui.ColMatch, false, true)1929+ newLine.width = t.printHighlighted(result, base, match, false, true)1930 }1923- if current && t.highlightLine {1931+ if (current || selected) && t.highlightLine {1932+ color := tui.ColSelected1933+ if current {1934+ color = tui.ColCurrent1935+ }1936 maxWidth := t.window.Width() - (t.pointerLen + t.markerLen + 1)1937 fillSpaces := maxWidth - newLine.width1938 newLine.width = maxWidth1939 if fillSpaces > 0 {1928- t.window.CPrint(tui.ColCurrent, strings.Repeat(" ", fillSpaces))1940+ t.window.CPrint(color, strings.Repeat(" ", fillSpaces))1941 }1942 } else {1943 fillSpaces := prevLine.width - newLine.width1944 if fillSpaces > 0 {2469 unmodified linesmodified:CHANGELOG.md+27 added
1 CHANGELOG2 =========3 4+0.52.05+------6+- Added `--highlight-line` to highlight the whole current line (à la `set cursorline` of Vim)7+- Added color names for selected lines: `selected-fg`, `selected-bg`, and `selected-hl`8+ ```sh9+ fzf --border --multi --info inline-right --layout reverse --marker ▏ --pointer ▌ \10+ --highlight-line --color gutter:-1,selected-bg:238,selected-fg:146,current-fg:18911+ ```12+- Added `click-header` event that is triggered when the header section is clicked. When the event is triggered, `$FZF_CLICK_HEADER_COLUMN` and `$FZF_CLICK_HEADER_LINE` are set.13+ ```sh14+ fd --type f |15+ fzf --header $'[Files] [Directories]' --header-first \16+ --bind 'click-header:transform:17+ (( FZF_CLICK_HEADER_COLUMN <= 7 )) && echo "reload(fd --type f)"18+ (( FZF_CLICK_HEADER_COLUMN >= 9 )) && echo "reload(fd --type d)"19+ '20+ ```21+- Add `$FZF_COMPLETION_{DIR,PATH}_OPTS` for separately customizing the behavior of fuzzy completion22+ ```sh23+ # Set --walker options without 'follow' not to follow symbolic links24+ FZF_COMPLETION_PATH_OPTS="--walker=file,dir,hidden"25+ FZF_COMPLETION_DIR_OPTS="--walker=dir,hidden"26+ ```27+- Fixed Windows argument escaping28+- Bug fixes and improvements29+- The code was heavily refactored to allow using fzf as a library in Go programs. The API is still experimental and subject to change.30+31 0.51.032 ------33 - Added a new environment variable `$FZF_POS` exported to the child processes. It's the vertical position of the cursor in the list starting from 1.34 ```sh2041 unmodified lines