mirror of
https://github.com/Llewellynvdm/fzf.git
synced 2024-06-03 07:50:49 +00:00
parent
d9752a4c21
commit
865144850d
|
@ -3,9 +3,10 @@ CHANGELOG
|
||||||
|
|
||||||
0.23.1
|
0.23.1
|
||||||
------
|
------
|
||||||
- Reset `hidden` flag and scroll offset of `--preview-window` if another
|
- Added `--preview-window` options for disabling flags
|
||||||
`--preview-window` is found. We should only keep style-related flags across
|
- `nocycle`
|
||||||
multiple `--preview-window` options.
|
- `nohidden`
|
||||||
|
- `nowrap`
|
||||||
|
|
||||||
0.23.0
|
0.23.0
|
||||||
------
|
------
|
||||||
|
|
|
@ -381,7 +381,7 @@ Preview window will be updated even when there is no match for the current
|
||||||
query if any of the placeholder expressions evaluates to a non-empty string.
|
query if any of the placeholder expressions evaluates to a non-empty string.
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
.BI "--preview-window=" "[POSITION][:SIZE[%]][:rounded|sharp|noborder][:wrap][:cycle][:hidden][:+SCROLL[-OFFSET]]"
|
.BI "--preview-window=" "[POSITION][:SIZE[%]][:rounded|sharp|noborder][:[no]wrap][:[no]cycle][:[no]hidden][:+SCROLL[-OFFSET]]"
|
||||||
|
|
||||||
.RS
|
.RS
|
||||||
.B POSITION: (default: right)
|
.B POSITION: (default: right)
|
||||||
|
@ -430,18 +430,6 @@ e.g.
|
||||||
|
|
||||||
.RE
|
.RE
|
||||||
|
|
||||||
You can write style-related flags across multiple \fB--preview-window\fR
|
|
||||||
options. But flags that are not style-related such as \fBhidden\fR and scroll
|
|
||||||
offset are only allowed in the last \fB--preview-window\fR.
|
|
||||||
|
|
||||||
.RS
|
|
||||||
e.g.
|
|
||||||
export FZF_DEFAULT_OPTS='--preview-window sharp:cycle'
|
|
||||||
|
|
||||||
# sharp + cycle + up + 50%
|
|
||||||
fzf --preview-window 'up' --preview-window '50%' --preview 'bat {}'
|
|
||||||
.RE
|
|
||||||
|
|
||||||
.SS Scripting
|
.SS Scripting
|
||||||
.TP
|
.TP
|
||||||
.BI "-q, --query=" "STR"
|
.BI "-q, --query=" "STR"
|
||||||
|
|
|
@ -80,9 +80,10 @@ const usage = `usage: fzf [options]
|
||||||
Preview
|
Preview
|
||||||
--preview=COMMAND Command to preview highlighted line ({})
|
--preview=COMMAND Command to preview highlighted line ({})
|
||||||
--preview-window=OPT Preview window layout (default: right:50%)
|
--preview-window=OPT Preview window layout (default: right:50%)
|
||||||
[up|down|left|right][:SIZE[%]][:wrap][:cycle][:hidden]
|
[up|down|left|right][:SIZE[%]]
|
||||||
[:+SCROLL[-OFFSET]]
|
[:[no]wrap][:[no]cycle][:[no]hidden]
|
||||||
[:rounded|sharp|noborder]
|
[:rounded|sharp|noborder]
|
||||||
|
[:+SCROLL[-OFFSET]]
|
||||||
|
|
||||||
Scripting
|
Scripting
|
||||||
-q, --query=STR Start the finder with the given query
|
-q, --query=STR Start the finder with the given query
|
||||||
|
@ -994,10 +995,6 @@ func parseInfoStyle(str string) infoStyle {
|
||||||
}
|
}
|
||||||
|
|
||||||
func parsePreviewWindow(opts *previewOpts, input string) {
|
func parsePreviewWindow(opts *previewOpts, input string) {
|
||||||
// We should reset flags that are not style-related.
|
|
||||||
opts.hidden = false
|
|
||||||
opts.scroll = ""
|
|
||||||
|
|
||||||
tokens := strings.Split(input, ":")
|
tokens := strings.Split(input, ":")
|
||||||
sizeRegex := regexp.MustCompile("^[0-9]+%?$")
|
sizeRegex := regexp.MustCompile("^[0-9]+%?$")
|
||||||
offsetRegex := regexp.MustCompile("^\\+([0-9]+|{-?[0-9]+})(-[0-9]+|-/[1-9][0-9]*)?$")
|
offsetRegex := regexp.MustCompile("^\\+([0-9]+|{-?[0-9]+})(-[0-9]+|-/[1-9][0-9]*)?$")
|
||||||
|
@ -1006,10 +1003,16 @@ func parsePreviewWindow(opts *previewOpts, input string) {
|
||||||
case "":
|
case "":
|
||||||
case "hidden":
|
case "hidden":
|
||||||
opts.hidden = true
|
opts.hidden = true
|
||||||
|
case "nohidden":
|
||||||
|
opts.hidden = false
|
||||||
case "wrap":
|
case "wrap":
|
||||||
opts.wrap = true
|
opts.wrap = true
|
||||||
|
case "nowrap":
|
||||||
|
opts.wrap = false
|
||||||
case "cycle":
|
case "cycle":
|
||||||
opts.cycle = true
|
opts.cycle = true
|
||||||
|
case "nocycle":
|
||||||
|
opts.cycle = false
|
||||||
case "up", "top":
|
case "up", "top":
|
||||||
opts.position = posUp
|
opts.position = posUp
|
||||||
case "down", "bottom":
|
case "down", "bottom":
|
||||||
|
|
|
@ -399,11 +399,11 @@ func TestPreviewOpts(t *testing.T) {
|
||||||
}
|
}
|
||||||
opts = optsFor("--preview-window=up:15:wrap:hidden:+{1}-/2", "--preview-window=down", "--preview-window=cycle")
|
opts = optsFor("--preview-window=up:15:wrap:hidden:+{1}-/2", "--preview-window=down", "--preview-window=cycle")
|
||||||
if !(opts.Preview.command == "" &&
|
if !(opts.Preview.command == "" &&
|
||||||
opts.Preview.hidden == false &&
|
opts.Preview.hidden == true &&
|
||||||
opts.Preview.wrap == true &&
|
opts.Preview.wrap == true &&
|
||||||
opts.Preview.cycle == true &&
|
opts.Preview.cycle == true &&
|
||||||
opts.Preview.position == posDown &&
|
opts.Preview.position == posDown &&
|
||||||
opts.Preview.scroll == "" &&
|
opts.Preview.scroll == "{1}-/2" &&
|
||||||
opts.Preview.size.percent == false &&
|
opts.Preview.size.percent == false &&
|
||||||
opts.Preview.size.size == 15) {
|
opts.Preview.size.size == 15) {
|
||||||
t.Error(opts.Preview.size.size)
|
t.Error(opts.Preview.size.size)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user