Open sledgehammer999 opened 4 months ago
With the same setup, non-ascii characters make Fzf quit; it's intricate
I found out that as soon as I removed the --height
option from $FZF_DEFAULT_OPTS
, fzf accepts non-ascii characters in Git Bash in Windows Terminal; however I could not make fzf work at all in Git bash.
Regarding the --height
option, it's unfortunately set by almost all common commands, such as Ctrl-T
.
The following lines, say in .bash_profile
, remove it wherever possible:
export FZF_DEFAULT_OPTS="${FZF_DEFAULT_OPTS//--height[=[:space:]][1-9][0-9]?/ }"
export FZF_CTRL_T_OPTS="${FZF_CTRL_T_OPTS//--height[=[:space:]][1-9][0-9]?/ }"
export FZF_CTRL_R_OPTS="${FZF_CTRL_R_OPTS//--height[=[:space:]][1-9][0-9]?/ }"
export FZF_ALT_C_OPTS="${FZF_DEFAULT_OPTS} --preview='tree.com //F {} | tail +3 | head -\$LINES'"
Ideally, of course, the issue with setting --height
in Fzf in Git Bash itself could be fixed.
You can just append --no-height
at the end, because the last one wins.
export FZF_DEFAULT_OPTS="$FZF_DEFAULT_OPTS --no-height"
Thank you, I was not aware of it. This is more robust. Ideally, since the provided bash scripts set their own custom parameters, add a check for Git Bash, say by [ -z ${MSYSTEM+x} ] || ...
, and append --no-height
.
I can confirm that --no-height
works for me too. In both Windows Terminal and mintty(from git bash).
BTW echo $FZF_DEFAULT_OPTS
is empty so I suppose --height
is the default, right?
Yes, you can inspect here:
__fzf_defaults() {
# $1: Prepend to FZF_DEFAULT_OPTS_FILE and FZF_DEFAULT_OPTS
# $2: Append to FZF_DEFAULT_OPTS_FILE and FZF_DEFAULT_OPTS
echo "--height ${FZF_TMUX_HEIGHT:-40%} --bind=ctrl-z:ignore $1"
command cat "${FZF_DEFAULT_OPTS_FILE-}" 2> /dev/null
echo "${FZF_DEFAULT_OPTS-} $2"
}
__fzf_select__() {
FZF_DEFAULT_COMMAND=${FZF_CTRL_T_COMMAND:-} \
FZF_DEFAULT_OPTS=$(__fzf_defaults "--reverse --walker=file,dir,follow,hidden --scheme=path" "${FZF_CTRL_T_OPTS-} -m") \
For me unability to input non-latin characters was introduced in 0.54, 0.53 works fine.
Now I did, with no result. Will stick to 0.53 for a while.
If you're experiencing a change of behavior in 0.54.0, this might be the cause.
https://github.com/junegunn/fzf/commit/dca2262fe6f8d7c4a9264464e45d44e684d0e70b
See https://github.com/junegunn/fzf/issues/3847#issuecomment-2162913817
I'll look into it when I get some time.
I can confirm that the LightRenderer for Windows written by @kelleyma49 cannot take Unicode characters.
When I type in a Unicode character, it reads it as ?
(63).
Ideally, we should fix LightRenderer to support non-ASCII input, but I don't have the Windows expertise to do that, so I'm going to revert the decision I made in 0.54 to prefer LightRenderer over tcell-based renderer for now.
Related:
I believe I have a fix for reading and displaying non-ASCII input. Please see #3951
Checklist
man fzf
)Output of
fzf --version
0.52.1 (6432f00)
OS
Shell
Problem / Steps to reproduce
Specifically I use bash from git for windows. OS: Win 10 Terminal:
When I hit CTRL+T and try to input greek characters they appear in the prompt either transliterated to their equivalent ascii (eg
α
becomesa
) or printed as the?
character. This happens with both terminals.Both terminals are able to print greek characters (eg
ls
a folder with greek filenames) and are able to take greek input in their prompts. So the issue is with fzf's prompt.