Closed kuremu closed 5 months ago
Merged, thanks!
Glad to contribute! Thanks
Hmm, I think we should reconsider how to report the line number as it can be confusing when you use multi-line --header
.
Unlike --header-lines
, multi-line --header
s are always displayed from top to bottom, so in the following case,
fzf --header $'1. hello\n2. world' --header-first \
--bind 'click-header:transform-prompt:echo ${FZF_CLICK_HEADER_LINE}x${FZF_CLICK_HEADER_COLUMN}'
clicking on 1. hello
reports line 2.
But when you're in --reverse
layout, it will report line 1.
fzf --header $'1. hello\n2. world' --header-first \
--bind 'click-header:transform-prompt:echo ${FZF_CLICK_HEADER_LINE}x${FZF_CLICK_HEADER_COLUMN}'
This gets even more confusing when you use both --header
and --header-lines
.
Should we always count from the top? Let me think about that.
Sets
FZF_HEADERCLICK_LINE
andFZF_HEADERCLICK_COLUMN
env vars with coordinates of last click inside and relative to the header and fires header-click event.printf "header1\nheader2\nheader3\na\nb\nc" | fzf --header-lines=3 --bind "header-click:transform-prompt(echo \${FZF_HEADERCLICK_LINE}x\${FZF_HEADERCLICK_COLUMN})"
Could be useful for eg. selecting a sort column. Could set a
FZF_HEADERCLICK_WORD
var as well if that is more useful to people.Here is a more complex demo with an interactive keyboard (invoke like
cat /usr/share/dict/words | python keyboard.py
).