Skip to content
Myr

Allow specifying '{n}' as the OFFSET in the preview-window flag (#4079)

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

* fzf: Allow '{n}' to be used as the OFFSET in the preview-window flag * man: Document using '{n}' as the OFFSET in the preview-window flag

authored by jaydee-coder · committed by GitHub · parent 6816b7d · Browse files · 2 files+2 added−2 removed
This commit

State

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

Diff stats

2 files+2 added−2 removed

  • other:+2 added−2 removed

2 files+2 added−2 removed

modified:man/man1/fzf.1+1 added-1 removed
803 unmodified lines
804805* \fB[:+SCROLL[OFFSETS][/DENOM]]\fR determines the initial scroll offset of the806preview window.807808 - \fBSCROLL\fR can be either a numeric integer or a single-field index expression that refers to a numeric integer.808 - \fBSCROLL\fR can be either a numeric integer or a single-field index expression that refers to a numeric integer or {n} to refer to the zero-based ordinal index of the current item.809810 - The optional \fBOFFSETS\fR part is for adjusting the base offset. It should be given as a series of signed integers (\fB\-INTEGER\fR or \fB+INTEGER\fR).811812 - The final \fB/DENOM\fR part is for specifying a fraction of the preview window height.
897 unmodified lines
modified:src/options.go+1 added-1 removed
1724 unmodified lines
1725func parsePreviewWindowImpl(opts *previewOpts, input string) error {1726 var err error1727 tokenRegex := regexp.MustCompile(`[:,]*(<([1-9][0-9]*)\(([^)<]+)\)|[^,:]+)`)1728 sizeRegex := regexp.MustCompile("^[0-9]+%?$")1729 offsetRegex := regexp.MustCompile(`^(\+{-?[0-9]+})?([+-][0-9]+)*(-?/[1-9][0-9]*)?$`)1729 offsetRegex := regexp.MustCompile(`^(\+{(-?[0-9]+|n)})?([+-][0-9]+)*(-?/[1-9][0-9]*)?$`)1730 headerRegex := regexp.MustCompile("^~(0|[1-9][0-9]*)$")1731 tokens := tokenRegex.FindAllStringSubmatch(input, -1)1732 var alternative string1733 for _, match := range tokens {
1276 unmodified lines