mirror of
https://github.com/junegunn/fzf
synced 2024-11-18 09:28:40 +00:00
parent
be36de2482
commit
15f4cfb6d9
@ -1,6 +1,15 @@
|
||||
CHANGELOG
|
||||
=========
|
||||
|
||||
0.27.0
|
||||
------
|
||||
- More border options for `--preview-window`
|
||||
```sh
|
||||
fzf --preview 'cat {}' --preview-window border-left
|
||||
fzf --preview 'cat {}' --preview-window top:border-bottom
|
||||
fzf --preview 'cat {}' --preview-window top:border-horizontal
|
||||
```
|
||||
|
||||
0.26.0
|
||||
------
|
||||
- Added support for fixed header in preview window
|
||||
|
@ -203,6 +203,8 @@ Draw border around the finder
|
||||
.br
|
||||
.BR right
|
||||
.br
|
||||
.BR none
|
||||
.br
|
||||
|
||||
.TP
|
||||
.B "--no-unicode"
|
||||
@ -442,7 +444,7 @@ e.g.
|
||||
done'\fR
|
||||
.RE
|
||||
.TP
|
||||
.BI "--preview-window=" "[POSITION][:SIZE[%]][:rounded|sharp|noborder][:[no]wrap][:[no]follow][:[no]cycle][:[no]hidden][:+SCROLL[OFFSETS][/DENOM]][:~HEADER_LINES][:default]"
|
||||
.BI "--preview-window=" "[POSITION][:SIZE[%]][:border-BORDER_OPT][:[no]wrap][:[no]follow][:[no]cycle][:[no]hidden][:+SCROLL[OFFSETS][/DENOM]][:~HEADER_LINES][:default]"
|
||||
|
||||
.RS
|
||||
.B POSITION: (default: right)
|
||||
@ -477,8 +479,10 @@ e.g.
|
||||
* Cyclic scrolling is enabled with \fB:cycle\fR flag.
|
||||
|
||||
* To change the style of the border of the preview window, specify one of
|
||||
\fBrounded\fR (border with rounded edges, default), \fBsharp\fR (border with
|
||||
sharp edges), or \fBnoborder\fR (no border).
|
||||
the options for \fB--border\fR with \fBborder-\fR prefix.
|
||||
e.g. \fBborder-rounded\fR (border with rounded edges, default),
|
||||
\fBborder-sharp\fR (border with sharp edges), \fBborder-left\fR,
|
||||
\fBborder-none\fR, etc.
|
||||
|
||||
* \fB[:+SCROLL[OFFSETS][/DENOM]]\fR determines the initial scroll offset of the
|
||||
preview window.
|
||||
|
@ -58,7 +58,7 @@ const usage = `usage: fzf [options]
|
||||
--layout=LAYOUT Choose layout: [default|reverse|reverse-list]
|
||||
--border[=STYLE] Draw border around the finder
|
||||
[rounded|sharp|horizontal|vertical|
|
||||
top|bottom|left|right] (default: rounded)
|
||||
top|bottom|left|right|none] (default: rounded)
|
||||
--margin=MARGIN Screen margin (TRBL | TB,RL | T,RL,B | T,R,B,L)
|
||||
--padding=PADDING Padding inside border (TRBL | TB,RL | T,RL,B | T,R,B,L)
|
||||
--info=STYLE Finder info style [default|inline|hidden]
|
||||
@ -83,7 +83,7 @@ const usage = `usage: fzf [options]
|
||||
--preview-window=OPT Preview window layout (default: right:50%)
|
||||
[up|down|left|right][:SIZE[%]]
|
||||
[:[no]wrap][:[no]cycle][:[no]follow][:[no]hidden]
|
||||
[:rounded|sharp|noborder]
|
||||
[:border-BORDER_OPT]
|
||||
[:+SCROLL[OFFSETS][/DENOM]][:~HEADER_LINES]
|
||||
[:default]
|
||||
|
||||
@ -436,11 +436,13 @@ func parseBorder(str string, optional bool) tui.BorderShape {
|
||||
return tui.BorderLeft
|
||||
case "right":
|
||||
return tui.BorderRight
|
||||
case "none":
|
||||
return tui.BorderNone
|
||||
default:
|
||||
if optional && str == "" {
|
||||
return tui.BorderRounded
|
||||
}
|
||||
errorExit("invalid border style (expected: rounded|sharp|horizontal|vertical|top|bottom|left|right)")
|
||||
errorExit("invalid border style (expected: rounded|sharp|horizontal|vertical|top|bottom|left|right|none)")
|
||||
}
|
||||
return tui.BorderNone
|
||||
}
|
||||
@ -1105,12 +1107,24 @@ func parsePreviewWindow(opts *previewOpts, input string) {
|
||||
opts.position = posLeft
|
||||
case "right":
|
||||
opts.position = posRight
|
||||
case "rounded", "border":
|
||||
case "rounded", "border", "border-rounded":
|
||||
opts.border = tui.BorderRounded
|
||||
case "sharp":
|
||||
case "sharp", "border-sharp":
|
||||
opts.border = tui.BorderSharp
|
||||
case "noborder":
|
||||
case "noborder", "border-none":
|
||||
opts.border = tui.BorderNone
|
||||
case "border-horizontal":
|
||||
opts.border = tui.BorderHorizontal
|
||||
case "border-vertical":
|
||||
opts.border = tui.BorderVertical
|
||||
case "border-top":
|
||||
opts.border = tui.BorderTop
|
||||
case "border-bottom":
|
||||
opts.border = tui.BorderBottom
|
||||
case "border-left":
|
||||
opts.border = tui.BorderLeft
|
||||
case "border-right":
|
||||
opts.border = tui.BorderRight
|
||||
case "follow":
|
||||
opts.follow = true
|
||||
case "nofollow":
|
||||
|
@ -831,16 +831,33 @@ func (t *Terminal) resizeWindows() {
|
||||
createPreviewWindow := func(y int, x int, w int, h int) {
|
||||
pwidth := w
|
||||
pheight := h
|
||||
if t.previewOpts.border != tui.BorderNone {
|
||||
previewBorder := tui.MakeBorderStyle(t.previewOpts.border, t.unicode)
|
||||
t.pborder = t.tui.NewWindow(y, x, w, h, true, previewBorder)
|
||||
var previewBorder tui.BorderStyle
|
||||
if t.previewOpts.border == tui.BorderNone {
|
||||
previewBorder = tui.MakeTransparentBorder()
|
||||
} else {
|
||||
previewBorder = tui.MakeBorderStyle(t.previewOpts.border, t.unicode)
|
||||
}
|
||||
t.pborder = t.tui.NewWindow(y, x, w, h, true, previewBorder)
|
||||
switch t.previewOpts.border {
|
||||
case tui.BorderSharp, tui.BorderRounded:
|
||||
pwidth -= 4
|
||||
pheight -= 2
|
||||
x += 2
|
||||
y += 1
|
||||
} else {
|
||||
previewBorder := tui.MakeTransparentBorder()
|
||||
t.pborder = t.tui.NewWindow(y, x, w, h, true, previewBorder)
|
||||
case tui.BorderLeft:
|
||||
pwidth -= 2
|
||||
x += 2
|
||||
case tui.BorderRight:
|
||||
pwidth -= 2
|
||||
case tui.BorderTop:
|
||||
pheight -= 1
|
||||
y += 1
|
||||
case tui.BorderBottom:
|
||||
pheight -= 1
|
||||
case tui.BorderHorizontal:
|
||||
pheight -= 2
|
||||
y += 1
|
||||
case tui.BorderVertical:
|
||||
pwidth -= 4
|
||||
x += 2
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user