mirror of
https://github.com/junegunn/fzf.git
synced 2025-08-25 01:13:50 -07:00
Compare commits
15 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
f2179f015c | ||
|
9a53d84b9c | ||
|
0a8ff7899c | ||
|
f9d7877d8b | ||
|
9fe9976591 | ||
|
de1824f71d | ||
|
19a9296c47 | ||
|
49967f3d45 | ||
|
978b6254c7 | ||
|
1afd143810 | ||
|
e5cd7f0a3a | ||
|
51d3940c63 | ||
|
179aec1578 | ||
|
af0014aba8 | ||
|
da3d995709 |
2
.github/workflows/codeql-analysis.yml
vendored
2
.github/workflows/codeql-analysis.yml
vendored
@@ -27,7 +27,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v5
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
|
2
.github/workflows/depsreview.yaml
vendored
2
.github/workflows/depsreview.yaml
vendored
@@ -9,6 +9,6 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: 'Checkout Repository'
|
- name: 'Checkout Repository'
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v5
|
||||||
- name: 'Dependency Review'
|
- name: 'Dependency Review'
|
||||||
uses: actions/dependency-review-action@v4
|
uses: actions/dependency-review-action@v4
|
||||||
|
2
.github/workflows/linux.yml
vendored
2
.github/workflows/linux.yml
vendored
@@ -18,7 +18,7 @@ jobs:
|
|||||||
build:
|
build:
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v5
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
|
2
.github/workflows/macos.yml
vendored
2
.github/workflows/macos.yml
vendored
@@ -15,7 +15,7 @@ jobs:
|
|||||||
build:
|
build:
|
||||||
runs-on: macos-latest
|
runs-on: macos-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v5
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
|
2
.github/workflows/sponsors.yml
vendored
2
.github/workflows/sponsors.yml
vendored
@@ -9,7 +9,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout 🛎️
|
- name: Checkout 🛎️
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v5
|
||||||
|
|
||||||
- name: Generate Sponsors 💖
|
- name: Generate Sponsors 💖
|
||||||
uses: JamesIves/github-sponsors-readme-action@v1
|
uses: JamesIves/github-sponsors-readme-action@v1
|
||||||
|
2
.github/workflows/typos.yml
vendored
2
.github/workflows/typos.yml
vendored
@@ -6,5 +6,5 @@ jobs:
|
|||||||
name: Spell Check with Typos
|
name: Spell Check with Typos
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v5
|
||||||
- uses: crate-ci/typos@v1.29.4
|
- uses: crate-ci/typos@v1.29.4
|
||||||
|
@@ -1,6 +1,12 @@
|
|||||||
CHANGELOG
|
CHANGELOG
|
||||||
=========
|
=========
|
||||||
|
|
||||||
|
0.65.1
|
||||||
|
------
|
||||||
|
- Fixed incorrect `$FZF_CLICK_HEADER_WORD` and `$FZF_CLICK_FOOTER_WORD` when the header or footer contains ANSI escape sequences and tab characters.
|
||||||
|
- Fixed a bug where you cannot unset the default `--nth` using `change-nth` action.
|
||||||
|
- Fixed a highlighting bug when using `--color fg:dim,nth:regular` pattern over ANSI-colored items.
|
||||||
|
|
||||||
0.65.0
|
0.65.0
|
||||||
------
|
------
|
||||||
- Added `click-footer` event that is triggered when the footer section is clicked. When the event is triggered, the following environment variables are set:
|
- Added `click-footer` event that is triggered when the footer section is clicked. When the event is triggered, the following environment variables are set:
|
||||||
|
4
install
4
install
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
set -u
|
set -u
|
||||||
|
|
||||||
version=0.65.0
|
version=0.65.1
|
||||||
auto_completion=
|
auto_completion=
|
||||||
key_bindings=
|
key_bindings=
|
||||||
update_config=2
|
update_config=2
|
||||||
@@ -164,7 +164,7 @@ download() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Try to download binary executable
|
# Try to download binary executable
|
||||||
archi=$(uname -smo)
|
archi=$(uname -smo 2>/dev/null || uname -sm)
|
||||||
binary_available=1
|
binary_available=1
|
||||||
binary_error=""
|
binary_error=""
|
||||||
case "$archi" in
|
case "$archi" in
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
$version="0.65.0"
|
$version="0.65.1"
|
||||||
|
|
||||||
$fzf_base=Split-Path -Parent $MyInvocation.MyCommand.Definition
|
$fzf_base=Split-Path -Parent $MyInvocation.MyCommand.Definition
|
||||||
|
|
||||||
|
@@ -21,7 +21,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
THE SOFTWARE.
|
THE SOFTWARE.
|
||||||
..
|
..
|
||||||
.TH fzf\-tmux 1 "Jul 2025" "fzf 0.65.0" "fzf\-tmux - open fzf in tmux split pane"
|
.TH fzf\-tmux 1 "Aug 2025" "fzf 0.65.1" "fzf\-tmux - open fzf in tmux split pane"
|
||||||
|
|
||||||
.SH NAME
|
.SH NAME
|
||||||
fzf\-tmux - open fzf in tmux split pane
|
fzf\-tmux - open fzf in tmux split pane
|
||||||
|
@@ -21,7 +21,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
THE SOFTWARE.
|
THE SOFTWARE.
|
||||||
..
|
..
|
||||||
.TH fzf 1 "Jul 2025" "fzf 0.65.0" "fzf - a command-line fuzzy finder"
|
.TH fzf 1 "Aug 2025" "fzf 0.65.1" "fzf - a command-line fuzzy finder"
|
||||||
|
|
||||||
.SH NAME
|
.SH NAME
|
||||||
fzf - a command-line fuzzy finder
|
fzf - a command-line fuzzy finder
|
||||||
@@ -1046,7 +1046,7 @@ are not affected by \fB\-\-with\-nth\fR. ANSI color codes are processed even whe
|
|||||||
|
|
||||||
.TP
|
.TP
|
||||||
.BI "\-\-footer\-border" [=STYLE]
|
.BI "\-\-footer\-border" [=STYLE]
|
||||||
Draw border around the header section. \fBline\fR style draws a single
|
Draw border around the footer section. \fBline\fR style draws a single
|
||||||
separator line between the footer and the list section.
|
separator line between the footer and the list section.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
|
@@ -125,7 +125,7 @@ bind -m emacs-standard '"\C-z": vi-editing-mode'
|
|||||||
if (( BASH_VERSINFO[0] < 4 )); then
|
if (( BASH_VERSINFO[0] < 4 )); then
|
||||||
# CTRL-T - Paste the selected file path into the command line
|
# CTRL-T - Paste the selected file path into the command line
|
||||||
if [[ "${FZF_CTRL_T_COMMAND-x}" != "" ]]; then
|
if [[ "${FZF_CTRL_T_COMMAND-x}" != "" ]]; then
|
||||||
bind -m emacs-standard '"\C-t": " \C-b\C-k \C-u`__fzf_select__`\e\C-e\er\C-a\C-y\C-h\C-e\e \C-y\ey\C-x\C-x\C-f"'
|
bind -m emacs-standard '"\C-t": " \C-b\C-k \C-u`__fzf_select__`\e\C-e\er\C-a\C-y\C-h\C-e\e \C-y\ey\C-x\C-x\C-f\C-y\ey\C-_"'
|
||||||
bind -m vi-command '"\C-t": "\C-z\C-t\C-z"'
|
bind -m vi-command '"\C-t": "\C-z\C-t\C-z"'
|
||||||
bind -m vi-insert '"\C-t": "\C-z\C-t\C-z"'
|
bind -m vi-insert '"\C-t": "\C-z\C-t\C-z"'
|
||||||
fi
|
fi
|
||||||
@@ -150,7 +150,7 @@ fi
|
|||||||
|
|
||||||
# ALT-C - cd into the selected directory
|
# ALT-C - cd into the selected directory
|
||||||
if [[ "${FZF_ALT_C_COMMAND-x}" != "" ]]; then
|
if [[ "${FZF_ALT_C_COMMAND-x}" != "" ]]; then
|
||||||
bind -m emacs-standard '"\ec": " \C-b\C-k \C-u`__fzf_cd__`\e\C-e\er\C-m\C-y\C-h\e \C-y\ey\C-x\C-x\C-d"'
|
bind -m emacs-standard '"\ec": " \C-b\C-k \C-u`__fzf_cd__`\e\C-e\er\C-m\C-y\C-h\e \C-y\ey\C-x\C-x\C-d\C-y\ey\C-_"'
|
||||||
bind -m vi-command '"\ec": "\C-z\ec\C-z"'
|
bind -m vi-command '"\ec": "\C-z\ec\C-z"'
|
||||||
bind -m vi-insert '"\ec": "\C-z\ec\C-z"'
|
bind -m vi-insert '"\ec": "\C-z\ec\C-z"'
|
||||||
fi
|
fi
|
||||||
|
@@ -90,11 +90,12 @@ func runProxy(commandPrefix string, cmdBuilder func(temp string, needBash bool)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// * Write the command to a temporary file and run it with sh to ensure POSIX compliance.
|
// Write the command to a temporary file and run it with sh to ensure POSIX compliance.
|
||||||
// * Nullify FZF_DEFAULT_* variables as tmux popup may inject them even when undefined.
|
var exports []string
|
||||||
exports := []string{"FZF_DEFAULT_COMMAND=", "FZF_DEFAULT_OPTS=", "FZF_DEFAULT_OPTS_FILE="}
|
|
||||||
needBash := false
|
needBash := false
|
||||||
if withExports {
|
if withExports {
|
||||||
|
// Nullify FZF_DEFAULT_* variables as tmux popup may inject them even when undefined.
|
||||||
|
exports = []string{"FZF_DEFAULT_COMMAND=", "FZF_DEFAULT_OPTS=", "FZF_DEFAULT_OPTS_FILE="}
|
||||||
validIdentifier := regexp.MustCompile(`^[a-zA-Z_][a-zA-Z0-9_]*$`)
|
validIdentifier := regexp.MustCompile(`^[a-zA-Z_][a-zA-Z0-9_]*$`)
|
||||||
for _, pairStr := range os.Environ() {
|
for _, pairStr := range os.Environ() {
|
||||||
pair := strings.SplitN(pairStr, "=", 2)
|
pair := strings.SplitN(pairStr, "=", 2)
|
||||||
|
@@ -285,7 +285,7 @@ func (r *Reader) readFiles(roots []string, opts walkerOpts, ignores []string) bo
|
|||||||
if strings.HasPrefix(ignore, sep) {
|
if strings.HasPrefix(ignore, sep) {
|
||||||
ignoresSuffix = append(ignoresSuffix, ignore)
|
ignoresSuffix = append(ignoresSuffix, ignore)
|
||||||
} else {
|
} else {
|
||||||
// 'foo/bar' should match match
|
// 'foo/bar' should match
|
||||||
// * 'foo/bar'
|
// * 'foo/bar'
|
||||||
// * 'baz/foo/bar'
|
// * 'baz/foo/bar'
|
||||||
// * but NOT 'bazfoo/bar'
|
// * but NOT 'bazfoo/bar'
|
||||||
|
@@ -128,9 +128,9 @@ func (result *Result) colorOffsets(matchOffsets []Offset, nthOffsets []Offset, t
|
|||||||
|
|
||||||
// No ANSI codes
|
// No ANSI codes
|
||||||
if len(itemColors) == 0 && len(nthOffsets) == 0 {
|
if len(itemColors) == 0 && len(nthOffsets) == 0 {
|
||||||
var offsets []colorOffset
|
offsets := make([]colorOffset, len(matchOffsets))
|
||||||
for _, off := range matchOffsets {
|
for i, off := range matchOffsets {
|
||||||
offsets = append(offsets, colorOffset{offset: [2]int32{off[0], off[1]}, color: colMatch, match: true})
|
offsets[i] = colorOffset{offset: [2]int32{off[0], off[1]}, color: colMatch, match: true}
|
||||||
}
|
}
|
||||||
return offsets
|
return offsets
|
||||||
}
|
}
|
||||||
@@ -237,7 +237,7 @@ func (result *Result) colorOffsets(matchOffsets []Offset, nthOffsets []Offset, t
|
|||||||
if color.Fg().IsDefault() && origColor.HasBg() {
|
if color.Fg().IsDefault() && origColor.HasBg() {
|
||||||
color = origColor
|
color = origColor
|
||||||
if curr.nth {
|
if curr.nth {
|
||||||
color = color.WithAttr(attrNth)
|
color = color.WithAttr(attrNth &^ tui.AttrRegular)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
color = origColor.MergeNonDefault(color)
|
color = origColor.MergeNonDefault(color)
|
||||||
|
@@ -1394,7 +1394,7 @@ func (t *Terminal) ansiLabelPrinter(str string, color *tui.ColorPair, fill bool)
|
|||||||
if !fill {
|
if !fill {
|
||||||
ellipsis, ellipsisWidth = util.Truncate(t.ellipsis, limit)
|
ellipsis, ellipsisWidth = util.Truncate(t.ellipsis, limit)
|
||||||
}
|
}
|
||||||
if length > limit-ellipsisWidth {
|
if length > limit {
|
||||||
trimmedRunes, _ := t.trimRight(runes, limit-ellipsisWidth)
|
trimmedRunes, _ := t.trimRight(runes, limit-ellipsisWidth)
|
||||||
window.CPrint(*color, string(trimmedRunes)+string(ellipsis))
|
window.CPrint(*color, string(trimmedRunes)+string(ellipsis))
|
||||||
} else if fill {
|
} else if fill {
|
||||||
@@ -1801,6 +1801,11 @@ func (t *Terminal) displayWidth(runes []rune) int {
|
|||||||
return width
|
return width
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (t *Terminal) displayWidthWithPrefix(str string, prefixWidth int) int {
|
||||||
|
width, _ := util.RunesWidth([]rune(str), prefixWidth, t.tabstop, math.MaxInt32)
|
||||||
|
return width
|
||||||
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
minWidth = 4
|
minWidth = 4
|
||||||
minHeight = 3
|
minHeight = 3
|
||||||
@@ -4767,6 +4772,7 @@ func (t *Terminal) addClickHeaderWord(env []string) []string {
|
|||||||
if t.layout == layoutReverse {
|
if t.layout == layoutReverse {
|
||||||
headers[0], headers[1] = headers[1], headers[0]
|
headers[0], headers[1] = headers[1], headers[0]
|
||||||
}
|
}
|
||||||
|
var trimmedLine string
|
||||||
var words []Token
|
var words []Token
|
||||||
var lineNum int
|
var lineNum int
|
||||||
for lineNum = 0; lineNum <= clickHeaderLine; lineNum++ {
|
for lineNum = 0; lineNum <= clickHeaderLine; lineNum++ {
|
||||||
@@ -4785,7 +4791,9 @@ func (t *Terminal) addClickHeaderWord(env []string) []string {
|
|||||||
return env
|
return env
|
||||||
}
|
}
|
||||||
|
|
||||||
words = Tokenize(line, t.delimiter)
|
// NOTE: We can't expand tabs here because the delimiter can contain tabs.
|
||||||
|
trimmedLine, _, _ = extractColor(line, nil, nil)
|
||||||
|
words = Tokenize(trimmedLine, t.delimiter)
|
||||||
if currentLine {
|
if currentLine {
|
||||||
break
|
break
|
||||||
} else {
|
} else {
|
||||||
@@ -4796,11 +4804,14 @@ func (t *Terminal) addClickHeaderWord(env []string) []string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
colNum := t.clickHeaderColumn - 1
|
colNum := t.clickHeaderColumn - 1
|
||||||
|
prefixWidth, prefixLength := 0, 0
|
||||||
for idx, token := range words {
|
for idx, token := range words {
|
||||||
prefixWidth := int(token.prefixLength)
|
prefixWidth += t.displayWidthWithPrefix(trimmedLine[prefixLength:token.prefixLength], prefixWidth)
|
||||||
word := token.text.ToString()
|
prefixLength = int(token.prefixLength)
|
||||||
|
|
||||||
|
word, _ := t.processTabs(token.text.ToRunes(), prefixWidth)
|
||||||
trimmed := strings.TrimRightFunc(word, unicode.IsSpace)
|
trimmed := strings.TrimRightFunc(word, unicode.IsSpace)
|
||||||
trimWidth, _ := util.RunesWidth([]rune(trimmed), prefixWidth, t.tabstop, math.MaxInt32)
|
trimWidth := t.displayWidthWithPrefix(trimmed, prefixWidth)
|
||||||
|
|
||||||
// Find the position of the first non-space character in the word
|
// Find the position of the first non-space character in the word
|
||||||
minPos := strings.IndexFunc(trimmed, func(r rune) bool {
|
minPos := strings.IndexFunc(trimmed, func(r rune) bool {
|
||||||
@@ -4828,13 +4839,15 @@ func (t *Terminal) addClickFooterWord(env []string) []string {
|
|||||||
|
|
||||||
// NOTE: Unlike in click-header, we don't use --delimiter here, since we're
|
// NOTE: Unlike in click-header, we don't use --delimiter here, since we're
|
||||||
// only interested in the word, not nth. Does this make sense?
|
// only interested in the word, not nth. Does this make sense?
|
||||||
words := Tokenize(t.footer[clickFooterLine], Delimiter{})
|
trimmed, _, _ := extractColor(t.footer[clickFooterLine], nil, nil)
|
||||||
|
trimmed, _ = t.processTabs([]rune(trimmed), 0)
|
||||||
|
words := Tokenize(trimmed, Delimiter{})
|
||||||
colNum := t.clickFooterColumn - 1
|
colNum := t.clickFooterColumn - 1
|
||||||
for _, token := range words {
|
for _, token := range words {
|
||||||
prefixWidth := int(token.prefixLength)
|
prefixWidth := int(token.prefixLength)
|
||||||
word := token.text.ToString()
|
word := token.text.ToString()
|
||||||
trimmed := strings.TrimRightFunc(word, unicode.IsSpace)
|
trimmed := strings.TrimRightFunc(word, unicode.IsSpace)
|
||||||
trimWidth, _ := util.RunesWidth([]rune(trimmed), prefixWidth, t.tabstop, math.MaxInt32)
|
trimWidth := t.displayWidthWithPrefix(trimmed, prefixWidth)
|
||||||
|
|
||||||
// Find the position of the first non-space character in the word
|
// Find the position of the first non-space character in the word
|
||||||
minPos := strings.IndexFunc(trimmed, func(r rune) bool {
|
minPos := strings.IndexFunc(trimmed, func(r rune) bool {
|
||||||
@@ -5713,7 +5726,7 @@ func (t *Terminal) Loop() error {
|
|||||||
capture(true, func(expr string) {
|
capture(true, func(expr string) {
|
||||||
// Split nth expression
|
// Split nth expression
|
||||||
tokens := strings.Split(expr, "|")
|
tokens := strings.Split(expr, "|")
|
||||||
if nth, err := splitNth(tokens[0]); err == nil {
|
if nth, err := splitNth(tokens[0]); err == nil || len(expr) == 0 {
|
||||||
// Changed
|
// Changed
|
||||||
newNth = &nth
|
newNth = &nth
|
||||||
} else {
|
} else {
|
||||||
|
@@ -1415,6 +1415,11 @@ class TestCore < TestInteractive
|
|||||||
tmux.until { assert_match(%r{ --1/10000/10000-- *$}, it[-1]) }
|
tmux.until { assert_match(%r{ --1/10000/10000-- *$}, it[-1]) }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_info_command_inline_right_no_ansi
|
||||||
|
tmux.send_keys(%(seq 10000 | #{FZF} --info-command 'echo -e "--$FZF_POS/$FZF_INFO--"' --info inline-right), :Enter)
|
||||||
|
tmux.until { assert_match(%r{ --1/10000/10000-- *$}, it[-1]) }
|
||||||
|
end
|
||||||
|
|
||||||
def test_info_command_and_focus
|
def test_info_command_and_focus
|
||||||
tmux.send_keys(%(seq 100 | #{FZF} --separator x --info-command 'echo $FZF_POS' --bind focus:clear-query), :Enter)
|
tmux.send_keys(%(seq 100 | #{FZF} --separator x --info-command 'echo $FZF_POS' --bind focus:clear-query), :Enter)
|
||||||
tmux.until { assert_match(/^ 1 xx/, it[-2]) }
|
tmux.until { assert_match(/^ 1 xx/, it[-2]) }
|
||||||
@@ -2045,4 +2050,19 @@ class TestCore < TestInteractive
|
|||||||
tmux.send_keys :b
|
tmux.send_keys :b
|
||||||
tmux.until { |lines| assert_includes lines, '> 9' }
|
tmux.until { |lines| assert_includes lines, '> 9' }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_change_nth_unset_default
|
||||||
|
tmux.send_keys %(echo foo bar | #{FZF} --nth 2 --query fb --bind space:change-nth:), :Enter
|
||||||
|
tmux.until do
|
||||||
|
assert_equal 1, it.item_count
|
||||||
|
assert_equal 0, it.match_count
|
||||||
|
end
|
||||||
|
|
||||||
|
tmux.send_keys :Space
|
||||||
|
|
||||||
|
tmux.until do
|
||||||
|
assert_equal 1, it.item_count
|
||||||
|
assert_equal 1, it.match_count
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user