Commit Graph

105 Commits

Author SHA1 Message Date
Junegunn Choi 4bedd33c59
Refactor the code to remove global variables 2024-05-07 16:58:17 +09:00
Junegunn Choi e8405f40fe
Refactor the code so that fzf can be used as a library (#3769) 2024-05-07 01:06:42 +09:00
Junegunn Choi a4391aeedd
Add --with-shell for shelling out with different command and flags (#3746)
Close #3732
2024-04-27 18:36:37 +09:00
Junegunn Choi d8bfb6712d
Remove invalid 'result' event when using --sync option
When the search for the initial query doesn't finish immediately
fzf would trigger an invalid 'result' event for an empty query.

  seq 100 | fzf --query 99 --bind result:accept --sync
    # Prints 99

  seq 1000000 | fzf --query 99 --bind result:accept --sync
    # Should print 99, but fzf would print 1
2024-04-20 14:42:43 +09:00
Junegunn Choi 3acb4ca90e
Fix streaming filter mode by not running reader callback concurrently
Close #3728
2024-04-14 23:34:25 +09:00
Charlie Vieth 3c877c504b
Enable profiling options when 'pprof' tag is set (#2813)
This commit enables cpu, mem, block, and mutex profling of the FZF
executable. To support flushing the profiles at program exit it adds
util.AtExit to register "at exit" functions and mandates that util.Exit
is used instead of os.Exit to stop the program.

Co-authored-by: Junegunn Choi <junegunn.c@gmail.com>
2024-04-13 14:58:11 +09:00
Junegunn Choi c30e486b64
Further performance improvements by removing unnecessary copies 2024-04-02 08:43:08 +09:00
Junegunn Choi 41b3511ad9
Improve ingestion performance (by around 20%) 2024-04-01 23:38:46 +09:00
Junegunn Choi 008fb9d258
Fix reload and reload-sync behaviors
https://github.com/junegunn/fzf/discussions/3696#discussioncomment-8915593
2024-03-27 17:25:56 +09:00
Junegunn Choi d282a1649d
Add walker options and replace 'find' with the built-in walker (#3649) 2024-03-13 20:56:31 +09:00
Junegunn Choi 5e6788c679
Export FZF_* variables to 'reload' process as well 2024-02-19 12:36:14 +09:00
Junegunn Choi d7b61ede07
Add support for negative --height
fzf --height=-1

Close #3487
2023-12-21 18:42:23 +09:00
Junegunn Choi 4c70745cc1
Fix bug where preview is not updated after reload when --disabled is set
Fix #3311
2023-05-27 15:51:04 +09:00
Junegunn Choi 7795748a3f
Remove dead code 2023-05-27 15:10:47 +09:00
Junegunn Choi b7c2e8cb67
Fix caching when reload and query change triggered by the same binding 2023-05-01 13:53:34 +09:00
Junegunn Choi 77f9f4664a
Fix search not triggered when query change and reload happen at the same time
Fix #3268
2023-04-30 18:14:40 +09:00
tyama711 fb019d43bf
Fix a bug of height range with -1 or -0 (#3226)
Fixed a bug that when both heightUnknown and deferred are true, deferred is not properly reset and the program terminates abnormally.

Co-authored-by: Junegunn Choi <junegunn.c@gmail.com>
2023-04-02 23:26:13 +09:00
Junegunn Choi 924ffb5a35
Fix cache being immediately cleared on reload-sync 2022-12-31 09:33:23 +09:00
Junegunn Choi 6c37177cf5
Add reload-sync action
Close #2816
2022-12-29 20:04:33 +09:00
Junegunn Choi 22cbd9fa58
Implement height range (--height ~[VALUE][%])
Close #2953
2022-09-28 23:22:31 +09:00
Junegunn Choi f4fd53211a
Reformat comments adhere to gofmt 2022-08-12 22:11:15 +09:00
Junegunn Choi 38259d0382
Fix incorrect ordering of `--tiebreak=chunk` 2022-08-03 22:18:26 +09:00
Junegunn Choi d56f605b63
Add `rebind` action for restoring bindings after `unbind`
Fix #2752
Close #2564
2022-04-04 21:54:22 +09:00
Junegunn Choi 0f02fc0c77
Reset {n} after reload
Fix #2611
2021-09-14 20:36:10 +09:00
Junegunn Choi e2e8d94b14
Kill input command on terminate
Fix #2381
Close #2382
2021-03-07 11:30:26 +09:00
Junegunn Choi 8c533e34ea
0.25.0 2021-01-03 00:56:11 +09:00
Junegunn Choi d779ff7e6d
Make search toggleable
- `--phony` renamed to `--disabled` for consistency
    - `--no-phony` is now `--enabled`
- Added `enable-search`, `disable-search`, and `toggle-search` actions
  for `--bind`
- Added `--color` options: `query` and `disabled`

Close #2303
2021-01-03 00:15:00 +09:00
Junegunn Choi 552414978e
0.24.0-rc1 2020-10-27 11:07:27 +09:00
Junegunn Choi 11841f688b
Add support for text styling using --color
Close #1663
2020-10-25 19:30:41 +09:00
Junegunn Choi 212de25409
Fix incorrect header array mutation 2019-12-16 18:47:05 +09:00
Junegunn Choi 2b725a4db5
Defer resetting multi-selection on reload 2019-12-09 21:32:58 +09:00
Junegunn Choi 86e3994e87 Properly clear list when --header-lines not filled on reload 2019-12-06 22:34:45 +09:00
Junegunn Choi 394d8cfd18
Remove immediate flickering on reload action 2019-12-05 22:27:18 +09:00
Junegunn Choi 751aa1944a
Remove trailing whitespaces when using --with-nth 2019-11-12 23:20:09 +09:00
Junegunn Choi 7e1c0f39e7
'reload' action should reset --header-lines 2019-11-12 00:10:24 +09:00
Junegunn Choi 73c0a645e0
Remove unnecessary reader barrier on --filter mode 2019-11-11 12:53:03 +09:00
Junegunn Choi 78da928727
Experimental implementation of "reload" action
# Reload input list with different sources
  seq 10 | fzf --bind 'ctrl-a:reload(seq 100),ctrl-b:reload(seq 1000)'

  # Reload as you type
  seq 10 | fzf --bind 'change:reload:seq {q}' --phony

  # Integration with ripgrep
  RG_PREFIX="rg --column --line-number --no-heading --color=always --smart-case "
  INITIAL_QUERY=""
  FZF_DEFAULT_COMMAND="$RG_PREFIX '$INITIAL_QUERY'" \
    fzf --bind "change:reload:$RG_PREFIX {q} || true" \
        --ansi --phony --query "$INITIAL_QUERY"

Close #751
Close #965
Close #974
Close #1736
Related #1723
2019-11-10 11:43:37 +09:00
Junegunn Choi 11962dabba
Add --phony option for disabling search
With --phony, fzf becomes a simply selector interface without its own
search functionality. The query string is only used for building the
command for preview or execute action.

Close #1723
2019-11-10 11:36:55 +09:00
Junegunn Choi 85c1f8a9e0
Always prepend ANSI reset code before re-assembling tokens 2019-03-07 15:29:57 +09:00
Junegunn Choi e00e7e1e56
Remove unnecessary ANSI code injection 2019-03-07 02:02:02 +09:00
Junegunn Choi ef577a6509
Preserve the original color of each token when using --with-nth with --ansi
Close #1500
2019-03-06 19:05:05 +09:00
Junegunn Choi 5624a89231
Inverse-only matches should not reorder the remaining results
Fix #1458
2018-12-19 23:05:29 +09:00
Junegunn Choi 55ee4186aa
Ignore EvtReadNew if EvtReadFin is already set 2017-08-20 14:30:17 +09:00
Junegunn Choi 87874bba88
Remove redundant read event when --sync is used 2017-08-20 01:58:51 +09:00
Junegunn Choi 0558dfee79
Remove count field from ChunkList 2017-08-16 12:26:06 +09:00
Junegunn Choi 487c8fe88f
Make Reader event notification asynchronous
Instead of notifying the event coordinator (EventBox) whenever a new
line is arrived, start a background goroutine that periodically does the
task. Atomic.StoreInt32 is much cheaper than mutex synchronization
that happens during EventBox update.
2017-08-16 03:33:48 +09:00
Junegunn Choi 0d171ba1d8
Remove special nilItem 2017-08-15 01:10:41 +09:00
Junegunn Choi 37370f057f
Do not use defer in performance-sensitive contexts 2017-08-01 03:44:55 +09:00
Junegunn Choi bd98f988f0
Further reduce unnecessary rune array conversion
I was too quick to release 0.16.9, this commit makes --ansi processing
even faster.
2017-07-21 17:31:11 +09:00
Junegunn Choi c9f16b6430
Avoid unconditionally storsing input as runes
When --with-nth is used, fzf used to preprocess each line and store the
result as rune array, which was wasteful if the line only contains ascii
characters.
2017-07-20 02:44:30 +09:00