* Fix nth attr merge order to respect precedence hierarchy
nth attrs were merged ON TOP of current-fg/selected-fg attrs, so
nth:regular would clear attrs like underline from current-fg. Fix the
merge chain to apply nth BEFORE the line-type overlay:
fg < nth < selected-fg < current-fg < hl < selected-hl < current-hl
Store raw current-fg and selected-fg attrs in ColorTheme before they
get merged with fg/ListFg, then pass them as nthOverlay through
printHighlighted to colorOffsets where the correct merge chain is
computed: fgAttr.Merge(nthAttr).Merge(nthOverlay).
Fix#4687
* Make current-fg inherit from list-fg instead of fg
current-fg was inheriting from fg, not list-fg, so setting list-fg
had no effect on the current line. e.g.
fzf --color fg:dim,list-fg:underline,nth:regular -d / --nth -1
The non-nth part of the current line was dim (from fg) instead of
underline (from list-fg). Resolve ListFg/ListBg earlier in InitTheme
so Current can inherit from them.
* Make selected-fg inherit from list-fg via merge instead of override
selected-fg used o() which replaces the attr from list-fg entirely.
e.g. with fg:dim,selected-fg:italic, the dim was lost on selected
lines because o() replaced dim with italic instead of merging them.
Use ColorAttr.Merge() so attrs are combined additively, consistent
with how current-fg inherits from list-fg.
* Apply selected-fg attrs on current line when item is selected
When an item is both current and selected, the current-line rendering
ignored selected-fg attrs entirely. e.g.
echo foo | fzf --color fg:dim,nth:regular,current-fg:underline,selected-fg:italic --bind result:select --multi
The italic from selected-fg was lost. Merge NthSelectedAttr into the
overlay and rebuild colBase attr with the correct precedence chain:
fg < selected-fg < current-fg.
Support double, curly, dotted, and dashed underline styles via --color
(e.g. underline-curly) and ANSI passthrough (SGR 4:N, 58, 59) with --ansi.
Close#4633Close#4678
Thanks to @shtse8 for the test cases.
Since you can actually distinguish between Ctrl-H and Ctrl-Backspace in Windows we need to reintroduce the tui.CtrlH constant. On *nix systems we map all Ctrl(-Alt)-h to Ctrl(-Alt)-Backspace internally, but you can use either in --bind.
Motivation:
`--color base16` can be a better default than `dark` or `light`, since it uses
the colors defined by the current theme. This usually blends in more
naturally and works well in both light and dark modes.
However, some elements were previously hard-coded with white or black
foreground colors, which can cause rendering issues in certain terminal
themes.
* Added tests for `LightRenderer`
* Added common SHIFT, ALT and ALT+SHIFT key sequences
* Added common CTRL key sequences
* Added common CTRL+ALT, CTRL+SHIFT, CTRL+ALT+SHIFT key sequences
* Added proper xterm META modifier handling
according to defc6dd568/input.c (L357-L375)
* Fix `ctrl-backspace` and `ctrl-alt-backspace`
* Fix broken tcell tests on windows by swallowing Resize events
* Added tests for FullscreenRenderer
* Removed own fork of tcell and updated tcell to 2.9.0
tcell 2.9.0 is needed for `Ctrl-Alt-*` and `Ctrl-Alt-Shift-*` shortcuts in Windows
* Replace conditional checks with switch statements to improve readability
* Replace long conditionals with constant slices to improve readability
* Bind `ctrl-bspace` (`ctrl-h`) to `backward-delete-char` by default
Since we now distinguish between Backspace and Ctrl-Backspace, Ctrl-Backspace should trigger the same action as Backspace by default. In that way nothing changes for the user but you can bind other actions to Ctrl-Backspace when desired.
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.
Test cases:
1. 'jump' should show alternating background colors even when 'alt-bg' is
not defined as before.
go run main.go --bind load:jump
Two differences:
* The alternating lines will not be in bold (was a bug)
* The marker column will not be rendered with alternating background color
2. Use alternating background color when 'alt-bg' is set
go run main.go --color bg:238,alt-bg:237
go run main.go --color bg:238,alt-bg:237 --highlight-line
3. 'selected-bg' should take precedence
go run main.go --color bg:238,alt-bg:237,selected-bg:232 \
--highlight-line --multi --bind 'load:select+up+select+up'
4. Should work with text with ANSI colors
declare -f | perl -0777 -pe 's/^}\n/}\0/gm' |
bat --plain --language bash --color always |
go run main.go --read0 --ansi --reverse --multi \
--color bg:237,alt-bg:238,current-bg:236 --highlight-line
---
Close#4354Fix#4372
Close#2890Close#1396
You can't type in queries in this mode, and the only way to trigger an
fzf search is to use `search(...)` action.
# Click header to trigger search
fzf --header '[src] [test]' --no-input --layout reverse \
--header-border bottom --input-border \
--bind 'click-header:transform-search:echo ${FZF_CLICK_HEADER_WORD:1:-1}'
Examples:
# Border only around the header from --header-lines
seq 10 | fzf --header 'hello' --header-lines 2 --header-lines-border
# Both headers with borders
seq 10 | fzf --header 'hello' --header-lines 2 --header-border --header-lines-border
# Use 'none' to still separate two headers but without a border
seq 10 | fzf --header 'hello' --header-lines 2 --header-border --header-lines-border none --list-border
If you do not want 'current-fg' to inherit attributes of 'fg', prefix it
with 'regular:' to reset them.
# italic and underline
fzf --color fg:italic,current-fg:underline
# only underline
fzf --color fg:italic,current-fg:regular:underline
It draws a single line between the preview window and the rest of the
interface. i.e. automatically choose between 'left', 'right', 'top', and
'bottom' depending on the position of the preview window.
De-duplicate code and reduce the amount of code that has to be changed
when new BorderShapes are being added. This also adds and uses the
missing HasBottom().
When --sync is provided, fzf will not render the interface until the
initial filtering and associated actions (bound to any of 'start',
'load', or 'result') are complete.