Add `--preview-window noborder` option to disable preview border
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Close #1699
authored by Junegunn Choi · committed by Junegunn Choi · parent d2fa470 · Browse files · 4 files·+16 added−4 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
4 files+16 added−4 removed
- other:+16 added−4 removed
Provenance
- Commit
e242992- Tree
95725bb- Author
Junegunn Choi <junegunn.c@gmail.com>- Committer
Junegunn Choi <junegunn.c@gmail.com>- Parent
d2fa470
4 files changed+16 added−4 removed
modified:man/man1/fzf.1+2 added-2 removed
359 unmodified lines360 Preview window will be updated even when there is no match for the current361 query if any of the placeholder expressions evaluates to a non-empty string.362 .RE363 .TP364-.BI "--preview-window=" "[POSITION][:SIZE[%]][:wrap][:hidden]"365-Determine the layout of the preview window. If the argument ends with364+.BI "--preview-window=" "[POSITION][:SIZE[%]][:noborder][:wrap][:hidden]"365+Determines the layout of the preview window. If the argument contains366 \fB:hidden\fR, the preview window will be hidden by default until367 \fBtoggle-preview\fR action is triggered. Long lines are truncated by default.368 Line wrap can be enabled with \fB:wrap\fR flag.369 397 unmodified linesmodified:src/options.go+7 added-1 removed
154 unmodified lines155 position windowPosition156 size sizeSpec157 hidden bool158 wrap bool159+ border bool160 }161 162 // Options stores the values of command-line options163 type Options struct {84 unmodified lines248 Filter: nil,249 ToggleSort: false,250 Expect: make(map[int]string),251 Keymap: make(map[int][]action),251- Preview: previewOpts{"", posRight, sizeSpec{50, true}, false, false},252+ Preview: previewOpts{"", posRight, sizeSpec{50, true}, false, false, true},253 PrintQuery: false,254 ReadZero: false,255 Printer: func(str string) { fmt.Println(str) },256 PrintSep: "\n",680 unmodified lines937 tokens := strings.Split(input, ":")938 sizeRegex := regexp.MustCompile("^[0-9]+%?$")939 for _, token := range tokens {940 switch token {941+ case "":942 case "hidden":943 opts.hidden = true944 case "wrap":945 opts.wrap = true4 unmodified lines950 case "left":951 opts.position = posLeft952 case "right":953 opts.position = posRight954+ case "border":955+ opts.border = true956+ case "noborder":957+ opts.border = false958 default:959 if sizeRegex.MatchString(token) {960 opts.size = parseSize(token, 99, "window size")961 } else {413 unmodified linesmodified:src/terminal.go+5 added-1 removed
622 unmodified lines623 }624 noBorder := tui.MakeBorderStyle(tui.BorderNone, t.unicode)625 if previewVisible {626 createPreviewWindow := func(y int, x int, w int, h int) {627- t.pborder = t.tui.NewWindow(y, x, w, h, tui.MakeBorderStyle(tui.BorderAround, t.unicode))627+ previewBorder := noBorder628+ if t.preview.border {629+ previewBorder = tui.MakeBorderStyle(tui.BorderAround, t.unicode)630+ }631+ t.pborder = t.tui.NewWindow(y, x, w, h, previewBorder)632 pwidth := w - 4633 // ncurses auto-wraps the line when the cursor reaches the right-end of634 // the window. To prevent unintended line-wraps, we use the width one635 // column larger than the desired value.1531 unmodified linesmodified:CHANGELOG.md+2 added
41 unmodified lines42 - Info line style can be changed by `--info=STYLE`43 - `--info=default`44 - `--info=inline` (same as old `--inline-info`)45 - `--info=hidden`46+- Preview window border can be disabled by adding `noborder` to47+ `--preview-window`.48 - When you transform the input with `--with-nth`, the trailing white spaces49 are removed.50 - `ctrl-\`, `ctrl-]`, `ctrl-^`, and `ctrl-/` can now be used with `--bind`51 - See https://github.com/junegunn/fzf/milestone/15?closed=1 for more details714 unmodified lines