mirror of
https://github.com/Llewellynvdm/fzf.git
synced 2025-01-15 11:46:58 +00:00
Compare commits
4 Commits
4fdc07927f
...
f422893b8e
Author | SHA1 | Date | |
---|---|---|---|
|
f422893b8e | ||
|
22b498489c | ||
|
5460517bd2 | ||
|
9a6e557e52 |
14
CHANGELOG.md
14
CHANGELOG.md
@ -6,7 +6,15 @@ CHANGELOG
|
|||||||
|
|
||||||
This version introduces three new border types, `--list-border`, `--input-border`, and `--header-border`, offering much greater flexibility for customizing the user interface.
|
This version introduces three new border types, `--list-border`, `--input-border`, and `--header-border`, offering much greater flexibility for customizing the user interface.
|
||||||
|
|
||||||
Also, fzf now offers three "style presets" for easier customization, which can be activated using the `--style=[default|minimal|full]` option.
|
<img src="https://raw.githubusercontent.com/junegunn/i/master/fzf-4-borders.png" />
|
||||||
|
|
||||||
|
Also, fzf now offers "style presets" for quick customization, which can be activated using the `--style` option.
|
||||||
|
|
||||||
|
| Preset | Screenshot |
|
||||||
|
| :--- | :--- |
|
||||||
|
| `default` | <img src="https://raw.githubusercontent.com/junegunn/i/master/fzf-style-default.png"/> |
|
||||||
|
| `full` | <img src="https://raw.githubusercontent.com/junegunn/i/master/fzf-style-full.png"/> |
|
||||||
|
| `minimal` | <img src="https://raw.githubusercontent.com/junegunn/i/master/fzf-style-minimal.png"/> |
|
||||||
|
|
||||||
- Style presets (#4160)
|
- Style presets (#4160)
|
||||||
- `--style=full`
|
- `--style=full`
|
||||||
@ -59,6 +67,10 @@ Also, fzf now offers three "style presets" for easier customization, which can b
|
|||||||
```
|
```
|
||||||
- Added `toggle-multi-line` action
|
- Added `toggle-multi-line` action
|
||||||
- Added `toggle-hscroll` action
|
- Added `toggle-hscroll` action
|
||||||
|
- A single-character delimiter is now treated as a plain string delimiter rather than a regular expression delimiter, even if it's a regular expression meta-character.
|
||||||
|
- This means you can just write `--delimiter '|'` instead of escaping it as `--delimiter '\|'`
|
||||||
|
- Bug fixes
|
||||||
|
- Bug fixes in fish scripts (thanks to @bitraid)
|
||||||
|
|
||||||
0.57.0
|
0.57.0
|
||||||
------
|
------
|
||||||
|
@ -73,11 +73,10 @@ function fzf_key_bindings
|
|||||||
builtin history -z --reverse | command perl -0 -pe 's/^/$.\t/g; s/\n/\n\t/gm' | eval (__fzfcmd) --tac --read0 --print0 -q '(commandline)' | string replace -r '^\d*\t' '' | read -lz result
|
builtin history -z --reverse | command perl -0 -pe 's/^/$.\t/g; s/\n/\n\t/gm' | eval (__fzfcmd) --tac --read0 --print0 -q '(commandline)' | string replace -r '^\d*\t' '' | read -lz result
|
||||||
and commandline -- $result
|
and commandline -- $result
|
||||||
else
|
else
|
||||||
set -l line 0
|
set -l h (builtin history -z | string split0)
|
||||||
for i in (builtin history -z --reverse | string split0)
|
for i in (seq (count $h) -1 1)
|
||||||
set line (math $line + 1)
|
string join0 -- $i\t(string replace -a -- \n \n\t $h[$i] | string collect)
|
||||||
string escape -n -- $line\t(string replace -a -- \n \n\t $i | string collect)
|
end | eval (__fzfcmd) --read0 --print0 -q '(commandline)' | string replace -r '^\d*\t' '' | read -lz result
|
||||||
end | string join0 | string unescape -n | eval (__fzfcmd) --tac --read0 --print0 -q '(commandline)' | string replace -r '^\d*\t' '' | read -lz result
|
|
||||||
and commandline -- $result
|
and commandline -- $result
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
@ -755,18 +755,23 @@ func delimiterRegexp(str string) Delimiter {
|
|||||||
// Special handling of \t
|
// Special handling of \t
|
||||||
str = strings.ReplaceAll(str, "\\t", "\t")
|
str = strings.ReplaceAll(str, "\\t", "\t")
|
||||||
|
|
||||||
// 1. Pattern does not contain any special character
|
// 1. Pattern is a single character
|
||||||
|
if len([]rune(str)) == 1 {
|
||||||
|
return Delimiter{str: &str}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. Pattern does not contain any special character
|
||||||
if regexp.QuoteMeta(str) == str {
|
if regexp.QuoteMeta(str) == str {
|
||||||
return Delimiter{str: &str}
|
return Delimiter{str: &str}
|
||||||
}
|
}
|
||||||
|
|
||||||
rx, e := regexp.Compile(str)
|
rx, e := regexp.Compile(str)
|
||||||
// 2. Pattern is not a valid regular expression
|
// 3. Pattern is not a valid regular expression
|
||||||
if e != nil {
|
if e != nil {
|
||||||
return Delimiter{str: &str}
|
return Delimiter{str: &str}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. Pattern as regular expression. Slow.
|
// 4. Pattern as regular expression. Slow.
|
||||||
return Delimiter{regex: rx}
|
return Delimiter{regex: rx}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,9 +9,13 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestDelimiterRegex(t *testing.T) {
|
func TestDelimiterRegex(t *testing.T) {
|
||||||
// Valid regex
|
// Valid regex, but a single character -> string
|
||||||
delim := delimiterRegexp(".")
|
delim := delimiterRegexp(".")
|
||||||
if delim.regex == nil || delim.str != nil {
|
if delim.regex != nil || *delim.str != "." {
|
||||||
|
t.Error(delim)
|
||||||
|
}
|
||||||
|
delim = delimiterRegexp("|")
|
||||||
|
if delim.regex != nil || *delim.str != "|" {
|
||||||
t.Error(delim)
|
t.Error(delim)
|
||||||
}
|
}
|
||||||
// Broken regex -> string
|
// Broken regex -> string
|
||||||
|
Loading…
Reference in New Issue
Block a user