Close#4430
Example:
# Implement popup that disappears after 1 second
# * Use footer as the popup
# * Use `bell` to ring the terminal bell
# * Use `bg-transform-footer` to clear the footer after 1 second
# * Use `bg-cancel` to ignore currently running background transform actions
fzf --multi --list-border \
--bind 'enter:execute-silent(echo -n {+} | pbcopy)+bell' \
--bind 'enter:+transform-footer(echo Copied {} to clipboard)' \
--bind 'enter:+bg-cancel+bg-transform-footer(sleep 1)'
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.
fzf displayed --header-lines inconsistently depending on the presence of borders:
# --header and --header-lines co-located
seq 10 | fzf --header-lines 3 --header "$(seq 101 103)" --header-first
# --header and --header-lines separated
seq 10 | fzf --header-lines 3 --header "$(seq 101 103)" --header-first --header-lines-border
This commit fixes the inconsistency with the following logic:
* If only one of --header or --header-lines is provided, --header-first
applies to that single header.
* If both are present, --header-first affects only the regular --header,
not --header-lines.
For the line "Host host1 # this is a comment", the current
implementation generates words in an inline comment as hostnames.
This patch removes the comment before generating the hostname.
In ~/.ssh/config, "=" can also be used as a separator between the
field name and the value. The current master does not properly handle
this and generate a hostname "=" or one starting with "=". This patch
correctly handles it.
Comments are anyway removed in the subsequent call to `sub(/#.*/,
"")`, and it becomes a blank line. Blank lines do not have fields, so
they are ignored in the next for-loop.
In the current implementation, any hostnames in /etc/hosts containing
"0.0.0.0" as a part (such as "110.0.0.0" would be excluded. "0.0.0.0"
should be checked by the exact match.
An entry of the form `[example.com]:port,192.168.0.1 ...` in
~/.ssh/known_hosts are not properly processed. The current
implementation gives up the matching on the first occurrence of `]`,
the subsequent 192.168.0.1 would not be extracted. This patch
continues the analysis and removes "]" together with "[".
This patch also removes the ":port" part from the hostnames in
~/.ssh/known_hosts. One cannot use the form "hostname:port" in the
arguments to the ssh command anyway.
Solaris awk at /usr/bin/awk is meant for backward compatibility with
an ancient implementation of 1977 awk in the original UNIX. It lacks
many features of POSIX awk. To use a standard-conforming version in
Solaris, one needs to explicitly use /usr/xpg4/bin/awk.
macOS awk is a variant of nawk, but it contains a unique patch for the
UTF-8 support. However, this patch causes the problem. If the input
contains any non-UTF-8 data, macOS awk stops processing and does not
do anything, instead of ignoring the unrecognized data and continue
the processing. However, the contents of the ssh configuration and
/etc/hosts is not under the control of fzf, so we cannot fix the input
when those files contain non-UTF-8 data. To work around this
behavior, one can set the locale to LC_ALL=C to treat the input data
with the plain 8-bit encoding.