summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2024-07-05 20:15:03 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2024-07-05 20:15:03 +0900
commit8f4c23f1c454a1f5f3e3ca1479227ee5186f8212 (patch)
treea9d4205761297d974f3e52eb995f37e69c254a07
parent23a391e71599fadb780b53f716c86d5aec07e1d8 (diff)
downloadfzf-8f4c23f1c454a1f5f3e3ca1479227ee5186f8212.tar.gz
Remove --walker-path-sep
Related: #3859 #3907 #3909
-rw-r--r--CHANGELOG.md2
-rw-r--r--man/man1/fzf.15
-rw-r--r--src/core.go4
-rw-r--r--src/options.go23
-rw-r--r--src/reader.go17
5 files changed, 6 insertions, 45 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4817c76f..31312ddd 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -47,8 +47,6 @@ CHANGELOG
--bind 'start:reload:sleep 1; ps -ef' \
--bind 'load:change-header:Loaded!'
```
-- Added `--walker-path-sep=CHAR` option to change the default path separator used by the built-in walker
- - Needed when running a Windows binary on WSL or zsh on Windows where forward slashes are expected
- Fixed mouse support on Windows
- Fixed crash when using `--tiebreak=end` with very long items
- zsh 5.0 compatibility (thanks to @LangLangBart)
diff --git a/man/man1/fzf.1 b/man/man1/fzf.1
index e74702c1..14761438 100644
--- a/man/man1/fzf.1
+++ b/man/man1/fzf.1
@@ -1008,11 +1008,6 @@ The default value is the current working directory.
Comma-separated list of directory names to skip during the directory walk.
The default value is \fB.git,node_modules\fR.
-.TP
-.B "\-\-walker\-path\-sep=CHAR"
-Path separator to be used by the built-in directory walker (default: '/' on
-Unix, '\\' on Windows)
-
.SS Shell integration
.TP
.B "\-\-bash"
diff --git a/src/core.go b/src/core.go
index 1dc642f4..caada27c 100644
--- a/src/core.go
+++ b/src/core.go
@@ -159,7 +159,7 @@ func Run(opts *Options) (int, error) {
// reload or reload-sync action is bound to 'start' event, no need to start the reader
eventBox.Set(EvtReadNone, nil)
} else {
- go reader.ReadSource(opts.Input, opts.WalkerRoot, opts.WalkerOpts, opts.WalkerSkip, opts.WalkerSep)
+ go reader.ReadSource(opts.Input, opts.WalkerRoot, opts.WalkerOpts, opts.WalkerSkip)
}
}
@@ -212,7 +212,7 @@ func Run(opts *Options) (int, error) {
}
return false
}, eventBox, executor, opts.ReadZero, false)
- reader.ReadSource(opts.Input, opts.WalkerRoot, opts.WalkerOpts, opts.WalkerSkip, opts.WalkerSep)
+ reader.ReadSource(opts.Input, opts.WalkerRoot, opts.WalkerOpts, opts.WalkerSkip)
} else {
eventBox.Unwatch(EvtReadNew)
eventBox.WaitFor(EvtReadFin)
diff --git a/src/options.go b/src/options.go
index 58b5782b..d32daf10 100644
--- a/src/options.go
+++ b/src/options.go
@@ -147,7 +147,6 @@ Usage: fzf [options]
--walker-root=DIR Root directory from which to start walker (default: .)
--walker-skip=DIRS Comma-separated list of directory names to skip
(default: .git,node_modules)
- --walker-path-sep=CHAR Path separator to use (default: / on Unix, \ on Windows)
Shell integration
--bash Print script to set up Bash shell integration
@@ -490,7 +489,6 @@ type Options struct {
WalkerOpts walkerOpts
WalkerRoot string
WalkerSkip []string
- WalkerSep byte
Version bool
Help bool
CPUProfile string
@@ -594,7 +592,6 @@ func defaultOptions() *Options {
WalkerOpts: walkerOpts{file: true, hidden: true, follow: true},
WalkerRoot: ".",
WalkerSkip: []string{".git", "node_modules"},
- WalkerSep: os.PathSeparator,
Help: false,
Version: false}
}
@@ -1907,14 +1904,6 @@ func parseMarkerMultiLine(str string) (*[3]string, error) {
return &result, nil
}
-func parsePathSep(str string) (byte, error) {
- bytes := []byte(str)
- if len(bytes) != 1 {
- return os.PathSeparator, errors.New("invalid path separator (expected: single-byte character)")
- }
- return bytes[0], nil
-}
-
func parseOptions(index *int, opts *Options, allArgs []string) error {
var err error
var historyMax int
@@ -2490,14 +2479,6 @@ func parseOptions(index *int, opts *Options, allArgs []string) error {
return err
}
opts.WalkerSkip = filterNonEmpty(strings.Split(str, ","))
- case "--walker-path-sep":
- str, err := nextString(allArgs, &i, "path separator required")
- if err != nil {
- return err
- }
- if opts.WalkerSep, err = parsePathSep(str); err != nil {
- return err
- }
case "--profile-cpu":
if opts.CPUProfile, err = nextString(allArgs, &i, "file path required: cpu"); err != nil {
return err
@@ -2685,10 +2666,6 @@ func parseOptions(index *int, opts *Options, allArgs []string) error {
opts.WalkerRoot = value
} else if match, value := optString(arg, "--walker-skip="); match {
opts.WalkerSkip = filterNonEmpty(strings.Split(value, ","))
- } else if match, value := optString(arg, "--walker-path-sep="); match {
- if opts.WalkerSep, err = parsePathSep(value); err != nil {
- return err
- }
} else if match, value := optString(arg, "--hscroll-off="); match {
if opts.HscrollOff, err = atoi(value); err != nil {
return err
diff --git a/src/reader.go b/src/reader.go
index 9d4fe160..9d4b2f46 100644
--- a/src/reader.go
+++ b/src/reader.go
@@ -111,7 +111,7 @@ func (r *Reader) readChannel(inputChan chan string) bool {
}
// ReadSource reads data from the default command or from standard input
-func (r *Reader) ReadSource(inputChan chan string, root string, opts walkerOpts, ignores []string, sep byte) {
+func (r *Reader) ReadSource(inputChan chan string, root string, opts walkerOpts, ignores []string) {
r.startEventPoller()
var success bool
if inputChan != nil {
@@ -119,7 +119,7 @@ func (r *Reader) ReadSource(inputChan chan string, root string, opts walkerOpts,
} else if util.IsTty(os.Stdin) {
cmd := os.Getenv("FZF_DEFAULT_COMMAND")
if len(cmd) == 0 {
- success = r.readFiles(root, opts, ignores, sep)
+ success = r.readFiles(root, opts, ignores)
} else {
// We can't export FZF_* environment variables to the default command
success = r.readFromCommand(cmd, nil)
@@ -233,10 +233,9 @@ func isSymlinkToDir(path string, de os.DirEntry) bool {
return false
}
-func (r *Reader) readFiles(root string, opts walkerOpts, ignores []string, sep byte) bool {
+func (r *Reader) readFiles(root string, opts walkerOpts, ignores []string) bool {
r.killed = false
conf := fastwalk.Config{Follow: opts.follow}
- replaceSep := sep != os.PathSeparator
fn := func(path string, de os.DirEntry, err error) error {
if err != nil {
return nil
@@ -255,15 +254,7 @@ func (r *Reader) readFiles(root string, opts walkerOpts, ignores []string, sep b
}
}
}
- bytes := stringBytes(path)
- if replaceSep {
- for i, b := range bytes {
- if b == os.PathSeparator {
- bytes[i] = sep
- }
- }
- }
- if ((opts.file && !isDir) || (opts.dir && isDir)) && r.pusher(bytes) {
+ if ((opts.file && !isDir) || (opts.dir && isDir)) && r.pusher(stringBytes(path)) {
atomic.StoreInt32(&r.event, int32(EvtReadNew))
}
}