Genivia / ugrep

NEW ugrep 6.5: a more powerful, ultra fast, user-friendly, compatible grep. Includes a TUI, Google-like Boolean search with AND/OR/NOT, fuzzy search, hexdumps, searches (nested) archives (zip, 7z, tar, pax, cpio), compressed files (gz, Z, bz2, lzma, xz, lz4, zstd, brotli), pdfs, docs, and more
https://ugrep.com
BSD 3-Clause "New" or "Revised" License
2.57k stars 109 forks source link

--tabs=4 has no effect on --initial-tab (-T) #326

Closed hihihippp closed 9 months ago

hihihippp commented 9 months ago

ug --help format | ug -n -T --tabs=4 "" | less -S

The result shows that 8 space tab applied to the line number, even with --tabs=4, not the 4 space tab as ecpected.

tested on linux and cygwin, the result is same.

genivia-inc commented 9 months ago

The --tabs=NUM option sets the tab size for option -k to output the column number. A column number depends on the tab size when tabs are used in matching lines. This tab size is 8 by default. But sometimes we also want 4 or turn it off with 1 to not count tabs to get -k to output character counts, not column positions.

As per ug --help tabs:

$ ug --help tabs

Options and arguments:

    --tabs[=NUM]
            Set the tab size to NUM to expand tabs for option -k.  The value of
            NUM may be 1, 2, 4, or 8.  The default tab size is 8.

There is no option to change the -T spacing, which uses a similar spacing as other grep like BSD grep and GNU grep.