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
Provenance
- Commit
952276d- Tree
6ed0677- Author
Junegunn Choi <junegunn.c@gmail.com>- Committer
Junegunn Choi <junegunn.c@gmail.com>- Parent
2286edb
4 files changed+23 added−6 removed
modified:man/man1/fzf.1+5 added-2 removed
19 unmodified lines20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN22 THE 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"25 26 .SH NAME27 fzf - a command-line fuzzy finder28 726 unmodified lines755 default value 0 (or \fBcenter\fR) will put the label at the center of the756 border line.757 758 .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)]"760 761 .RS762 .B POSITION: (default: right)763 \fBup25 unmodified lines789 .RE790 791 * Cyclic scrolling is enabled with \fBcycle\fR flag.792 793+* To hide the scroll offset information on the top right corner, specify794+\fBnoinfo\fR.795+796 * To change the style of the border of the preview window, specify one of797 the options for \fB\-\-border\fR with \fBborder\-\fR prefix.798 e.g. \fBborder\-rounded\fR (border with rounded edges, default),799 \fBborder\-sharp\fR (border with sharp edges), \fBborder\-left\fR,907 unmodified linesmodified:src/options.go+8 added-3 removed
118 unmodified lines119 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 lines270 hidden bool271 wrap bool272 cycle bool273 follow bool274+ info bool275 border tui.BorderShape276 headerLines int277 threshold int278 alternative *previewOpts229 unmodified lines508 return output509 }510 511 func 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 }514 515 func defaultOptions() *Options {516 var theme *tui.ColorTheme1272 unmodified lines1789 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 err1196 unmodified linesmodified:src/terminal.go+1 added-1 removed
2505 unmodified lines2506 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 linesmodified:test/test_go.rb+9 added
3376 unmodified lines3377 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 end3381+3382+ 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+ end3390 end3391 3392 module TestShell3393 def setup520 unmodified lines