Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package fzf for openSUSE:Factory checked in at 2023-02-18 17:10:21 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/fzf (Old) and /work/SRC/openSUSE:Factory/.fzf.new.22824 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "fzf" Sat Feb 18 17:10:21 2023 rev:30 rq:1066417 version:0.38.0 Changes: -------- --- /work/SRC/openSUSE:Factory/fzf/fzf.changes 2023-02-07 18:49:20.211212863 +0100 +++ /work/SRC/openSUSE:Factory/.fzf.new.22824/fzf.changes 2023-02-18 17:10:24.410743989 +0100 @@ -1,0 +2,21 @@ +Fri Feb 17 13:29:54 UTC 2023 - Soc Virnyl Estela <[email protected]> + +- Disable LTO +- Replace unused RPM_OPT_FLAGS +- Update to version 0.38.0: + * New actions + - become(...) - Replace the current fzf process with the specified command using execve(2) system call. + See https://github.com/junegunn/fzf#turning-into-a-different-process for more information. + # Open selected files in Vim + fzf --multi --bind 'enter:become(vim {+})' + + # Open the file in Vim and go to the line + git grep --line-number . | + fzf --delimiter : --nth 3.. --bind 'enter:become(vim {1} +{2})' + >> this action is not supported on Windows + - show-preview + - hide-preview + * Bug fixes + - --preview-window 0,hidden should not execute the preview command until toggle-preview action is triggered + +------------------------------------------------------------------- Old: ---- fzf-0.37.0.tar.gz New: ---- fzf-0.38.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ fzf.spec ++++++ --- /var/tmp/diff_new_pack.bMwUWN/_old 2023-02-18 17:10:25.910753460 +0100 +++ /var/tmp/diff_new_pack.bMwUWN/_new 2023-02-18 17:10:25.914753485 +0100 @@ -16,8 +16,9 @@ # +%global _lto_cflags %nil Name: fzf -Version: 0.37.0 +Version: 0.38.0 Release: 0 Summary: A command-line fuzzy finder License: MIT @@ -137,7 +138,9 @@ %else BUILDMOD="-buildmode=pie" %endif -export RPM_OPT_FLAGS="%{optflags}" +export CGO_CFLAGS="%{optflags}" +export CGO_CXXFLAGS="%{optflags}" +export CGO_CPPFLAGS="%{optflags}" go test -v -x -mod=vendor ${BUILDMOD} -a \ -ldflags "-X main.revision=%{version}" \ github.com/junegunn/fzf/src \ ++++++ fzf-0.37.0.tar.gz -> fzf-0.38.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fzf-0.37.0/.github/workflows/winget.yml new/fzf-0.38.0/.github/workflows/winget.yml --- old/fzf-0.37.0/.github/workflows/winget.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/fzf-0.38.0/.github/workflows/winget.yml 2023-02-15 15:24:42.000000000 +0100 @@ -0,0 +1,15 @@ +name: Publish to Winget +on: + release: + types: [released] + +jobs: + publish: + runs-on: windows-latest # Action can only run on Windows + steps: + - uses: vedantmgoyal2009/winget-releaser@v2 + with: + identifier: junegunn.fzf + version: ${{ github.event.release.tag_name }} + installers-regex: '-windows_(armv7|arm64|amd64)\.zip$' + token: ${{ secrets.WINGET_TOKEN }} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fzf-0.37.0/ADVANCED.md new/fzf-0.38.0/ADVANCED.md --- old/fzf-0.37.0/ADVANCED.md 2023-01-24 14:11:14.000000000 +0100 +++ new/fzf-0.38.0/ADVANCED.md 2023-02-15 15:24:42.000000000 +0100 @@ -1,30 +1,33 @@ Advanced fzf examples ====================== -*(Last update: 2022/08/25)* +* *Last update: 2023/02/15* +* *Requires fzf 0.38.0 or above* + +--- <!-- vim-markdown-toc GFM --> * [Introduction](#introduction) * [Screen Layout](#screen-layout) - * [`--height`](#--height) - * [`fzf-tmux`](#fzf-tmux) - * [Popup window support](#popup-window-support) + * [`--height`](#--height) + * [`fzf-tmux`](#fzf-tmux) + * [Popup window support](#popup-window-support) * [Dynamic reloading of the list](#dynamic-reloading-of-the-list) - * [Updating the list of processes by pressing CTRL-R](#updating-the-list-of-processes-by-pressing-ctrl-r) - * [Toggling between data sources](#toggling-between-data-sources) + * [Updating the list of processes by pressing CTRL-R](#updating-the-list-of-processes-by-pressing-ctrl-r) + * [Toggling between data sources](#toggling-between-data-sources) * [Ripgrep integration](#ripgrep-integration) - * [Using fzf as the secondary filter](#using-fzf-as-the-secondary-filter) - * [Using fzf as interactive Ripgrep launcher](#using-fzf-as-interactive-ripgrep-launcher) - * [Switching to fzf-only search mode](#switching-to-fzf-only-search-mode) - * [Switching between Ripgrep mode and fzf mode](#switching-between-ripgrep-mode-and-fzf-mode) + * [Using fzf as the secondary filter](#using-fzf-as-the-secondary-filter) + * [Using fzf as interactive Ripgrep launcher](#using-fzf-as-interactive-ripgrep-launcher) + * [Switching to fzf-only search mode](#switching-to-fzf-only-search-mode) + * [Switching between Ripgrep mode and fzf mode](#switching-between-ripgrep-mode-and-fzf-mode) * [Log tailing](#log-tailing) * [Key bindings for git objects](#key-bindings-for-git-objects) - * [Files listed in `git status`](#files-listed-in-git-status) - * [Branches](#branches) - * [Commit hashes](#commit-hashes) + * [Files listed in `git status`](#files-listed-in-git-status) + * [Branches](#branches) + * [Commit hashes](#commit-hashes) * [Color themes](#color-themes) - * [Generating fzf color theme from Vim color schemes](#generating-fzf-color-theme-from-vim-color-schemes) + * [Generating fzf color theme from Vim color schemes](#generating-fzf-color-theme-from-vim-color-schemes) <!-- vim-markdown-toc --> @@ -236,15 +239,13 @@ # 1. Search for text in files using Ripgrep # 2. Interactively narrow down the list using fzf # 3. Open the file in Vim -IFS=: read -ra selected < <( - rg --color=always --line-number --no-heading --smart-case "${*:-}" | - fzf --ansi \ - --color "hl:-1:underline,hl+:-1:underline:reverse" \ - --delimiter : \ - --preview 'bat --color=always {1} --highlight-line {2}' \ - --preview-window 'up,60%,border-bottom,+{2}+3/3,~3' -) -[ -n "${selected[0]}" ] && vim "${selected[0]}" "+${selected[1]}" +rg --color=always --line-number --no-heading --smart-case "${*:-}" | + fzf --ansi \ + --color "hl:-1:underline,hl+:-1:underline:reverse" \ + --delimiter : \ + --preview 'bat --color=always {1} --highlight-line {2}' \ + --preview-window 'up,60%,border-bottom,+{2}+3/3,~3' \ + --bind 'enter:become(vim {1} +{2})' ``` And run it with an initial query string. @@ -307,8 +308,12 @@ position in the window - `~3` makes the top three lines fixed header so that they are always visible regardless of the scroll offset -- Once we selected a line, we open the file with `vim` (`vim - "${selected[0]}"`) and move the cursor to the line (`+${selected[1]}`). +- Instead of using shell script to process the final output of fzf, we use + `become(...)` action which was added in [fzf 0.38.0][0.38.0] to turn fzf + into a new process that opens the file with `vim` (`vim {1}`) and move the + cursor to the line (`+{2}`). + +[0.38.0]: https://github.com/junegunn/fzf/blob/master/CHANGELOG.md#0380 ### Using fzf as interactive Ripgrep launcher @@ -331,16 +336,14 @@ # 3. Open the file in Vim RG_PREFIX="rg --column --line-number --no-heading --color=always --smart-case " INITIAL_QUERY="${*:-}" -IFS=: read -ra selected < <( - FZF_DEFAULT_COMMAND="$RG_PREFIX $(printf %q "$INITIAL_QUERY")" \ - fzf --ansi \ - --disabled --query "$INITIAL_QUERY" \ - --bind "change:reload:sleep 0.1; $RG_PREFIX {q} || true" \ - --delimiter : \ - --preview 'bat --color=always {1} --highlight-line {2}' \ - --preview-window 'up,60%,border-bottom,+{2}+3/3,~3' -) -[ -n "${selected[0]}" ] && vim "${selected[0]}" "+${selected[1]}" +FZF_DEFAULT_COMMAND="$RG_PREFIX $(printf %q "$INITIAL_QUERY")" \ +fzf --ansi \ + --disabled --query "$INITIAL_QUERY" \ + --bind "change:reload:sleep 0.1; $RG_PREFIX {q} || true" \ + --delimiter : \ + --preview 'bat --color=always {1} --highlight-line {2}' \ + --preview-window 'up,60%,border-bottom,+{2}+3/3,~3' \ + --bind 'enter:become(vim {1} +{2})' ```  @@ -358,8 +361,6 @@ ### Switching to fzf-only search mode -*(Requires fzf 0.27.1 or above)* - In the previous example, we lost fuzzy matching capability as we completely delegated search functionality to Ripgrep. But we can dynamically switch to fzf-only search mode by *"unbinding"* `reload` action from `change` event. @@ -375,19 +376,17 @@ # 3. Open the file in Vim RG_PREFIX="rg --column --line-number --no-heading --color=always --smart-case " INITIAL_QUERY="${*:-}" -IFS=: read -ra selected < <( - FZF_DEFAULT_COMMAND="$RG_PREFIX $(printf %q "$INITIAL_QUERY")" \ - fzf --ansi \ - --color "hl:-1:underline,hl+:-1:underline:reverse" \ - --disabled --query "$INITIAL_QUERY" \ - --bind "change:reload:sleep 0.1; $RG_PREFIX {q} || true" \ - --bind "alt-enter:unbind(change,alt-enter)+change-prompt(2. fzf> )+enable-search+clear-query" \ - --prompt '1. ripgrep> ' \ - --delimiter : \ - --preview 'bat --color=always {1} --highlight-line {2}' \ - --preview-window 'up,60%,border-bottom,+{2}+3/3,~3' -) -[ -n "${selected[0]}" ] && vim "${selected[0]}" "+${selected[1]}" +FZF_DEFAULT_COMMAND="$RG_PREFIX $(printf %q "$INITIAL_QUERY")" \ +fzf --ansi \ + --color "hl:-1:underline,hl+:-1:underline:reverse" \ + --disabled --query "$INITIAL_QUERY" \ + --bind "change:reload:sleep 0.1; $RG_PREFIX {q} || true" \ + --bind "alt-enter:unbind(change,alt-enter)+change-prompt(2. fzf> )+enable-search+clear-query" \ + --prompt '1. ripgrep> ' \ + --delimiter : \ + --preview 'bat --color=always {1} --highlight-line {2}' \ + --preview-window 'up,60%,border-bottom,+{2}+3/3,~3' \ + --bind 'enter:become(vim {1} +{2})' ``` * Phase 1. Filtering with Ripgrep @@ -408,10 +407,8 @@ ### Switching between Ripgrep mode and fzf mode -*(Requires fzf 0.30.0 or above)* - -fzf 0.30.0 added `rebind` action so we can "rebind" the bindings that were -previously "unbound" via `unbind`. +[fzf 0.30.0][0.30.0] added `rebind` action so we can "rebind" the bindings +that were previously "unbound" via `unbind`. This is an improved version of the previous example that allows us to switch between Ripgrep launcher mode and fzf-only filtering mode via CTRL-R and @@ -421,24 +418,33 @@ #!/usr/bin/env bash # Switch between Ripgrep launcher mode (CTRL-R) and fzf filtering mode (CTRL-F) +rm -f /tmp/rg-fzf-{r,f} RG_PREFIX="rg --column --line-number --no-heading --color=always --smart-case " INITIAL_QUERY="${*:-}" -IFS=: read -ra selected < <( - FZF_DEFAULT_COMMAND="$RG_PREFIX $(printf %q "$INITIAL_QUERY")" \ - fzf --ansi \ - --color "hl:-1:underline,hl+:-1:underline:reverse" \ - --disabled --query "$INITIAL_QUERY" \ - --bind "change:reload:sleep 0.1; $RG_PREFIX {q} || true" \ - --bind "ctrl-f:unbind(change,ctrl-f)+change-prompt(2. fzf> )+enable-search+clear-query+rebind(ctrl-r)" \ - --bind "ctrl-r:unbind(ctrl-r)+change-prompt(1. ripgrep> )+disable-search+reload($RG_PREFIX {q} || true)+rebind(change,ctrl-f)" \ - --prompt '1. Ripgrep> ' \ - --delimiter : \ - --header 'â± CTRL-R (Ripgrep mode) â± CTRL-F (fzf mode) â±' \ - --preview 'bat --color=always {1} --highlight-line {2}' \ - --preview-window 'up,60%,border-bottom,+{2}+3/3,~3' -) -[ -n "${selected[0]}" ] && vim "${selected[0]}" "+${selected[1]}" -``` +FZF_DEFAULT_COMMAND="$RG_PREFIX $(printf %q "$INITIAL_QUERY")" \ +fzf --ansi \ + --color "hl:-1:underline,hl+:-1:underline:reverse" \ + --disabled --query "$INITIAL_QUERY" \ + --bind "change:reload:sleep 0.1; $RG_PREFIX {q} || true" \ + --bind "ctrl-f:unbind(change,ctrl-f)+change-prompt(2. fzf> )+enable-search+rebind(ctrl-r)+transform-query(echo {q} > /tmp/rg-fzf-r; cat /tmp/rg-fzf-f)" \ + --bind "ctrl-r:unbind(ctrl-r)+change-prompt(1. ripgrep> )+disable-search+reload($RG_PREFIX {q} || true)+rebind(change,ctrl-f)+transform-query(echo {q} > /tmp/rg-fzf-f; cat /tmp/rg-fzf-r)" \ + --bind "start:unbind(ctrl-r)" \ + --prompt '1. ripgrep> ' \ + --delimiter : \ + --header 'â± CTRL-R (ripgrep mode) â± CTRL-F (fzf mode) â±' \ + --preview 'bat --color=always {1} --highlight-line {2}' \ + --preview-window 'up,60%,border-bottom,+{2}+3/3,~3' \ + --bind 'enter:become(vim {1} +{2})' +``` + +- To restore the query string when switching between modes, we store the + current query in `/tmp/rg-fzf-{r,f}` files and restore the query using + `transform-query` action which was added in [fzf 0.36.0][0.36.0]. +- Also note that we unbind `ctrl-r` binding on `start` event which is + triggered once when fzf starts. + +[0.30.0]: https://github.com/junegunn/fzf/blob/master/CHANGELOG.md#0300 +[0.36.0]: https://github.com/junegunn/fzf/blob/master/CHANGELOG.md#0360 Log tailing ----------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fzf-0.37.0/CHANGELOG.md new/fzf-0.38.0/CHANGELOG.md --- old/fzf-0.37.0/CHANGELOG.md 2023-01-24 14:11:14.000000000 +0100 +++ new/fzf-0.38.0/CHANGELOG.md 2023-02-15 15:24:42.000000000 +0100 @@ -1,6 +1,28 @@ CHANGELOG ========= +0.38.0 +------ +- New actions + - `become(...)` - Replace the current fzf process with the specified + command using `execve(2)` system call. + See https://github.com/junegunn/fzf#turning-into-a-different-process for + more information. + ```sh + # Open selected files in Vim + fzf --multi --bind 'enter:become(vim {+})' + + # Open the file in Vim and go to the line + git grep --line-number . | + fzf --delimiter : --nth 3.. --bind 'enter:become(vim {1} +{2})' + ``` + - This action is not supported on Windows + - `show-preview` + - `hide-preview` +- Bug fixes + - `--preview-window 0,hidden` should not execute the preview command until + `toggle-preview` action is triggered + 0.37.0 ------ - Added a way to customize the separator of inline info diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fzf-0.37.0/README.md new/fzf-0.38.0/README.md --- old/fzf-0.37.0/README.md 2023-01-24 14:11:14.000000000 +0100 +++ new/fzf-0.38.0/README.md 2023-02-15 15:24:42.000000000 +0100 @@ -54,6 +54,7 @@ * [Advanced topics](#advanced-topics) * [Performance](#performance) * [Executing external programs](#executing-external-programs) + * [Turning into a different process](#turning-into-a-different-process) * [Reloading the candidate list](#reloading-the-candidate-list) * [1. Update the list of processes by pressing CTRL-R](#1-update-the-list-of-processes-by-pressing-ctrl-r) * [2. Switch between sources by pressing CTRL-D or CTRL-F](#2-switch-between-sources-by-pressing-ctrl-d-or-ctrl-f) @@ -136,15 +137,17 @@ ### Windows Pre-built binaries for Windows can be downloaded [here][bin]. fzf is also -available via [Chocolatey][choco] and [Scoop][scoop]: +available via [Chocolatey][choco], [Scoop][scoop], and [Winget][winget]: -| Package manager | Command | -| --- | --- | -| Chocolatey | `choco install fzf` | -| Scoop | `scoop install fzf` | +| Package manager | Command | +| --- | --- | +| Chocolatey | `choco install fzf` | +| Scoop | `scoop install fzf` | +| Winget | `winget install fzf` | [choco]: https://chocolatey.org/packages/fzf [scoop]: https://github.com/ScoopInstaller/Main/blob/master/bucket/fzf.json +[winget]: https://github.com/microsoft/winget-pkgs/tree/master/manifests/j/junegunn/fzf Known issues and limitations on Windows can be found on [the wiki page][windows-wiki]. @@ -202,6 +205,22 @@ vim $(fzf) ``` +> *:bulb: A more robust solution would be to use `xargs` but we've presented +> the above as it's easier to grasp* +> ```sh +> fzf --print0 | xargs -0 -o vim +> ``` + +> +> *:bulb: fzf also has the ability to turn itself into a different process.* +> +> ```sh +> fzf --bind 'enter:become(vim {})' +> ``` +> +> *See [Turning into a different process](#turning-into-a-different-process) +> for more information.* + ### Using the finder - `CTRL-K` / `CTRL-J` (or `CTRL-P` / `CTRL-N`) to move cursor up and down @@ -560,6 +579,47 @@ See *KEY BINDINGS* section of the man page for details. +### Turning into a different process + +`become(...)` is similar to `execute(...)`/`execute-silent(...)` described +above, but instead of executing the command and coming back to fzf on +complete, it turns fzf into a new process for the command. + +```sh +fzf --bind 'enter:become(vim {})' +``` + +Compared to the seemingly equivalent command substitution `vim "$(fzf)"`, this +approach has several advantages: + +* Vim will not open an empty file when you terminate fzf with + <kbd>CTRL-C</kbd> +* Vim will not open an empty file when you press <kbd>ENTER</kbd> on an empty + result +* Can handle multiple selections even when they have whitespaces + ```sh + fzf --multi --bind 'enter:become(vim {+})' + ``` + +To be fair, running `fzf --print0 | xargs -0 -o vim` instead of `vim "$(fzf)"` +resolves all of the issues mentioned. Nonetheless, `become(...)` still offers +additional benefits in different scenarios. + +* You can set up multiple bindings to handle the result in different ways + without any wrapping script + ```sh + fzf --bind 'enter:become(vim {}),ctrl-e:become(emacs {})' + ``` + * Previously, you would have to use `--expect=ctrl-e` and check the first + line of the output of fzf +* You can easily build the subsequent command using the field index + expressions of fzf + ```sh + # Open the file in Vim and go to the line + git grep --line-number . | + fzf --delimiter : --nth 3.. --bind 'enter:become(vim {1} +{2})' + ``` + ### Reloading the candidate list By binding `reload` action to a key or an event, you can make fzf dynamically diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fzf-0.37.0/bin/fzf-tmux new/fzf-0.38.0/bin/fzf-tmux --- old/fzf-0.37.0/bin/fzf-tmux 2023-01-24 14:11:14.000000000 +0100 +++ new/fzf-0.38.0/bin/fzf-tmux 2023-02-15 15:24:42.000000000 +0100 @@ -179,9 +179,10 @@ envs="export TERM=$TERM " if [[ "$opt" =~ "-E" ]]; then - FZF_DEFAULT_OPTS="--margin 0,1 $FZF_DEFAULT_OPTS" tmux_version=$(tmux -V) - if [[ ! $tmux_version =~ 3\.2 ]]; then + if [[ $tmux_version =~ ^tmux\ 3\.2[a-z]?$ ]]; then + FZF_DEFAULT_OPTS="--margin 0,1 $FZF_DEFAULT_OPTS" + else FZF_DEFAULT_OPTS="--border $FZF_DEFAULT_OPTS" opt="-B $opt" fi diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fzf-0.37.0/install new/fzf-0.38.0/install --- old/fzf-0.37.0/install 2023-01-24 14:11:14.000000000 +0100 +++ new/fzf-0.38.0/install 2023-02-15 15:24:42.000000000 +0100 @@ -2,7 +2,7 @@ set -u -version=0.37.0 +version=0.38.0 auto_completion= key_bindings= update_config=2 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fzf-0.37.0/install.ps1 new/fzf-0.38.0/install.ps1 --- old/fzf-0.37.0/install.ps1 2023-01-24 14:11:14.000000000 +0100 +++ new/fzf-0.38.0/install.ps1 2023-02-15 15:24:42.000000000 +0100 @@ -1,4 +1,4 @@ -$version="0.37.0" +$version="0.38.0" $fzf_base=Split-Path -Parent $MyInvocation.MyCommand.Definition diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fzf-0.37.0/main.go new/fzf-0.38.0/main.go --- old/fzf-0.37.0/main.go 2023-01-24 14:11:14.000000000 +0100 +++ new/fzf-0.38.0/main.go 2023-02-15 15:24:42.000000000 +0100 @@ -5,7 +5,7 @@ "github.com/junegunn/fzf/src/protector" ) -var version string = "0.37" +var version string = "0.38" var revision string = "devel" func main() { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fzf-0.37.0/man/man1/fzf-tmux.1 new/fzf-0.38.0/man/man1/fzf-tmux.1 --- old/fzf-0.37.0/man/man1/fzf-tmux.1 2023-01-24 14:11:14.000000000 +0100 +++ new/fzf-0.38.0/man/man1/fzf-tmux.1 2023-02-15 15:24:42.000000000 +0100 @@ -21,7 +21,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. .. -.TH fzf-tmux 1 "Jan 2023" "fzf 0.37.0" "fzf-tmux - open fzf in tmux split pane" +.TH fzf-tmux 1 "Feb 2023" "fzf 0.38.0" "fzf-tmux - open fzf in tmux split pane" .SH NAME fzf-tmux - open fzf in tmux split pane diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fzf-0.37.0/man/man1/fzf.1 new/fzf-0.38.0/man/man1/fzf.1 --- old/fzf-0.37.0/man/man1/fzf.1 2023-01-24 14:11:14.000000000 +0100 +++ new/fzf-0.38.0/man/man1/fzf.1 2023-02-15 15:24:42.000000000 +0100 @@ -21,7 +21,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. .. -.TH fzf 1 "Jan 2023" "fzf 0.37.0" "fzf - a command-line fuzzy finder" +.TH fzf 1 "Feb 2023" "fzf 0.38.0" "fzf - a command-line fuzzy finder" .SH NAME fzf - a command-line fuzzy finder @@ -999,6 +999,7 @@ \fBbackward-delete-char/eof\fR (same as \fBbackward-delete-char\fR except aborts fzf if query is empty) \fBbackward-kill-word\fR \fIalt-bs\fR \fBbackward-word\fR \fIalt-b shift-left\fR + \fBbecome(...)\fR (replace fzf process with the specified command; see below for the details) \fBbeginning-of-line\fR \fIctrl-a home\fR \fBcancel\fR (clear query string if not empty, abort fzf otherwise) \fBchange-border-label(...)\fR (change \fB--border-label\fR to the given string) @@ -1036,6 +1037,7 @@ \fBpage-up\fR \fIpgup\fR \fBhalf-page-down\fR \fBhalf-page-up\fR + \fBhide-preview\fR \fBpos(...)\fR (move cursor to the numeric position; negative number to count from the end) \fBprev-history\fR (\fIctrl-p\fR on \fB--history\fR) \fBprev-selected\fR (move to the previous selected item) @@ -1058,6 +1060,7 @@ \fBreplace-query\fR (replace query string with the current selection) \fBselect\fR \fBselect-all\fR (select all matches) + \fBshow-preview\fR \fBtoggle\fR (\fIright-click\fR) \fBtoggle-all\fR (toggle all matches) \fBtoggle+down\fR \fIctrl-i (tab)\fR @@ -1141,6 +1144,14 @@ set, otherwise with \fBsh -c\fR, so in this case make sure that the command is POSIX-compliant. +\fBbecome(...)\fR action is similar to \fBexecute(...)\fR, but it replaces the +current fzf process with the specifed command using \fBexecve(2)\fR system +call. + + \fBfzf --bind "enter:become(vim {})"\fR + +\fBbecome(...)\fR is not supported on Windows. + .SS RELOAD INPUT \fBreload(...)\fR action is used to dynamically update the input list diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fzf-0.37.0/plugin/fzf.vim new/fzf-0.38.0/plugin/fzf.vim --- old/fzf-0.37.0/plugin/fzf.vim 2023-01-24 14:11:14.000000000 +0100 +++ new/fzf-0.38.0/plugin/fzf.vim 2023-02-15 15:24:42.000000000 +0100 @@ -512,9 +512,7 @@ let optstr .= ' --height='.height endif " Respect --border option given in 'options' - if stridx(optstr, '--border') < 0 && stridx(optstr, '--no-border') < 0 - let optstr .= s:border_opt(get(dict, 'window', 0)) - endif + let optstr = join([s:border_opt(get(dict, 'window', 0)), optstr]) let prev_default_command = $FZF_DEFAULT_COMMAND if len(source_command) let $FZF_DEFAULT_COMMAND = source_command @@ -741,7 +739,7 @@ return size endif let margin = match(opts, '--inline-info\|--info[^-]\{-}inline') > match(opts, '--no-inline-info\|--info[^-]\{-}\(default\|hidden\)') ? 1 : 2 - let margin += stridx(opts, '--border') > stridx(opts, '--no-border') ? 2 : 0 + let margin += match(opts, '--border\([^-]\|$\)') > match(opts, '--no-border\([^-]\|$\)') ? 2 : 0 if stridx(opts, '--header') > stridx(opts, '--no-header') let margin += len(split(opts, "\n")) endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fzf-0.37.0/shell/completion.bash new/fzf-0.38.0/shell/completion.bash --- old/fzf-0.37.0/shell/completion.bash 2023-01-24 14:11:14.000000000 +0100 +++ new/fzf-0.38.0/shell/completion.bash 2023-02-15 15:24:42.000000000 +0100 @@ -373,7 +373,7 @@ } # Environment variables / Aliases / Hosts / Process -_fzf_setup_completion 'var' export unset +_fzf_setup_completion 'var' export unset printenv _fzf_setup_completion 'alias' unalias _fzf_setup_completion 'host' ssh telnet _fzf_setup_completion 'proc' kill diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fzf-0.37.0/src/options.go new/fzf-0.38.0/src/options.go --- old/fzf-0.37.0/src/options.go 2023-01-24 14:11:14.000000000 +0100 +++ new/fzf-0.38.0/src/options.go 2023-02-15 15:24:42.000000000 +0100 @@ -10,6 +10,7 @@ "github.com/junegunn/fzf/src/algo" "github.com/junegunn/fzf/src/tui" + "github.com/junegunn/fzf/src/util" "github.com/mattn/go-runewidth" "github.com/mattn/go-shellwords" @@ -921,7 +922,7 @@ func init() { executeRegexp = regexp.MustCompile( - `(?si)[:+](execute(?:-multi|-silent)?|reload(?:-sync)?|preview|(?:change|transform)-(?:query|prompt|border-label|preview-label)|change-preview-window|change-preview|(?:re|un)bind|pos|put)`) + `(?si)[:+](become|execute(?:-multi|-silent)?|reload(?:-sync)?|preview|(?:change|transform)-(?:query|prompt|border-label|preview-label)|change-preview-window|change-preview|(?:re|un)bind|pos|put)`) splitRegexp = regexp.MustCompile("[,:]+") actionNameRegexp = regexp.MustCompile("(?i)^[a-z-]+") } @@ -1111,6 +1112,10 @@ appendAction(actPrevSelected) case "next-selected": appendAction(actNextSelected) + case "show-preview": + appendAction(actShowPreview) + case "hide-preview": + appendAction(actHidePreview) case "toggle-preview": appendAction(actTogglePreview) case "toggle-preview-wrap": @@ -1167,6 +1172,10 @@ actions = append(actions, &action{t: t, a: actionArg}) } switch t { + case actBecome: + if util.IsWindows() { + exit("become action is not supported on Windows") + } case actUnbind, actRebind: parseKeyChordsImpl(actionArg, spec[0:offset]+" target required", exit) case actChangePreviewWindow: @@ -1219,6 +1228,8 @@ prefix := actionNameRegexp.FindString(str) switch prefix { + case "become": + return actBecome case "reload": return actReload case "reload-sync": diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fzf-0.37.0/src/terminal.go new/fzf-0.38.0/src/terminal.go --- old/fzf-0.37.0/src/terminal.go 2023-01-24 14:11:14.000000000 +0100 +++ new/fzf-0.38.0/src/terminal.go 2023-02-15 15:24:42.000000000 +0100 @@ -6,6 +6,7 @@ "io/ioutil" "math" "os" + "os/exec" "os/signal" "regexp" "sort" @@ -104,7 +105,6 @@ version int64 lines []string offset int - enabled bool scrollable bool final bool following resumableState @@ -350,6 +350,8 @@ actRefreshPreview actReplaceQuery actToggleSort + actShowPreview + actHidePreview actTogglePreview actTogglePreviewWrap actTransformBorderLabel @@ -386,6 +388,7 @@ actDeselect actUnbind actRebind + actBecome ) type placeholderFlags struct { @@ -643,7 +646,7 @@ reqBox: util.NewEventBox(), initialPreviewOpts: opts.Preview, previewOpts: opts.Preview, - previewer: previewer{0, []string{}, 0, len(opts.Preview.command) > 0, false, true, disabledState, "", []bool{}}, + previewer: previewer{0, []string{}, 0, false, true, disabledState, "", []bool{}}, previewed: previewed{0, 0, 0, false}, previewBox: previewBox, eventBox: eventBox, @@ -1032,7 +1035,7 @@ if t.noInfoLine() { minAreaHeight -= 1 } - if t.mayNeedPreviewWindow() { + if t.needPreviewWindow() { minPreviewHeight := 1 + borderLines(t.previewOpts.border) minPreviewWidth := 5 switch t.previewOpts.position { @@ -1115,7 +1118,7 @@ // Set up preview window noBorder := tui.MakeBorderStyle(tui.BorderNone, t.unicode) - if t.mayNeedPreviewWindow() { + if forcePreview || t.needPreviewWindow() { var resizePreviewWindows func(previewOpts *previewOpts) resizePreviewWindows = func(previewOpts *previewOpts) { t.activePreviewOpts = previewOpts @@ -1244,6 +1247,8 @@ } } resizePreviewWindows(&t.previewOpts) + } else { + t.activePreviewOpts = &t.previewOpts } // Without preview window @@ -2234,7 +2239,7 @@ func (t *Terminal) executeCommand(template string, forcePlus bool, background bool, captureFirstLine bool) string { line := "" - valid, list := t.buildPlusList(template, forcePlus, false) + valid, list := t.buildPlusList(template, forcePlus) // captureFirstLine is used for transform-{prompt,query} and we don't want to // return an empty string in those cases if !valid && !captureFirstLine { @@ -2273,13 +2278,13 @@ return t.previewBox != nil } -func (t *Terminal) mayNeedPreviewWindow() bool { - return t.hasPreviewer() && t.previewer.enabled && t.previewOpts.Visible() +func (t *Terminal) needPreviewWindow() bool { + return t.hasPreviewer() && len(t.previewOpts.command) > 0 && t.previewOpts.Visible() } // Check if previewer is currently in action (invisible previewer with size 0 or visible previewer) -func (t *Terminal) isPreviewEnabled() bool { - return t.hasPreviewer() && t.previewer.enabled && (!t.previewOpts.Visible() || t.pwindow != nil) +func (t *Terminal) canPreview() bool { + return t.hasPreviewer() && (!t.previewOpts.Visible() && !t.previewOpts.hidden || t.hasPreviewWindow()) } func (t *Terminal) hasPreviewWindow() bool { @@ -2294,10 +2299,10 @@ return nil } -func (t *Terminal) buildPlusList(template string, forcePlus bool, forceEvaluation bool) (bool, []*Item) { +func (t *Terminal) buildPlusList(template string, forcePlus bool) (bool, []*Item) { current := t.currentItem() slot, plus, query := hasPreviewFlags(template) - if !forceEvaluation && !(!slot || query || (forcePlus || plus) && len(t.selected) > 0) { + if !(!slot || query || (forcePlus || plus) && len(t.selected) > 0) { return current != nil, []*Item{current, current} } @@ -2387,7 +2392,7 @@ pad := fitpad.pad t.tui.Resize(func(termHeight int) int { contentHeight := fit + t.extraLines() - if t.mayNeedPreviewWindow() { + if t.needPreviewWindow() { if t.previewOpts.aboveOrBelow() { if t.previewOpts.size.percent { newContentHeight := int(float64(contentHeight) * 100. / (100. - t.previewOpts.size.size)) @@ -2621,8 +2626,8 @@ } refreshPreview := func(command string) { - if len(command) > 0 && t.isPreviewEnabled() { - _, list := t.buildPlusList(command, false, false) + if len(command) > 0 && t.canPreview() { + _, list := t.buildPlusList(command, false) t.cancelPreview() t.previewBox.Set(reqPreviewEnqueue, previewRequest{command, t.pwindow, t.evaluateScrollOffset(), list}) } @@ -2696,7 +2701,7 @@ case reqFullRedraw: wasHidden := t.pwindow == nil t.redraw() - if wasHidden && t.pwindow != nil { + if wasHidden && t.hasPreviewWindow() { refreshPreview(t.previewOpts.command) } case reqClose: @@ -2857,6 +2862,24 @@ doAction = func(a *action) bool { switch a.t { case actIgnore: + case actBecome: + valid, list := t.buildPlusList(a.a, false) + if valid { + command := t.replacePlaceholder(a.a, false, string(t.input), list) + shell := os.Getenv("SHELL") + if len(shell) == 0 { + shell = "sh" + } + shellPath, err := exec.LookPath(shell) + if err == nil { + t.tui.Close() + if t.history != nil { + t.history.append(string(t.input)) + } + util.SetStdin(tui.TtyIn()) + syscall.Exec(shellPath, []string{shell, "-c", command}, os.Environ()) + } + } case actExecute, actExecuteSilent: t.executeCommand(a.a, false, a.t == actExecuteSilent, false) case actExecuteMulti: @@ -2864,16 +2887,21 @@ case actInvalid: t.mutex.Unlock() return false - case actTogglePreview: - if t.hasPreviewer() { - if t.activePreviewOpts != nil { - t.activePreviewOpts.Toggle() - } else if !t.previewOpts.Visible() { - t.previewer.enabled = !t.previewer.enabled - } + case actTogglePreview, actShowPreview, actHidePreview: + var act bool + switch a.t { + case actShowPreview: + act = !t.hasPreviewWindow() && len(t.previewOpts.command) > 0 + case actHidePreview: + act = t.hasPreviewWindow() + case actTogglePreview: + act = t.hasPreviewWindow() || len(t.previewOpts.command) > 0 + } + if act { + t.activePreviewOpts.Toggle() updatePreviewWindow(false) - if t.isPreviewEnabled() { - valid, list := t.buildPlusList(t.previewOpts.command, false, false) + if t.canPreview() { + valid, list := t.buildPlusList(t.previewOpts.command, false) if valid { t.cancelPreview() t.previewBox.Set(reqPreviewEnqueue, @@ -2968,7 +2996,6 @@ t.prompt, t.promptLen = t.parsePrompt(a.a) req(reqPrompt) case actPreview: - t.previewer.enabled = true updatePreviewWindow(true) refreshPreview(a.a) case actRefreshPreview: @@ -3353,7 +3380,7 @@ case actReload, actReloadSync: t.failed = nil - valid, list := t.buildPlusList(a.a, false, false) + valid, list := t.buildPlusList(a.a, false) if !valid { // We run the command even when there's no match // 1. If the template doesn't have any slots @@ -3381,9 +3408,8 @@ } case actChangePreview: if t.previewOpts.command != a.a { - t.previewer.enabled = len(a.a) > 0 - updatePreviewWindow(false) t.previewOpts.command = a.a + updatePreviewWindow(false) refreshPreview(t.previewOpts.command) } case actChangePreviewWindow: @@ -3403,7 +3429,7 @@ if !currentPreviewOpts.sameLayout(t.previewOpts) { wasHidden := t.pwindow == nil updatePreviewWindow(false) - if wasHidden && t.pwindow != nil { + if wasHidden && t.hasPreviewWindow() { refreshPreview(t.previewOpts.command) } else { req(reqPreviewRefresh) @@ -3480,12 +3506,10 @@ req(reqList) } - if queryChanged { - if t.isPreviewEnabled() { - _, _, q := hasPreviewFlags(t.previewOpts.command) - if q { - t.version++ - } + if queryChanged && t.canPreview() && len(t.previewOpts.command) > 0 { + _, _, q := hasPreviewFlags(t.previewOpts.command) + if q { + t.version++ } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fzf-0.37.0/src/util/util_unix.go new/fzf-0.38.0/src/util/util_unix.go --- old/fzf-0.37.0/src/util/util_unix.go 2023-01-24 14:11:14.000000000 +0100 +++ new/fzf-0.38.0/src/util/util_unix.go 2023-02-15 15:24:42.000000000 +0100 @@ -6,6 +6,8 @@ "os" "os/exec" "syscall" + + "golang.org/x/sys/unix" ) // ExecCommand executes the given command with $SHELL @@ -45,3 +47,7 @@ func Read(fd int, b []byte) (int, error) { return syscall.Read(int(fd), b) } + +func SetStdin(file *os.File) { + unix.Dup2(int(file.Fd()), 0) +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fzf-0.37.0/src/util/util_windows.go new/fzf-0.38.0/src/util/util_windows.go --- old/fzf-0.37.0/src/util/util_windows.go 2023-01-24 14:11:14.000000000 +0100 +++ new/fzf-0.38.0/src/util/util_windows.go 2023-02-15 15:24:42.000000000 +0100 @@ -81,3 +81,7 @@ func Read(fd int, b []byte) (int, error) { return syscall.Read(syscall.Handle(fd), b) } + +func SetStdin(file *os.File) { + // No-op +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fzf-0.37.0/test/test_go.rb new/fzf-0.38.0/test/test_go.rb --- old/fzf-0.37.0/test/test_go.rb 2023-01-24 14:11:14.000000000 +0100 +++ new/fzf-0.38.0/test/test_go.rb 2023-02-15 15:24:42.000000000 +0100 @@ -180,7 +180,7 @@ end def writelines(path, lines) - File.unlink(path) while File.exist?(path) + FileUtils.rm_f(path) while File.exist?(path) File.open(path, 'w') { |f| f.puts lines } end @@ -188,7 +188,7 @@ wait { assert_path_exists tempname } File.read(tempname) ensure - File.unlink(tempname) while File.exist?(tempname) + FileUtils.rm_f(tempname) while File.exist?(tempname) @temp_suffix += 1 tmux.prepare end @@ -905,11 +905,7 @@ history_file = '/tmp/fzf-test-history' # History with limited number of entries - begin - File.unlink(history_file) - rescue StandardError - nil - end + FileUtils.rm_f(history_file) opts = "--history=#{history_file} --history-size=4" input = %w[00 11 22 33 44] input.each do |keys| @@ -955,7 +951,7 @@ tmux.until { |lines| assert_equal '> 33', lines[-1] } tmux.send_keys :Enter ensure - File.unlink(history_file) + FileUtils.rm_f(history_file) end def test_execute @@ -984,11 +980,7 @@ ], File.readlines(output, chomp: true) end ensure - begin - File.unlink(output) - rescue StandardError - nil - end + FileUtils.rm_f(output) end def test_execute_multi @@ -1013,20 +1005,12 @@ ], File.readlines(output, chomp: true) end ensure - begin - File.unlink(output) - rescue StandardError - nil - end + FileUtils.rm_f(output) end def test_execute_plus_flag output = tempname + '.tmp' - begin - File.unlink(output) - rescue StandardError - nil - end + FileUtils.rm_f(output) writelines(tempname, ['foo bar', '123 456']) tmux.send_keys "cat #{tempname} | #{FZF} --multi --bind 'x:execute-silent(echo {+}/{}/{+2}/{2} >> #{output})'", :Enter @@ -1059,21 +1043,13 @@ ], File.readlines(output, chomp: true) end rescue StandardError - begin - File.unlink(output) - rescue StandardError - nil - end + FileUtils.rm_f(output) end def test_execute_shell # Custom script to use as $SHELL output = tempname + '.out' - begin - File.unlink(output) - rescue StandardError - nil - end + FileUtils.rm_f(output) writelines(tempname, ['#!/usr/bin/env bash', "echo $1 / $2 > #{output}"]) system("chmod +x #{tempname}") @@ -1087,11 +1063,7 @@ assert_equal ["-c / 'foo'bar"], File.readlines(output, chomp: true) end ensure - begin - File.unlink(output) - rescue StandardError - nil - end + FileUtils.rm_f(output) end def test_cycle @@ -1485,6 +1457,83 @@ tmux.until { |lines| assert_includes lines[1], ' {5-1 3 4} ' } end + def test_toggle_preview_without_default_preview_command + tmux.send_keys %(seq 100 | #{FZF} --bind 'space:preview(echo [{}]),enter:toggle-preview' --preview-window up,border-double), :Enter + tmux.until do |lines| + assert_equal 100, lines.match_count + refute_includes lines[1], 'â [1]' + end + + # toggle-preview should do nothing + tmux.send_keys :Enter + tmux.until { |lines| refute_includes lines[1], 'â [1]' } + tmux.send_keys :Up + tmux.until do |lines| + refute_includes lines[1], 'â [1]' + refute_includes lines[1], 'â [2]' + end + + tmux.send_keys :Up + tmux.until do |lines| + assert_includes lines, '> 3' + refute_includes lines[1], 'â [3]' + end + + # One-off preview action + tmux.send_keys :Space + tmux.until { |lines| assert_includes lines[1], 'â [3]' } + + # toggle-preview to hide it + tmux.send_keys :Enter + tmux.until { |lines| refute_includes lines[1], 'â [3]' } + + # toggle-preview again does nothing + tmux.send_keys :Enter, :Up + tmux.until do |lines| + assert_includes lines, '> 4' + refute_includes lines[1], 'â [4]' + end + end + + def test_show_and_hide_preview + tmux.send_keys %(seq 100 | #{FZF} --preview-window hidden,border-bold --preview 'echo [{}]' --bind 'a:show-preview,b:hide-preview'), :Enter + + # Hidden by default + tmux.until do |lines| + assert_equal 100, lines.match_count + refute_includes lines[1], 'â [1]' + end + + # Show + tmux.send_keys :a + tmux.until { |lines| assert_includes lines[1], 'â [1]' } + + # Already shown + tmux.send_keys :a + tmux.send_keys :Up + tmux.until { |lines| assert_includes lines[1], 'â [2]' } + + # Hide + tmux.send_keys :b + tmux.send_keys :Up + tmux.until do |lines| + assert_includes lines, '> 3' + refute_includes lines[1], 'â [3]' + end + + # Already hidden + tmux.send_keys :b + tmux.send_keys :Up + tmux.until do |lines| + assert_includes lines, '> 4' + refute_includes lines[1], 'â [4]' + end + + # Show it again + tmux.send_keys :a + tmux.until { |lines| assert_includes lines[1], 'â [4]' } + end + def test_preview_hidden tmux.send_keys %(seq 1000 | #{FZF} --preview 'echo {{}-{}-$FZF_PREVIEW_LINES-$FZF_PREVIEW_COLUMNS}' --preview-window down:1:hidden --bind ?:toggle-preview), :Enter tmux.until { |lines| assert_equal '>', lines[-1] } @@ -1497,11 +1546,7 @@ end def test_preview_size_0 - begin - File.unlink(tempname) - rescue StandardError - nil - end + FileUtils.rm_f(tempname) tmux.send_keys %(seq 100 | #{FZF} --reverse --preview 'echo {} >> #{tempname}; echo ' --preview-window 0 --bind space:toggle-preview), :Enter tmux.until do |lines| assert_equal 100, lines.item_count @@ -1526,6 +1571,32 @@ end end + def test_preview_size_0_hidden + FileUtils.rm_f(tempname) + tmux.send_keys %(seq 100 | #{FZF} --reverse --preview 'echo {} >> #{tempname}; echo ' --preview-window 0,hidden --bind space:toggle-preview), :Enter + tmux.until { |lines| assert_equal 100, lines.item_count } + tmux.send_keys :Down, :Down + tmux.until { |lines| assert_includes lines, '> 3' } + wait { refute_path_exists tempname } + tmux.send_keys :Space + wait do + assert_path_exists tempname + assert_equal %w[3], File.readlines(tempname, chomp: true) + end + tmux.send_keys :Down + wait do + assert_equal %w[3 4], File.readlines(tempname, chomp: true) + end + tmux.send_keys :Space, :Down + tmux.until { |lines| assert_includes lines, '> 5' } + tmux.send_keys :Down + tmux.until { |lines| assert_includes lines, '> 6' } + tmux.send_keys :Space + wait do + assert_equal %w[3 4 6], File.readlines(tempname, chomp: true) + end + end + def test_preview_flags tmux.send_keys %(seq 10 | sed 's/^/:: /; s/$/ /' | #{FZF} --multi --preview 'echo {{2}/{s2}/{+2}/{+s2}/{q}/{n}/{+n}}'), :Enter @@ -2087,11 +2158,7 @@ wait { refute system("pgrep -f #{script}") } ensure system("pkill -9 -f #{script}") - begin - File.unlink(script) - rescue StandardError - nil - end + FileUtils.rm_f(script) end def test_kill_default_command_on_accept @@ -2109,11 +2176,7 @@ wait { refute system("pgrep -f #{script}") } ensure system("pkill -9 -f #{script}") - begin - File.unlink(script) - rescue StandardError - nil - end + FileUtils.rm_f(script) end def test_kill_reload_command_on_abort @@ -2134,11 +2197,7 @@ wait { refute system("pgrep -f #{script}") } ensure system("pkill -9 -f #{script}") - begin - File.unlink(script) - rescue StandardError - nil - end + FileUtils.rm_f(script) end def test_kill_reload_command_on_accept @@ -2158,11 +2217,7 @@ wait { refute system("pgrep -f #{script}") } ensure system("pkill -9 -f #{script}") - begin - File.unlink(script) - rescue StandardError - nil - end + FileUtils.rm_f(script) end def test_preview_header @@ -2588,6 +2643,19 @@ tmux.send_keys :Space tmux.until { |lines| assert_includes lines, '/1/1/' } end + + def test_become + tmux.send_keys "seq 100 | #{FZF} --bind 'enter:become:seq {} | #{FZF}'", :Enter + tmux.until { |lines| assert_equal 100, lines.item_count } + tmux.send_keys 999 + tmux.until { |lines| assert_equal 0, lines.match_count } + tmux.send_keys :Enter + tmux.until { |lines| assert_equal 0, lines.match_count } + tmux.send_keys :BSpace + tmux.until { |lines| assert_equal 1, lines.match_count } + tmux.send_keys :Enter + tmux.until { |lines| assert_equal 99, lines.item_count } + end end module TestShell ++++++ vendor.tar.zst ++++++ Binary files /var/tmp/diff_new_pack.bMwUWN/_old and /var/tmp/diff_new_pack.bMwUWN/_new differ
