mirror of
https://github.com/junegunn/fzf.git
synced 2025-11-14 06:13:47 -05:00
Compare commits
12 Commits
go-1.21
...
adjust-def
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
afc955771c | ||
|
|
c134c6f898 | ||
|
|
95697b96f8 | ||
|
|
3809ebb0c8 | ||
|
|
ca9b4d5a49 | ||
|
|
04888f5b94 | ||
|
|
3072b46218 | ||
|
|
a67aa85820 | ||
|
|
c5cabe1691 | ||
|
|
cbed41cd82 | ||
|
|
6684771cbf | ||
|
|
f5f894ea47 |
2
.github/workflows/linux.yml
vendored
2
.github/workflows/linux.yml
vendored
@@ -25,7 +25,7 @@ jobs:
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: "1.21"
|
||||
go-version: "1.23"
|
||||
|
||||
- name: Setup Ruby
|
||||
uses: ruby/setup-ruby@v1
|
||||
|
||||
2
.github/workflows/macos.yml
vendored
2
.github/workflows/macos.yml
vendored
@@ -22,7 +22,7 @@ jobs:
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: "1.21"
|
||||
go-version: "1.23"
|
||||
|
||||
- name: Setup Ruby
|
||||
uses: ruby/setup-ruby@v1
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
golang 1.21.13
|
||||
golang 1.23.12
|
||||
ruby 3.4.1
|
||||
|
||||
27
CHANGELOG.md
27
CHANGELOG.md
@@ -1,6 +1,33 @@
|
||||
CHANGELOG
|
||||
=========
|
||||
|
||||
0.66.0
|
||||
------
|
||||
- Style changes
|
||||
- Updated `--color base16` (alias: `16`) theme so that it works better with both dark and light themes.
|
||||
- Narrowed the gutter column by using the left-half block character (`▌`).
|
||||
- Removed background colors from markers.
|
||||
- Added `--gutter CHAR` option for customizing the gutter column. Some examples using [box-drawing characters](https://en.wikipedia.org/wiki/Box-drawing_characters):
|
||||
```sh
|
||||
# Right-aligned gutter
|
||||
fzf --gutter '▐'
|
||||
|
||||
# Even thinner gutter
|
||||
fzf --gutter '▎'
|
||||
|
||||
# Checker
|
||||
fzf --gutter '▚'
|
||||
|
||||
# Dotted
|
||||
fzf --gutter '▖'
|
||||
|
||||
# Full-width
|
||||
fzf --gutter '█'
|
||||
|
||||
# No gutter
|
||||
fzf --gutter ' '
|
||||
```
|
||||
|
||||
0.65.2
|
||||
------
|
||||
- Bug fixes and improvements
|
||||
|
||||
@@ -47,10 +47,10 @@ characters and still get the results you want.
|
||||
Highlights
|
||||
----------
|
||||
|
||||
- 📦 **Portable** — Distributed as a single binary for easy installation
|
||||
- ⚡ **Blazingly fast** — Highly optimized code instantly processes millions of items
|
||||
- 🛠️ **Extremely versatile** — Fully customizable via an event-action binding mechanism
|
||||
- 🔋 **Batteries included** — Includes integration with bash, zsh, fish, Vim, and Neovim
|
||||
- **Portable** — Distributed as a single binary for easy installation
|
||||
- **Fast** — Optimized to process millions of items instantly
|
||||
- **Versatile** — Fully customizable through an event-action binding mechanism
|
||||
- **All-inclusive** — Comes with integrations for Bash, Zsh, Fish, Vim, and Neovim
|
||||
|
||||
Table of Contents
|
||||
-----------------
|
||||
|
||||
12
go.mod
12
go.mod
@@ -1,20 +1,20 @@
|
||||
module github.com/junegunn/fzf
|
||||
|
||||
require (
|
||||
github.com/charlievieth/fastwalk v1.0.13
|
||||
github.com/charlievieth/fastwalk v1.0.14
|
||||
github.com/gdamore/tcell/v2 v2.9.0
|
||||
github.com/junegunn/go-shellwords v0.0.0-20250127100254-2aa3b3277741
|
||||
github.com/junegunn/tcell/v2 v2.9.1
|
||||
github.com/mattn/go-isatty v0.0.20
|
||||
github.com/rivo/uniseg v0.4.7
|
||||
golang.org/x/sys v0.30.0
|
||||
golang.org/x/term v0.29.0
|
||||
golang.org/x/sys v0.35.0
|
||||
golang.org/x/term v0.34.0
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/gdamore/encoding v1.0.1 // indirect
|
||||
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
|
||||
github.com/mattn/go-runewidth v0.0.16 // indirect
|
||||
golang.org/x/text v0.22.0 // indirect
|
||||
golang.org/x/text v0.28.0 // indirect
|
||||
)
|
||||
|
||||
go 1.21.13
|
||||
go 1.23.0
|
||||
|
||||
20
go.sum
20
go.sum
@@ -1,11 +1,11 @@
|
||||
github.com/charlievieth/fastwalk v1.0.13 h1:rCdesaKpxBft4jdNqKbJtTS23Dfhem3eEPE0jfj//xc=
|
||||
github.com/charlievieth/fastwalk v1.0.13/go.mod h1:diVcUreiU1aQ4/Wu3NbxxH4/KYdKpLDojrQ1Bb2KgNY=
|
||||
github.com/charlievieth/fastwalk v1.0.14 h1:3Eh5uaFGwHZd8EGwTjJnSpBkfwfsak9h6ICgnWlhAyg=
|
||||
github.com/charlievieth/fastwalk v1.0.14/go.mod h1:diVcUreiU1aQ4/Wu3NbxxH4/KYdKpLDojrQ1Bb2KgNY=
|
||||
github.com/gdamore/encoding v1.0.1 h1:YzKZckdBL6jVt2Gc+5p82qhrGiqMdG/eNs6Wy0u3Uhw=
|
||||
github.com/gdamore/encoding v1.0.1/go.mod h1:0Z0cMFinngz9kS1QfMjCP8TY7em3bZYeeklsSDPivEo=
|
||||
github.com/gdamore/tcell/v2 v2.9.0 h1:N6t+eqK7/xwtRPwxzs1PXeRWnm0H9l02CrgJ7DLn1ys=
|
||||
github.com/gdamore/tcell/v2 v2.9.0/go.mod h1:8/ZoqM9rxzYphT9tH/9LnunhV9oPBqwS8WHGYm5nrmo=
|
||||
github.com/junegunn/go-shellwords v0.0.0-20250127100254-2aa3b3277741 h1:7dYDtfMDfKzjT+DVfIS4iqknSEKtZpEcXtu6vuaasHs=
|
||||
github.com/junegunn/go-shellwords v0.0.0-20250127100254-2aa3b3277741/go.mod h1:6EILKtGpo5t+KLb85LNZLAF6P9LKp78hJI80PXMcn3c=
|
||||
github.com/junegunn/tcell/v2 v2.9.1 h1:r5PqSXkPwCMWRCjOu6MY5xdtzpeNAo4W/eZMKEcibYA=
|
||||
github.com/junegunn/tcell/v2 v2.9.1/go.mod h1:Hjh577pMWP9M119MS7yAK1ygOfQYjmOjdYxbSxlClaw=
|
||||
github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY=
|
||||
github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
|
||||
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
||||
@@ -34,20 +34,20 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc
|
||||
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc=
|
||||
golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI=
|
||||
golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
|
||||
golang.org/x/term v0.29.0 h1:L6pJp37ocefwRRtYPKSWOWzOtWSxVajvz2ldH/xi3iU=
|
||||
golang.org/x/term v0.29.0/go.mod h1:6bl4lRlvVuDgSf3179VpIxBF0o10JUpXWOnI7nErv7s=
|
||||
golang.org/x/term v0.34.0 h1:O/2T7POpk0ZZ7MAzMeWFSg6S5IpWd/RXDlM9hgM3DR4=
|
||||
golang.org/x/term v0.34.0/go.mod h1:5jC53AEywhIVebHgPVeg0mj8OD3VO9OzclacVrqpaAw=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
||||
golang.org/x/text v0.22.0 h1:bofq7m3/HAFvbF51jz3Q9wLg3jkvSPuiZu/pD1XwgtM=
|
||||
golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY=
|
||||
golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng=
|
||||
golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
||||
|
||||
@@ -246,11 +246,11 @@ color mappings. Each entry is separated by a comma and/or whitespaces.
|
||||
|
||||
.RS
|
||||
.B BASE SCHEME:
|
||||
(default: \fBdark\fR on 256-color terminal, otherwise \fB16\fR; If \fBNO_COLOR\fR is set, \fBbw\fR)
|
||||
(default: \fBdark\fR on 256-color terminal, otherwise \fBbase16\fR; If \fBNO_COLOR\fR is set, \fBbw\fR)
|
||||
|
||||
\fBdark \fRColor scheme for dark 256-color terminal
|
||||
\fBlight \fRColor scheme for light 256-color terminal
|
||||
\fB16 \fRColor scheme for 16-color terminal
|
||||
\fBdark \fRColor scheme for dark terminal
|
||||
\fBlight \fRColor scheme for light terminal
|
||||
\fBbase16 \fRColor scheme using base 16 colors (alias: \fB16\fR)
|
||||
\fBbw \fRNo colors (equivalent to \fB\-\-no\-color\fR)
|
||||
|
||||
.B COLOR NAMES:
|
||||
|
||||
@@ -59,7 +59,7 @@ Usage: fzf [options]
|
||||
|
||||
GLOBAL STYLE
|
||||
--style=PRESET Apply a style preset [default|minimal|full[:BORDER_STYLE]
|
||||
--color=COLSPEC Base scheme (dark|light|16|bw) and/or custom colors
|
||||
--color=COLSPEC Base scheme (dark|light|base16|bw) and/or custom colors
|
||||
--no-color Disable colors
|
||||
--no-bold Do not use bold text
|
||||
|
||||
@@ -590,6 +590,7 @@ type Options struct {
|
||||
Separator *string
|
||||
JumpLabels string
|
||||
Prompt string
|
||||
Gutter *string
|
||||
Pointer *string
|
||||
Marker *string
|
||||
MarkerMulti *[3]string
|
||||
@@ -710,6 +711,7 @@ func defaultOptions() *Options {
|
||||
Separator: nil,
|
||||
JumpLabels: defaultJumpLabels,
|
||||
Prompt: "> ",
|
||||
Gutter: nil,
|
||||
Pointer: nil,
|
||||
Marker: nil,
|
||||
MarkerMulti: nil,
|
||||
@@ -1323,7 +1325,7 @@ func parseTheme(defaultTheme *tui.ColorTheme, str string) (*tui.ColorTheme, erro
|
||||
theme = dupeTheme(tui.Dark256)
|
||||
case "light":
|
||||
theme = dupeTheme(tui.Light256)
|
||||
case "16":
|
||||
case "base16", "16":
|
||||
theme = dupeTheme(tui.Default16)
|
||||
case "bw", "no":
|
||||
theme = tui.NoColorTheme()
|
||||
@@ -2857,6 +2859,13 @@ func parseOptions(index *int, opts *Options, allArgs []string) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
case "--gutter":
|
||||
str, err := nextString("gutter character required")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
str = firstLine(str)
|
||||
opts.Gutter = &str
|
||||
case "--pointer":
|
||||
str, err := nextString("pointer sign required")
|
||||
if err != nil {
|
||||
@@ -3355,22 +3364,28 @@ func applyPreset(opts *Options, preset string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func validateSign(sign string, signOptName string) error {
|
||||
if uniseg.StringWidth(sign) > 2 {
|
||||
return fmt.Errorf("%v display width should be up to 2", signOptName)
|
||||
func validateSign(sign string, signOptName string, maxWidth int) error {
|
||||
if uniseg.StringWidth(sign) > maxWidth {
|
||||
return fmt.Errorf("%v display width should be up to %d", signOptName, maxWidth)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func validateOptions(opts *Options) error {
|
||||
if opts.Pointer != nil {
|
||||
if err := validateSign(*opts.Pointer, "pointer"); err != nil {
|
||||
if err := validateSign(*opts.Pointer, "pointer", 2); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if opts.Marker != nil {
|
||||
if err := validateSign(*opts.Marker, "marker"); err != nil {
|
||||
if err := validateSign(*opts.Marker, "marker", 2); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if opts.Gutter != nil {
|
||||
if err := validateSign(*opts.Gutter, "gutter", 1); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
@@ -462,7 +462,7 @@ func TestValidateSign(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, testCase := range testCases {
|
||||
err := validateSign(testCase.inputSign, "")
|
||||
err := validateSign(testCase.inputSign, "", 2)
|
||||
if testCase.isValid && err != nil {
|
||||
t.Errorf("Input sign `%s` caused error", testCase.inputSign)
|
||||
}
|
||||
|
||||
@@ -272,6 +272,7 @@ type Terminal struct {
|
||||
footerLabel labelPrinter
|
||||
footerLabelLen int
|
||||
footerLabelOpts labelOpts
|
||||
gutterReverse bool
|
||||
pointer string
|
||||
pointerLen int
|
||||
pointerEmpty string
|
||||
@@ -1094,10 +1095,27 @@ func NewTerminal(opts *Options, eventBox *util.EventBox, executor *util.Executor
|
||||
// This should be called before accessing tui.Color*
|
||||
tui.InitTheme(opts.Theme, renderer.DefaultTheme(), opts.Black, opts.InputBorderShape.Visible(), opts.HeaderBorderShape.Visible())
|
||||
|
||||
// Gutter character
|
||||
var gutterChar string
|
||||
if opts.Gutter != nil {
|
||||
gutterChar = *opts.Gutter
|
||||
} else if t.unicode && !t.theme.Gutter.Color.IsDefault() {
|
||||
gutterChar = "▌"
|
||||
} else {
|
||||
gutterChar = " "
|
||||
t.gutterReverse = true
|
||||
}
|
||||
|
||||
t.prompt, t.promptLen = t.parsePrompt(opts.Prompt)
|
||||
// Pre-calculated empty pointer and marker signs
|
||||
t.pointerEmpty = strings.Repeat(" ", t.pointerLen)
|
||||
if t.pointerLen == 0 {
|
||||
t.pointerEmpty = ""
|
||||
} else {
|
||||
t.pointerEmpty = gutterChar + strings.Repeat(" ", util.Max(0, t.pointerLen-1))
|
||||
}
|
||||
t.markerEmpty = strings.Repeat(" ", t.markerLen)
|
||||
|
||||
// Labels
|
||||
t.listLabel, t.listLabelLen = t.ansiLabelPrinter(opts.ListLabel.label, &tui.ColListLabel, false)
|
||||
t.borderLabel, t.borderLabelLen = t.ansiLabelPrinter(opts.BorderLabel.label, &tui.ColBorderLabel, false)
|
||||
t.previewLabel, t.previewLabelLen = t.ansiLabelPrinter(opts.PreviewLabel.label, &tui.ColPreviewLabel, false)
|
||||
@@ -3096,9 +3114,21 @@ func (t *Terminal) renderEmptyLine(line int, barRange [2]int) {
|
||||
t.renderBar(line, barRange)
|
||||
}
|
||||
|
||||
func (t *Terminal) gutter(current bool) {
|
||||
var color tui.ColorPair
|
||||
if current {
|
||||
color = tui.ColCurrentCursorEmpty
|
||||
} else if t.gutterReverse {
|
||||
color = tui.ColCursorEmpty
|
||||
} else {
|
||||
color = tui.ColCursorEmptyChar
|
||||
}
|
||||
t.window.CPrint(color, t.pointerEmpty)
|
||||
}
|
||||
|
||||
func (t *Terminal) renderGapLine(line int, barRange [2]int, drawLine bool) {
|
||||
t.move(line, 0, false)
|
||||
t.window.CPrint(tui.ColCursorEmpty, t.pointerEmpty)
|
||||
t.gutter(false)
|
||||
t.window.Print(t.markerEmpty)
|
||||
x := t.pointerLen + t.markerLen
|
||||
|
||||
@@ -3262,7 +3292,7 @@ func (t *Terminal) printItem(result Result, line int, maxLine int, index int, cu
|
||||
return indentSize
|
||||
}
|
||||
if len(label) == 0 {
|
||||
t.window.CPrint(tui.ColCurrentCursorEmpty, t.pointerEmpty)
|
||||
t.gutter(true)
|
||||
} else {
|
||||
t.window.CPrint(tui.ColCurrentCursor, label)
|
||||
}
|
||||
@@ -3284,7 +3314,7 @@ func (t *Terminal) printItem(result Result, line int, maxLine int, index int, cu
|
||||
return indentSize
|
||||
}
|
||||
if len(label) == 0 {
|
||||
t.window.CPrint(tui.ColCursorEmpty, t.pointerEmpty)
|
||||
t.gutter(false)
|
||||
} else {
|
||||
t.window.CPrint(tui.ColCursor, label)
|
||||
}
|
||||
@@ -3630,7 +3660,7 @@ func (t *Terminal) printColoredString(window tui.Window, text []rune, offsets []
|
||||
for _, offset := range offsets {
|
||||
b := util.Constrain32(offset.offset[0], index, maxOffset)
|
||||
e := util.Constrain32(offset.offset[1], index, maxOffset)
|
||||
if url != nil && offset.url == nil {
|
||||
if url != nil && offset.url != url {
|
||||
url = nil
|
||||
window.LinkEnd()
|
||||
}
|
||||
|
||||
@@ -7,8 +7,8 @@ import (
|
||||
"regexp"
|
||||
"time"
|
||||
|
||||
"github.com/gdamore/tcell/v2"
|
||||
"github.com/junegunn/fzf/src/util"
|
||||
"github.com/junegunn/tcell/v2"
|
||||
|
||||
"github.com/rivo/uniseg"
|
||||
)
|
||||
@@ -724,13 +724,13 @@ func (r *FullscreenRenderer) GetChar() Event {
|
||||
|
||||
func (r *FullscreenRenderer) Pause(clear bool) {
|
||||
if clear {
|
||||
r.Close()
|
||||
_screen.Suspend()
|
||||
}
|
||||
}
|
||||
|
||||
func (r *FullscreenRenderer) Resume(clear bool, sigcont bool) {
|
||||
if clear {
|
||||
r.initScreen()
|
||||
_screen.Resume()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@ import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/gdamore/tcell/v2"
|
||||
"github.com/junegunn/fzf/src/util"
|
||||
"github.com/junegunn/tcell/v2"
|
||||
)
|
||||
|
||||
func assert(t *testing.T, context string, got any, want any) bool {
|
||||
|
||||
@@ -303,6 +303,14 @@ const (
|
||||
colMagenta
|
||||
colCyan
|
||||
colWhite
|
||||
colGrey
|
||||
colBrightRed
|
||||
colBrightGreen
|
||||
colBrightYellow
|
||||
colBrightBlue
|
||||
colBrightMagenta
|
||||
colBrightCyan
|
||||
colBrightWhite
|
||||
)
|
||||
|
||||
type FillReturn int
|
||||
@@ -776,6 +784,7 @@ var (
|
||||
ColMatch ColorPair
|
||||
ColCursor ColorPair
|
||||
ColCursorEmpty ColorPair
|
||||
ColCursorEmptyChar ColorPair
|
||||
ColMarker ColorPair
|
||||
ColSelected ColorPair
|
||||
ColSelectedMatch ColorPair
|
||||
@@ -922,19 +931,19 @@ func init() {
|
||||
SelectedFg: ColorAttr{colUndefined, AttrUndefined},
|
||||
SelectedBg: ColorAttr{colUndefined, AttrUndefined},
|
||||
SelectedMatch: ColorAttr{colUndefined, AttrUndefined},
|
||||
DarkBg: ColorAttr{colBlack, AttrUndefined},
|
||||
DarkBg: ColorAttr{colGrey, AttrUndefined},
|
||||
Prompt: ColorAttr{colBlue, AttrUndefined},
|
||||
Match: ColorAttr{colGreen, AttrUndefined},
|
||||
Current: ColorAttr{colYellow, AttrUndefined},
|
||||
CurrentMatch: ColorAttr{colGreen, AttrUndefined},
|
||||
Current: ColorAttr{colBrightWhite, AttrUndefined},
|
||||
CurrentMatch: ColorAttr{colBrightGreen, AttrUndefined},
|
||||
Spinner: ColorAttr{colGreen, AttrUndefined},
|
||||
Info: ColorAttr{colWhite, AttrUndefined},
|
||||
Info: ColorAttr{colYellow, AttrUndefined},
|
||||
Cursor: ColorAttr{colRed, AttrUndefined},
|
||||
Marker: ColorAttr{colMagenta, AttrUndefined},
|
||||
Header: ColorAttr{colCyan, AttrUndefined},
|
||||
Footer: ColorAttr{colCyan, AttrUndefined},
|
||||
Border: ColorAttr{colBlack, AttrUndefined},
|
||||
BorderLabel: ColorAttr{colWhite, AttrUndefined},
|
||||
Border: ColorAttr{colDefault, Dim},
|
||||
BorderLabel: ColorAttr{colDefault, AttrUndefined},
|
||||
Ghost: ColorAttr{colUndefined, Dim},
|
||||
Disabled: ColorAttr{colUndefined, AttrUndefined},
|
||||
PreviewFg: ColorAttr{colUndefined, AttrUndefined},
|
||||
@@ -1168,10 +1177,11 @@ func initPalette(theme *ColorTheme) {
|
||||
ColSelectedMatch = pair(theme.SelectedMatch, theme.SelectedBg)
|
||||
ColCursor = pair(theme.Cursor, theme.Gutter)
|
||||
ColCursorEmpty = pair(blank, theme.Gutter)
|
||||
ColCursorEmptyChar = pair(theme.Gutter, theme.ListBg)
|
||||
if theme.SelectedBg.Color != theme.ListBg.Color {
|
||||
ColMarker = pair(theme.Marker, theme.SelectedBg)
|
||||
} else {
|
||||
ColMarker = pair(theme.Marker, theme.Gutter)
|
||||
ColMarker = pair(theme.Marker, theme.ListBg)
|
||||
}
|
||||
ColCurrent = pair(theme.Current, theme.DarkBg)
|
||||
ColCurrentMatch = pair(theme.CurrentMatch, theme.DarkBg)
|
||||
|
||||
@@ -24,7 +24,7 @@ DEFAULT_TIMEOUT = 10
|
||||
FILE = File.expand_path(__FILE__)
|
||||
BASE = File.expand_path('../..', __dir__)
|
||||
Dir.chdir(BASE)
|
||||
FZF = "FZF_DEFAULT_OPTS=\"--no-scrollbar --pointer \\> --marker \\>\" FZF_DEFAULT_COMMAND= #{BASE}/bin/fzf".freeze
|
||||
FZF = %[FZF_DEFAULT_OPTS="--no-scrollbar --gutter ' ' --pointer '>' --marker '>'" FZF_DEFAULT_COMMAND= #{BASE}/bin/fzf].freeze
|
||||
|
||||
def wait(timeout = DEFAULT_TIMEOUT)
|
||||
since = Time.now
|
||||
|
||||
@@ -403,7 +403,7 @@ class TestExec < TestInteractive
|
||||
end
|
||||
|
||||
def test_become
|
||||
tmux.send_keys "seq 100 | #{FZF} --bind 'enter:become:seq {} | #{FZF}'", :Enter
|
||||
tmux.send_keys "seq 100 | fzf --bind 'enter:become:seq {} | fzf'", :Enter
|
||||
tmux.until { |lines| assert_equal 100, lines.match_count }
|
||||
tmux.send_keys 999
|
||||
tmux.until { |lines| assert_equal 0, lines.match_count }
|
||||
|
||||
@@ -178,8 +178,8 @@ class TestLayout < TestInteractive
|
||||
tmux.send_keys 'seq 3 | fzf --height ~100% --info=inline --border rounded', :Enter
|
||||
expected = <<~OUTPUT
|
||||
╭──────────
|
||||
│ 3
|
||||
│ 2
|
||||
│ ▌ 3
|
||||
│ ▌ 2
|
||||
│ > 1
|
||||
│ > < 3/3
|
||||
╰──────────
|
||||
@@ -197,8 +197,8 @@ class TestLayout < TestInteractive
|
||||
│ │
|
||||
│ │
|
||||
│ ╰────────
|
||||
│ 3
|
||||
│ 2
|
||||
│ ▌ 3
|
||||
│ ▌ 2
|
||||
│ > 1
|
||||
│ > < 3/3
|
||||
╰──────────
|
||||
@@ -247,7 +247,7 @@ class TestLayout < TestInteractive
|
||||
tmux.send_keys 'seq 100 | fzf --height ~5 --info=inline --border rounded', :Enter
|
||||
expected = <<~OUTPUT
|
||||
╭──────────────
|
||||
│ 2
|
||||
│ ▌ 2
|
||||
│ > 1
|
||||
│ > < 100/100
|
||||
╰──────────────
|
||||
@@ -275,12 +275,12 @@ class TestLayout < TestInteractive
|
||||
def test_fzf_multi_line
|
||||
tmux.send_keys %[(echo -en '0\\0'; echo -en '1\\n2\\0'; seq 1000) | fzf --read0 --multi --bind load:select-all --border rounded], :Enter
|
||||
block = <<~BLOCK
|
||||
│ ┃998
|
||||
│ ┃999
|
||||
│ ┃1000
|
||||
│ ╹
|
||||
│ ╻1
|
||||
│ ╹2
|
||||
│ ▌┃998
|
||||
│ ▌┃999
|
||||
│ ▌┃1000
|
||||
│ ▌╹
|
||||
│ ▌╻1
|
||||
│ ▌╹2
|
||||
│ >>0
|
||||
│ 3/3 (3)
|
||||
│ >
|
||||
@@ -312,11 +312,11 @@ class TestLayout < TestInteractive
|
||||
│ >
|
||||
│ 3/3 (3)
|
||||
│ >>0
|
||||
│ ╻1
|
||||
│ ╹2
|
||||
│ ╻1
|
||||
│ ┃2
|
||||
│ ┃3
|
||||
│ ▌╻1
|
||||
│ ▌╹2
|
||||
│ ▌╻1
|
||||
│ ▌┃2
|
||||
│ ▌┃3
|
||||
BLOCK
|
||||
tmux.until { assert_block(block, it) }
|
||||
end
|
||||
@@ -1156,6 +1156,42 @@ class TestLayout < TestInteractive
|
||||
tmux.until { assert_block(block, it) }
|
||||
end
|
||||
|
||||
def test_gutter_default
|
||||
tmux.send_keys %(seq 10 | fzf), :Enter
|
||||
block = <<~BLOCK
|
||||
▌ 3
|
||||
▌ 2
|
||||
> 1
|
||||
10/10
|
||||
>
|
||||
BLOCK
|
||||
tmux.until { assert_block(block, it) }
|
||||
end
|
||||
|
||||
def test_gutter_default_no_unicode
|
||||
tmux.send_keys %(seq 10 | fzf --no-unicode), :Enter
|
||||
block = <<~BLOCK
|
||||
3
|
||||
2
|
||||
> 1
|
||||
10/10
|
||||
>
|
||||
BLOCK
|
||||
tmux.until { assert_block(block, it) }
|
||||
end
|
||||
|
||||
def test_gutter_custom
|
||||
tmux.send_keys %(seq 10 | fzf --gutter x), :Enter
|
||||
block = <<~BLOCK
|
||||
x 3
|
||||
x 2
|
||||
> 1
|
||||
10/10
|
||||
>
|
||||
BLOCK
|
||||
tmux.until { assert_block(block, it) }
|
||||
end
|
||||
|
||||
def test_combinations
|
||||
skip unless ENV['LONGTEST']
|
||||
|
||||
|
||||
Reference in New Issue
Block a user