Commit Graph

1039 Commits (master)

Author SHA1 Message Date
Junegunn Choi 8a74976c1f
Add track-current, untrack-current, and toggle-track-current (#3699)
Close #3691
2 months ago
Junegunn Choi 008fb9d258
Fix reload and reload-sync behaviors
https://github.com/junegunn/fzf/discussions/3696#discussioncomment-8915593
2 months ago
Junegunn Choi db6db49ed6
Increase the buffer size for POST requests
Close #3685
2 months ago
Junegunn Choi 05453881c3
Set a 2-second timeout for POST requests
Close #3685
2 months ago
Junegunn Choi c7ee071efa
Fix panic caused by invalid cursor index
Fix #3681
2 months ago
Junegunn Choi 8977c9257a
Limit the maximum number of focus events to process at once 2 months ago
Junegunn Choi e74b1251c0
Embed shell integration scripts in fzf binary (`--bash` / `--zsh` / `--fish`) (#3675)
This simplifies the distribution, and the users are less likely to have
problems caused by using incompatible scripts and binaries.

    # Set up fzf key bindings and fuzzy completion
    eval "$(fzf --bash)"

    # Set up fzf key bindings and fuzzy completion
    eval "$(fzf --zsh)"

    # Set up fzf key bindings
    fzf --fish | source
2 months ago
Junegunn Choi d282a1649d
Add walker options and replace 'find' with the built-in walker (#3649) 2 months ago
Junegunn Choi 26244ad8c2
Fix preview area not being cleared when using certain types of border styles
fzf --preview 'sleep 3; date' --preview-window hidden \
      --bind ctrl-/:change-preview-window:up,border-bottom
2 months ago
Junegunn Choi fa0aa5510d
Kill preview process when hiding the preview window
via toggle-preview, hide-preview, or change-preview-window
2 months ago
Junegunn Choi eec557b6aa
Fix invalid memory access when the preview window becomes hidden 2 months ago
onee-only 61bc129e1d Update parseGetParams to call strconv.Atoi when params are valid 2 months ago
onee-only 52210a57f0 Update error return position according to convention 2 months ago
onee-only 8061a2f108 Remove duplicate code 2 months ago
Junegunn Choi 686f9288fc
Allow iTerm2 image data that ends with 'ESC \' (#3646) 3 months ago
Junegunn Choi 1833670fb9
Add $FZF_DEFAULT_OPTS_FILE (#3618)
For those who prefer to manage default options in a file.
If the file is not found, fzf will exit with an error.

We're not setting a default value for it because:

1. it's hard to find a default value that can be universally agreed upon
2. to avoid fzf having to check for the existence of the file even when it's not used
3 months ago
Junegunn Choi 99a7beba57
Fix missing bonus score on a delimiter character
Fix #3645
3 months ago
Junegunn Choi ca747a2b54
Fix unit tests 3 months ago
Junegunn Choi 5e6788c679
Export FZF_* variables to 'reload' process as well 3 months ago
Junegunn Choi 7a72f1a253
Code cleanup: Remove unused argument 3 months ago
Junegunn Choi 208e556332
Replace "default find command" with built-in directory traversal 3 months ago
Junegunn Choi 3c0a630475
0.46.1 4 months ago
Junegunn Choi 413c66beba
Fix tests for tcell build 4 months ago
Junegunn Choi 1416e696b1
Avoid full redraw on 'preview' action when preview window exists 4 months ago
Junegunn Choi d373cf89c7
Retain preview window on resize after 'preview' action 4 months ago
Junegunn Choi 76cf6559cc
junegunn/uniseg -> rivo/uniseg
https://github.com/rivo/uniseg/pull/47
4 months ago
Junegunn Choi da752fc9a4
Fix Windows build
Fix #3598
4 months ago
Junegunn Choi 2a8b65e105
Fix highlighting of regions that are matched multiple times
Fix #3596
4 months ago
Junegunn Choi 7484292e63
Avoid deadlocks by adding a 2 second timeout to GET / endpoint
Because fzf processes HTTP GET requests in the main event loop,
accessing the endpoint from within execute/transform actions would
result in a deadlock and hang fzf indefinitely. This commit sets
a 2 second timeout to avoid the deadlock.
4 months ago
Junegunn Choi 687c2741b8
Add 'resize' event
Close #3570
4 months ago
Junegunn Choi 16f6473938
Change mattn/go-runewidth dependency to rivo/uniseg for accurate results
Related #3588 #3588 #3567
4 months ago
Junegunn Choi 8a2c41e183
Handle ambiguous emoji width
Fix #3588
4 months ago
Junegunn Choi cdfaf761df
Expose state information via environment variables to child processes
Close #3582
4 months ago
Junegunn Choi 1a9ea6f738
Remove 'replace' directive for 'go install' compatibility
Close #3577
4 months ago
Junegunn Choi 250496c953
Add 'result' event that is triggered when the result list is ready
Close #3560
4 months ago
Junegunn Choi e47dc758c9
Fix focus event not triggered in certain cases 4 months ago
Junegunn Choi 2024010119
0.45.0 5 months ago
Junegunn Choi 412040f77e
Enable preview if 'transform' action is bound to a key 5 months ago
Junegunn Choi d210660ce8
Add actions: show-header and hide-header 5 months ago
Junegunn Choi 863a12562b
Trigger focus actions synchronously 5 months ago
Junegunn Choi 5d360180af
Add {fzf:prompt} placeholder expression
Close #3354
5 months ago
Junegunn Choi 519de7c833
Fix unexpected result of --tiebreak=end
See https://github.com/junegunn/fzf/issues/3255#issuecomment-1869580320
5 months ago
Junegunn Choi 97ccef1a04
{fzf:query} should trigger preview update
fzf --preview 'echo {fzf:query}'
    fzf --preview 'echo {q}'
5 months ago
Junegunn Choi cd114c6818
Change transform action to directly execute actions
To avoid filling up input channel for HTTP server
5 months ago
Junegunn Choi 1707b8cdba
Add 'transform' action to conditionally perform a series of actions
'transform' action runs an external command that prints a series of
actions to perform.

  # Disallow selecting an empty line
  echo -e "1. Hello\n2. Goodbye\n\n3. Exit" |
    fzf --reverse --header 'Select one' \
        --bind 'enter:transform:[[ -n {} ]] && echo accept || echo "change-header:Invalid selection"'

  # Move cursor past the empty line
  echo -e "1. Hello\n2. Goodbye\n\n3. Exit" |
    fzf --reverse --header 'Select one' \
        --bind 'enter:transform:[[ -n {} ]] && echo accept || echo "change-header:Invalid selection"' \
        --bind 'focus:transform:[[ -n {} ]] && exit; [[ {fzf:action} =~ up$ ]] && echo up || echo down'

Close #3368
Close #2980
5 months ago
Junegunn Choi 41d4d70b98
Fix shell escaping for fish
Fix #3224
5 months ago
Junegunn Choi 0e999482cb
Fix handling of empty ANSI color sequence
Fix #3320
5 months ago
Junegunn Choi d7b61ede07
Add support for negative --height
fzf --height=-1

Close #3487
5 months ago
Jan Verbeek 91387a741b
Terminate simple server success response with double CRLF (#3542)
The simple success case had only the status line plus a single CRLF,
and pedantic HTTP client implementations (`hyper`) stumbled over
this. A double CRLF makes it OK.

Fixes #3541.
5 months ago
Junegunn Choi c36a64be68
Add accept-or-print-query
Close #3528
5 months ago
Junegunn Choi cd6788a2bb
Increase buffer size of event channel to avoid freeze on zero event
Fix #3516
6 months ago
Laurent Cheylus 952b6af445
Allow files creation in /tmp on OpenBSD (#3512)
- src/protector/protector_openbsd.go: add tmppath for pledge
    permissions
  - fix junegunn/fzf#3511

Signed-off-by: Laurent Cheylus <foxy@free.fr>
6 months ago
Junegunn Choi 29e67d307a
Fix crash when preview window is hidden on focus event 6 months ago
Junegunn Choi 7320b7df62
0.44.0 6 months ago
Tomáš Janoušek 11fb4233f7
Fix Home, End on rxvt-unicode (#3507) 6 months ago
Junegunn Choi 84bb350b14
Reset horizontal offset of the prompt on 'beginning-of-line'
https://github.com/junegunn/fzf/issues/3498#issuecomment-1806651174
6 months ago
Junegunn Choi 38e3694d1c
Revert "Sixel and Kitty image support on Windows binary (#2544)"
This reverts commit 68db9cb499.
6 months ago
Junegunn Choi 230fc49ae2
(Experimental) Add support for iTerm2 inline image protocol
Close #1102

  fzf --preview 'imgcat -W $FZF_PREVIEW_COLUMNS -H $FZF_PREVIEW_LINES {}'

Notes:
* There is no good way to determine the height of the rendered image,
  so we assume that the image takes the full height of the preview
  window. So the image cannot be displayed with the other text.
* fzf-preview.sh script was updated to use `imgcat` if it's available
  but `chafa` is not.
* iTerm2 also supports Sixel, so adding support for this protocol is not
  quite necessary but it renders animated GIFs much better (e.g. looping).
6 months ago
Junegunn Choi a818653174
Add --listen-unsafe=ADDR to allow remote process execution (#3498) 7 months ago
Junegunn Choi c5aa8729a1
Fix failing test case 7 months ago
Junegunn Choi 3f78d76da1
Allow accepting remote connections
Close #3498

  # FZF_API_KEY is required for a non-localhost listen address
  FZF_API_KEY=xxx fzf --listen 0.0.0.0:6266
7 months ago
Junegunn Choi 70c19ccf16
Fix CTRL-Z handling: Signal SIGSTOP to PGID
Fix #3501
7 months ago
Junegunn Choi 68db9cb499
Sixel and Kitty image support on Windows binary (#2544) 7 months ago
Junegunn Choi d0466fa777
Fix regression where tcell renderer not clearing the preview window 7 months ago
Junegunn Choi 21ab64e962
sixel: Export $FZF_PREVIEW_TOP to the preview command (#2544)
So that it can determine if it should subtract 1 from $FZF_PREVIEW_LINES
to avoid scrolling issue of Sixel image that touches the bottom of the
screen.
7 months ago
Junegunn Choi a0145cebf2
sixel: Better handling of animated GIFs (#2544) 7 months ago
Junegunn Choi 278dce9ba6
Restore scroll after rendering full-height Sixel image (#2544)
When a Sixel image touches the bottom of the screen, the whole screen
scrolls up one line to make room for the cursor. Add an ANSI escape
code to compensate for the movement. Unfortunately, the movement of the
screen is sometimes noticeable.

  fzf --preview='fzf-preview.sh {}' --preview-window border-left
7 months ago
Junegunn Choi 9a95cd5794
Fix Sixel height calculation (#2544) 7 months ago
Junegunn Choi 96e31e4b78
Fix Sixel issues (#2544)
* Fix regression where previous image is not properly cleared
* Change the way fzf calculates the number of required lines to display
  an image (ceil -> floor) to fix the issue where an image is always
  rendered as a wireframe.
7 months ago
Junegunn Choi 242641264d
Clear previous non-Sixel text before rendering Sixel image (#2544) 7 months ago
Junegunn Choi 3277e8c89c
Remove $FZF_PREVIEW_PIXEL_{WIDTH,HEIGHT} (#2544)
They are not neccessary because we can use a program such as chafa that
can resize images by the terminal columns and lines.
7 months ago
Junegunn Choi d02b9442a5
(Experimental) Improve Sixel graphics support (#2544)
Progress:

* Sixel image can now be displayed with other text, and is scrollable
* If an image can't be displayed entirely due to the scroll offset, fzf
  will render a wireframe to indicate that an image should be displayed
* Renamed $FZF_PREVIEW_{WIDTH,HEIGHT} to $FZF_PREVIEW_PIXEL_{WIDTH,HEIGHT}
  for clarity
* Added bin/fzf-preview.sh script to demonstrate how to display an image
  using Kitty or Sixel protocol

An example:

  ls *.jpg | fzf --preview='seq $((FZF_PREVIEW_LINES*9/10)); fzf-preview.sh {}; seq 100'

A known issue:

* If you reduce the size of the preview window, the image may extend
  beyond the preview window
7 months ago
Junegunn Choi bac385b59c
Simplify LightRenderer.Size() 7 months ago
Junegunn Choi b1a0ab8086
Experimental Sixel support (#2544) 7 months ago
Junegunn Choi f5e4ee90e4
Fix bug where top section of the previous preview content appearing
when the preview window is re-enabled and the current preview process is
taking more than 500ms and previewDelayed is triggered

  fzf --preview 'sleep 1; date; seq 1000' --bind space:toggle-preview
7 months ago
Junegunn Choi 690d5e6dbd
Fix scrollability of the preview window when preview offset is specified
This should not be scrollable

  fzf --preview 'seq $FZF_PREVIEW_LINES' --preview-window '~5'
7 months ago
Junegunn Choi a76c055b63
Fix inconsistent preview window width with --border
fzf --preview 'cat {}' --bind 'space:change-preview-window:up|right' --border
7 months ago
Laurent Cheylus d51b71ee80
Fix crash on OpenBSD with --listen (#3483)
- src/protector/protector_openbsd.go: add inet permissions for pledge
  - fix #3481

Signed-off-by: Laurent Cheylus <foxy@free.fr>
7 months ago
Junegunn Choi 3df06a1c68
Fix offset-up and offset-down with --layout=reverse (#3456) 7 months ago
Junegunn Choi 404b6a864b
Add offset-up and offset-down
# Scrolling will behave similarly to CTRL-E and CTRL-Y of vim
  fzf --bind scroll-up:offset-up,scroll-down:offset-down \
      --bind ctrl-y:offset-up,ctrl-e:offset-down \
      --scroll-off=5

Close #3456
7 months ago
Junegunn Choi 391aa14845
Add mouse events for --bind
Close #3473
7 months ago
Junegunn Choi d8188fce7b
Experimental support for Kitty image protocol in preview window
Close #3228

* Works inside and outside of tmux
* There is a problem where fzf unnecessarily displays the scroll offset
  indicator at the topbright of the screen when the image just fits the
  preview window. This is because `kitty icat` generates an extra line
  after the image area.

    # A 5-row images; an extra row at the end confuses fzf
    ["\e_Ga ... \e[9C􎻮̅̅ࠪ􎻮̅̍ࠪ􎻮̅̎ࠪ􎻮̅̐ࠪ􎻮̅̒ࠪ􎻮̅̽ࠪ􎻮̅̾ࠪ􎻮̅̿ࠪ􎻮̅͆ࠪ􎻮̅͊ࠪ􎻮̅͋ࠪ\n",
     "\r\e[9C􎻮̍̅ࠪ􎻮̍̍ࠪ􎻮̍̎ࠪ􎻮̍̐ࠪ􎻮̍̒ࠪ􎻮̍̽ࠪ􎻮̍̾ࠪ􎻮̍̿ࠪ􎻮̍͆ࠪ􎻮̍͊ࠪ􎻮̍͋ࠪ\n",
     "\r\e[9C􎻮̎̅ࠪ􎻮̎̍ࠪ􎻮̎̎ࠪ􎻮̎̐ࠪ􎻮̎̒ࠪ􎻮̎̽ࠪ􎻮̎̾ࠪ􎻮̎̿ࠪ􎻮̎͆ࠪ􎻮̎͊ࠪ􎻮̎͋ࠪ\n",
     "\r\e[9C􎻮̐̅ࠪ􎻮̐̍ࠪ􎻮̐̎ࠪ􎻮̐̐ࠪ􎻮̐̒ࠪ􎻮̐̽ࠪ􎻮̐̾ࠪ􎻮̐̿ࠪ􎻮̐͆ࠪ􎻮̐͊ࠪ􎻮̐͋ࠪ\n",
     "\r\e[9C􎻮̒̅ࠪ􎻮̒̍ࠪ􎻮̒̎ࠪ􎻮̒̐ࠪ􎻮̒̒ࠪ􎻮̒̽ࠪ􎻮̒̾ࠪ􎻮̒̿ࠪ􎻮̒͆ࠪ􎻮̒͊ࠪ􎻮̒͋ࠪ\n",
     "\r\e[39m\e8"]

* Example:

  fzf --preview='
    if file --mime-type {} | grep -qF 'image/'; then
      # --transfer-mode=memory is the fastest option but if you want fzf to be able
      # to redraw the image on terminal resize or on 'change-preview-window',
      # you need to use --transfer-mode=stream.
      kitty icat --clear --transfer-mode=memory --stdin=no --place=${FZF_PREVIEW_COLUMNS}x${FZF_PREVIEW_LINES}@0x0 {}
    else
      bat --color=always {}
    fi
  '
7 months ago
Junegunn Choi 76364ea767 Remove unnecessary escaping in the default command 8 months ago
Junegunn Choi 901939bd96
Add support for limit and offset parameters for GET / endpoint
Related #3372
8 months ago
Junegunn Choi 4490b2d209
Respect ANSI codes to reset properties
Fix #3441
8 months ago
Junegunn Choi 0f50dc848e
Add 'GET /' endpoint for getting the program state (experimental)
Related #3372
9 months ago
Junegunn Choi f50a7058d6
Fix center-alignment of border/preview label
Fix #3421
9 months ago
Junegunn Choi dd59b8c7b9
Fix ANSI color continuation in --header
# Both lines should be in red
  fzf --header $'\x1b[31mfoo\nbar'
10 months ago
Junegunn Choi f83491274f
Add toggle-header option
Close #3358
10 months ago
Boaz Yaniv c0435fdff4
Add API Keys for fzf --listen (#3374) 10 months ago
Bart 3c09c77269
Fix deprecations of ioutil (#3370) 10 months ago
Junegunn Choi 547e101f1d
Use $SHELL instead of bash if it's known to support 'pipefail'
when running the default find command

Close #3339
Close #3364
10 months ago
Junegunn Choi 63aa5d3b4e
Correct outdated comment 11 months ago
guangwu 4772bd8d4c
Use strings.ContainsRune instead (#3335) 11 months ago
Junegunn Choi d0b7780239
Add --info=right
Related: #3322
11 months ago
Junegunn Choi e627ca6bd7
Add --info=inline-right
Close #3322
11 months ago
Junegunn Choi c97172bdd4
Fix background color of spinner on the preview window 11 months ago
Mike ce8a745fb4
Add new border style: 'thinblock' (#3327)
Co-authored-by: Junegunn Choi <junegunn.c@gmail.com>
11 months ago
Junegunn Choi 448d7e0c5a
Update test case 12 months ago
Junegunn Choi 4c70745cc1
Fix bug where preview is not updated after reload when --disabled is set
Fix #3311
12 months ago