Skip to content
Myr

Add 'noinfo' option to hide scroll offset information in preview window

Before adoption: this commit came in with the history the project adopted, so no landing records it.

fzf --preview 'seq 1000' --preview-window noinfo Close #2525

authored by Junegunn Choi · committed by Junegunn Choi · parent 2286edb · Browse files · 4 files+23 added−6 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+23 added−6 removed

  • tests:+9 added−0 removed
  • other:+14 added−6 removed

4 files+23 added−6 removed

modified:man/man1/fzf.1+5 added-2 removed
19 unmodified lines
20LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,21OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN22THE SOFTWARE.23..24.TH fzf 1 "Aug 2024" "fzf 0.55.0" "fzf - a command-line fuzzy finder"24.TH fzf 1 "Sep 2024" "fzf 0.56.0" "fzf - a command-line fuzzy finder"2526.SH NAME27fzf - a command-line fuzzy finder28
726 unmodified lines
755default value 0 (or \fBcenter\fR) will put the label at the center of the756border line.757758.TP759.BI "\-\-preview\-window=" "[POSITION][,SIZE[%]][,border\-BORDER_OPT][,[no]wrap][,[no]follow][,[no]cycle][,[no]hidden][,+SCROLL[OFFSETS][/DENOM]][,~HEADER_LINES][,default][,<SIZE_THRESHOLD(ALTERNATIVE_LAYOUT)]"759.BI "\-\-preview\-window=" "[POSITION][,SIZE[%]][,border\-BORDER_OPT][,[no]wrap][,[no]follow][,[no]cycle][,[no]info][,[no]hidden][,+SCROLL[OFFSETS][/DENOM]][,~HEADER_LINES][,default][,<SIZE_THRESHOLD(ALTERNATIVE_LAYOUT)]"760761.RS762.B POSITION: (default: right)763 \fBup
25 unmodified lines
789.RE790791* Cyclic scrolling is enabled with \fBcycle\fR flag.792793* To hide the scroll offset information on the top right corner, specify794\fBnoinfo\fR.795796* To change the style of the border of the preview window, specify one of797the options for \fB\-\-border\fR with \fBborder\-\fR prefix.798e.g. \fBborder\-rounded\fR (border with rounded edges, default),799\fBborder\-sharp\fR (border with sharp edges), \fBborder\-left\fR,
907 unmodified lines
modified:src/options.go+8 added-3 removed
118 unmodified lines
119 Preview120 --preview=COMMAND Command to preview highlighted line ({})121 --preview-window=OPT Preview window layout (default: right:50%)122 [up|down|left|right][,SIZE[%]]123 [,[no]wrap][,[no]cycle][,[no]follow][,[no]hidden]124 [,border-BORDER_OPT]123 [,[no]wrap][,[no]cycle][,[no]follow][,[no]info]124 [,[no]hidden][,border-BORDER_OPT]125 [,+SCROLL[OFFSETS][/DENOM]][,~HEADER_LINES]126 [,default][,<SIZE_THRESHOLD(ALTERNATIVE_LAYOUT)]127 --preview-label=LABEL128 --preview-label-pos=N Same as --border-label and --border-label-pos,
141 unmodified lines
270 hidden bool271 wrap bool272 cycle bool273 follow bool274 info bool275 border tui.BorderShape276 headerLines int277 threshold int278 alternative *previewOpts
229 unmodified lines
508 return output509}510511func defaultPreviewOpts(command string) previewOpts {511 return previewOpts{command, posRight, sizeSpec{50, true}, "", false, false, false, false, tui.DefaultBorderShape, 0, 0, nil}512 return previewOpts{command, posRight, sizeSpec{50, true}, "", false, false, false, false, true, tui.DefaultBorderShape, 0, 0, nil}513}514515func defaultOptions() *Options {516 var theme *tui.ColorTheme
1272 unmodified lines
1789 case "follow":1790 opts.follow = true1791 case "nofollow":1792 opts.follow = false1793 case "info":1794 opts.info = true1795 case "noinfo":1796 opts.info = false1797 default:1798 if headerRegex.MatchString(token) {1799 if opts.headerLines, err = atoi(token[1:]); err != nil {1800 return err
1196 unmodified lines
modified:src/terminal.go+1 added-1 removed
2505 unmodified lines
2506 numLines := len(t.previewer.lines)2507 spin := t.previewer.spinner2508 if len(spin) > 0 || t.previewer.scrollable {2509 maxWidth := t.pwindow.Width()2510 if !t.previewer.scrollable {2510 if !t.previewer.scrollable || !t.previewOpts.info {2511 if maxWidth > 0 {2512 t.pwindow.Move(0, maxWidth-1)2513 t.pwindow.CPrint(tui.ColPreviewSpinner, spin)2514 }
2554 unmodified lines
modified:test/test_go.rb+9 added
3376 unmodified lines
3377 result = `printf -- 'xxx\n-xx\nxx-\n_x_\n_x-\n-x_\n[x]\n-x-\n x \n/x/\n' | #{FZF} -f"'x'" --scheme=#{scheme}`.lines(chomp: true)3378 assert_equal expected, result3379 end3380 end33813382 def test_preview_window_noinfo3383 # │ 1 ││3384 tmux.send_keys %(#{FZF} --preview 'seq 1000' --preview-window top,noinfo --scrollbar), :Enter3385 tmux.until do |lines|3386 assert lines[1]&.start_with?('│ 1')3387 assert lines[1]&.end_with?(' ││')3388 end3389 end3390end33913392module TestShell3393 def setup
520 unmodified lines