Hello community, here is the log from the commit of package fzf for openSUSE:Factory checked in at 2020-10-26 16:20:45 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/fzf (Old) and /work/SRC/openSUSE:Factory/.fzf.new.3463 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "fzf" Mon Oct 26 16:20:45 2020 rev:10 rq:843822 version:0.23.1 Changes: -------- --- /work/SRC/openSUSE:Factory/fzf/fzf.changes 2020-08-04 20:23:01.653006301 +0200 +++ /work/SRC/openSUSE:Factory/.fzf.new.3463/fzf.changes 2020-10-26 16:21:52.371203429 +0100 @@ -1,0 +2,53 @@ +Sat Oct 24 22:08:02 UTC 2020 - Matej Cepl <mc...@suse.com> + +- Update to 0.24.1: + - Real-time rendering of preview window + # fzf can render preview window before the command completes + fzf --preview 'sleep 1; for i in $(seq 100); do echo $i; sleep 0.01; done' + + # Preview window can process ANSI escape sequence (CSI 2 J) for clearing the display + fzf --preview 'for i in $(seq 100000); do + (( i % 200 == 0 )) && printf "\033[2J" + echo "$i" + sleep 0.01 + done' + + - To indicate if --multi mode is enabled, fzf will print the number of + selected items even when no item is selected + + seq 100 | fzf + # 100/100 + seq 100 | fzf --multi + # 100/100 (0) + seq 100 | fzf --multi 5 + # 100/100 (0/5) + + - Added --preview-window options for disabling flags + nocycle + nohidden + nowrap + default + + - Support preview scroll offset relative to window height + + git grep --line-number '' | + fzf --delimiter : \ + --preview 'bat --style=numbers --color=always --highlight-line {2} {1}' \ + --preview-window +{2}-/2 + + - Added --preview-window option for sharp edges (--preview-window + sharp) + - Added --preview-window option for cyclic scrolling (--preview-window + cycle) + - Reduced vertical padding around the preview window when + --preview-window noborder is used + - Added actions for preview window + preview-half-page-up + preview-half-page-down + - Vim + - Popup width and height can be given in absolute integer values + - Added fzf#exec() function for getting the path of fzf executable + It also downloads the latest binary if it's not available by + running ./install --bin + +------------------------------------------------------------------- Old: ---- fzf-0.22.0.tar.gz New: ---- fzf-0.23.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ fzf.spec ++++++ --- /var/tmp/diff_new_pack.zH1Blr/_old 2020-10-26 16:21:53.939204690 +0100 +++ /var/tmp/diff_new_pack.zH1Blr/_new 2020-10-26 16:21:53.943204693 +0100 @@ -17,7 +17,7 @@ Name: fzf -Version: 0.22.0 +Version: 0.23.1 Release: 0 Summary: A command-line fuzzy finder License: MIT ++++++ fzf-0.22.0.tar.gz -> fzf-0.23.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fzf-0.22.0/CHANGELOG.md new/fzf-0.23.1/CHANGELOG.md --- old/fzf-0.22.0/CHANGELOG.md 2020-08-02 08:56:02.000000000 +0200 +++ new/fzf-0.23.1/CHANGELOG.md 2020-10-10 19:04:07.000000000 +0200 @@ -1,6 +1,40 @@ CHANGELOG ========= +0.23.1 +------ +- Added `--preview-window` options for disabling flags + - `nocycle` + - `nohidden` + - `nowrap` + - `default` +- Built with Go 1.14.9 due to performance regression + - https://github.com/golang/go/issues/40727 + +0.23.0 +------ +- Support preview scroll offset relative to window height + ```sh + git grep --line-number '' | + fzf --delimiter : \ + --preview 'bat --style=numbers --color=always --highlight-line {2} {1}' \ + --preview-window +{2}-/2 + ``` +- Added `--preview-window` option for sharp edges (`--preview-window sharp`) +- Added `--preview-window` option for cyclic scrolling (`--preview-window cycle`) +- Reduced vertical padding around the preview window when `--preview-window + noborder` is used +- Added actions for preview window + - `preview-half-page-up` + - `preview-half-page-down` +- Vim + - Popup width and height can be given in absolute integer values + - Added `fzf#exec()` function for getting the path of fzf executable + - It also downloads the latest binary if it's not available by running + `./install --bin` +- Built with Go 1.15.2 + - We no longer provide 32-bit binaries + 0.22.0 ------ - Added more options for `--bind` diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fzf-0.22.0/Makefile new/fzf-0.23.1/Makefile --- old/fzf-0.22.0/Makefile 2020-08-02 08:56:02.000000000 +0200 +++ new/fzf-0.23.1/Makefile 2020-10-10 19:04:07.000000000 +0200 @@ -8,7 +8,6 @@ REVISION := $(shell git log -n 1 --pretty=format:%h -- $(SOURCES)) BUILD_FLAGS := -a -ldflags "-X main.revision=$(REVISION) -w '-extldflags=$(LDFLAGS)'" -tags "$(TAGS)" -BINARY32 := fzf-$(GOOS)_386 BINARY64 := fzf-$(GOOS)_amd64 BINARYARM5 := fzf-$(GOOS)_arm5 BINARYARM6 := fzf-$(GOOS)_arm6 @@ -16,7 +15,6 @@ BINARYARM8 := fzf-$(GOOS)_arm8 BINARYPPC64LE := fzf-$(GOOS)_ppc64le VERSION := $(shell awk -F= '/version =/ {print $$2}' src/constants.go | tr -d "\" ") -RELEASE32 := fzf-$(VERSION)-$(GOOS)_386 RELEASE64 := fzf-$(VERSION)-$(GOOS)_amd64 RELEASEARM5 := fzf-$(VERSION)-$(GOOS)_arm5 RELEASEARM6 := fzf-$(VERSION)-$(GOOS)_arm6 @@ -30,10 +28,6 @@ BINARY := $(BINARY64) else ifeq ($(UNAME_M),amd64) BINARY := $(BINARY64) -else ifeq ($(UNAME_M),i686) - BINARY := $(BINARY32) -else ifeq ($(UNAME_M),i386) - BINARY := $(BINARY32) else ifeq ($(UNAME_M),armv5l) BINARY := $(BINARYARM5) else ifeq ($(UNAME_M),armv6l) @@ -56,13 +50,11 @@ mkdir -p $@ ifeq ($(GOOS),windows) -release: target/$(BINARY32) target/$(BINARY64) - cd target && cp -f $(BINARY32) fzf.exe && zip $(RELEASE32).zip fzf.exe +release: target/$(BINARY64) cd target && cp -f $(BINARY64) fzf.exe && zip $(RELEASE64).zip fzf.exe cd target && rm -f fzf.exe else ifeq ($(GOOS),linux) -release: target/$(BINARY32) target/$(BINARY64) target/$(BINARYARM5) target/$(BINARYARM6) target/$(BINARYARM7) target/$(BINARYARM8) target/$(BINARYPPC64LE) - cd target && cp -f $(BINARY32) fzf && tar -czf $(RELEASE32).tgz fzf +release: target/$(BINARY64) target/$(BINARYARM5) target/$(BINARYARM6) target/$(BINARYARM7) target/$(BINARYARM8) target/$(BINARYPPC64LE) cd target && cp -f $(BINARY64) fzf && tar -czf $(RELEASE64).tgz fzf cd target && cp -f $(BINARYARM5) fzf && tar -czf $(RELEASEARM5).tgz fzf cd target && cp -f $(BINARYARM6) fzf && tar -czf $(RELEASEARM6).tgz fzf @@ -71,8 +63,7 @@ cd target && cp -f $(BINARYPPC64LE) fzf && tar -czf $(RELEASEPPC64LE).tgz fzf cd target && rm -f fzf else -release: target/$(BINARY32) target/$(BINARY64) - cd target && cp -f $(BINARY32) fzf && tar -czf $(RELEASE32).tgz fzf +release: target/$(BINARY64) cd target && cp -f $(BINARY64) fzf && tar -czf $(RELEASE64).tgz fzf cd target && rm -f fzf endif @@ -96,9 +87,6 @@ clean: $(RM) -r target -target/$(BINARY32): $(SOURCES) - GOARCH=386 $(GO) build $(BUILD_FLAGS) -o $@ - target/$(BINARY64): $(SOURCES) GOARCH=amd64 $(GO) build $(BUILD_FLAGS) -o $@ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fzf-0.22.0/README-VIM.md new/fzf-0.23.1/README-VIM.md --- old/fzf-0.22.0/README-VIM.md 2020-08-02 08:56:02.000000000 +0200 +++ new/fzf-0.23.1/README-VIM.md 2020-10-10 19:04:07.000000000 +0200 @@ -127,8 +127,9 @@ \ 'ctrl-v': 'vsplit' } " Default fzf layout -" - down / up / left / right +" - down / up / left / right / window let g:fzf_layout = { 'down': '40%' } +let g:fzf_layout = { 'window': { 'width': 0.9, 'height': 0.6 } } " You can set up fzf window using a Vim command (Neovim or latest Vim 8 required) let g:fzf_layout = { 'window': 'enew' } @@ -290,8 +291,8 @@ following options are allowed: - Required: - - `width` [float range [0 ~ 1]] - - `height` [float range [0 ~ 1]] + - `width` [float range [0 ~ 1]] or [integer range [8 ~ ]] + - `height` [float range [0 ~ 1]] or [integer range [4 ~ ]] - Optional: - `yoffset` [float default 0.5 range [0 ~ 1]] - `xoffset` [float default 0.5 range [0 ~ 1]] @@ -386,8 +387,8 @@ ```vim " Required: -" - width [float range [0 ~ 1]] -" - height [float range [0 ~ 1]] +" - width [float range [0 ~ 1]] or [integer range [8 ~ ]] +" - height [float range [0 ~ 1]] or [integer range [4 ~ ]] " " Optional: " - xoffset [float default 0.5 range [0 ~ 1]] @@ -416,8 +417,8 @@ `fzf`. So you can set up `FileType fzf` autocmd to customize the settings of the window. -For example, if you use the default layout (`{'down': '40%'}`) on Neovim, you -might want to temporarily disable the statusline for a cleaner look. +For example, if you use a non-popup layout (e.g. `{'down': '40%'}`) on Neovim, +you might want to temporarily disable the statusline for a cleaner look. ```vim if has('nvim') && !exists('g:fzf_layout') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fzf-0.22.0/README.md new/fzf-0.23.1/README.md --- old/fzf-0.22.0/README.md 2020-08-02 08:56:02.000000000 +0200 +++ new/fzf-0.23.1/README.md 2020-10-10 19:04:07.000000000 +0200 @@ -22,42 +22,50 @@ Table of Contents ----------------- - * [Installation](#installation) - * [Using Homebrew or Linuxbrew](#using-homebrew-or-linuxbrew) - * [Using git](#using-git) - * [Using Linux package managers](#using-linux-package-managers) - * [Windows](#windows) - * [As Vim plugin](#as-vim-plugin) - * [Upgrading fzf](#upgrading-fzf) - * [Building fzf](#building-fzf) - * [Usage](#usage) - * [Using the finder](#using-the-finder) - * [Layout](#layout) - * [Search syntax](#search-syntax) - * [Environment variables](#environment-variables) - * [Options](#options) - * [Demo](#demo) - * [Examples](#examples) - * [fzf-tmux script](#fzf-tmux-script) - * [Key bindings for command line](#key-bindings-for-command-line) - * [Fuzzy completion for bash and zsh](#fuzzy-completion-for-bash-and-zsh) - * [Files and directories](#files-and-directories) - * [Process IDs](#process-ids) - * [Host names](#host-names) - * [Environment variables / Aliases](#environment-variables--aliases) - * [Settings](#settings) - * [Supported commands](#supported-commands) - * [Custom fuzzy completion](#custom-fuzzy-completion) - * [Vim plugin](#vim-plugin) - * [Advanced topics](#advanced-topics) - * [Performance](#performance) - * [Executing external programs](#executing-external-programs) - * [Preview window](#preview-window) - * [Tips](#tips) - * [Respecting .gitignore](#respecting-gitignore) - * [Fish shell](#fish-shell) - * [Related projects](#related-projects) - * [<a href="LICENSE">License</a>](#license) +<!-- vim-markdown-toc GFM --> + +* [Installation](#installation) + * [Using Homebrew or Linuxbrew](#using-homebrew-or-linuxbrew) + * [Using git](#using-git) + * [Using Linux package managers](#using-linux-package-managers) + * [Windows](#windows) + * [As Vim plugin](#as-vim-plugin) +* [Upgrading fzf](#upgrading-fzf) +* [Building fzf](#building-fzf) +* [Usage](#usage) + * [Using the finder](#using-the-finder) + * [Layout](#layout) + * [Search syntax](#search-syntax) + * [Environment variables](#environment-variables) + * [Options](#options) + * [Demo](#demo) +* [Examples](#examples) +* [`fzf-tmux` script](#fzf-tmux-script) +* [Key bindings for command-line](#key-bindings-for-command-line) +* [Fuzzy completion for bash and zsh](#fuzzy-completion-for-bash-and-zsh) + * [Files and directories](#files-and-directories) + * [Process IDs](#process-ids) + * [Host names](#host-names) + * [Environment variables / Aliases](#environment-variables--aliases) + * [Settings](#settings) + * [Supported commands](#supported-commands) + * [Custom fuzzy completion](#custom-fuzzy-completion) +* [Vim plugin](#vim-plugin) +* [Advanced topics](#advanced-topics) + * [Performance](#performance) + * [Executing external programs](#executing-external-programs) + * [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) + * [3. Interactive ripgrep integration](#3-interactive-ripgrep-integration) + * [Preview window](#preview-window) +* [Tips](#tips) + * [Respecting `.gitignore`](#respecting-gitignore) + * [Fish shell](#fish-shell) +* [Related projects](#related-projects) +* [License](#license) + +<!-- vim-markdown-toc --> Installation ------------ @@ -528,6 +536,50 @@ See *KEY BINDINGS* section of the man page for details. +### Reloading the candidate list + +By binding `reload` action to a key or an event, you can make fzf dynamically +reload the candidate list. See https://github.com/junegunn/fzf/issues/1750 for +more details. + +#### 1. Update the list of processes by pressing CTRL-R + +```sh +FZF_DEFAULT_COMMAND='ps -ef' \ + fzf --bind 'ctrl-r:reload($FZF_DEFAULT_COMMAND)' \ + --header 'Press CTRL-R to reload' --header-lines=1 \ + --height=50% --layout=reverse +``` + +#### 2. Switch between sources by pressing CTRL-D or CTRL-F + +```sh +FZF_DEFAULT_COMMAND='find . -type f' \ + fzf --bind 'ctrl-d:reload(find . -type d),ctrl-f:reload($FZF_DEFAULT_COMMAND)' \ + --height=50% --layout=reverse +``` + +#### 3. Interactive ripgrep integration + +The following example uses fzf as the selector interface for ripgrep. We bound +`reload` action to `change` event, so every time you type on fzf, ripgrep +process will restart with the updated query string denoted by the placeholder +expression `{q}`. Also, note that we used `--phony` option so that fzf doesn't +perform any secondary filtering. + +```sh +INITIAL_QUERY="" +RG_PREFIX="rg --column --line-number --no-heading --color=always --smart-case " +FZF_DEFAULT_COMMAND="$RG_PREFIX '$INITIAL_QUERY'" \ + fzf --bind "change:reload:$RG_PREFIX {q} || true" \ + --ansi --phony --query "$INITIAL_QUERY" \ + --height=50% --layout=reverse +``` + +If ripgrep doesn't find any matches, it will exit with a non-zero exit status, +and fzf will warn you about it. To suppress the warning message, we added +`|| true` to the command, so that it always exits with 0. + ### Preview window When the `--preview` option is set, fzf automatically starts an external process diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fzf-0.22.0/bin/fzf-tmux new/fzf-0.23.1/bin/fzf-tmux --- old/fzf-0.22.0/bin/fzf-tmux 2020-08-02 08:56:02.000000000 +0200 +++ new/fzf-0.23.1/bin/fzf-tmux 2020-10-10 19:04:07.000000000 +0200 @@ -136,7 +136,7 @@ fi # --height option is not allowed -args=("--no-height" "${args[@]}") +args=("${args[@]}" "--no-height") # Handle zoomed tmux pane without popup options by moving it to a temp window if [[ ! "$opt" =~ "-K -E" ]] && tmux list-panes -F '#F' | grep -q Z; then @@ -154,12 +154,13 @@ fifo1="${TMPDIR:-/tmp}/fzf-fifo1-$id" fifo2="${TMPDIR:-/tmp}/fzf-fifo2-$id" fifo3="${TMPDIR:-/tmp}/fzf-fifo3-$id" +tmux_win_opts=( $(tmux show-window-options remain-on-exit \; show-window-options synchronize-panes | sed '/ off/d; s/^/set-window-option /; s/$/ \\;/') ) cleanup() { \rm -f $argsf $fifo1 $fifo2 $fifo3 # Restore tmux window options if [[ "${#tmux_win_opts[@]}" -gt 0 ]]; then - eval "tmux ${tmux_win_opts[@]}" + eval "tmux ${tmux_win_opts[*]}" fi # Remove temp window if we were zoomed without popup options @@ -179,58 +180,45 @@ trap 'cleanup 1' SIGUSR1 trap 'cleanup' EXIT -envs="env TERM=$TERM " +envs="export TERM=$TERM " [[ "$opt" =~ "-K -E" ]] && FZF_DEFAULT_OPTS="--margin 0,1 $FZF_DEFAULT_OPTS" [[ -n "$FZF_DEFAULT_OPTS" ]] && envs="$envs FZF_DEFAULT_OPTS=$(printf %q "$FZF_DEFAULT_OPTS")" [[ -n "$FZF_DEFAULT_COMMAND" ]] && envs="$envs FZF_DEFAULT_COMMAND=$(printf %q "$FZF_DEFAULT_COMMAND")" - -mkfifo -m o+w $fifo2 -mkfifo -m o+w $fifo3 +echo "$envs;" > "$argsf" # Build arguments to fzf -opts="" -for arg in "${args[@]}"; do - arg="${arg//\\/\\\\}" - arg="${arg//\"/\\\"}" - arg="${arg//\`/\\\`}" - arg="${arg//$/\\$}" - opts="$opts \"$arg\"" -done +opts=$(printf "%q " "${args[@]}") pppid=$$ -echo -n "trap 'kill -SIGUSR1 -$pppid' EXIT SIGINT SIGTERM;" > $argsf +echo -n "trap 'kill -SIGUSR1 -$pppid' EXIT SIGINT SIGTERM;" >> $argsf close="; trap - EXIT SIGINT SIGTERM $close" -tmux_win_opts=( $(tmux show-window-options remain-on-exit \; show-window-options synchronize-panes | sed '/ off/d; s/^/set-window-option /; s/$/ \\;/') ) - +export TMUX=$(cut -d , -f 1,2 <<< "$TMUX") +mkfifo -m o+w $fifo2 if [[ "$opt" =~ "-K -E" ]]; then cat $fifo2 & if [[ -n "$term" ]] || [[ -t 0 ]]; then cat <<< "\"$fzf\" $opts > $fifo2; out=\$? $close; exit \$out" >> $argsf - TMUX=$(echo $TMUX | cut -d , -f 1,2) tmux popup -d "$PWD" "${tmux_args[@]}" $opt -R "$envs bash $argsf" > /dev/null 2>&1 else mkfifo $fifo1 cat <<< "\"$fzf\" $opts < $fifo1 > $fifo2; out=\$? $close; exit \$out" >> $argsf cat <&0 > $fifo1 & - TMUX=$(echo $TMUX | cut -d , -f 1,2) tmux popup -d "$PWD" "${tmux_args[@]}" $opt -R "$envs bash $argsf" > /dev/null 2>&1 fi + tmux popup -d "$PWD" "${tmux_args[@]}" $opt -R "bash $argsf" > /dev/null 2>&1 exit $? fi +mkfifo -m o+w $fifo3 if [[ -n "$term" ]] || [[ -t 0 ]]; then cat <<< "\"$fzf\" $opts > $fifo2; echo \$? > $fifo3 $close" >> $argsf - TMUX=$(echo $TMUX | cut -d , -f 1,2) tmux set-window-option synchronize-panes off \;\ - set-window-option remain-on-exit off \;\ - split-window $opt "${tmux_args[@]}" "$envs bash -c 'cd $(printf %q "$PWD"); exec -a fzf bash $argsf'" $swap \ - > /dev/null 2>&1 || { "$fzf" "${args[@]}"; exit $?; } else mkfifo $fifo1 cat <<< "\"$fzf\" $opts < $fifo1 > $fifo2; echo \$? > $fifo3 $close" >> $argsf - TMUX=$(echo $TMUX | cut -d , -f 1,2) tmux set-window-option synchronize-panes off \;\ - set-window-option remain-on-exit off \;\ - split-window $opt "${tmux_args[@]}" "$envs bash -c 'exec -a fzf bash $argsf'" $swap \ - > /dev/null 2>&1 || { "$fzf" "${args[@]}"; exit $?; } cat <&0 > $fifo1 & fi +tmux set-window-option synchronize-panes off \;\ + set-window-option remain-on-exit off \;\ + split-window -c "$PWD" $opt "${tmux_args[@]}" "bash -c 'exec -a fzf bash $argsf'" $swap \ + > /dev/null 2>&1 || { "$fzf" "${args[@]}"; exit $?; } cat $fifo2 exit "$(cat $fifo3)" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fzf-0.22.0/doc/fzf.txt new/fzf-0.23.1/doc/fzf.txt --- old/fzf-0.22.0/doc/fzf.txt 2020-08-02 08:56:02.000000000 +0200 +++ new/fzf-0.23.1/doc/fzf.txt 2020-10-10 19:04:07.000000000 +0200 @@ -154,8 +154,9 @@ \ 'ctrl-v': 'vsplit' } " Default fzf layout - " - down / up / left / right + " - down / up / left / right / window let g:fzf_layout = { 'down': '~40%' } + let g:fzf_layout = { 'window': { 'width': 0.9, 'height': 0.6 } } " You can set up fzf window using a Vim command (Neovim or latest Vim 8 required) let g:fzf_layout = { 'window': 'enew' } @@ -305,8 +306,8 @@ following options are allowed: - Required: - - `width` [float range [0 ~ 1]] - - `height` [float range [0 ~ 1]] + - `width` [float range [0 ~ 1]] or [integer range [8 ~ ]] + - `height` [float range [0 ~ 1]] or [integer range [4 ~ ]] - Optional: - `yoffset` [float default 0.5 range [0 ~ 1]] - `xoffset` [float default 0.5 range [0 ~ 1]] @@ -426,8 +427,9 @@ `fzf`. So you can set up `FileType fzf` autocmd to customize the settings of the window. -For example, if you use the default layout (`{'down': '~40%'}`) on Neovim, you -might want to temporarily disable the statusline for a cleaner look. +For example, if you use a non-popup layout (e.g. `{'down': '40%'}`) on +Neovim, you might want to temporarily disable the statusline for a cleaner +look. > if has('nvim') && !exists('g:fzf_layout') autocmd! FileType fzf diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fzf-0.22.0/go.mod new/fzf-0.23.1/go.mod --- old/fzf-0.22.0/go.mod 2020-08-02 08:56:02.000000000 +0200 +++ new/fzf-0.23.1/go.mod 2020-10-10 19:04:07.000000000 +0200 @@ -1,7 +1,7 @@ module github.com/junegunn/fzf require ( - github.com/gdamore/tcell v1.3.0 + github.com/gdamore/tcell v1.4.0 github.com/lucasb-eyer/go-colorful v1.0.3 // indirect github.com/mattn/go-isatty v0.0.12 github.com/mattn/go-runewidth v0.0.8 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fzf-0.22.0/go.sum new/fzf-0.23.1/go.sum --- old/fzf-0.22.0/go.sum 2020-08-02 08:56:02.000000000 +0200 +++ new/fzf-0.23.1/go.sum 2020-10-10 19:04:07.000000000 +0200 @@ -1,8 +1,8 @@ github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= github.com/gdamore/encoding v1.0.0 h1:+7OoQ1Bc6eTm5niUzBa0Ctsh6JbMW6Ra+YNuAtDBdko= github.com/gdamore/encoding v1.0.0/go.mod h1:alR0ol34c49FCSBLjhosxzcPHQbf2trDkoo5dl+VrEg= -github.com/gdamore/tcell v1.3.0 h1:r35w0JBADPZCVQijYebl6YMWWtHRqVEGt7kL2eBADRM= -github.com/gdamore/tcell v1.3.0/go.mod h1:Hjvr+Ofd+gLglo7RYKxxnzCBmev3BzsS67MebKS4zMM= +github.com/gdamore/tcell v1.4.0 h1:vUnHwJRvcPQa3tzi+0QI4U9JINXYJlOz9yiaiPQ2wMU= +github.com/gdamore/tcell v1.4.0/go.mod h1:vxEiSDZdW3L+Uhjii9c3375IlDmR05bzxY404ZVSMo0= github.com/lucasb-eyer/go-colorful v1.0.2 h1:mCMFu6PgSozg9tDNMMK3g18oJBX7oYGrC09mS6CXfO4= github.com/lucasb-eyer/go-colorful v1.0.2/go.mod h1:0MS4r+7BZKSJ5mw4/S5MPN+qHFF1fYclkSPilDOKW0s= github.com/lucasb-eyer/go-colorful v1.0.3 h1:QIbQXiugsb+q10B+MI+7DI1oQLdmnep86tWFlaaUAac= @@ -11,6 +11,7 @@ github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-runewidth v0.0.4 h1:2BvfKmzob6Bmd4YsL0zygOqfdFnK7GR4QL06Do4/p7Y= github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= +github.com/mattn/go-runewidth v0.0.7/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-runewidth v0.0.8 h1:3tS41NlGYSmhhe/8fhGRzc+z3AYCw1Fe1WAyLuujKs0= github.com/mattn/go-runewidth v0.0.8/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-shellwords v1.0.9 h1:eaB5JspOwiKKcHdqcjbfe5lA9cNn/4NRRtddXJCimqk= diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fzf-0.22.0/install new/fzf-0.23.1/install --- old/fzf-0.22.0/install 2020-08-02 08:56:02.000000000 +0200 +++ new/fzf-0.23.1/install 2020-10-10 19:04:07.000000000 +0200 @@ -2,7 +2,7 @@ set -u -version=0.22.0 +version=0.23.1 auto_completion= key_bindings= update_config=2 @@ -28,9 +28,6 @@ --no-bash Do not set up bash configuration --no-zsh Do not set up zsh configuration --no-fish Do not set up fish configuration - - --32 Download 32-bit binary - --64 Download 64-bit binary EOF } @@ -56,8 +53,6 @@ --no-completion) auto_completion=0 ;; --update-rc) update_config=1 ;; --no-update-rc) update_config=0 ;; - --32) binary_arch=386 ;; - --64) binary_arch=amd64 ;; --bin) ;; --no-bash) shells=${shells/bash/} ;; --no-zsh) shells=${shells/zsh/} ;; @@ -179,24 +174,17 @@ binary_error="" case "$archi" in Darwin\ *64) download fzf-$version-darwin_${binary_arch:-amd64}.tgz ;; - Darwin\ *86) download fzf-$version-darwin_${binary_arch:-386}.tgz ;; Linux\ armv5*) download fzf-$version-linux_${binary_arch:-arm5}.tgz ;; Linux\ armv6*) download fzf-$version-linux_${binary_arch:-arm6}.tgz ;; Linux\ armv7*) download fzf-$version-linux_${binary_arch:-arm7}.tgz ;; Linux\ armv8*) download fzf-$version-linux_${binary_arch:-arm8}.tgz ;; Linux\ aarch64*) download fzf-$version-linux_${binary_arch:-arm8}.tgz ;; Linux\ *64) download fzf-$version-linux_${binary_arch:-amd64}.tgz ;; - Linux\ *86) download fzf-$version-linux_${binary_arch:-386}.tgz ;; FreeBSD\ *64) download fzf-$version-freebsd_${binary_arch:-amd64}.tgz ;; - FreeBSD\ *86) download fzf-$version-freebsd_${binary_arch:-386}.tgz ;; OpenBSD\ *64) download fzf-$version-openbsd_${binary_arch:-amd64}.tgz ;; - OpenBSD\ *86) download fzf-$version-openbsd_${binary_arch:-386}.tgz ;; CYGWIN*\ *64) download fzf-$version-windows_${binary_arch:-amd64}.zip ;; - MINGW*\ *86) download fzf-$version-windows_${binary_arch:-386}.zip ;; MINGW*\ *64) download fzf-$version-windows_${binary_arch:-amd64}.zip ;; - MSYS*\ *86) download fzf-$version-windows_${binary_arch:-386}.zip ;; MSYS*\ *64) download fzf-$version-windows_${binary_arch:-amd64}.zip ;; - Windows*\ *86) download fzf-$version-windows_${binary_arch:-386}.zip ;; Windows*\ *64) download fzf-$version-windows_${binary_arch:-amd64}.zip ;; *) binary_available=0 binary_error=1 ;; esac diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fzf-0.22.0/install.ps1 new/fzf-0.23.1/install.ps1 --- old/fzf-0.22.0/install.ps1 2020-08-02 08:56:02.000000000 +0200 +++ new/fzf-0.23.1/install.ps1 2020-10-10 19:04:07.000000000 +0200 @@ -1,4 +1,4 @@ -$version="0.22.0" +$version="0.23.1" if ([Environment]::Is64BitProcess) { $binary_arch="amd64" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fzf-0.22.0/man/man1/fzf-tmux.1 new/fzf-0.23.1/man/man1/fzf-tmux.1 --- old/fzf-0.22.0/man/man1/fzf-tmux.1 2020-08-02 08:56:02.000000000 +0200 +++ new/fzf-0.23.1/man/man1/fzf-tmux.1 2020-10-10 19:04:07.000000000 +0200 @@ -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 "Aug 2020" "fzf 0.22.0" "fzf-tmux - open fzf in tmux split pane" +.TH fzf-tmux 1 "Oct 2020" "fzf 0.23.1" "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.22.0/man/man1/fzf.1 new/fzf-0.23.1/man/man1/fzf.1 --- old/fzf-0.22.0/man/man1/fzf.1 2020-08-02 08:56:02.000000000 +0200 +++ new/fzf-0.23.1/man/man1/fzf.1 2020-10-10 19:04:07.000000000 +0200 @@ -21,7 +21,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. .. -.TH fzf 1 "Aug 2020" "fzf 0.22.0" "fzf - a command-line fuzzy finder" +.TH fzf 1 "Oct 2020" "fzf 0.23.1" "fzf - a command-line fuzzy finder" .SH NAME fzf - a command-line fuzzy finder @@ -381,28 +381,37 @@ query if any of the placeholder expressions evaluates to a non-empty string. .RE .TP -.BI "--preview-window=" "[POSITION][:SIZE[%]][:noborder][:wrap][:hidden][:+SCROLL[-OFFSET]]" -Determines the layout of the preview window. If the argument contains +.BI "--preview-window=" "[POSITION][:SIZE[%]][:rounded|sharp|noborder][:[no]wrap][:[no]cycle][:[no]hidden][:+SCROLL[-OFFSET]][:default]" + +.RS +.B POSITION: (default: right) + \fBup + \fBdown + \fBleft + \fBright +.RE + +\fRDetermines the layout of the preview window. If the argument contains \fB:hidden\fR, the preview window will be hidden by default until \fBtoggle-preview\fR action is triggered. Long lines are truncated by default. -Line wrap can be enabled with \fB:wrap\fR flag. +Line wrap can be enabled with \fB:wrap\fR flag. Cyclic scrolling is enabled +with \fB:cycle\fR flag. If size is given as 0, preview window will not be visible, but fzf will still execute the command in the background. +To change the style of the border of the preview window, specify one of +\fBrounded\fR (border with rounded edges, default), \fBsharp\fR (border with +sharp edges), or \fBnoborder\fR (no border). + \fB+SCROLL[-OFFSET]\fR determines the initial scroll offset of the preview window. \fBSCROLL\fR can be either a numeric integer or a single-field index expression that refers to a numeric integer. The optional \fB-OFFSET\fR part is for adjusting the base offset so that you can see the text above it. It should -be given as a numeric integer. +be given as a numeric integer (\fB-INTEGER\fR), or as a denominator form +(\fB-/INTEGER\fR) for specifying a fraction of the preview window height. -.RS -.B POSITION: (default: right) - \fBup - \fBdown - \fBleft - \fBright -.RE +\fBdefault\fR resets all options previously set to the default. .RS e.g. @@ -411,11 +420,18 @@ fzf --preview="file {}" --preview-window=down:1 # Initial scroll offset is set to the line number of each line of - # git grep output *minus* 5 lines + # git grep output *minus* 5 lines (-5) git grep --line-number '' | - fzf --delimiter : --preview 'nl {1}' --preview-window +{2}-5\fR + fzf --delimiter : --preview 'nl {1}' --preview-window +{2}-5 + + # Preview with bat, matching line in the middle of the window (-/2) + git grep --line-number '' | + fzf --delimiter : \\ + --preview 'bat --style=numbers --color=always --highlight-line {2} {1}' \\ + --preview-window +{2}-/2\fR .RE + .SS Scripting .TP .BI "-q, --query=" "STR" @@ -690,7 +706,6 @@ \fBend-of-line\fR \fIctrl-e end\fR \fBexecute(...)\fR (see below for the details) \fBexecute-silent(...)\fR (see below for the details) - \fRexecute-multi(...)\fR (deprecated in favor of \fB{+}\fR expression) \fBforward-char\fR \fIctrl-f right\fR \fBforward-word\fR \fIalt-f shift-right\fR \fBignore\fR @@ -708,6 +723,8 @@ \fBpreview-up\fR \fIshift-up\fR \fBpreview-page-down\fR \fBpreview-page-up\fR + \fBpreview-half-page-down\fR + \fBpreview-half-page-up\fR \fBprevious-history\fR (\fIctrl-p\fR on \fB--history\fR) \fBprint-query\fR (print query and exit) \fBrefresh-preview\fR diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fzf-0.22.0/plugin/fzf.vim new/fzf-0.23.1/plugin/fzf.vim --- old/fzf-0.22.0/plugin/fzf.vim 2020-08-02 08:56:02.000000000 +0200 +++ new/fzf-0.23.1/plugin/fzf.vim 2020-10-10 19:04:07.000000000 +0200 @@ -115,7 +115,6 @@ return s:fzf_call('tempname') endfunction -let s:default_layout = { 'down': '~40%' } let s:layout_keys = ['window', 'tmux', 'up', 'down', 'left', 'right'] let s:fzf_go = s:base_dir.'/bin/fzf' let s:fzf_tmux = s:base_dir.'/bin/fzf-tmux' @@ -123,6 +122,16 @@ let s:cpo_save = &cpo set cpo&vim +function! s:popup_support() + return has('nvim') ? has('nvim-0.4') : has('popupwin') && has('patch-8.2.191') +endfunction + +function! s:default_layout() + return s:popup_support() + \ ? { 'window' : { 'width': 0.9, 'height': 0.6, 'highlight': 'Normal' } } + \ : { 'down': '~40%' } +endfunction + function! fzf#install() if s:is_win && !has('win32unix') let script = s:base_dir.'/install.ps1' @@ -145,7 +154,7 @@ endif endfunction -function! s:fzf_exec() +function! fzf#exec() if !exists('s:exec') if executable(s:fzf_go) let s:exec = s:fzf_go @@ -154,13 +163,13 @@ elseif input('fzf executable not found. Download binary? (y/n) ') =~? '^y' redraw call fzf#install() - return s:fzf_exec() + return fzf#exec() else redraw throw 'fzf executable not found' endif endif - return fzf#shellescape(s:exec) + return s:exec endfunction function! s:tmux_enabled() @@ -325,7 +334,7 @@ if !exists('g:fzf_layout') && exists('g:fzf_height') let opts.down = g:fzf_height else - let opts = extend(opts, s:validate_layout(get(g:, 'fzf_layout', s:default_layout))) + let opts = extend(opts, s:validate_layout(get(g:, 'fzf_layout', s:default_layout()))) endif endif @@ -376,7 +385,7 @@ let temps = { 'result': s:fzf_tempname() } let optstr = s:evaluate_opts(get(dict, 'options', '')) try - let fzf_exec = s:fzf_exec() + let fzf_exec = fzf#shellescape(fzf#exec()) catch throw v:exception endtry @@ -658,7 +667,7 @@ try if s:present(a:dict, 'window') if type(a:dict.window) == type({}) - if !(has('nvim') ? has('nvim-0.4') : has('popupwin') && has('patch-8.2.191')) + if !s:popup_support() throw 'Nvim 0.4+ or Vim 8.2.191+ with popupwin feature is required for pop-up window' end call s:popup(a:dict.window) @@ -864,9 +873,9 @@ let ambidouble = &ambiwidth == 'double' ? 2 : 1 " Size and position - let width = min([max([0, float2nr(&columns * a:opts.width)]), &columns]) + let width = min([max([8, a:opts.width > 1 ? a:opts.width : float2nr(&columns * a:opts.width)]), &columns]) let width += width % ambidouble - let height = min([max([0, float2nr(&lines * a:opts.height)]), &lines - has('nvim')]) + let height = min([max([4, a:opts.height > 1 ? a:opts.height : float2nr(&lines * a:opts.height)]), &lines - has('nvim')]) let row = float2nr(get(a:opts, 'yoffset', 0.5) * (&lines - height)) let col = float2nr(get(a:opts, 'xoffset', 0.5) * (&columns - width)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fzf-0.22.0/shell/completion.bash new/fzf-0.23.1/shell/completion.bash --- old/fzf-0.22.0/shell/completion.bash 2020-08-02 08:56:02.000000000 +0200 +++ new/fzf-0.23.1/shell/completion.bash 2020-10-10 19:04:07.000000000 +0200 @@ -272,7 +272,7 @@ _fzf_host_completion() { _fzf_complete +m -- "$@" < <( - cat <(cat ~/.ssh/config ~/.ssh/config.d/* /etc/ssh/ssh_config 2> /dev/null | command grep -i '^\s*host\(name\)\? ' | awk '{for (i = 2; i <= NF; i++) print $1 " " $i}' | command grep -v '[*?]') \ + command cat <(command tail -n +1 ~/.ssh/config ~/.ssh/config.d/* /etc/ssh/ssh_config 2> /dev/null | command grep -i '^\s*host\(name\)\? ' | awk '{for (i = 2; i <= NF; i++) print $1 " " $i}' | command grep -v '[*?]') \ <(command grep -oE '^[[a-z0-9.,:-]+' ~/.ssh/known_hosts | tr ',' '\n' | tr -d '[' | awk '{ print $1 " " $1 }') \ <(command grep -v '^\s*\(#\|$\)' /etc/hosts | command grep -Fv '0.0.0.0') | awk '{if (length($2) > 0) {print $2}}' | sort -u diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fzf-0.22.0/shell/completion.zsh new/fzf-0.23.1/shell/completion.zsh --- old/fzf-0.22.0/shell/completion.zsh 2020-08-02 08:56:02.000000000 +0200 +++ new/fzf-0.23.1/shell/completion.zsh 2020-10-10 19:04:07.000000000 +0200 @@ -225,7 +225,7 @@ _fzf_complete_ssh() { _fzf_complete +m -- "$@" < <( setopt localoptions nonomatch - command cat <(cat ~/.ssh/config ~/.ssh/config.d/* /etc/ssh/ssh_config 2> /dev/null | command grep -i '^\s*host\(name\)\? ' | awk '{for (i = 2; i <= NF; i++) print $1 " " $i}' | command grep -v '[*?]') \ + command cat <(command tail -n +1 ~/.ssh/config ~/.ssh/config.d/* /etc/ssh/ssh_config 2> /dev/null | command grep -i '^\s*host\(name\)\? ' | awk '{for (i = 2; i <= NF; i++) print $1 " " $i}' | command grep -v '[*?]') \ <(command grep -oE '^[[a-z0-9.,:-]+' ~/.ssh/known_hosts | tr ',' '\n' | tr -d '[' | awk '{ print $1 " " $1 }') \ <(command grep -v '^\s*\(#\|$\)' /etc/hosts | command grep -Fv '0.0.0.0') | awk '{if (length($2) > 0) {print $2}}' | sort -u diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fzf-0.22.0/shell/key-bindings.zsh new/fzf-0.23.1/shell/key-bindings.zsh --- old/fzf-0.22.0/shell/key-bindings.zsh 2020-08-02 08:56:02.000000000 +0200 +++ new/fzf-0.23.1/shell/key-bindings.zsh 2020-10-10 19:04:07.000000000 +0200 @@ -87,9 +87,15 @@ zle redisplay return 0 fi - cd "$dir" - unset dir # ensure this doesn't end up appearing in prompt expansion + if [ -z "$BUFFER" ]; then + BUFFER="cd ${(q)dir}" + zle accept-line + else + print -sr "cd ${(q)dir}" + cd "$dir" + fi local ret=$? + unset dir # ensure this doesn't end up appearing in prompt expansion zle fzf-redraw-prompt return $ret } @@ -100,7 +106,7 @@ fzf-history-widget() { local selected num setopt localoptions noglobsubst noposixbuiltins pipefail no_aliases 2> /dev/null - selected=( $(fc -rl 1 | perl -ne 'print if !$seen{(/^\s*[0-9]+\s+(.*)/, $1)}++' | + selected=( $(fc -rl 1 | perl -ne 'print if !$seen{(/^\s*[0-9]+\**\s+(.*)/, $1)}++' | FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} $FZF_DEFAULT_OPTS -n2..,.. --tiebreak=index --bind=ctrl-r:toggle-sort $FZF_CTRL_R_OPTS --query=${(qqq)LBUFFER} +m" $(__fzfcmd)) ) local ret=$? if [ -n "$selected" ]; then diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fzf-0.22.0/src/constants.go new/fzf-0.23.1/src/constants.go --- old/fzf-0.22.0/src/constants.go 2020-08-02 08:56:02.000000000 +0200 +++ new/fzf-0.23.1/src/constants.go 2020-10-10 19:04:07.000000000 +0200 @@ -10,7 +10,7 @@ const ( // Current version - version = "0.22.0" + version = "0.23.1" // Core coordinatorDelayMax time.Duration = 100 * time.Millisecond diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fzf-0.22.0/src/options.go new/fzf-0.23.1/src/options.go --- old/fzf-0.22.0/src/options.go 2020-08-02 08:56:02.000000000 +0200 +++ new/fzf-0.23.1/src/options.go 2020-10-10 19:04:07.000000000 +0200 @@ -80,7 +80,11 @@ Preview --preview=COMMAND Command to preview highlighted line ({}) --preview-window=OPT Preview window layout (default: right:50%) - [up|down|left|right][:SIZE[%]][:wrap][:hidden][:+SCROLL[-OFFSET]] + [up|down|left|right][:SIZE[%]] + [:[no]wrap][:[no]cycle][:[no]hidden] + [:rounded|sharp|noborder] + [:+SCROLL[-OFFSET]] + [:default] Scripting -q, --query=STR Start the finder with the given query @@ -162,7 +166,8 @@ scroll string hidden bool wrap bool - border bool + cycle bool + border tui.BorderShape } // Options stores the values of command-line options @@ -222,6 +227,10 @@ Version bool } +func defaultPreviewOpts(command string) previewOpts { + return previewOpts{command, posRight, sizeSpec{50, true}, "", false, false, false, tui.BorderRounded} +} + func defaultOptions() *Options { return &Options{ Fuzzy: true, @@ -261,7 +270,7 @@ ToggleSort: false, Expect: make(map[int]string), Keymap: make(map[int][]action), - Preview: previewOpts{"", posRight, sizeSpec{50, true}, "", false, false, true}, + Preview: defaultPreviewOpts(""), PrintQuery: false, ReadZero: false, Printer: func(str string) { fmt.Println(str) }, @@ -853,6 +862,10 @@ appendAction(actPreviewPageUp) case "preview-page-down": appendAction(actPreviewPageDown) + case "preview-half-page-up": + appendAction(actPreviewHalfPageUp) + case "preview-half-page-down": + appendAction(actPreviewHalfPageDown) default: t := isExecuteAction(specLower) if t == actIgnore { @@ -987,22 +1000,26 @@ } func parsePreviewWindow(opts *previewOpts, input string) { - // Default - opts.position = posRight - opts.size = sizeSpec{50, true} - opts.hidden = false - opts.wrap = false - tokens := strings.Split(input, ":") sizeRegex := regexp.MustCompile("^[0-9]+%?$") - offsetRegex := regexp.MustCompile("^\\+([0-9]+|{-?[0-9]+})(-[0-9]+)?$") + offsetRegex := regexp.MustCompile("^\\+([0-9]+|{-?[0-9]+})(-[0-9]+|-/[1-9][0-9]*)?$") for _, token := range tokens { switch token { case "": + case "default": + *opts = defaultPreviewOpts(opts.command) case "hidden": opts.hidden = true + case "nohidden": + opts.hidden = false case "wrap": opts.wrap = true + case "nowrap": + opts.wrap = false + case "cycle": + opts.cycle = true + case "nocycle": + opts.cycle = false case "up", "top": opts.position = posUp case "down", "bottom": @@ -1011,10 +1028,12 @@ opts.position = posLeft case "right": opts.position = posRight - case "border": - opts.border = true + case "rounded", "border": + opts.border = tui.BorderRounded + case "sharp": + opts.border = tui.BorderSharp case "noborder": - opts.border = false + opts.border = tui.BorderNone default: if sizeRegex.MatchString(token) { opts.size = parseSize(token, 99, "window size") @@ -1025,14 +1044,6 @@ } } } - if !opts.size.percent && opts.size.size > 0 { - // Adjust size for border - opts.size.size += 2 - // And padding - if opts.position == posLeft || opts.position == posRight { - opts.size.size += 2 - } - } } func parseMargin(margin string) [4]sizeSpec { @@ -1274,7 +1285,7 @@ opts.Preview.command = "" case "--preview-window": parsePreviewWindow(&opts.Preview, - nextString(allArgs, &i, "preview window layout required: [up|down|left|right][:SIZE[%]][:noborder][:wrap][:hidden][:+SCROLL[-OFFSET]]")) + nextString(allArgs, &i, "preview window layout required: [up|down|left|right][:SIZE[%]][:rounded|sharp|noborder][:wrap][:cycle][:hidden][:+SCROLL[-OFFSET]][:default]")) case "--height": opts.Height = parseHeight(nextString(allArgs, &i, "height required: HEIGHT[%]")) case "--min-height": diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fzf-0.22.0/src/options_test.go new/fzf-0.23.1/src/options_test.go --- old/fzf-0.22.0/src/options_test.go 2020-08-02 08:56:02.000000000 +0200 +++ new/fzf-0.23.1/src/options_test.go 2020-10-10 19:04:07.000000000 +0200 @@ -387,23 +387,26 @@ opts.Preview.size.size == 50) { t.Error() } - opts = optsFor("--preview", "cat {}", "--preview-window=left:15:hidden:wrap") + opts = optsFor("--preview", "cat {}", "--preview-window=left:15:hidden:wrap:+{1}-/2") if !(opts.Preview.command == "cat {}" && opts.Preview.hidden == true && opts.Preview.wrap == true && opts.Preview.position == posLeft && + opts.Preview.scroll == "{1}-/2" && opts.Preview.size.percent == false && - opts.Preview.size.size == 15+2+2) { + opts.Preview.size.size == 15) { t.Error(opts.Preview) } - opts = optsFor("--preview-window=up:15:wrap:hidden", "--preview-window=down") + opts = optsFor("--preview-window=up:15:wrap:hidden:+{1}-/2", "--preview-window=down", "--preview-window=cycle") if !(opts.Preview.command == "" && - opts.Preview.hidden == false && - opts.Preview.wrap == false && + opts.Preview.hidden == true && + opts.Preview.wrap == true && + opts.Preview.cycle == true && opts.Preview.position == posDown && - opts.Preview.size.percent == true && - opts.Preview.size.size == 50) { - t.Error(opts.Preview) + opts.Preview.scroll == "{1}-/2" && + opts.Preview.size.percent == false && + opts.Preview.size.size == 15) { + t.Error(opts.Preview.size.size) } opts = optsFor("--preview-window=up:15:wrap:hidden") if !(opts.Preview.command == "" && @@ -411,7 +414,14 @@ opts.Preview.wrap == true && opts.Preview.position == posUp && opts.Preview.size.percent == false && - opts.Preview.size.size == 15+2) { + opts.Preview.size.size == 15) { + t.Error(opts.Preview) + } + opts = optsFor("--preview=foo", "--preview-window=up", "--preview-window=default:70%") + if !(opts.Preview.command == "foo" && + opts.Preview.position == posRight && + opts.Preview.size.percent == true && + opts.Preview.size.size == 70) { t.Error(opts.Preview) } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fzf-0.22.0/src/terminal.go new/fzf-0.23.1/src/terminal.go --- old/fzf-0.22.0/src/terminal.go 2020-08-02 08:56:02.000000000 +0200 +++ new/fzf-0.23.1/src/terminal.go 2020-10-10 19:04:07.000000000 +0200 @@ -236,6 +236,8 @@ actPreviewDown actPreviewPageUp actPreviewPageDown + actPreviewHalfPageUp + actPreviewHalfPageDown actPreviousHistory actNextHistory actExecute @@ -612,12 +614,12 @@ maxDisplayWidthCalc = 1024 ) -func calculateSize(base int, size sizeSpec, margin int, minSize int) int { - max := base - margin +func calculateSize(base int, size sizeSpec, occupied int, minSize int, pad int) int { + max := base - occupied if size.percent { return util.Constrain(int(float64(base)*0.01*size.size), minSize, max) } - return util.Constrain(int(size.size), minSize, max) + return util.Constrain(int(size.size)+pad, minSize, max) } func (t *Terminal) resizeWindows() { @@ -676,6 +678,8 @@ } if t.pborder != nil { t.pborder.Close() + } + if t.pwindow != nil { t.pwindow.Close() } @@ -700,38 +704,51 @@ noBorder := tui.MakeBorderStyle(tui.BorderNone, t.unicode) if previewVisible { createPreviewWindow := func(y int, x int, w int, h int) { - previewBorder := tui.MakeBorderStyle(tui.BorderRounded, t.unicode) - if !t.preview.border { - previewBorder = tui.MakeTransparentBorder() + pwidth := w + pheight := h + if t.preview.border != tui.BorderNone { + previewBorder := tui.MakeBorderStyle(t.preview.border, t.unicode) + t.pborder = t.tui.NewWindow(y, x, w, h, true, previewBorder) + pwidth -= 4 + pheight -= 2 + x += 2 + y += 1 + } else { + previewBorder := tui.MakeTransparentBorder() + t.pborder = t.tui.NewWindow(y, x, w, h, true, previewBorder) + pwidth -= 4 + x += 2 } - t.pborder = t.tui.NewWindow(y, x, w, h, true, previewBorder) - pwidth := w - 4 // ncurses auto-wraps the line when the cursor reaches the right-end of // the window. To prevent unintended line-wraps, we use the width one // column larger than the desired value. if !t.preview.wrap && t.tui.DoesAutoWrap() { pwidth += 1 } - t.pwindow = t.tui.NewWindow(y+1, x+2, pwidth, h-2, true, noBorder) + t.pwindow = t.tui.NewWindow(y, x, pwidth, pheight, true, noBorder) + } + verticalPad := 2 + if t.preview.border == tui.BorderNone { + verticalPad = 0 } switch t.preview.position { case posUp: - pheight := calculateSize(height, t.preview.size, minHeight, 3) + pheight := calculateSize(height, t.preview.size, minHeight, 3, verticalPad) t.window = t.tui.NewWindow( marginInt[0]+pheight, marginInt[3], width, height-pheight, false, noBorder) createPreviewWindow(marginInt[0], marginInt[3], width, pheight) case posDown: - pheight := calculateSize(height, t.preview.size, minHeight, 3) + pheight := calculateSize(height, t.preview.size, minHeight, 3, verticalPad) t.window = t.tui.NewWindow( marginInt[0], marginInt[3], width, height-pheight, false, noBorder) createPreviewWindow(marginInt[0]+height-pheight, marginInt[3], width, pheight) case posLeft: - pwidth := calculateSize(width, t.preview.size, minWidth, 5) + pwidth := calculateSize(width, t.preview.size, minWidth, 5, 4) t.window = t.tui.NewWindow( marginInt[0], marginInt[3]+pwidth, width-pwidth, height, false, noBorder) createPreviewWindow(marginInt[0], marginInt[3], pwidth, height) case posRight: - pwidth := calculateSize(width, t.preview.size, minWidth, 5) + pwidth := calculateSize(width, t.preview.size, minWidth, 5, 4) t.window = t.tui.NewWindow( marginInt[0], marginInt[3], width-pwidth, height, false, noBorder) createPreviewWindow(marginInt[0], marginInt[3]+width-pwidth, pwidth, height) @@ -1037,7 +1054,7 @@ } offsets := result.colorOffsets(charOffsets, t.theme, col2, attr, current) - maxWidth := t.window.Width() - 3 + maxWidth := t.window.Width() - (t.pointerLen + t.markerLen + 1) maxe = util.Constrain(maxe+util.Min(maxWidth/2-2, t.hscrollOff), 0, len(text)) displayWidth := t.displayWidthWithLimit(text, 0, maxWidth) if displayWidth > maxWidth { @@ -1210,7 +1227,10 @@ windows = append(windows, t.border) } if t.hasPreviewWindow() { - windows = append(windows, t.pborder, t.pwindow) + if t.pborder != nil { + windows = append(windows, t.pborder) + } + windows = append(windows, t.pwindow) } windows = append(windows, t.window) t.tui.RefreshWindows(windows) @@ -1374,7 +1394,7 @@ return n } -func (t *Terminal) evaluateScrollOffset(list []*Item) int { +func (t *Terminal) evaluateScrollOffset(list []*Item, height int) int { offsetExpr := t.replacePlaceholder(t.preview.scroll, false, "", list) nums := strings.Split(offsetExpr, "-") switch len(nums) { @@ -1387,6 +1407,13 @@ } else if len(nums) == 1 { return base - 1 } + if nums[1][0] == '/' { + denom := atopi(nums[1][1:]) + if denom == 0 { + return base + } + return base - height/denom + } return base - atopi(nums[1]) - 1 default: return 0 @@ -1532,8 +1559,8 @@ func (t *Terminal) buildPlusList(template string, forcePlus bool) (bool, []*Item) { current := t.currentItem() - _, plus, query := hasPreviewFlags(template) - if !(query && len(t.input) > 0 || (forcePlus || plus) && len(t.selected) > 0) { + slot, plus, query := hasPreviewFlags(template) + if !(!slot || query && len(t.input) > 0 || (forcePlus || plus) && len(t.selected) > 0) { return current != nil, []*Item{current, current} } @@ -1676,11 +1703,13 @@ // We don't display preview window if no match if items[0] != nil { command := t.replacePlaceholder(commandTemplate, false, string(t.Input()), items) - offset := t.evaluateScrollOffset(items) + offset := 0 cmd := util.ExecCommand(command, true) if t.pwindow != nil { + height := t.pwindow.Height() + offset = t.evaluateScrollOffset(items, height) env := os.Environ() - lines := fmt.Sprintf("LINES=%d", t.pwindow.Height()) + lines := fmt.Sprintf("LINES=%d", height) columns := fmt.Sprintf("COLUMNS=%d", t.pwindow.Width()) env = append(env, lines) env = append(env, "FZF_PREVIEW_"+lines) @@ -1859,8 +1888,11 @@ if !t.previewer.more { return } - newOffset := util.Constrain( - t.previewer.offset+amount, 0, t.previewer.lines-1) + newOffset := t.previewer.offset + amount + if t.preview.cycle { + newOffset = (newOffset + t.previewer.lines) % t.previewer.lines + } + newOffset = util.Constrain(newOffset, 0, t.previewer.lines-1) if t.previewer.offset != newOffset { t.previewer.offset = newOffset req(reqPreviewRefresh) @@ -1930,6 +1962,14 @@ if t.hasPreviewWindow() { scrollPreview(t.pwindow.Height()) } + case actPreviewHalfPageUp: + if t.hasPreviewWindow() { + scrollPreview(-t.pwindow.Height() / 2) + } + case actPreviewHalfPageDown: + if t.hasPreviewWindow() { + scrollPreview(t.pwindow.Height() / 2) + } case actBeginningOfLine: t.cx = 0 case actBackwardChar: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fzf-0.22.0/src/tui/light.go new/fzf-0.23.1/src/tui/light.go --- old/fzf-0.22.0/src/tui/light.go 2020-08-02 08:56:02.000000000 +0200 +++ new/fzf-0.23.1/src/tui/light.go 2020-10-10 19:04:07.000000000 +0200 @@ -3,7 +3,6 @@ import ( "fmt" "os" - "os/exec" "regexp" "strconv" "strings" @@ -126,17 +125,6 @@ return &r } -func (r *LightRenderer) defaultTheme() *ColorTheme { - if strings.Contains(os.Getenv("TERM"), "256") { - return Dark256 - } - colors, err := exec.Command("tput", "colors").Output() - if err == nil && atoi(strings.TrimSpace(string(colors)), 16) > 16 { - return Dark256 - } - return Default16 -} - func repeat(r rune, times int) string { if times > 0 { return strings.Repeat(string(r), times) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fzf-0.22.0/src/tui/light_unix.go new/fzf-0.23.1/src/tui/light_unix.go --- old/fzf-0.22.0/src/tui/light_unix.go 2020-08-02 08:56:02.000000000 +0200 +++ new/fzf-0.23.1/src/tui/light_unix.go 2020-10-10 19:04:07.000000000 +0200 @@ -5,6 +5,8 @@ import ( "fmt" "os" + "os/exec" + "strings" "syscall" "github.com/junegunn/fzf/src/util" @@ -15,6 +17,17 @@ return true } +func (r *LightRenderer) defaultTheme() *ColorTheme { + if strings.Contains(os.Getenv("TERM"), "256") { + return Dark256 + } + colors, err := exec.Command("tput", "colors").Output() + if err == nil && atoi(strings.TrimSpace(string(colors)), 16) > 16 { + return Dark256 + } + return Default16 +} + func (r *LightRenderer) fd() int { return int(r.ttyin.Fd()) } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fzf-0.22.0/src/tui/light_windows.go new/fzf-0.23.1/src/tui/light_windows.go --- old/fzf-0.22.0/src/tui/light_windows.go 2020-08-02 08:56:02.000000000 +0200 +++ new/fzf-0.23.1/src/tui/light_windows.go 2020-10-10 19:04:07.000000000 +0200 @@ -34,6 +34,14 @@ return canSetVt100 } +func (r *LightRenderer) defaultTheme() *ColorTheme { + // the getenv check is borrowed from here: https://github.com/gdamore/tcell/commit/0c473b86d82f68226a142e96cc5a34c5a29b3690#diff-b008fcd5e6934bf31bc3d33bf49f47d8R178: + if !IsLightRendererSupported() || os.Getenv("ConEmuPID") != "" || os.Getenv("TCELL_TRUECOLOR") == "disable" { + return Default16 + } + return Dark256 +} + func (r *LightRenderer) initPlatform() error { //outHandle := windows.Stdout outHandle, _ := syscall.Open("CONOUT$", syscall.O_RDWR, 0) ++++++ vendor.tar.xz ++++++ /work/SRC/openSUSE:Factory/fzf/vendor.tar.xz /work/SRC/openSUSE:Factory/.fzf.new.3463/vendor.tar.xz differ: char 1, line 1