mirror of
https://github.com/Llewellynvdm/fzf.git
synced 2024-11-24 13:47:39 +00:00
Add 'noinfo' option to hide scroll offset information in preview window
fzf --preview 'seq 1000' --preview-window noinfo Close #2525
This commit is contained in:
parent
2286edb329
commit
952276dc2d
@ -21,7 +21,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
..
|
||||
.TH fzf 1 "Aug 2024" "fzf 0.55.0" "fzf - a command-line fuzzy finder"
|
||||
.TH fzf 1 "Sep 2024" "fzf 0.56.0" "fzf - a command-line fuzzy finder"
|
||||
|
||||
.SH NAME
|
||||
fzf - a command-line fuzzy finder
|
||||
@ -756,7 +756,7 @@ default value 0 (or \fBcenter\fR) will put the label at the center of the
|
||||
border line.
|
||||
|
||||
.TP
|
||||
.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)]"
|
||||
.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)]"
|
||||
|
||||
.RS
|
||||
.B POSITION: (default: right)
|
||||
@ -790,6 +790,9 @@ e.g.
|
||||
|
||||
* Cyclic scrolling is enabled with \fBcycle\fR flag.
|
||||
|
||||
* To hide the scroll offset information on the top right corner, specify
|
||||
\fBnoinfo\fR.
|
||||
|
||||
* To change the style of the border of the preview window, specify one of
|
||||
the options for \fB\-\-border\fR with \fBborder\-\fR prefix.
|
||||
e.g. \fBborder\-rounded\fR (border with rounded edges, default),
|
||||
|
@ -120,8 +120,8 @@ Usage: fzf [options]
|
||||
--preview=COMMAND Command to preview highlighted line ({})
|
||||
--preview-window=OPT Preview window layout (default: right:50%)
|
||||
[up|down|left|right][,SIZE[%]]
|
||||
[,[no]wrap][,[no]cycle][,[no]follow][,[no]hidden]
|
||||
[,border-BORDER_OPT]
|
||||
[,[no]wrap][,[no]cycle][,[no]follow][,[no]info]
|
||||
[,[no]hidden][,border-BORDER_OPT]
|
||||
[,+SCROLL[OFFSETS][/DENOM]][,~HEADER_LINES]
|
||||
[,default][,<SIZE_THRESHOLD(ALTERNATIVE_LAYOUT)]
|
||||
--preview-label=LABEL
|
||||
@ -271,6 +271,7 @@ type previewOpts struct {
|
||||
wrap bool
|
||||
cycle bool
|
||||
follow bool
|
||||
info bool
|
||||
border tui.BorderShape
|
||||
headerLines int
|
||||
threshold int
|
||||
@ -508,7 +509,7 @@ func filterNonEmpty(input []string) []string {
|
||||
}
|
||||
|
||||
func defaultPreviewOpts(command string) previewOpts {
|
||||
return previewOpts{command, posRight, sizeSpec{50, true}, "", false, false, false, false, tui.DefaultBorderShape, 0, 0, nil}
|
||||
return previewOpts{command, posRight, sizeSpec{50, true}, "", false, false, false, false, true, tui.DefaultBorderShape, 0, 0, nil}
|
||||
}
|
||||
|
||||
func defaultOptions() *Options {
|
||||
@ -1789,6 +1790,10 @@ func parsePreviewWindowImpl(opts *previewOpts, input string) error {
|
||||
opts.follow = true
|
||||
case "nofollow":
|
||||
opts.follow = false
|
||||
case "info":
|
||||
opts.info = true
|
||||
case "noinfo":
|
||||
opts.info = false
|
||||
default:
|
||||
if headerRegex.MatchString(token) {
|
||||
if opts.headerLines, err = atoi(token[1:]); err != nil {
|
||||
|
@ -2507,7 +2507,7 @@ func (t *Terminal) renderPreviewSpinner() {
|
||||
spin := t.previewer.spinner
|
||||
if len(spin) > 0 || t.previewer.scrollable {
|
||||
maxWidth := t.pwindow.Width()
|
||||
if !t.previewer.scrollable {
|
||||
if !t.previewer.scrollable || !t.previewOpts.info {
|
||||
if maxWidth > 0 {
|
||||
t.pwindow.Move(0, maxWidth-1)
|
||||
t.pwindow.CPrint(tui.ColPreviewSpinner, spin)
|
||||
|
@ -3378,6 +3378,15 @@ class TestGoFZF < TestBase
|
||||
assert_equal expected, result
|
||||
end
|
||||
end
|
||||
|
||||
def test_preview_window_noinfo
|
||||
# │ 1 ││
|
||||
tmux.send_keys %(#{FZF} --preview 'seq 1000' --preview-window top,noinfo --scrollbar), :Enter
|
||||
tmux.until do |lines|
|
||||
assert lines[1]&.start_with?('│ 1')
|
||||
assert lines[1]&.end_with?(' ││')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
module TestShell
|
||||
|
Loading…
Reference in New Issue
Block a user