mirror of
https://github.com/sharkdp/bat.git
synced 2026-02-08 00:32:08 +00:00
Fix -n flag to show line numbers in loop-through mode
When the -n/--number flag is passed on the command line, bat now shows line numbers even when piping output to another process (loop-through mode), similar to how `cat -n` behaves. This change detects if -n or --number was passed on the CLI (before merging with config file and environment variables) and disables loop-through mode in that case, allowing the InteractivePrinter to add line numbers. The existing behavior is preserved: - Styles from config/env are still ignored when piping (unless --decorations=always is set) - Only the -n flag from CLI enables line numbers in piped mode - -p and --style options from CLI do not disable loop-through mode
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
- Fix hang when using `--list-themes` with an explicit pager, see #3457 (@abhinavcool42)
|
||||
- Fix negative values of N not being parsed in <N:M> line ranges without `=` flag value separator, see #3442 (@lmmx)
|
||||
- Fix broken Docker syntax preventing use of custom assets, see #3476 (@keith-hall)
|
||||
- Fix decorations being applied unexpectedly when piping, breaking cat compatibility. See #3496 (@keith-hall)
|
||||
- Fix decorations being applied unexpectedly when piping. Now only line numbers explicitly required on the command line should be applied in auto decorations mode for `cat` compatibility. See #3496 (@keith-hall)
|
||||
|
||||
## Other
|
||||
- Improve README documentation on pager options passed to less, see #3443 (@injust)
|
||||
|
||||
Reference in New Issue
Block a user