Commit Graph

64 Commits (20230117636c9dfa3ed6f6428c5bc4c51b02f60a)

Author SHA1 Message Date
OHZEKI Naoki 6b7a543c82
Add more util tests (#3062)
Co-authored-by: Junegunn Choi <junegunn.c@gmail.com>
2 years ago
Bruno Heridet 46877e0a92
test(eventbox): remove obsolete EvtClose const (#3059) 2 years ago
Junegunn Choi 8868d7d188
Add --separator to customize the info separator 2 years ago
Junegunn Choi ef67a45702
Add --ellipsis=.. option
Close #2432

Also see
- #1769
- https://github.com/junegunn/fzf/pull/1844#issuecomment-586663660
2 years ago
Junegunn Choi b88eb72ac2
Modernize build tags 2 years ago
Junegunn Choi cd23401411
Fix rendering of the prompt line when overflow occurs with `--info=inline`
Fix #2692
2 years ago
Rashil Gandhi 7c3f42bbba Fix powershell escaping 3 years ago
Junegunn Choi edac9820b5
Cache cygpath result
No need to repeatedly run cygpath process because $SHELL never changes.
3 years ago
Rashil Gandhi 84a47f7102
Respect SHELL env var on Windows (#2641)
This makes fzf respect SHELL environment variable on Windows, like it does on *nix, whenever defined.

Close #2638
3 years ago
Vlastimil Ovčáčík 00fb486f6a [tests] Add testing of keyboard events in FullscreenRenderer.GetChar()
This contains one test case of each tcell.Key* event type that can be
sent to and subsequently processed in fzf's GetChar(). The test cases
describe status quo, and all of them PASS.

Small function util.ToTty() was added. It is similar to util.IsTty(),
but for stdout (hence the To preposition).
3 years ago
Junegunn Choi 8255aa23f4
Fix bug where `--read0` not properly displaying long lines
Fix #2508
3 years ago
Junegunn Choi 3f75a8369f
Replace RuneWidth to StringWidth to handle grapheme clusters
Fix #2482
3 years ago
Alexandr a6a732e1fc
Update AtomicBool to use atomic memory operation (#1939) 4 years ago
Junegunn Choi 4c9cab3f8a
Fix prefix/suffix/equal matcher to trim whitespaces
- Prefix matcher will trim leading whitespaces only when the pattern
  doesn't start with a whitespace
- Suffix matcher will trim trailing whitespaces only when the pattern
  doesn't end with a whitespace
- Equal matcher will trim leading whitespaces only when the pattern
  doesn't start with a whitespace, and trim trailing whitespaces only
  when the pattern doesn't end with a whitespace

Previously, only suffix matcher would trim whitespaces unconditionally.

Fix #1894
4 years ago
Junegunn Choi 2b725a4db5
Defer resetting multi-selection on reload 5 years ago
Junegunn Choi 751aa1944a
Remove trailing whitespaces when using --with-nth 5 years ago
Christian Muehlhaeuser a1260feeed Code cleanup (#1640)
- Replaced time.Now().Sub() with time.Since()
- Replaced unnecessary string/byte slice conversions
- Removed obsolete return and value assignment in range loop
5 years ago
Junegunn Choi 85c1f8a9e0
Always prepend ANSI reset code before re-assembling tokens 5 years ago
Junegunn Choi ef577a6509
Preserve the original color of each token when using --with-nth with --ansi
Close #1500
5 years ago
Junegunn Choi b46227dcb6
0.17.5 6 years ago
Junegunn Choi 0d748a0699
Kill running preview process after 500ms when focus has changed
Close #1383
Close #1384
6 years ago
Junegunn Choi f57920ad90
Do not print non-displayable characters
fzf used to print non-displayable characters (ascii code < 32) as '?',
but we will simply ignore those characters with this patch, just like
our terminals do.

\n and \r are exceptions. They will be printed as a space character.

TODO: \H should delete the preceding character, but this is not implemented.

Related: #1253
6 years ago
Ryan Boehning 21b94d2de5
Make fzf pass go vet
Add String() methods to types, so they can be printed with %s. Change
some %s format specifiers to %v, when the default string representation
is good enough. In Go 1.10, `go test` triggers a parallel `go vet`. So
this also makes fzf pass `go test`.

Close #1236
Close #1219
6 years ago
Jan Edmund Lazo 7f0caf0683 Update Windows default command to print relative paths (#1200) 6 years ago
Junegunn Choi 438f6c96cd
Fix compilation error of Windows binary 7 years ago
Jan Edmund Lazo c4185e81e8
Fix ExecCommandWith for cmd.exe in Windows (#1072)
Close #1018

Run the command as is in cmd.exe with no parsing and escaping.
Explicity set cmd.SysProcAttr so execCommand does not escape the command.
Technically, the command should be escaped with ^ for special characters,
including ". This allows cmd.exe commands to be chained together.

See https://github.com/neovim/neovim/pull/7343#issuecomment-333350201

This commit also updates quoteEntry to use strings.Replace instead of
strconv.Quote which escapes more than \ and ".
7 years ago
Junegunn Choi ee40212e97
Update FZF_DEFAULT_COMMAND
- Use bash for `set -o pipefail`
- Fall back to simpler find command when the original command failed

Related: #1061
7 years ago
Junegunn Choi af809c9661
Minor refactorings 7 years ago
Junegunn Choi 55ee4186aa
Ignore EvtReadNew if EvtReadFin is already set 7 years ago
Junegunn Choi 87874bba88
Remove redundant read event when --sync is used 7 years ago
Junegunn Choi 99927c7071
Modify loop conditions in checkAscii function 7 years ago
Junegunn Choi 37370f057f
Do not use defer in performance-sensitive contexts 7 years ago
Junegunn Choi 69aa2fea68
Optimize fuzzy search performance for ASCII strings 7 years ago
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.
7 years ago
Junegunn Choi 5e72709613
Speed up initial scanning with bitwise AND operation 7 years ago
Junegunn Choi 9e85cba0d0
Reduce memory footprint of Item struct 7 years ago
Junegunn Choi ca0b3b6fd7
Fixes for Cygwin
- Update install script to download Windows binary if $TERM == cygwin
- Unset TERM if $TERM == cygwin (#933)
- Always use cmd.exe instead of $SHELL when running commands
7 years ago
Edgar Lee 7d3575b362
Use glide to handle go dependencies 7 years ago
Tw ab182e276b Use read syscall directly to get character (#931)
Due to go std lib uses poller for os.File introducing in this commit:
c05b06a12d
There are two changes to watch out:
1. os.File.Fd will always return a blocking fd except on bsd.
2. os.File.Read won't return EAGAIN error for nonblocking fd.

So
For 1, we just get tty's fd in advance and then set its block mode.
For 2, we use read syscall directly to get what we wanted error(EAGAIN).

Fix issue #910.

Signed-off-by: Tw <tw19881113@gmail.com>
7 years ago
Junegunn Choi 6c6c0a4778
Make util.RuneWidth return 1 for non-displayable characters
Fix line wrapping in preview window
8 years ago
Junegunn Choi 1448d631a7
Add --height option 8 years ago
Junegunn Choi 898d8d94c8
Fix issues in tcell renderer and Windows build
- Fix display of CJK wide characters
- Fix horizontal offset of header lines
- Add support for keys with ALT modifier, shift-tab, page-up and down
- Fix util.ExecCommand to properly parse command-line arguments
- Fix redraw on resize
- Implement Pause/Resume for execute action
- Remove runtime check of GOOS
- Change exit status to 2 when tcell failed to start
- TBD: Travis CI build for tcell renderer
    - Pending. tcell cannot reliably ingest keys from tmux send-keys
8 years ago
Junegunn Choi 0c573b3dff
Prepare for termbox/windows build
`TAGS=termbox make` (or `go build -tags termbox`)
8 years ago
Junegunn Choi 04492bab10
Use unicode.IsSpace to cover more whitespace characters 8 years ago
Junegunn Choi 2fc7c18747
Revise ranking algorithm 8 years ago
Junegunn Choi 37dc273148
Micro-optimizations
- Make structs smaller
- Introduce Result struct and use it to represent matched items instead of
  reusing Item struct for that purpose
- Avoid unnecessary memory allocation
- Avoid growing slice from the initial capacity
- Code cleanup
8 years ago
Junegunn Choi 41e916a511
[perf] evaluateBonus can start from sidx - 1 8 years ago
Junegunn Choi d9c8a9a880
[perf] Remove memory copy when using string delimiter 8 years ago
Junegunn Choi ddc7bb9064
[perf] Optimize AWK-style tokenizer for --nth
Approx. 50% less memory footprint and 40% improvement in query time
8 years ago
Junegunn Choi 1d4057c209
[perf] Avoid allocating rune array for ascii string
In the best case (all ascii), this reduces the memory footprint by 60%
and the response time by 15% to 20%. In the worst case (every line has
non-ascii characters), 3 to 4% overhead is observed.
8 years ago