Rashil Gandhi
7c3f42bbba
Fix powershell escaping
2021-11-02 15:56:20 +09:00
Junegunn Choi
edac9820b5
Cache cygpath result
...
No need to repeatedly run cygpath process because $SHELL never changes.
2021-10-25 18:46:59 +09:00
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
2021-10-23 01:09:47 +09:00
Junegunn Choi
97ae8afb6f
Reload should update preview window
...
Fix #2644
2021-10-23 01:06:15 +09:00
Vlastimil Ovčáčík
61339a8ae2
Add more tests of placeholder flags and simplify its logic ( #2624 )
...
* [tests] Test fzf's placeholders and escaping on practical commands
This tests some reasonable commands in fzf's templates (for commands,
previews, rebinds etc.), how are those commands escaped (backslashes,
double quotes), and documents if the output is executable in cmd.exe.
Both on Unix and Windows.
* [tests] Add testing of placeholder parsing and matching
Adds tests and bit of docs for the curly brackets placeholders in fzf's
template strings. Also tests the "placeholder" regex.
* [tests] Add more test cases of replacing placeholders focused on flags
Replacing placeholders in templates is already tested, this adds tests
that focus more on the parameters of placeholders - e.g. flags, token
ranges.
There is at least one test for each flag, not all combinations are
tested though.
* [refactoring] Split OS-specific function quoteEntry() to corresponding source file
This is minor refactoring, and also the function's test was made
crossplatform.
* [refactoring] Simplify replacePlaceholder function
Should be equivalent to the original, but has simpler structure.
2021-10-15 22:31:59 +09:00
Junegunn Choi
50eb2e3855
Render spinner on info line during "reload"
...
Fix #2637
2021-10-15 22:13:57 +09:00
Vlastimil Ovčáčík
b8aa2d2c32
Minor refactoring tcell library from tui.go to tcell.go
...
To prevent including tcell library in non-windows builds.
2021-10-03 01:39:30 +09:00
Vlastimil Ovčáčík
0ff885461b
Add mouse support to the FullscreenRenderer
2021-10-03 01:39:30 +09:00
Vlastimil Ovčáčík
ca43f95fb1
Fix Backspace key to emit BSpace and AltBS events instead of CtrlH
...
CtrlH events are still sent when appropriate. I have adjusted
FullscreenRenderer to match the LightRenderer's behaviour, which seems
to be correct.
2021-10-03 01:39:30 +09:00
Vlastimil Ovčáčík
09700f676b
Add CtrlCaret keyboard event to FullscreenRenderer
2021-10-03 01:39:30 +09:00
Vlastimil Ovčáčík
4271e9cffa
Fix Ctrl+Space key combination to emit CtrlSpace instead of Rune ' '
2021-10-03 01:39:30 +09:00
Vlastimil Ovčáčík
f3dc8a10d5
Add ability to type AltGr characters in FullscreenRenderer on Windows.
2021-10-03 01:39:30 +09:00
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).
2021-10-03 01:39:30 +09:00
Junegunn Choi
4173e94c6f
Do not check for --height support on --version
...
https://github.com/junegunn/fzf.vim/issues/1329
2021-09-29 20:17:44 +09:00
Hiroki Konishi
261d3d3340
fix: replace broken links with archived ones
2021-09-28 18:07:22 +09:00
Hiroki Konishi
15e20fcae1
fix: spelling Refence
-> Reference
2021-09-28 18:07:22 +09:00
Vlastimil Ovčáčík
f4f47f5fe3
Minor changes
...
- obsolete todo removed, I tested the ev.ch for " " char and it works just
fine
2021-09-24 16:04:36 +09:00
Vlastimil Ovčáčík
71d11de7ca
[tests] Change tests to output to stdout only with verbose flag
...
This hides stdout output unless "go test -v" was run.
2021-09-24 16:04:36 +09:00
Vlastimil Ovčáčík
88d74a15aa
Change the tests to run on Windows ( #2615 )
...
Most of the "expected" strings in terminal.go test were changed to
"text/template" values. Quotes in those string were parametrized in
the templates. Two functions handling templates were added
for convenience.
Templates has the advantage of:
- parametrize repetitive strings inside "expected" values
- inner and outer quotes were parametrized in templates
- long and confusing test values are more readable
- templates can be localized for other operating systems
2021-09-24 09:45:06 +09:00
Junegunn Choi
0f02fc0c77
Reset {n} after reload
...
Fix #2611
2021-09-14 20:36:10 +09:00
Keating950
3f90fb42d8
Fix spelling error (Extention -> Extension) ( #2589 )
2021-08-17 16:40:24 +09:00
Michael Kelley
c21e9edad4
Restore VT hack for Windows ( #2580 )
...
- restore VT enable hack
- resolve an issue reported in https://github.com/kelleyma49/PSFzf
2021-08-15 16:01:50 +09:00
Junegunn Choi
7191ebb615
Do not show preview window by default if --preview
is empty
...
Close #2516
2021-06-08 08:53:29 +09:00
Junegunn Choi
8255aa23f4
Fix bug where --read0
not properly displaying long lines
...
Fix #2508
2021-06-01 16:55:51 +09:00
Junegunn Choi
a4bc08f5a3
Allow specifying 16 base ANSI colors by their names
...
Close #2502
2021-05-26 19:35:26 +09:00
Junegunn Choi
347c4b2625
Add 'unbind' action
...
Fix #2486
2021-05-22 13:16:39 +09:00
Junegunn Choi
3f75a8369f
Replace RuneWidth to StringWidth to handle grapheme clusters
...
Fix #2482
2021-05-14 11:44:44 +09:00
Junegunn Choi
da1f645670
Change --preview-window delimiter from : to , for consistency
...
Delimiter : was chosen when --preview-option only supported position and
size attributes. e.g. up:50%
2021-04-06 20:10:55 +09:00
Junegunn Choi
3a2015ee26
Fix minimum preview window height
2021-04-06 20:05:54 +09:00
Junegunn Choi
3d37a5ba1d
Apply preview-bg color to preview border of all shapes
2021-04-06 18:01:29 +09:00
Junegunn Choi
15f4cfb6d9
More border optins for preview window
...
Close #2431
2021-04-06 17:37:11 +09:00
Junegunn Choi
be36de2482
Ignore more ANSI escape sequences
...
Fix #2420
2021-04-06 00:51:39 +09:00
Junegunn Choi
8b36a4cb19
Speed up preview switching when doing partial rendering
...
Fix #2417
2021-04-04 13:43:16 +09:00
Michael Kelley
c8cd94a772
Ensure proper ESC seq handling under Windows preview mode ( #2430 )
...
- Increase go routine buffer size
- Add time wait for nonblock getchr()
- Resolve #2429
2021-04-04 13:19:43 +09:00
Junegunn Choi
764316a53d
Fix flaky test case: test_interrupt_execute
...
Try to avoid extraneous INT signal
2021-03-26 17:40:12 +09:00
Junegunn Choi
f84b3de24b
Automatically set /dev/tty as STDIN on execute action
...
https://github.com/junegunn/fzf/issues/1360#issuecomment-788178140
# Redirect /dev/tty to suppress "Vim: Warning: Input is not from a terminal"
ls | fzf --bind "enter:execute(vim {} < /dev/tty)"
# With this change, we can omit "< /dev/tty" part
ls | fzf --bind "enter:execute(vim {})"
2021-03-25 20:00:09 +09:00
Mitsuo Heijo
2e353aee96
Replace golang.org/x/crypto/ssh/terminal with golang.org/x/term ( #2395 )
...
See https://github.com/golang/go/issues/31044
2021-03-20 14:38:34 +09:00
Junegunn Choi
1b08f43f82
Advanced preview scroll offset expression to better support fixed header
2021-03-13 02:26:41 +09:00
Junegunn Choi
b24a2e2fdc
Fix regression in preview window rendering
2021-03-12 21:23:16 +09:00
Junegunn Choi
4c4c6e626e
Add support for preview window header
...
Fix #2373
# Display top 3 lines as the fixed header
fzf --preview 'bat --style=header,grid --color=always {}' --preview-window '~3'
2021-03-12 20:32:27 +09:00
Junegunn Choi
7310370a31
Fix truncation of colored line when --preview-window wrap is set
...
Fix #2346
2021-03-12 20:31:27 +09:00
Junegunn Choi
8ae94f0059
Fix premature truncation of colored line when --preview-window wrap is set
...
Fix #2346
2021-03-12 11:05:51 +09:00
Junegunn Choi
8fccf20892
Fix incorrect tab character handling
...
Fix #2372
2021-03-12 10:08:18 +09:00
Charlie Vieth
5a874ae241
Speed up ANSI code processing ( #2368 )
...
This commit speeds up the parsing/processing of ANSI escape codes by
roughly 7.5x. The speedup is mostly accomplished by replacing the regex
with dedicated parsing logic (nextAnsiEscapeSequence()) and reducing the
number of allocations in extractColor().
#### Benchmarks
```
name old time/op new time/op delta
ExtractColor-16 4.89µs ± 5% 0.64µs ± 2% -86.87% (p=0.000 n=9+9)
name old speed new speed delta
ExtractColor-16 25.6MB/s ± 5% 194.6MB/s ± 2% +661.43% (p=0.000 n=9+9)
name old alloc/op new alloc/op delta
ExtractColor-16 1.37kB ± 0% 0.31kB ± 0% -77.31% (p=0.000 n=10+10)
name old allocs/op new allocs/op delta
ExtractColor-16 48.0 ± 0% 4.0 ± 0% -91.67% (p=0.000 n=10+10)
```
2021-03-11 19:34:50 +09:00
Junegunn Choi
b82c1693c0
Fix deadlocks
2021-03-08 00:08:10 +09:00
Junegunn Choi
019bfc4e35
Fix yet another deadlock
...
EventBox.Set should not be called while holding the terminal mutex
goroutine 1 [semacquire]:
sync.runtime_SemacquireMutex(0xc0001923bc, 0x1000001066200, 0x1)
/usr/local/Cellar/go/1.16/libexec/src/runtime/sema.go:71 +0x47
sync.(*Mutex).lockSlow(0xc0001923b8)
/usr/local/Cellar/go/1.16/libexec/src/sync/mutex.go:138 +0x105
sync.(*Mutex).Lock(...)
/usr/local/Cellar/go/1.16/libexec/src/sync/mutex.go:81
github.com/junegunn/fzf/src.(*Terminal).Input(0xc000192000, 0x0, 0x0, 0x0, 0x0)
/fzf/src/terminal.go:581 +0x145
github.com/junegunn/fzf/src.Run.func10(0xc00010c8a0, 0xc000092050, 0xa)
/fzf/src/core.go:245 +0x37
github.com/junegunn/fzf/src.Run.func11(0xc00011a4e0)
/fzf/src/core.go:295 +0x5ce
github.com/junegunn/fzf/src/util.(*EventBox).Wait(0xc00011a4e0, 0xc000127ec8)
/fzf/src/util/eventbox.go:34 +0x5e
github.com/junegunn/fzf/src.Run(0xc000180000, 0x11ac014, 0x6, 0x11ac158, 0x7)
/fzf/src/core.go:251 +0xdac
main.main()
/fzf/main.go:13 +0x5a
goroutine 11 [semacquire]:
sync.runtime_SemacquireMutex(0xc00012c31c, 0xc00010e800, 0x1)
/usr/local/Cellar/go/1.16/libexec/src/runtime/sema.go:71 +0x47
sync.(*Mutex).lockSlow(0xc00012c318)
/usr/local/Cellar/go/1.16/libexec/src/sync/mutex.go:138 +0x105
sync.(*Mutex).Lock(0xc00012c318)
/usr/local/Cellar/go/1.16/libexec/src/sync/mutex.go:81 +0x47
github.com/junegunn/fzf/src/util.(*EventBox).Set(0xc00011a4e0, 0x7, 0x114eb40, 0x1265460)
/fzf/src/util/eventbox.go:40 +0x3b
github.com/junegunn/fzf/src.(*Terminal).killPreview(0xc000192000, 0x0)
/fzf/src/terminal.go:1831 +0xa5
github.com/junegunn/fzf/src.(*Terminal).exit(0xc000192000, 0xc000106e58)
/fzf/src/terminal.go:1847 +0x75
github.com/junegunn/fzf/src.(*Terminal).Loop.func8.1(0xc00011a540)
/fzf/src/terminal.go:2148 +0x38f
github.com/junegunn/fzf/src/util.(*EventBox).Wait(0xc00011a540, 0xc000106f90)
/fzf/src/util/eventbox.go:34 +0x5e
github.com/junegunn/fzf/src.(*Terminal).Loop.func8(0xc000192000, 0xc00010a2c0)
/fzf/src/terminal.go:2077 +0xa5
created by github.com/junegunn/fzf/src.(*Terminal).Loop
/fzf/src/terminal.go:2072 +0x3e8
2021-03-07 23:35:19 +09:00
Junegunn Choi
f657169616
Fix deadlock on exit
2021-03-07 21:44:08 +09:00
Junegunn Choi
e2e8d94b14
Kill input command on terminate
...
Fix #2381
Close #2382
2021-03-07 11:30:26 +09:00
bitterfox
4f9a7f8c87
Don't exit fzf by SIGINT while executing command ( #2375 )
...
Fix #2374
Co-authored-by: Junegunn Choi <junegunn.c@gmail.com>
2021-02-28 21:01:03 +09:00
Junegunn Choi
bb0502ff44
Check gofmt in make test
2021-02-28 18:28:21 +09:00