Skip to content

--with-nth 1 and --with-nth '{1}' behave differently #4272

@lamdevhs

Description

@lamdevhs

Checklist

  • I have read through the manual page (man fzf)
  • I have searched through the existing issues
  • For bug reports, I have checked if the bug is reproducible in the latest version of fzf

Output of fzf --version

0.60.0 (3347d61)

OS

  • Linux
  • macOS
  • Windows
  • Etc.

Shell

  • bash
  • zsh
  • fish

Problem / Steps to reproduce

So perhaps this is intended behavior, but the following don't behave identically:

printf "%s\n" 'a:b:c' 'd:e:f' | fzf --delimiter ':' --with-nth '{1}'

printf "%s\n" 'a:b:c' 'd:e:f' | fzf --delimiter ':' --with-nth '1'

The first line does what I personally expect: it displays two entries to select, labelled "a" and "d". The second line doesn't get rid of the trailing delimiter, however, displaying "a:" and "d:" instead (but if you choose --with-nth 3 you don't get trailing delimiters since there's none after 'c' and 'f' in the input). I believe this wasn't the case before the introduction of '{N}' templates.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions