Compare commits

...

10 Commits

Author SHA1 Message Date
Junegunn Choi
4e3f9854e6
Update README.md 2025-05-17 22:06:06 +09:00
Junegunn Choi
b27943423e
Show ellipsis for truncated labels
Close #4390
2025-05-17 11:25:15 +09:00
Junegunn Choi
894a1016bc
RuboCop lint 2025-05-17 11:20:29 +09:00
Junegunn Choi
efe6cddd34
Update README 2025-05-16 22:15:38 +09:00
Junegunn Choi
f1c6bdf3e8
Update README 2025-05-16 22:15:06 +09:00
Junegunn Choi
710659bcf5
Update SECURITY.md 2025-05-14 11:06:15 +09:00
Josef Andersson
be67775da4
Add initial security policy (#4379)
Signed-off-by: Josef Andersson <janderssonse@proton.me>
Co-authored-by: Junegunn Choi <junegunn.c@gmail.com>
2025-05-14 11:05:20 +09:00
jiz4oh
2c6381499c
[neovim] Respect winborder of Neovim 0.11+ (#4389)
Co-authored-by: Junegunn Choi <junegunn.c@gmail.com>
2025-05-14 00:53:26 +09:00
junegunn
4df842e78c Deploying to master from @ junegunn/fzf@b81696fb64 🚀 2025-05-11 00:02:09 +00:00
Ajeet D'Souza
b81696fb64
bash: set keybinding right before printing special character (#4377) 2025-05-10 15:29:27 +09:00
8 changed files with 100 additions and 15 deletions

View File

@ -1,5 +1,5 @@
--- ---
name: Test fzf on Linux name: build
on: on:
push: push:

File diff suppressed because one or more lines are too long

33
SECURITY.md Normal file
View File

@ -0,0 +1,33 @@
# Security Reporting
If you wish to report a security vulnerability privately, we appreciate your diligence. Please follow the guidelines below to submit your report.
## Reporting
To report a security vulnerability, please provide the following information:
1. **PROJECT**
- https://github.com/junegunn/fzf
2. **PUBLIC**
- Indicate whether this vulnerability has already been publicly discussed or disclosed.
- If so, provide relevant links.
3. **DESCRIPTION**
- Provide a detailed description of the security vulnerability.
- Include as much information as possible to help us understand and address the issue.
Send this information, along with any additional relevant details, to <junegunn.c AT gmail DOT com>.
## Confidentiality
We kindly ask you to keep the report confidential until a public announcement is made.
## Notes
- Vulnerabilities will be handled on a best-effort basis.
- You may request an advance copy of the patched release, but we cannot guarantee early access before the public release.
- You will be notified via email simultaneously with the public announcement.
- We will respond within a few weeks to confirm whether your report has been accepted or rejected.
Thank you for helping to improve the security of our project!

View File

@ -553,8 +553,15 @@ try
let height = s:calc_size(&lines, dict.down, dict) let height = s:calc_size(&lines, dict.down, dict)
let optstr .= ' --no-tmux --height='.height let optstr .= ' --no-tmux --height='.height
endif endif
" Respect --border option given in $FZF_DEFAULT_OPTS and 'options'
let optstr = join([s:border_opt(get(dict, 'window', 0)), s:extract_option($FZF_DEFAULT_OPTS, 'border'), optstr]) if exists('&winborder') && &winborder !=# '' && &winborder !=# 'none'
" Add 1-column horizontal margin
let optstr = join(['--margin 0,1', optstr])
else
" Respect --border option given in $FZF_DEFAULT_OPTS and 'options'
let optstr = join([s:border_opt(get(dict, 'window', 0)), s:extract_option($FZF_DEFAULT_OPTS, 'border'), optstr])
endif
let command = prefix.(use_tmux ? s:fzf_tmux(dict) : fzf_exec).' '.optstr.' > '.temps.result let command = prefix.(use_tmux ? s:fzf_tmux(dict) : fzf_exec).' '.optstr.' > '.temps.result
if use_term if use_term

View File

@ -31,9 +31,6 @@ if [[ $- =~ i ]]; then
########################################################### ###########################################################
# To redraw line after fzf closes (printf '\e[5n')
bind '"\e[0n": redraw-current-line' 2> /dev/null
__fzf_defaults() { __fzf_defaults() {
# $1: Prepend to FZF_DEFAULT_OPTS_FILE and FZF_DEFAULT_OPTS # $1: Prepend to FZF_DEFAULT_OPTS_FILE and FZF_DEFAULT_OPTS
# $2: Append to FZF_DEFAULT_OPTS_FILE and FZF_DEFAULT_OPTS # $2: Append to FZF_DEFAULT_OPTS_FILE and FZF_DEFAULT_OPTS
@ -328,6 +325,8 @@ __fzf_generic_path_completion() {
else else
COMPREPLY=( "$cur" ) COMPREPLY=( "$cur" )
fi fi
# To redraw line after fzf closes (printf '\e[5n')
bind '"\e[0n": redraw-current-line' 2> /dev/null
printf '\e[5n' printf '\e[5n'
return 0 return 0
fi fi
@ -384,6 +383,7 @@ _fzf_complete() {
else else
COMPREPLY=("$cur") COMPREPLY=("$cur")
fi fi
bind '"\e[0n": redraw-current-line' 2> /dev/null
printf '\e[5n' printf '\e[5n'
return 0 return 0
else else

View File

@ -1235,9 +1235,14 @@ func (t *Terminal) ansiLabelPrinter(str string, color *tui.ColorPair, fill bool)
return nil, 0 return nil, 0
} }
printFn := func(window tui.Window, limit int) { printFn := func(window tui.Window, limit int) {
if length > limit { ellipsis := []rune{}
trimmedRunes, _ := t.trimRight(runes, limit) ellipsisWidth := 0
window.CPrint(*color, string(trimmedRunes)) if !fill {
ellipsis, ellipsisWidth = util.Truncate(t.ellipsis, limit)
}
if length > limit-ellipsisWidth {
trimmedRunes, _ := t.trimRight(runes, limit-ellipsisWidth)
window.CPrint(*color, string(trimmedRunes)+string(ellipsis))
} else if fill { } else if fill {
window.CPrint(*color, util.RepeatToFill(text, length, limit)) window.CPrint(*color, util.RepeatToFill(text, length, limit))
} else { } else {

View File

@ -1859,9 +1859,9 @@ class TestCore < TestInteractive
line = nil line = nil
tmux.until { |lines| line = lines.index('> 1') } tmux.until { |lines| line = lines.index('> 1') }
tmux.send_keys :PgDn tmux.send_keys :PgDn
tmux.until { |lines| assert_includes lines[line + 4], "> 5" } tmux.until { |lines| assert_includes lines[line + 4], '> 5' }
tmux.send_keys :Space tmux.send_keys :Space
tmux.until { |lines| assert_includes lines[line + 2], "> 5" } tmux.until { |lines| assert_includes lines[line + 2], '> 5' }
end end
def test_no_input_query def test_no_input_query

View File

@ -992,6 +992,36 @@ class TestLayout < TestInteractive
tmux.until { assert_block(block, it) } tmux.until { assert_block(block, it) }
end end
def test_label_trunction
command = <<~CMD
seq 10 | #{FZF} --style full --border --header-lines=1 --preview ':' \\
--border-label "#{'b' * 1000}" \\
--preview-label "#{'p' * 1000}" \\
--header-label "#{'h' * 1000}" \\
--header-label "#{'h' * 1000}" \\
--input-label "#{'i' * 1000}" \\
--list-label "#{'l' * 1000}"
CMD
writelines(command.lines.map(&:chomp))
tmux.send_keys("sh #{tempname}", :Enter)
tmux.until do |lines|
text = lines.join
assert_includes text, 'b··'
assert_includes text, 'l··p'
assert_includes text, 'p··'
assert_includes text, 'h··'
assert_includes text, 'i··'
end
end
def test_separator_no_ellipsis
tmux.send_keys %(seq 10 | #{FZF} --separator "$(seq 1000 | tr '\\n' ' ')"), :Enter
tmux.until do |lines|
assert_equal 10, lines.match_count
refute_includes lines.join, '··'
end
end
def test_header_border_no_pointer_and_marker def test_header_border_no_pointer_and_marker
tmux.send_keys %(seq 10 | #{FZF} --header-lines 1 --header-border sharp --no-list-border --pointer '' --marker ''), :Enter tmux.send_keys %(seq 10 | #{FZF} --header-lines 1 --header-border sharp --no-list-border --pointer '' --marker ''), :Enter
block = <<~BLOCK block = <<~BLOCK