1
0
mirror of https://github.com/sharkdp/bat synced 2026-07-05 14:13:17 +00:00
Commit Graph

3946 Commits

Author SHA1 Message Date
Keith Hall b7ae4585ad Merge pull request #3812 from greymoth-jp/fix/list-languages-narrow-width-underflow
fix: avoid usize underflow in --list-languages at narrow terminal width
2026-06-27 06:12:21 +03:00
Keith Hall a4609d1778 Merge branch 'master' into fix/list-languages-narrow-width-underflow 2026-06-27 06:03:16 +03:00
Keith Hall 8f70e0cf00 Merge pull request #3703 from blinxen/master
Replace libgit2 with gitoxide (#2)
2026-06-27 05:53:22 +03:00
blinxen e34595b53e Update gix to 0.85 2026-06-26 20:28:29 +02:00
blinxen 6ba745b74b cargo fmt 2026-06-26 20:27:49 +02:00
blinxen 98f09fd6f3 Add test with fauly git repo version 2026-06-26 20:27:49 +02:00
blinxen 69f40d9d8a Regenerate Cargo.lock after rebase 2026-06-26 20:27:49 +02:00
blinxen 6e6137ce10 Update to gix 0.83 2026-06-26 20:27:49 +02:00
blinxen df164cc2e3 fix immediate dereference of reference 2026-06-26 20:27:49 +02:00
blinxen f9eed8d619 cargo fmt 2026-06-26 20:27:49 +02:00
blinxen d695ad8f88 Add more tests for git diff 2026-06-26 20:27:49 +02:00
blinxen e60d184f97 Use histogram instead of myers for diffing 2026-06-26 20:27:49 +02:00
blinxen e2568c52cd Use correct PR number 2026-06-26 20:27:49 +02:00
blinxen c5e6f6aae3 Replace libgit2 with gitoxide 2026-06-26 20:27:49 +02:00
greymoth 8f93137246 doc(changelog): add #3812 bugfix entry 2026-06-26 22:13:51 +09:00
greymoth-jp fa00fb8ce8 fix(list-languages): clamp desired_width to avoid usize underflow at tiny --terminal-width
`get_languages` computed `desired_width = term_width - longest - separator.len()`.
When `--terminal-width` is smaller than the longest language name (e.g. 1), this
underflows `usize`: in overflow-checked builds it panics ("attempt to subtract with
overflow"), and in release it wraps to ~usize::MAX, silently disabling the extension
line-wrapping so `--terminal-width` is ignored for `--list-languages`.

Use `saturating_sub`, mirroring the fix applied to `print_snip` in #3804 (the snip
separator had the same `term_width - ...` underflow pattern). Output at normal widths
is unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-26 17:24:01 +09:00
auto-merge-dependabot-prs[bot] 04576fd5a5 Merge pull request #3783 from sharkdp/dependabot/submodules/assets/syntaxes/02_Extra/vscode-wgsl-a285c38
build(deps): bump assets/syntaxes/02_Extra/vscode-wgsl from `acf2671` to `a285c38`
2026-06-17 17:51:31 +00:00
dependabot[bot] e7025d9bdb build(deps): bump assets/syntaxes/02_Extra/vscode-wgsl
Bumps [assets/syntaxes/02_Extra/vscode-wgsl](https://github.com/PolyMeilex/vscode-wgsl) from `acf2671` to `a285c38`.
- [Release notes](https://github.com/PolyMeilex/vscode-wgsl/releases)
- [Commits](https://github.com/PolyMeilex/vscode-wgsl/compare/acf26718d7a327377641e31d8f9a9dab376efa84...a285c38f74eba2eb5c5a06be8d95b9f581338509)

---
updated-dependencies:
- dependency-name: assets/syntaxes/02_Extra/vscode-wgsl
  dependency-version: a285c38f74eba2eb5c5a06be8d95b9f581338509
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-06-17 17:38:53 +00:00
Keith Hall 6d4a3cef53 Merge pull request #3789 from CosmicHorrorDev/caddy
feat: add syntax highlighting for `Caddyfile`
2026-06-17 20:35:17 +03:00
Cosmic Horror 6b8887133d feat: add syntax highlighting for Caddyfile 2026-06-17 04:44:53 -06:00
Keith Hall 5bb35b4bed Merge pull request #3804 from leeewee/fix-snip-terminal-width-1-panic
Fix capacity-overflow panic in snip separator at --terminal-width 1
2026-06-16 20:19:08 +03:00
weili d28aa4a8b4 Fix capacity-overflow panic in print_snip at --terminal-width 1
`InteractivePrinter::print_snip` computes the snip separator width as
`term_width - panel_count - snip_left_count - title_count`. At `--terminal-width 1`
the panel is disabled and `title_count == 2`, so the subtraction underflows
`usize` (release has no overflow-checks, so it wraps to ~usize::MAX); `str::repeat`
then aborts with "capacity overflow" whenever a snip separator is emitted (two or
more disjoint line ranges, or a diff gap) — which the default style does.

Use `saturating_sub` for the repeat counts so they clamp to 0 instead of
underflowing. Added an integration test.
2026-06-16 07:06:29 +00:00
auto-merge-dependabot-prs[bot] af1f53d9a9 Merge pull request #3786 from sharkdp/dependabot/cargo/nix-0.31.3
build(deps): bump nix from 0.31.2 to 0.31.3
2026-06-01 05:15:08 +00:00
dependabot[bot] 8033b1e7be build(deps): bump nix from 0.31.2 to 0.31.3
Bumps [nix](https://github.com/nix-rust/nix) from 0.31.2 to 0.31.3.
- [Changelog](https://github.com/nix-rust/nix/blob/master/CHANGELOG.md)
- [Commits](https://github.com/nix-rust/nix/compare/v0.31.2...v0.31.3)

---
updated-dependencies:
- dependency-name: nix
  dependency-version: 0.31.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-06-01 05:03:33 +00:00
auto-merge-dependabot-prs[bot] 01408ce094 Merge pull request #3785 from sharkdp/dependabot/cargo/predicates-3.1.4
build(deps): bump predicates from 3.1.3 to 3.1.4
2026-06-01 05:00:15 +00:00
dependabot[bot] bcd1d3f45b build(deps): bump predicates from 3.1.3 to 3.1.4
Bumps [predicates](https://github.com/assert-rs/predicates-rs) from 3.1.3 to 3.1.4.
- [Changelog](https://github.com/assert-rs/predicates-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/assert-rs/predicates-rs/compare/v3.1.3...v3.1.4)

---
updated-dependencies:
- dependency-name: predicates
  dependency-version: 3.1.4
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-06-01 04:48:18 +00:00
auto-merge-dependabot-prs[bot] 4cd5db2a78 Merge pull request #3787 from sharkdp/dependabot/cargo/indexmap-2.14.0
build(deps): bump indexmap from 2.13.0 to 2.14.0
2026-06-01 04:44:39 +00:00
dependabot[bot] 67aa491313 build(deps): bump indexmap from 2.13.0 to 2.14.0
Bumps [indexmap](https://github.com/indexmap-rs/indexmap) from 2.13.0 to 2.14.0.
- [Changelog](https://github.com/indexmap-rs/indexmap/blob/main/RELEASES.md)
- [Commits](https://github.com/indexmap-rs/indexmap/compare/2.13.0...2.14.0)

---
updated-dependencies:
- dependency-name: indexmap
  dependency-version: 2.14.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-06-01 04:28:21 +00:00
auto-merge-dependabot-prs[bot] e490c0f322 Merge pull request #3782 from sharkdp/dependabot/cargo/minus-5.7.1
build(deps): bump minus from 5.6.1 to 5.7.1
2026-06-01 04:24:38 +00:00
dependabot[bot] 2d29ecb939 build(deps): bump minus from 5.6.1 to 5.7.1
Bumps [minus](https://github.com/AMythicDev/minus) from 5.6.1 to 5.7.1.
- [Changelog](https://github.com/AMythicDev/minus/blob/main/CHANGELOG.md)
- [Commits](https://github.com/AMythicDev/minus/compare/v5.6.1...v5.7.1)

---
updated-dependencies:
- dependency-name: minus
  dependency-version: 5.7.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-06-01 03:59:42 +00:00
auto-merge-dependabot-prs[bot] 707b5949fd Merge pull request #3781 from sharkdp/dependabot/cargo/plist-1.9.0
build(deps): bump plist from 1.7.0 to 1.9.0
2026-06-01 03:50:11 +00:00
dependabot[bot] fd53693e1f build(deps): bump plist from 1.7.0 to 1.9.0
Bumps [plist](https://github.com/ebarnard/rust-plist) from 1.7.0 to 1.9.0.
- [Release notes](https://github.com/ebarnard/rust-plist/releases)
- [Changelog](https://github.com/ebarnard/rust-plist/blob/master/CHANGELOG.md)
- [Commits](https://github.com/ebarnard/rust-plist/compare/v1.7.0...v1.9.0)

---
updated-dependencies:
- dependency-name: plist
  dependency-version: 1.9.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-06-01 03:30:20 +00:00
Keith Hall f3d0773468 Merge pull request #3761 from mvanhorn/fix/3760-completion-skip-pager
fix(completions): force --no-paging on bat invocations in completion scripts (#3760)
2026-05-20 07:00:37 +03:00
Matt Van Horn 66e336bcfb fix(completions): force --no-paging on bat invocations in completion scripts (#3760)
Every shell completion script (bash, zsh, fish, PowerShell) shells out
to bat to enumerate languages/themes for tab completion candidates. If
the user has wired bat into LESSOPEN (e.g. LESSOPEN='|-bat -f -pp %s'),
bat's normal pager auto-detection can engage when stdout looks like a
terminal at completion time and reflect ANSI escape sequences back into
the candidate list. The result is the issue's reproducer: tab completion
expands 'Per' to '\033[38;2;248;248;242mPerl' instead of 'Perl'.

The list-languages/list-themes calls are always meant to be machine-
readable, so they should never page. Pass --no-paging explicitly to
every bat invocation inside the four completion files. The flag is the
public alias for --paging=never (already documented in bat --help) and
is the same form completion scripts elsewhere in the codebase use.

Touches the four completion files only; no production code changes.
2026-05-19 04:19:31 -07:00
Keith Hall ce7ad9adca Merge pull request #3758 from injust/patch-1
Include `.ssh/` subdirectories in SSH Config syntax mapping
2026-05-18 20:26:18 +03:00
Keith Hall f9fa590c3d Merge branch 'master' into patch-1 2026-05-18 20:11:48 +03:00
Keith Hall 1e1c3773fb Merge pull request #3759 from injust/patch-2
Add Ghostty syntax mapping
2026-05-18 20:10:26 +03:00
Justin Su 0ef0342ff2 Add changelog entry 2026-05-18 03:33:50 -04:00
Justin Su de396794cf Add Ghostty syntax mapping 2026-05-18 03:29:12 -04:00
Justin Su 43c4957e18 Add changelog entry 2026-05-18 03:08:39 -04:00
Justin Su c9fa10e76b Include .ssh/ subdirectories in SSH Config syntax mapping 2026-05-18 02:45:50 -04:00
Keith Hall 2cec8cdf25 Merge pull request #3737 from truffle-dev/fix/zsh-completion-language-only
fix: only offer language names in zsh tab completion for `-l`
2026-05-11 20:32:12 +03:00
truffle 138d70fd4c fix(zsh): drop redundant awk pipeline in language completion
`bat --list-languages` already emits each entry in `name:matchers`
form, which is the format `_describe` consumes directly. The previous
awk script split each line on `:` and re-emitted `$1:$2`, which is
byte-identical to the input.

Verified with `diff <(bat --list-languages) <(bat --list-languages |
awk -F: '{ printf("%s:%s\\n", $1, $2) }')` against the current
syntax set.
2026-05-10 14:10:54 +00:00
truffle 98df25434e fix: reference PR number in changelog entry 2026-05-10 09:20:40 +00:00
truffle 5f952066fb fix: only offer language names in zsh tab completion for -l
The previous awk script in `bat.zsh.in` split each line of
`bat --list-languages` on `:` or `,` and emitted every field as a
completion candidate, including the second column. That column lists
file matchers, which can be plain extensions (`rs`), globs (`*.rs`),
absolute paths (`/etc/profile`), or filenames (`Containerfile`). None
of those parse as `-l` arguments, so completing them produces
`unknown syntax` errors.

Switch to splitting on `:` only and emit the language name as the
completion value with the file-matcher list as its description, which
matches the bash completion's behavior.

Closes #3735.
2026-05-10 09:19:54 +00:00
Keith Hall f74082cee8 Merge pull request #3734 from kimjune01/fix/zsh-completion-force-plain
fix: pass --color=never --decorations=never in zsh completions
2026-05-09 13:52:47 +03:00
June Kim a0c95618c4 fix: pass --color=never --decorations=never in zsh completions
When BAT_OPTS contains --color=always or --decorations=always, the zsh
completion script's calls to --list-languages and --list-themes produce
ANSI escape codes that corrupt tab completion results.

Pass --color=never --decorations=never explicitly so completion output
is always plain text regardless of user config.

Fixes #3733
2026-05-09 03:35:54 -07:00
Keith Hall f57c1b6b1d Merge pull request #3726 from curious-rabbit/less
fix command injection in LESS template
2026-05-07 05:34:13 +03:00
Keith Hall 517de0463b Merge branch 'master' into less 2026-05-07 05:23:26 +03:00
curious-rabbit 3be4e30e00 improve patch 2026-05-06 10:58:02 +02:00