on 735bee4 help sign in
34 files changed+115−402
since splitsnapshots
unifiedsplit
.github/ISSUE_TEMPLATE/question.md−2 .github/workflows/CICD.yml+1−13 CHANGELOG.md+3−36 Cargo.lock+25−9 Cargo.toml+5−4 README.md+1−1 assets/acknowledgements.bin assets/completions/_bat.ps1.in+1−1 assets/completions/bat.fish.in+1−1 assets/completions/bat.zsh.in+1−1 assets/manual/bat.1.in+1−1 assets/syntaxes.bin assets/syntaxes/02_Extra/INI.sublime-syntax+2−2 assets/syntaxes/02_Extra/Nginx+1−1 assets/syntaxes/02_Extra/Zig+1−1 assets/themes.bin doc/release-checklist.md+6−7 src/assets.rs+4−71 src/bin/bat/app.rs+1−1 src/bin/bat/clap_app.rs+3−5 src/error.rs+1−4 src/less.rs+8−59 src/output.rs+5−7 src/printer.rs+2−14 src/style.rs+1−11 tests/examples/longline.json−3 tests/integration_tests.rs−78 tests/syntax-tests/highlighted/INI/test.inf−5 tests/syntax-tests/highlighted/Svelte/App.svelte+1−5 tests/syntax-tests/highlighted/Vue/example.vue−5 tests/syntax-tests/highlighted/Zig/example.zig+39−39 tests/syntax-tests/source/INI/test.inf−5 tests/syntax-tests/source/Svelte/App.svelte+1−5 tests/syntax-tests/source/Vue/example.vue−5
.github/ISSUE_TEMPLATE/question.md−2
@@ -7,5 +7,3 @@ assignees: ''
77
88---
99
10−<!-- Using a normal ticket is still fine, but feel free to ask your
11−questions about bat on https://github.com/sharkdp/bat/discussions instead. -->
.github/workflows/CICD.yml+1−13
@@ -118,18 +118,6 @@ jobs:
118118 toolchain: stable
119119 default: true
120120 profile: minimal
121− - name: Print -h
122− uses: actions-rs/cargo@v1
123− with:
124− command: run
125− args: --locked -- -h
126− - name: Print --help
127− uses: actions-rs/cargo@v1
128− with:
129− command: run
130− args: --locked -- --help
131− - name: Show man page
132− run: man $(find . -name bat.1)
133121 - name: Check documentation
134122 env:
135123 RUSTDOCFLAGS: -D warnings
@@ -154,7 +142,7 @@ jobs:
154142 - { target: x86_64-apple-darwin , os: macos-10.15 }
155143 - { target: x86_64-pc-windows-gnu , os: windows-2019 }
156144 - { target: x86_64-pc-windows-msvc , os: windows-2019 }
157− - { target: x86_64-unknown-linux-gnu , os: ubuntu-20.04, use-cross: true }
145+ - { target: x86_64-unknown-linux-gnu , os: ubuntu-20.04 }
158146 - { target: x86_64-unknown-linux-musl , os: ubuntu-20.04, use-cross: true }
159147 steps:
160148 - name: Checkout source code
CHANGELOG.md+3−36
@@ -2,39 +2,11 @@
22
33## Features
44
5−- Make the default macOS theme depend on Dark Mode. See #2197, #1746 (@Enselic)
6−
7−## Bugfixes
8−
9−## Other
10−
11−- Relaxed glibc requirements on amd64, see #2106 and #2194 (@sharkdp)
12−
13−## Syntaxes
14−
15−## Themes
16−
17−## `bat` as a library
18−
19−
20−# v0.21.0
21−
22−## Features
23−
24−- Correctly render tab stops in `--show-all`, see #2038 (@Synthetica9)
25−- Add a `--style=default` option and make it the default. It is less verbose than `full`, see #2061 (@IsaacHorvath)
26−- Enable BusyBox `less` as pager, see #2162 (@nfisher1226)
27−- File extensions are now matched case-insensitively. See #1854, #2181 (@Enselic)
5+- Correctly render tab stops in --show-all, see #2038 (@Synthetica9)
286
297## Bugfixes
308
319- Bump `regex` dependency from 1.5.4 to 1.5.5 to fix [CVE-2022-24713](https://blog.rust-lang.org/2022/03/08/cve-2022-24713.html), see #2145, #2139 (@Enselic)
32−- `bat` no longer crashes when encountering files that references missing syntaxes. See #915, #2181 (@Enselic)
33−
34−## Performance
35−
36−- Skip syntax highlighting on long lines (> 16384 chars) to help improve performance. See #2165 (@keith-hall)
37−- Vastly improve startup time by lazy-loading syntaxes via syntect 5.0.0. This makes bat display small files ~75% faster than before. See #951, #2181 (@Enselic)
3810
3911## Other
4012
@@ -46,17 +18,12 @@
4618- log syntax: improved handling of escape characters in double quoted strings. See #2123 (@keith-hall)
4719- Associate `/var/spool/mail/*` and `/var/mail/*` with the `Email` syntax. See #2156 (@cyqsimon)
4820- Added cmd-help syntax to scope --help messages. See #2148 (@victor-gp)
49−- Slightly adjust Zig syntax. See #2136 (@Enselic)
50−- Associate `.inf` files with the `INI` syntax. See #2190 (@Enselic)
21+
22+## Themes
5123
5224## `bat` as a library
5325
5426- Allow configuration of `show_nonprintable` with `PrettyPrinter`, see #2142
55−- The binary format of syntaxes.bin has been changed due to syntaxes now being lazy-loaded via syntect 5.0.0. See #2181 (@Enselic)
56−- Mark `bat::error::Error` enum as `#[non_exhaustive]` to allow adding new variants without future semver breakage. See #2181 (@Enselic)
57−- Change `Error::SyntectError(syntect::LoadingError)` to `Error::SyntectError(syntect::Error)`. See #2181 (@Enselic)
58−- Add `Error::SyntectLoadingError(syntect::LoadingError)` enum variant. See #2181 (@Enselic)
59−
6027
6128# v0.20.0
6229
Cargo.lock+25−9
@@ -74,7 +74,7 @@ checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd"
7474
7575[[package]]
7676name = "bat"
77−version = "0.21.0"
77+version = "0.20.0"
7878dependencies = [
7979 "ansi_colours",
8080 "ansi_term",
@@ -580,11 +580,17 @@ version = "1.4.0"
580580source = "registry+https://github.com/rust-lang/crates.io-index"
581581checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
582582
583+[[package]]
584+name = "lazycell"
585+version = "1.3.0"
586+source = "registry+https://github.com/rust-lang/crates.io-index"
587+checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
588+
583589[[package]]
584590name = "libc"
585−version = "0.2.125"
591+version = "0.2.112"
586592source = "registry+https://github.com/rust-lang/crates.io-index"
587−checksum = "5916d2ae698f6de9bfb891ad7a8d65c09d232dc58cc4ac433c7da3b2fd84bc2b"
593+checksum = "1b03d17f364a3a042d5e5d46b053bbbf82c92c9430c592dd4c064dc6ee997125"
588594
589595[[package]]
590596name = "libgit2-sys"
@@ -655,6 +661,15 @@ version = "2.4.1"
655661source = "registry+https://github.com/rust-lang/crates.io-index"
656662checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a"
657663
664+[[package]]
665+name = "memoffset"
666+version = "0.6.5"
667+source = "registry+https://github.com/rust-lang/crates.io-index"
668+checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce"
669+dependencies = [
670+ "autocfg",
671+]
672+
658673[[package]]
659674name = "miniz_oxide"
660675version = "0.5.1"
@@ -666,13 +681,15 @@ dependencies = [
666681
667682[[package]]
668683name = "nix"
669−version = "0.24.1"
684+version = "0.23.1"
670685source = "registry+https://github.com/rust-lang/crates.io-index"
671−checksum = "8f17df307904acd05aa8e32e97bb20f2a0df1728bbc2d771ae8f9a90463441e9"
686+checksum = "9f866317acbd3a240710c63f065ffb1e4fd466259045ccb504130b7f668f35c6"
672687dependencies = [
673688 "bitflags",
689+ "cc",
674690 "cfg-if",
675691 "libc",
692+ "memoffset",
676693]
677694
678695[[package]]
@@ -1065,9 +1082,9 @@ dependencies = [
10651082
10661083[[package]]
10671084name = "syntect"
1068−version = "5.0.0"
1085+version = "4.6.0"
10691086source = "registry+https://github.com/rust-lang/crates.io-index"
1070−checksum = "c6c454c27d9d7d9a84c7803aaa3c50cd088d2906fe3c6e42da3209aa623576a8"
1087+checksum = "8b20815bbe80ee0be06e6957450a841185fcf690fe0178f14d77a05ce2caa031"
10711088dependencies = [
10721089 "bincode",
10731090 "bitflags",
@@ -1075,14 +1092,13 @@ dependencies = [
10751092 "flate2",
10761093 "fnv",
10771094 "lazy_static",
1078− "once_cell",
1095+ "lazycell",
10791096 "onig",
10801097 "plist",
10811098 "regex-syntax",
10821099 "serde",
10831100 "serde_derive",
10841101 "serde_json",
1085− "thiserror",
10861102 "walkdir",
10871103 "yaml-rust",
10881104]
Cargo.toml+5−4
@@ -6,7 +6,7 @@ homepage = "https://github.com/sharkdp/bat"
66license = "MIT/Apache-2.0"
77name = "bat"
88repository = "https://github.com/sharkdp/bat"
9−version = "0.21.0"
9+version = "0.20.0"
1010exclude = ["assets/syntaxes/*", "assets/themes/*"]
1111build = "build.rs"
1212edition = '2018'
@@ -33,7 +33,8 @@ minimal-application = [
3333]
3434git = ["git2"] # Support indicating git modifications
3535paging = ["shell-words", "grep-cli"] # Support applying a pager on the output
36−build-assets = ["syntect/yaml-load", "syntect/plist-load", "regex", "walkdir"]
36+# Add "syntect/plist-load" when https://github.com/trishume/syntect/pull/345 reaches us
37+build-assets = ["syntect/yaml-load", "syntect/dump-create", "regex", "walkdir"]
3738
3839# You need to use one of these if you depend on bat as a library:
3940regex-onig = ["syntect/regex-onig"] # Use the "oniguruma" regex engine
@@ -72,7 +73,7 @@ optional = true
7273default-features = false
7374
7475[dependencies.syntect]
75−version = "5.0.0"
76+version = "4.6.0"
7677default-features = false
7778features = ["parsing"]
7879
@@ -90,7 +91,7 @@ wait-timeout = "0.2.0"
9091tempfile = "3.3.0"
9192
9293[target.'cfg(unix)'.dev-dependencies]
93−nix = { version = "0.24.1", default-features = false, features = ["term"] }
94+nix = "0.23.1"
9495
9596[build-dependencies]
9697clap = { version = "2.34", optional = true }
README.md+1−1
@@ -171,7 +171,7 @@ You can combine `bat` with `git diff` to view lines around code changes with pro
171171highlighting:
172172```bash
173173batdiff() {
174− git diff --name-only --relative --diff-filter=d | xargs bat --diff
174+ git diff --name-only --diff-filter=d | xargs bat --diff
175175}
176176```
177177If you prefer to use this as a separate tool, check out `batdiff` in [`bat-extras`](https://github.com/eth-p/bat-extras).
assets/acknowledgements.bin

Binary file not shown.

assets/completions/_bat.ps1.in+1−1
@@ -37,7 +37,7 @@ Register-ArgumentCompleter -Native -CommandName '{{PROJECT_EXECUTABLE}}' -Script
3737 [CompletionResult]::new('-m', 'm', [CompletionResultType]::ParameterName, 'Use the specified syntax for files matching the glob pattern (''*.cpp:C++'').')
3838 [CompletionResult]::new('--map-syntax', 'map-syntax', [CompletionResultType]::ParameterName, 'Use the specified syntax for files matching the glob pattern (''*.cpp:C++'').')
3939 [CompletionResult]::new('--theme', 'theme', [CompletionResultType]::ParameterName, 'Set the color theme for syntax highlighting.')
40− [CompletionResult]::new('--style', 'style', [CompletionResultType]::ParameterName, 'Comma-separated list of style elements to display (*default*, auto, full, plain, changes, header, header-filename, header-filesize, grid, rule, numbers, snip).')
40+ [CompletionResult]::new('--style', 'style', [CompletionResultType]::ParameterName, 'Comma-separated list of style elements to display (*auto*, full, plain, changes, header, header-filename, header-filesize, grid, rule, numbers, snip).')
4141 [CompletionResult]::new('-r', 'r', [CompletionResultType]::ParameterName, 'Only print the lines from N to M.')
4242 [CompletionResult]::new('--line-range', 'line-range', [CompletionResultType]::ParameterName, 'Only print the lines from N to M.')
4343 [CompletionResult]::new('-A', 'A', [CompletionResultType]::ParameterName, 'Show non-printable characters (space, tab, newline, ..).')
assets/completions/bat.fish.in+1−1
@@ -56,7 +56,7 @@ complete -c {{PROJECT_EXECUTABLE}} -s P -d "Disable paging. Alias for '--paging=
5656
5757complete -c {{PROJECT_EXECUTABLE}} -s A -l show-all -d "Show non-printable characters like space/tab/newline" -n "not __fish_seen_subcommand_from cache"
5858
59−complete -c {{PROJECT_EXECUTABLE}} -l style -xka "default auto full plain changes header header-filename header-filesize grid rule numbers snip" -d "Comma-separated list of style elements or presets to display with file contents" -n "not __fish_seen_subcommand_from cache"
59+complete -c {{PROJECT_EXECUTABLE}} -l style -xka "auto full plain changes header header-filename header-filesize grid rule numbers snip" -d "Comma-separated list of style elements or presets to display with file contents" -n "not __fish_seen_subcommand_from cache"
6060
6161complete -c {{PROJECT_EXECUTABLE}} -l tabs -x -d "<T> Set the tab width to T spaces (width of 0 passes tabs through directly)" -n "not __fish_seen_subcommand_from cache"
6262
assets/completions/bat.zsh.in+1−1
@@ -75,7 +75,7 @@ _{{PROJECT_EXECUTABLE}}_main() {
7575 ;;
7676
7777 style)
78− _values -s , 'style' default auto full plain changes header header-filename header-filesize grid rule numbers snip
78+ _values -s , 'style' auto full plain changes header header-filename header-filesize grid rule numbers snip
7979 ;;
8080 esac
8181}
assets/manual/bat.1.in+1−1
@@ -146,7 +146,7 @@ Configure which elements (line numbers, file headers, grid borders, Git modifica
146146of components to display (e.g. 'numbers,changes,grid') or a pre\-defined style ('full').
147147To set a default style, add the '\-\-style=".."' option to the configuration file or
148148export the BAT_STYLE environment variable (e.g.: export BAT_STYLE=".."). Possible
149−values: *default*, full, auto, plain, changes, header, header-filename, header-filesize, grid,
149+values: *full*, auto, plain, changes, header, header-filename, header-filesize, grid,
150150rule, numbers, snip.
151151.HP
152152\fB\-r\fR, \fB\-\-line\-range\fR <N:M>...
assets/syntaxes.bin

Binary file not shown.

assets/syntaxes/02_Extra/INI.sublime-syntax+2−2
@@ -5,8 +5,8 @@ name: INI
55file_extensions:
66 - ini
77 - INI
8− - "inf"
9− - "INF"
8+ - inf
9+ - INF
1010 - reg
1111 - REG
1212 - lng
assets/syntaxes/02_Extra/Nginx+1−1

Submodule changed.

assets/syntaxes/02_Extra/Zig+1−1

Submodule changed.

assets/themes.bin

Binary file not shown.

doc/release-checklist.md+6−7
@@ -7,22 +7,21 @@
77- [ ] Find the current min. supported Rust version by running
88 `grep '^\s*MIN_SUPPORTED_RUST_VERSION' .github/workflows/CICD.yml`.
99- [ ] Update the version and the min. supported Rust version in `README.md` and
10− `doc/README-*.md`. Check with
11− `git grep -i -e 'rust.*1\.' -e '1\..*rust' | grep README | grep -v tests/`.
10+ `doc/README-*.md`. Check with `git grep -i 'rust.*1\.'` and
11+ `git grep -i '1\..*rust'`.
1212- [ ] Update `CHANGELOG.md`. Introduce a section for the new release.
1313
1414## Update syntaxes and themes (build assets)
1515
16−- [ ] Install the latest master version (`cargo clean && cargo install --locked -f --path .`) and make
16+- [ ] Install the latest master version (`cargo clean && cargo install -f --path .`) and make
1717 sure that it is available on the `PATH` (`bat --version` should show the
1818 new version).
1919- [ ] Run `assets/create.sh` and check in the binary asset files.
2020
2121## Documentation
2222
23−- [ ] Review `-h`, `--help`, and the `man` page. All of these are shown in
24− the output of the CI job called *Documentation*, so look there.
25− The CI workflow corresponding to the tip of the master branch is a good place to look.
23+- [ ] Review the `-h` and `--help` texts
24+- [ ] Review the `man` page (`man $(fd -HIp target/release/build.*out/assets/manual/bat.1) | tee`)
2625
2726## Pre-release checks
2827
@@ -31,7 +30,7 @@
3130- [ ] Optional: manually test the new features and command-line options. To do
3231 this, install the latest `bat` version again (to include the new syntaxes
3332 and themes).
34−- [ ] Run `cargo publish --dry-run` to make sure that it will
33+- [ ] Run `cargo publish --dry-run --allow-dirty` to make sure that it will
3534 succeed later (after creating the GitHub release).
3635
3736## Release
src/assets.rs+4−71
@@ -43,9 +43,8 @@ pub struct SyntaxReferenceInSet<'a> {
4343 pub syntax_set: &'a SyntaxSet,
4444}
4545
46−/// Lazy-loaded syntaxes are already compressed, and we don't want to compress
47−/// already compressed data.
48−pub(crate) const COMPRESS_SYNTAXES: bool = false;
46+/// Compress for size of ~700 kB instead of ~4600 kB at the cost of ~30% longer deserialization time
47+pub(crate) const COMPRESS_SYNTAXES: bool = true;
4948
5049/// We don't want to compress our [LazyThemeSet] since the lazy-loaded themes
5150/// within it are already compressed, and compressing another time just makes
@@ -69,57 +68,10 @@ impl HighlightingAssets {
6968 }
7069 }
7170
72− /// The default theme.
73− ///
74− /// ### Windows and Linux
75− ///
76− /// Windows and most Linux distributions has a dark terminal theme by
77− /// default. On these platforms, this function always returns a theme that
78− /// looks good on a dark background.
79− ///
80− /// ### macOS
81− ///
82− /// On macOS the default terminal background is light, but it is common that
83− /// Dark Mode is active, which makes the terminal background dark. On this
84− /// platform, the default theme depends on
85− /// ```bash
86− /// defaults read -globalDomain AppleInterfaceStyle
87− /// ````
88− /// To avoid the overhead of the check on macOS, simply specify a theme
89− /// explicitly via `--theme`, `BAT_THEME`, or `~/.config/bat`.
90− ///
91− /// See <https://github.com/sharkdp/bat/issues/1746> and
92− /// <https://github.com/sharkdp/bat/issues/1928> for more context.
9371 pub fn default_theme() -> &'static str {
94− #[cfg(not(target_os = "macos"))]
95− {
96− Self::default_dark_theme()
97− }
98− #[cfg(target_os = "macos")]
99− {
100− if macos_dark_mode_active() {
101− Self::default_dark_theme()
102− } else {
103− Self::default_light_theme()
104− }
105− }
106− }
107−
108− /**
109− * The default theme that looks good on a dark background.
110− */
111− fn default_dark_theme() -> &'static str {
11272 "Monokai Extended"
11373 }
11474
115− /**
116− * The default theme that looks good on a light background.
117− */
118− #[cfg(target_os = "macos")]
119− fn default_light_theme() -> &'static str {
120− "Monokai Extended Light"
121− }
122−
12375 pub fn from_cache(cache_path: &Path) -> Result<Self> {
12476 Ok(HighlightingAssets::new(
12577 SerializedSyntaxSet::FromFile(cache_path.join("syntaxes.bin")),
@@ -399,16 +351,6 @@ fn asset_from_cache<T: serde::de::DeserializeOwned>(
399351 .map_err(|_| format!("Could not parse cached {}", description).into())
400352}
401353
402−#[cfg(target_os = "macos")]
403−fn macos_dark_mode_active() -> bool {
404− let mut defaults_cmd = std::process::Command::new("defaults");
405− defaults_cmd.args(&["read", "-globalDomain", "AppleInterfaceStyle"]);
406− match defaults_cmd.output() {
407− Ok(output) => output.stdout == b"Dark\n",
408− Err(_) => true,
409− }
410−}
411−
412354#[cfg(test)]
413355mod tests {
414356 use super::*;
@@ -639,22 +581,13 @@ mod tests {
639581 }
640582
641583 #[test]
642− fn syntax_detection_is_case_insensitive() {
584+ fn syntax_detection_is_case_sensitive() {
643585 let mut test = SyntaxDetectionTest::new();
644586
645− assert_eq!(test.syntax_for_file("README.md"), "Markdown");
646− assert_eq!(test.syntax_for_file("README.mD"), "Markdown");
647− assert_eq!(test.syntax_for_file("README.Md"), "Markdown");
648− assert_eq!(test.syntax_for_file("README.MD"), "Markdown");
649−
650− // Adding a mapping for "MD" in addition to "md" should not break the mapping
587+ assert_ne!(test.syntax_for_file("README.MD"), "Markdown");
651588 test.syntax_mapping
652589 .insert("*.MD", MappingTarget::MapTo("Markdown"))
653590 .ok();
654−
655− assert_eq!(test.syntax_for_file("README.md"), "Markdown");
656− assert_eq!(test.syntax_for_file("README.mD"), "Markdown");
657− assert_eq!(test.syntax_for_file("README.Md"), "Markdown");
658591 assert_eq!(test.syntax_for_file("README.MD"), "Markdown");
659592 }
660593
src/bin/bat/app.rs+1−1
@@ -322,7 +322,7 @@ impl App {
322322 .collect::<Vec<_>>()
323323 })
324324 .or(env_style_components)
325− .unwrap_or_else(|| vec![StyleComponent::Default])
325+ .unwrap_or_else(|| vec![StyleComponent::Full])
326326 .into_iter()
327327 .map(|style| style.components(self.interactive_output))
328328 .fold(HashSet::new(), |mut acc, components| {
src/bin/bat/clap_app.rs+3−5
@@ -398,7 +398,6 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
398398 !&[
399399 "auto",
400400 "full",
401− "default",
402401 "plain",
403402 "header",
404403 "header-filename",
@@ -420,7 +419,7 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
420419 })
421420 .help(
422421 "Comma-separated list of style elements to display \
423− (*default*, auto, full, plain, changes, header, header-filename, header-filesize, grid, rule, numbers, snip).",
422+ (*auto*, full, plain, changes, header, grid, rule, numbers, snip).",
424423 )
425424 .long_help(
426425 "Configure which elements (line numbers, file headers, grid \
@@ -431,9 +430,8 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
431430 '--style=\"..\"' option to the configuration file or export the \
432431 BAT_STYLE environment variable (e.g.: export BAT_STYLE=\"..\").\n\n\
433432 Possible values:\n\n \
434− * default: enables recommended style components (default).\n \
435− * full: enables all available components.\n \
436− * auto: same as 'default', unless the output is piped.\n \
433+ * full: enables all available components (default).\n \
434+ * auto: same as 'full', unless the output is piped.\n \
437435 * plain: disables all available components.\n \
438436 * changes: show Git modification markers.\n \
439437 * header: alias for 'header-filename'.\n \
src/error.rs+1−4
@@ -2,14 +2,11 @@ use std::io::Write;
22use thiserror::Error;
33
44#[derive(Error, Debug)]
5−#[non_exhaustive]
65pub enum Error {
76 #[error(transparent)]
87 Io(#[from] ::std::io::Error),
98 #[error(transparent)]
10− SyntectError(#[from] ::syntect::Error),
11− #[error(transparent)]
12− SyntectLoadingError(#[from] ::syntect::LoadingError),
9+ SyntectError(#[from] ::syntect::LoadingError),
1310 #[error(transparent)]
1411 ParseIntError(#[from] ::std::num::ParseIntError),
1512 #[error(transparent)]
src/less.rs+8−59
@@ -3,38 +3,21 @@
33use std::ffi::OsStr;
44use std::process::Command;
55
6−#[derive(Debug, PartialEq)]
7−pub enum LessVersion {
8− Less(usize),
9− BusyBox,
10−}
11−
12−pub fn retrieve_less_version(less_path: &dyn AsRef<OsStr>) -> Option<LessVersion> {
6+pub fn retrieve_less_version(less_path: &dyn AsRef<OsStr>) -> Option<usize> {
137 let resolved_path = grep_cli::resolve_binary(less_path.as_ref()).ok()?;
148
159 let cmd = Command::new(resolved_path).arg("--version").output().ok()?;
16− if cmd.status.success() {
17− parse_less_version(&cmd.stdout)
18− } else {
19− parse_less_version_busybox(&cmd.stderr)
20− }
10+ parse_less_version(&cmd.stdout)
2111}
2212
23−fn parse_less_version(output: &[u8]) -> Option<LessVersion> {
13+fn parse_less_version(output: &[u8]) -> Option<usize> {
2414 if !output.starts_with(b"less ") {
2515 return None;
2616 }
2717
2818 let version = std::str::from_utf8(&output[5..]).ok()?;
2919 let end = version.find(|c: char| !c.is_ascii_digit())?;
30− Some(LessVersion::Less(version[..end].parse::<usize>().ok()?))
31−}
32−
33−fn parse_less_version_busybox(output: &[u8]) -> Option<LessVersion> {
34− match std::str::from_utf8(output) {
35− Ok(version) if version.contains("BusyBox ") => Some(LessVersion::BusyBox),
36− _ => None,
37− }
20+ version[..end].parse::<usize>().ok()
3821}
3922
4023#[test]
@@ -47,7 +30,7 @@ For information about the terms of redistribution,
4730see the file named README in the less distribution.
4831Homepage: http://www.greenwoodsoftware.com/less";
4932
50− assert_eq!(Some(LessVersion::Less(487)), parse_less_version(output));
33+ assert_eq!(Some(487), parse_less_version(output));
5134}
5235
5336#[test]
@@ -60,7 +43,7 @@ For information about the terms of redistribution,
6043see the file named README in the less distribution.
6144Homepage: http://www.greenwoodsoftware.com/less";
6245
63− assert_eq!(Some(LessVersion::Less(529)), parse_less_version(output));
46+ assert_eq!(Some(529), parse_less_version(output));
6447}
6548
6649#[test]
@@ -73,7 +56,7 @@ For information about the terms of redistribution,
7356see the file named README in the less distribution.
7457Home page: http://www.greenwoodsoftware.com/less";
7558
76− assert_eq!(Some(LessVersion::Less(551)), parse_less_version(output));
59+ assert_eq!(Some(551), parse_less_version(output));
7760}
7861
7962#[test]
@@ -86,7 +69,7 @@ For information about the terms of redistribution,
8669see the file named README in the less distribution.
8770Home page: https://greenwoodsoftware.com/less";
8871
89− assert_eq!(Some(LessVersion::Less(581)), parse_less_version(output));
72+ assert_eq!(Some(581), parse_less_version(output));
9073}
9174
9275#[test]
@@ -94,38 +77,4 @@ fn test_parse_less_version_wrong_program() {
9477 let output = b"more from util-linux 2.34";
9578
9679 assert_eq!(None, parse_less_version(output));
97− assert_eq!(None, parse_less_version_busybox(output));
98−}
99−
100−#[test]
101−fn test_parse_less_version_busybox() {
102− let output = b"pkg/less: unrecognized option '--version'
103−BusyBox v1.35.0 (2022-04-21 10:38:11 EDT) multi-call binary.
104−
105−Usage: less [-EFIMmNSRh~] [FILE]...
106−
107−View FILE (or stdin) one screenful at a time
108−
109− -E Quit once the end of a file is reached
110− -F Quit if entire file fits on first screen
111− -I Ignore case in all searches
112− -M,-m Display status line with line numbers
113− and percentage through the file
114− -N Prefix line number to each line
115− -S Truncate long lines
116− -R Remove color escape codes in input
117− -~ Suppress ~s displayed past EOF";
118−
119− assert_eq!(
120− Some(LessVersion::BusyBox),
121− parse_less_version_busybox(output)
122− );
123−}
124−
125−#[test]
126−fn test_parse_less_version_invalid_utf_8() {
127− let output = b"\xff";
128−
129− assert_eq!(None, parse_less_version(output));
130− assert_eq!(None, parse_less_version_busybox(output));
13180}
src/output.rs+5−7
@@ -4,7 +4,7 @@ use std::process::Child;
44
55use crate::error::*;
66#[cfg(feature = "paging")]
7−use crate::less::{retrieve_less_version, LessVersion};
7+use crate::less::retrieve_less_version;
88#[cfg(feature = "paging")]
99use crate::paging::PagingMode;
1010#[cfg(feature = "paging")]
@@ -83,13 +83,13 @@ impl OutputType {
8383 let replace_arguments_to_less = pager.source == PagerSource::EnvVarPager;
8484
8585 if args.is_empty() || replace_arguments_to_less {
86− p.arg("-R"); // Short version of --RAW-CONTROL-CHARS for maximum compatibility
86+ p.arg("--RAW-CONTROL-CHARS");
8787 if single_screen_action == SingleScreenAction::Quit {
88− p.arg("-F"); // Short version of --quit-if-one-screen for compatibility
88+ p.arg("--quit-if-one-screen");
8989 }
9090
9191 if wrapping_mode == WrappingMode::NoWrapping(true) {
92− p.arg("-S"); // Short version of --chop-long-lines for compatibility
92+ p.arg("--chop-long-lines");
9393 }
9494
9595 // Passing '--no-init' fixes a bug with '--quit-if-one-screen' in older
@@ -103,9 +103,7 @@ impl OutputType {
103103 None => {
104104 p.arg("--no-init");
105105 }
106− Some(LessVersion::Less(version))
107− if (version < 530 || (cfg!(windows) && version < 558)) =>
108− {
106+ Some(version) if (version < 530 || (cfg!(windows) && version < 558)) => {
109107 p.arg("--no-init");
110108 }
111109 _ => {}
src/printer.rs+2−14
@@ -445,21 +445,9 @@ impl<'a> Printer for InteractivePrinter<'a> {
445445 return Ok(());
446446 }
447447 };
448−
449− // skip syntax highlighting on long lines
450− let too_long = line.len() > 1024 * 16;
451−
452− let for_highlighting: &str = if too_long { "\n" } else { &line };
453−
454− let mut highlighted_line = highlighter_from_set
448+ highlighter_from_set
455449 .highlighter
456− .highlight_line(for_highlighting, highlighter_from_set.syntax_set)?;
457−
458− if too_long {
459− highlighted_line[0].1 = &line;
460− }
461−
462− highlighted_line
450+ .highlight(&line, highlighter_from_set.syntax_set)
463451 };
464452
465453 if out_of_range {
src/style.rs+1−11
@@ -17,7 +17,6 @@ pub enum StyleComponent {
1717 LineNumbers,
1818 Snip,
1919 Full,
20− Default,
2120 Plain,
2221}
2322
@@ -26,7 +25,7 @@ impl StyleComponent {
2625 match self {
2726 StyleComponent::Auto => {
2827 if interactive_terminal {
29− StyleComponent::Default.components(interactive_terminal)
28+ StyleComponent::Full.components(interactive_terminal)
3029 } else {
3130 StyleComponent::Plain.components(interactive_terminal)
3231 }
@@ -49,14 +48,6 @@ impl StyleComponent {
4948 StyleComponent::LineNumbers,
5049 StyleComponent::Snip,
5150 ],
52− StyleComponent::Default => &[
53− #[cfg(feature = "git")]
54− StyleComponent::Changes,
55− StyleComponent::Grid,
56− StyleComponent::HeaderFilename,
57− StyleComponent::LineNumbers,
58− StyleComponent::Snip,
59− ],
6051 StyleComponent::Plain => &[],
6152 }
6253 }
@@ -78,7 +69,6 @@ impl FromStr for StyleComponent {
7869 "numbers" => Ok(StyleComponent::LineNumbers),
7970 "snip" => Ok(StyleComponent::Snip),
8071 "full" => Ok(StyleComponent::Full),
81− "default" => Ok(StyleComponent::Default),
8272 "plain" => Ok(StyleComponent::Plain),
8373 _ => Err(format!("Unknown style '{}'", s).into()),
8474 }
tests/examples/longline.jsondeleted−3
@@ -1,3 +0,0 @@
1−{"api":
2− {"ANGLE_instanced_arrays":{"__compat":{"mdn_url":"https://developer.mozilla.org/docs/Web/API/ANGLE_instanced_arrays","spec_url":"https://www.khronos.org/registry/webgl/extensions/ANGLE_instanced_arrays/","support":{"chrome":{"version_added":"32"},"chrome_android":{"version_added":"32"},"edge":{"version_added":"12"},"firefox":{"version_added":"47"},"firefox_android":{"version_added":true},"ie":{"version_added":"11"},"opera":{"version_added":"19"},"opera_android":{"version_added":"19"},"safari":{"version_added":"8"},"safari_ios":{"version_added":"8"},"samsunginternet_android":{"version_added":"2.0"},"webview_android":{"version_added":"4.4"}},"status":{"experimental":false,"standard_track":true,"deprecated":false}},"drawArraysInstancedANGLE":{"__compat":{"mdn_url":"https://developer.mozilla.org/docs/Web/API/ANGLE_instanced_arrays/drawArraysInstancedANGLE","spec_url":"https://www.khronos.org/registry/webgl/extensions/ANGLE_instanced_arrays/","support":{"chrome":{"version_added":"32"},"chrome_android":{"version_added":"32"},"edge":{"version_added":"12"},"firefox":{"version_added":"47"},"firefox_android":{"version_added":true},"ie":{"version_added":"11"},"opera":{"version_added":"19"},"opera_android":{"version_added":"19"},"safari":{"version_added":"8"},"safari_ios":{"version_added":"8"},"samsunginternet_android":{"version_added":"2.0"},"webview_android":{"version_added":"4.4"}},"status":{"experimental":false,"standard_track":true,"deprecated":false}}},"drawElementsInstancedANGLE":{"__compat":{"mdn_url":"https://developer.mozilla.org/docs/Web/API/ANGLE_instanced_arrays/drawElementsInstancedANGLE","spec_url":"https://www.khronos.org/registry/webgl/extensions/ANGLE_instanced_arrays/","support":{"chrome":{"version_added":"32"},"chrome_android":{"version_added":"32"},"edge":{"version_added":"12"},"firefox":{"version_added":"47"},"firefox_android":{"version_added":true},"ie":{"version_added":"11"},"opera":{"version_added":"19"},"opera_android":{"version_added":"19"},"safari":{"version_added":"8"},"safari_ios":{"version_added":"8"},"samsunginternet_android":{"version_added":"2.0"},"webview_android":{"version_added":"4.4"}},"status":{"experimental":false,"standard_track":true,"deprecated":false}}},"vertexAttribDivisorANGLE":{"__compat":{"mdn_url":"https://developer.mozilla.org/docs/Web/API/ANGLE_instanced_arrays/vertexAttribDivisorANGLE","spec_url":"https://www.khronos.org/registry/webgl/extensions/ANGLE_instanced_arrays/","support":{"chrome":{"version_added":"32"},"chrome_android":{"version_added":"32"},"edge":{"version_added":"12"},"firefox":{"version_added":"47"},"firefox_android":{"version_added":true},"ie":{"version_added":"11"},"opera":{"version_added":"19"},"opera_android":{"version_added":"19"},"safari":{"version_added":"8"},"safari_ios":{"version_added":"8"},"samsunginternet_android":{"version_added":"2.0"},"webview_android":{"version_added":"4.4"}},"status":{"experimental":false,"standard_track":true,"deprecated":false}}}},"AbortController":{"__compat":{"mdn_url":"https://developer.mozilla.org/docs/Web/API/AbortController","spec_url":"https://dom.spec.whatwg.org/#interface-abortcontroller","support":{"chrome":{"version_added":"66"},"chrome_android":{"version_added":"66"},"edge":{"version_added":"16"},"firefox":{"version_added":"57"},"firefox_android":{"version_added":"57"},"ie":{"version_added":false},"nodejs":{"version_added":"15.0.0"},"opera":{"version_added":"53"},"opera_android":{"version_added":"47"},"safari":[{"version_added":"12.1"},{"version_added":"11.1","partial_implementation":true,"notes":"Even though <code>window.AbortController</code> is defined, it doesn't really abort <code>fetch</code> requests. See <a href='https://webkit.org/b/174980'>bug 174980</a>."}],"safari_ios":[{"version_added":"12.2"},{"version_added":"11.3","partial_implementation":true,"notes":"Even though <code>window.AbortController</code> is defined, it doesn't really abort <code>fetch</code> requests. See <a href='https://webkit.org/b/174980'>bug 174980</a>."}],"samsunginternet_android":{"version_added":"9.0"},"webview_android":{"version_added":"66"}},"status":{"experimental":true,"standard_track":true,"deprecated":false}},"AbortController":{"__compat":{"mdn_url":"https://developer.mozilla.org/docs/Web/API/AbortController/AbortController","spec_url":"https://dom.spec.whatwg.org/#ref-for-dom-abortcontroller-abortcontroller①","description":"<code>AbortController()</code> constructor","support":{"chrome":{"version_added":"66"},"chrome_android":{"version_added":"66"},"edge":{"version_added":"16"},"firefox":{"version_added":"57"},"firefox_android":{"version_added":"57"},"ie":{"version_added":false},"nodejs":{"version_added":"15.0.0"},"opera":{"version_added":"53"},"opera_android":{"version_added":"47"},"safari":[{"version_added":"12.1"},{"version_added":"11.1","partial_implementation":true,"notes":"Even though <code>window.AbortController</code> is defined, it doesn't really abort <code>fetch</code> requests. See <a href='https://webkit.org/b/174980'>bug 174980</a>."}],"safari_ios":[{"version_added":"12.2"},{"version_added":"11.3","partial_implementation":true,"notes":"Even though <code>window.AbortController</code> is defined, it doesn't really abort <code>fetch</code> requests. See <a href='https://webkit.org/b/174980'>bug 174980</a>."}],"samsunginternet_android":{"version_added":"9.0"},"webview_android":{"version_added":"66"}},"status":{"experimental":true,"standard_track":true,"deprecated":false}}},"abort":{"__compat":{"mdn_url":"https://developer.mozilla.org/docs/Web/API/AbortController/abort","spec_url":"https://dom.spec.whatwg.org/#ref-for-dom-abortcontroller-abortcontroller①","support":{"chrome":{"version_added":"66"},"chrome_android":{"version_added":"66"},"edge":{"version_added":"16"},"firefox":{"version_added":"57"},"firefox_android":{"version_added":"57"},"ie":{"version_added":false},"nodejs":{"version_added":"15.0.0"},"opera":{"version_added":"53"},"opera_android":{"version_added":"47"},"safari":[{"version_added":"12.1"},{"version_added":"11.1","partial_implementation":true,"notes":"Even though <code>window.AbortController</code> is defined, it doesn't really abort <code>fetch</code> requests. See <a href='https://webkit.org/b/174980'>bug 174980</a>."}],"safari_ios":[{"version_added":"12.2"},{"version_added":"11.3","partial_implementation":true,"notes":"Even though <code>window.AbortController</code> is defined, it doesn't really abort <code>fetch</code> requests. See <a href='https://webkit.org/b/174980'>bug 174980</a>."}],"samsunginternet_android":{"version_added":"9.0"},"webview_android":{"version_added":"66"}},"status":{"experimental":true,"standard_track":true,"deprecated":false}}},"signal":{"__compat":{"mdn_url":"https://developer.mozilla.org/docs/Web/API/AbortController/signal","spec_url":"https://dom.spec.whatwg.org/#ref-for-dom-abortcontroller-signal②","support":{"chrome":{"version_added":"66"},"chrome_android":{"version_added":"66"},"edge":{"version_added":"16"},"firefox":{"version_added":"57"},"firefox_android":{"version_added":"57"},"ie":{"version_added":false},"nodejs":{"version_added":"15.0.0"},"opera":{"version_added":"53"},"opera_android":{"version_added":"47"},"safari":[{"version_added":"12.1"},{"version_added":"11.1","partial_implementation":true,"notes":"Even though <code>window.AbortController</code> is defined, it doesn't really abort <code>fetch</code> requests. See <a href='https://webkit.org/b/174980'>bug 174980</a>."}],"safari_ios":[{"version_added":"12.2"},{"version_added":"11.3","partial_implementation":true,"notes":"Even though <code>window.AbortController</code> is defined, it doesn't really abort <code>fetch</code> requests. See <a href='https://webkit.org/b/174980'>bug 174980</a>."}],"samsunginternet_android":{"version_added":"9.0"},"webview_android":{"version_added":"66"}},"status":{"experimental":true,"standard_track":true,"deprecated":false}}}},"AbortPaymentEvent":{"__compat":{"mdn_url":"https://developer.mozilla.org/docs/Web/API/AbortPaymentEvent","support":{"chrome":{"version_added":"70"},"chrome_android":{"version_added":"70"},"edge":{"version_added":"79"},"firefox":{"version_added":false},"firefox_android":{"version_added":false},"ie":{"version_added":false},"opera":{"version_added":"57"},"opera_android":{"version_added":"49"},"safari":{"version_added":false},"safari_ios":{"version_added":false},"samsunginternet_android":{"version_added":"10.0"},"webview_android":{"version_added":false}},"status":{"experimental":true,"standard_track":false,"deprecated":false}},"AbortPaymentEvent":{"__compat":{"description":"<code>AbortPaymentEvent()</code> constructor","mdn_url":"https://developer.mozilla.org/docs/Web/API/AbortPaymentEvent/AbortPaymentEvent","support":{"chrome":{"version_added":"70"},"chrome_android":{"version_added":"70"},"edge":{"version_added":"79"},"firefox":{"version_added":false},"firefox_android":{"version_added":false},"ie":{"version_added":false},"opera":{"version_added":"57"},"opera_android":{"version_added":"49"},"safari":{"version_added":false},"safari_ios":{"version_added":false},"samsunginternet_android":{"version_added":"10.0"},"webview_android":{"version_added":false}},"status":{"experimental":true,"standard_track":false,"deprecated":false}}},"respondWith":{"__compat":{"mdn_url":"https://developer.mozilla.org/docs/Web/API/AbortPaymentEvent/respondWith","support":{"chrome":{"version_added":"70"},"chrome_android":{"version_added":"70"},"edge":{"version_added":"79"},"firefox":{"version_added":false},"firefox_android":{"version_added":false},"ie":{"version_added":false},"opera":{"version_added":"57"},"opera_android":{"version_added":"49"},"safari":{"version_added":false},"safari_ios":{"version_added":false},"samsunginternet_android":{"version_added":"10.0"},"webview_android":{"version_added":false}},"status":{"experimental":true,"standard_track":false,"deprecated":false}}}},"AbortSignal":{"__compat":{"mdn_url":"https://developer.mozilla.org/docs/Web/API/AbortSignal","spec_url":"https://dom.spec.whatwg.org/#interface-AbortSignal","support":{"chrome":{"version_added":"66"},"chrome_android":{"version_added":"66"},"edge":{"version_added":"16"},"firefox":{"version_added":"57"},"firefox_android":{"version_added":"57"},"ie":{"version_added":false},"nodejs":{"version_added":"15.0.0"},"opera":{"version_added":"53"},"opera_android":{"version_added":"47"},"safari":{"version_added":"11.1"},"safari_ios":{"version_added":"11.3"},"samsunginternet_android":{"version_added":"9.0"},"webview_android":{"version_added":"66"}},"status":{"experimental":false,"standard_track":true,"deprecated":false}},"abort":{"__compat":{"mdn_url":"https://developer.mozilla.org/docs/Web/API/AbortSignal/abort","spec_url":"https://dom.spec.whatwg.org/#ref-for-dom-abortsignal-abort①","support":{"chrome":{"version_added":false},"chrome_android":{"version_added":false},"edge":{"version_added":false},"firefox":{"version_added":"88"},"firefox_android":{"version_added":"88"},"ie":{"version_added":false},"nodejs":{"version_added":false},"opera":{"version_added":false},"opera_android":{"version_added":false},"safari":{"version_added":false},"safari_ios":{"version_added":false},"samsunginternet_android":{"version_added":false},"webview_android":{"version_added":false}},"status":{"experimental":false,"standard_track":true,"deprecated":false}}},"abort_event":{"__compat":{"description":"<code>abort</code> event","mdn_url":"https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_event","spec_url":"https://dom.spec.whatwg.org/#eventdef-abortsignal-abort","support":{"chrome":{"version_added":"66"},"chrome_android":{"version_added":"66"},"edge":{"version_added":"16"},"firefox":{"version_added":"57"},"firefox_android":{"version_added":"57"},"ie":{"version_added":false},"nodejs":{"version_added":"15.0.0"},"opera":{"version_added":"53"},"opera_android":{"version_added":"47"},"safari":{"version_added":"11.1"},"safari_ios":{"version_added":"11.3"},"samsunginternet_android":{"version_added":"9.0"},"webview_android":{"version_added":"66"}},"status":{"experimental":false,"standard_track":true,"deprecated":false}}},"aborted":{"__compat":{"mdn_url":"https://developer.mozilla.org/docs/Web/API/AbortSignal/aborted","spec_url":"https://dom.spec.whatwg.org/#ref-for-dom-abortsignal-aborted①","support":{"chrome":{"version_added":"66"},"chrome_android":{"version_added":"66"},"edge":{"version_added":"16"},"firefox":{"version_added":"57"},"firefox_android":{"version_added":"57"},"ie":{"version_added":false},"nodejs":{"version_added":"15.0.0"},"opera":{"version_added":"53"},"opera_android":{"version_added":"47"},"safari":{"version_added":"11.1"},"safari_ios":{"version_added":"11.3"},"samsunginternet_android":{"version_added":"9.0"},"webview_android":{"version_added":"66"}},"status":{"experimental":false,"standard_track":true,"deprecated":false}}},"onabort":{"__compat":{"mdn_url":"https://developer.mozilla.org/docs/Web/API/AbortSignal/onabort","spec_url":"https://dom.spec.whatwg.org/#abortsignal-onabort","support":{"chrome":{"version_added":"66"},"chrome_android":{"version_added":"66"},"edge":{"version_added":"16"},"firefox":{"version_added":"57"},"firefox_android":{"version_added":"57"},"ie":{"version_added":false},"nodejs":{"version_added":"15.0.0"},"opera":{"version_added":"53"},"opera_android":{"version_added":"47"},"safari":{"version_added":"11.1"},"safari_ios":{"version_added":"11.3"},"samsunginternet_android":{"version_added":"9.0"},"webview_android":{"version_added":"66"}},"status":{"experimental":false,"standard_track":true,"deprecated":false}}}},"AbsoluteOrientationSensor":{"__compat":{"mdn_url":"https://developer.mozilla.org/docs/Web/API/AbsoluteOrientationSensor","spec_url":"https://w3c.github.io/orientation-sensor/#absoluteorientationsensor-interface","support":{"chrome":{"version_added":"67"},"chrome_android":{"version_added":"67"},"edge":{"version_added":"79"},"firefox":{"version_added":false},"firefox_android":{"version_added":false},"ie":{"version_added":false},"opera":{"version_added":"54"},"opera_android":{"version_added":"48"},"safari":{"version_added":false},"safari_ios":{"version_added":false},"samsunginternet_android":{"version_added":"9.0"},"webview_android":{"version_added":"67"}},"status":{"experimental":false,"standard_track":true,"deprecated":false}},"AbsoluteOrientationSensor":{"__compat":{"mdn_url":"https://developer.mozilla.org/docs/Web/API/AbsoluteOrientationSensor/AbsoluteOrientationSensor","spec_url":"https://w3c.github.io/orientation-sensor/#dom-absoluteorientationsensor-absoluteorientationsensor","description":"<code>AbsoluteOrientationSensor()</code> constructor","support":{"chrome":{"version_added":"67"},"chrome_android":{"version_added":"67"},"edge":{"version_added":"79"},"firefox":{"version_added":false},"firefox_android":{"version_added":false},"ie":{"version_added":false},"opera":{"version_added":"54"},"opera_android":{"version_added":"48"},"safari":{"version_added":false},"safari_ios":{"version_added":false},"samsunginternet_android":{"version_added":"9.0"},"webview_android":{"version_added":"67"}},"status":{"experimental":false,"standard_track":true,"deprecated":false}}}},"AbstractRange":{"__compat":{"mdn_url":"https://developer.mozilla.org/docs/Web/API/AbstractRange","spec_url":"https://dom.spec.whatwg.org/#interface-abstractrange","support":{"chrome":{"version_added":"90"},"chrome_android":{"version_added":"90"},"edge":[{"version_added":"90"},{"version_added":"18","version_removed":"79"}],"firefox":{"version_added":"69"},"firefox_android":{"version_added":false},"ie":{"version_added":false},"opera":{"version_added":false},"opera_android":{"version_added":false},"safari":{"version_added":"14.1"},"safari_ios":{"version_added":"14.5"},"samsunginternet_android":{"version_added":false},"webview_android":{"version_added":"90"}},"status":{"experimental":false,"standard_track":true,"deprecated":false}},"collapsed":{"__compat":{"mdn_url":"https://developer.mozilla.org/docs/Web/API/AbstractRange/collapsed","spec_url":"https://dom.spec.whatwg.org/#ref-for-dom-range-collapsed①","support":{"chrome":{"version_added":"90"},"chrome_android":{"version_added":"90"},"edge":[{"version_added":"90"},{"version_added":"18","version_removed":"79"}],"firefox":{"version_added":"69"},"firefox_android":{"version_added":false},"ie":{"version_added":false},"opera":{"version_added":false},"opera_android":
3− {"version_added":false}
tests/integration_tests.rs−78
@@ -974,53 +974,6 @@ fn header_full_binary() {
974974 .stderr("");
975975}
976976
977−#[test]
978−fn header_default() {
979− bat()
980− .arg("--paging=never")
981− .arg("--color=never")
982− .arg("--terminal-width=80")
983− .arg("--wrap=never")
984− .arg("--decorations=always")
985− .arg("--style=default")
986− .arg("single-line.txt")
987− .assert()
988− .success()
989− .stdout(
990− "\
991−───────┬────────────────────────────────────────────────────────────────────────
992− │ File: single-line.txt
993−───────┼────────────────────────────────────────────────────────────────────────
994− 1 │ Single Line
995−───────┴────────────────────────────────────────────────────────────────────────
996−",
997− )
998− .stderr("");
999−}
1000−
1001−#[test]
1002−fn header_default_is_default() {
1003− bat()
1004− .arg("--paging=never")
1005− .arg("--color=never")
1006− .arg("--terminal-width=80")
1007− .arg("--wrap=never")
1008− .arg("--decorations=always")
1009− .arg("single-line.txt")
1010− .assert()
1011− .success()
1012− .stdout(
1013− "\
1014−───────┬────────────────────────────────────────────────────────────────────────
1015− │ File: single-line.txt
1016−───────┼────────────────────────────────────────────────────────────────────────
1017− 1 │ Single Line
1018−───────┴────────────────────────────────────────────────────────────────────────
1019−",
1020− )
1021− .stderr("");
1022−}
1023−
1024977#[test]
1025978fn filename_stdin() {
1026979 bat()
@@ -1427,8 +1380,6 @@ fn ansi_passthrough_emit() {
14271380fn ignored_suffix_arg() {
14281381 bat()
14291382 .arg("-f")
1430− .arg("--theme")
1431− .arg("Monokai Extended")
14321383 .arg("-p")
14331384 .arg("test.json~")
14341385 .assert()
@@ -1438,8 +1389,6 @@ fn ignored_suffix_arg() {
14381389
14391390 bat()
14401391 .arg("-f")
1441− .arg("--theme")
1442− .arg("Monokai Extended")
14431392 .arg("-p")
14441393 .arg("--ignored-suffix=.suffix")
14451394 .arg("test.json.suffix")
@@ -1450,8 +1399,6 @@ fn ignored_suffix_arg() {
14501399
14511400 bat()
14521401 .arg("-f")
1453− .arg("--theme")
1454− .arg("Monokai Extended")
14551402 .arg("-p")
14561403 .arg("test.json.suffix")
14571404 .assert()
@@ -1460,25 +1407,6 @@ fn ignored_suffix_arg() {
14601407 .stderr("");
14611408}
14621409
1463−#[test]
1464−fn highlighting_is_skipped_on_long_lines() {
1465− let expected = "\u{1b}[38;5;231m{\u{1b}[0m\u{1b}[38;5;208m\"\u{1b}[0m\u{1b}[38;5;208mapi\u{1b}[0m\u{1b}[38;5;208m\"\u{1b}[0m\u{1b}[38;5;231m:\u{1b}[0m\n".to_owned() +
1466− "\u{1b}" +
1467− r#"[38;5;231m {"ANGLE_instanced_arrays":{"__compat":{"mdn_url":"https://developer.mozilla.org/docs/Web/API/ANGLE_instanced_arrays","spec_url":"https://www.khronos.org/registry/webgl/extensions/ANGLE_instanced_arrays/","support":{"chrome":{"version_added":"32"},"chrome_android":{"version_added":"32"},"edge":{"version_added":"12"},"firefox":{"version_added":"47"},"firefox_android":{"version_added":true},"ie":{"version_added":"11"},"opera":{"version_added":"19"},"opera_android":{"version_added":"19"},"safari":{"version_added":"8"},"safari_ios":{"version_added":"8"},"samsunginternet_android":{"version_added":"2.0"},"webview_android":{"version_added":"4.4"}},"status":{"experimental":false,"standard_track":true,"deprecated":false}},"drawArraysInstancedANGLE":{"__compat":{"mdn_url":"https://developer.mozilla.org/docs/Web/API/ANGLE_instanced_arrays/drawArraysInstancedANGLE","spec_url":"https://www.khronos.org/registry/webgl/extensions/ANGLE_instanced_arrays/","support":{"chrome":{"version_added":"32"},"chrome_android":{"version_added":"32"},"edge":{"version_added":"12"},"firefox":{"version_added":"47"},"firefox_android":{"version_added":true},"ie":{"version_added":"11"},"opera":{"version_added":"19"},"opera_android":{"version_added":"19"},"safari":{"version_added":"8"},"safari_ios":{"version_added":"8"},"samsunginternet_android":{"version_added":"2.0"},"webview_android":{"version_added":"4.4"}},"status":{"experimental":false,"standard_track":true,"deprecated":false}}},"drawElementsInstancedANGLE":{"__compat":{"mdn_url":"https://developer.mozilla.org/docs/Web/API/ANGLE_instanced_arrays/drawElementsInstancedANGLE","spec_url":"https://www.khronos.org/registry/webgl/extensions/ANGLE_instanced_arrays/","support":{"chrome":{"version_added":"32"},"chrome_android":{"version_added":"32"},"edge":{"version_added":"12"},"firefox":{"version_added":"47"},"firefox_android":{"version_added":true},"ie":{"version_added":"11"},"opera":{"version_added":"19"},"opera_android":{"version_added":"19"},"safari":{"version_added":"8"},"safari_ios":{"version_added":"8"},"samsunginternet_android":{"version_added":"2.0"},"webview_android":{"version_added":"4.4"}},"status":{"experimental":false,"standard_track":true,"deprecated":false}}},"vertexAttribDivisorANGLE":{"__compat":{"mdn_url":"https://developer.mozilla.org/docs/Web/API/ANGLE_instanced_arrays/vertexAttribDivisorANGLE","spec_url":"https://www.khronos.org/registry/webgl/extensions/ANGLE_instanced_arrays/","support":{"chrome":{"version_added":"32"},"chrome_android":{"version_added":"32"},"edge":{"version_added":"12"},"firefox":{"version_added":"47"},"firefox_android":{"version_added":true},"ie":{"version_added":"11"},"opera":{"version_added":"19"},"opera_android":{"version_added":"19"},"safari":{"version_added":"8"},"safari_ios":{"version_added":"8"},"samsunginternet_android":{"version_added":"2.0"},"webview_android":{"version_added":"4.4"}},"status":{"experimental":false,"standard_track":true,"deprecated":false}}}},"AbortController":{"__compat":{"mdn_url":"https://developer.mozilla.org/docs/Web/API/AbortController","spec_url":"https://dom.spec.whatwg.org/#interface-abortcontroller","support":{"chrome":{"version_added":"66"},"chrome_android":{"version_added":"66"},"edge":{"version_added":"16"},"firefox":{"version_added":"57"},"firefox_android":{"version_added":"57"},"ie":{"version_added":false},"nodejs":{"version_added":"15.0.0"},"opera":{"version_added":"53"},"opera_android":{"version_added":"47"},"safari":[{"version_added":"12.1"},{"version_added":"11.1","partial_implementation":true,"notes":"Even though <code>window.AbortController</code> is defined, it doesn't really abort <code>fetch</code> requests. See <a href='https://webkit.org/b/174980'>bug 174980</a>."}],"safari_ios":[{"version_added":"12.2"},{"version_added":"11.3","partial_implementation":true,"notes":"Even though <code>window.AbortController</code> is defined, it doesn't really abort <code>fetch</code> requests. See <a href='https://webkit.org/b/174980'>bug 174980</a>."}],"samsunginternet_android":{"version_added":"9.0"},"webview_android":{"version_added":"66"}},"status":{"experimental":true,"standard_track":true,"deprecated":false}},"AbortController":{"__compat":{"mdn_url":"https://developer.mozilla.org/docs/Web/API/AbortController/AbortController","spec_url":"https://dom.spec.whatwg.org/#ref-for-dom-abortcontroller-abortcontroller①","description":"<code>AbortController()</code> constructor","support":{"chrome":{"version_added":"66"},"chrome_android":{"version_added":"66"},"edge":{"version_added":"16"},"firefox":{"version_added":"57"},"firefox_android":{"version_added":"57"},"ie":{"version_added":false},"nodejs":{"version_added":"15.0.0"},"opera":{"version_added":"53"},"opera_android":{"version_added":"47"},"safari":[{"version_added":"12.1"},{"version_added":"11.1","partial_implementation":true,"notes":"Even though <code>window.AbortController</code> is defined, it doesn't really abort <code>fetch</code> requests. See <a href='https://webkit.org/b/174980'>bug 174980</a>."}],"safari_ios":[{"version_added":"12.2"},{"version_added":"11.3","partial_implementation":true,"notes":"Even though <code>window.AbortController</code> is defined, it doesn't really abort <code>fetch</code> requests. See <a href='https://webkit.org/b/174980'>bug 174980</a>."}],"samsunginternet_android":{"version_added":"9.0"},"webview_android":{"version_added":"66"}},"status":{"experimental":true,"standard_track":true,"deprecated":false}}},"abort":{"__compat":{"mdn_url":"https://developer.mozilla.org/docs/Web/API/AbortController/abort","spec_url":"https://dom.spec.whatwg.org/#ref-for-dom-abortcontroller-abortcontroller①","support":{"chrome":{"version_added":"66"},"chrome_android":{"version_added":"66"},"edge":{"version_added":"16"},"firefox":{"version_added":"57"},"firefox_android":{"version_added":"57"},"ie":{"version_added":false},"nodejs":{"version_added":"15.0.0"},"opera":{"version_added":"53"},"opera_android":{"version_added":"47"},"safari":[{"version_added":"12.1"},{"version_added":"11.1","partial_implementation":true,"notes":"Even though <code>window.AbortController</code> is defined, it doesn't really abort <code>fetch</code> requests. See <a href='https://webkit.org/b/174980'>bug 174980</a>."}],"safari_ios":[{"version_added":"12.2"},{"version_added":"11.3","partial_implementation":true,"notes":"Even though <code>window.AbortController</code> is defined, it doesn't really abort <code>fetch</code> requests. See <a href='https://webkit.org/b/174980'>bug 174980</a>."}],"samsunginternet_android":{"version_added":"9.0"},"webview_android":{"version_added":"66"}},"status":{"experimental":true,"standard_track":true,"deprecated":false}}},"signal":{"__compat":{"mdn_url":"https://developer.mozilla.org/docs/Web/API/AbortController/signal","spec_url":"https://dom.spec.whatwg.org/#ref-for-dom-abortcontroller-signal②","support":{"chrome":{"version_added":"66"},"chrome_android":{"version_added":"66"},"edge":{"version_added":"16"},"firefox":{"version_added":"57"},"firefox_android":{"version_added":"57"},"ie":{"version_added":false},"nodejs":{"version_added":"15.0.0"},"opera":{"version_added":"53"},"opera_android":{"version_added":"47"},"safari":[{"version_added":"12.1"},{"version_added":"11.1","partial_implementation":true,"notes":"Even though <code>window.AbortController</code> is defined, it doesn't really abort <code>fetch</code> requests. See <a href='https://webkit.org/b/174980'>bug 174980</a>."}],"safari_ios":[{"version_added":"12.2"},{"version_added":"11.3","partial_implementation":true,"notes":"Even though <code>window.AbortController</code> is defined, it doesn't really abort <code>fetch</code> requests. See <a href='https://webkit.org/b/174980'>bug 174980</a>."}],"samsunginternet_android":{"version_added":"9.0"},"webview_android":{"version_added":"66"}},"status":{"experimental":true,"standard_track":true,"deprecated":false}}}},"AbortPaymentEvent":{"__compat":{"mdn_url":"https://developer.mozilla.org/docs/Web/API/AbortPaymentEvent","support":{"chrome":{"version_added":"70"},"chrome_android":{"version_added":"70"},"edge":{"version_added":"79"},"firefox":{"version_added":false},"firefox_android":{"version_added":false},"ie":{"version_added":false},"opera":{"version_added":"57"},"opera_android":{"version_added":"49"},"safari":{"version_added":false},"safari_ios":{"version_added":false},"samsunginternet_android":{"version_added":"10.0"},"webview_android":{"version_added":false}},"status":{"experimental":true,"standard_track":false,"deprecated":false}},"AbortPaymentEvent":{"__compat":{"description":"<code>AbortPaymentEvent()</code> constructor","mdn_url":"https://developer.mozilla.org/docs/Web/API/AbortPaymentEvent/AbortPaymentEvent","support":{"chrome":{"version_added":"70"},"chrome_android":{"version_added":"70"},"edge":{"version_added":"79"},"firefox":{"version_added":false},"firefox_android":{"version_added":false},"ie":{"version_added":false},"opera":{"version_added":"57"},"opera_android":{"version_added":"49"},"safari":{"version_added":false},"safari_ios":{"version_added":false},"samsunginternet_android":{"version_added":"10.0"},"webview_android":{"version_added":false}},"status":{"experimental":true,"standard_track":false,"deprecated":false}}},"respondWith":{"__compat":{"mdn_url":"https://developer.mozilla.org/docs/Web/API/AbortPaymentEvent/respondWith","support":{"chrome":{"version_added":"70"},"chrome_android":{"version_added":"70"},"edge":{"version_added":"79"},"firefox":{"version_added":false},"firefox_android":{"version_added":false},"ie":{"version_added":false},"opera":{"version_added":"57"},"opera_android":{"version_added":"49"},"safari":{"version_added":false},"safari_ios":{"version_added":false},"samsunginternet_android":{"version_added":"10.0"},"webview_android":{"version_added":false}},"status":{"experimental":true,"standard_track":false,"deprecated":false}}}},"AbortSignal":{"__compat":{"mdn_url":"https://developer.mozilla.org/docs/Web/API/AbortSignal","spec_url":"https://dom.spec.whatwg.org/#interface-AbortSignal","support":{"chrome":{"version_added":"66"},"chrome_android":{"version_added":"66"},"edge":{"version_added":"16"},"firefox":{"version_added":"57"},"firefox_android":{"version_added":"57"},"ie":{"version_added":false},"nodejs":{"version_added":"15.0.0"},"opera":{"version_added":"53"},"opera_android":{"version_added":"47"},"safari":{"version_added":"11.1"},"safari_ios":{"version_added":"11.3"},"samsunginternet_android":{"version_added":"9.0"},"webview_android":{"version_added":"66"}},"status":{"experimental":false,"standard_track":true,"deprecated":false}},"abort":{"__compat":{"mdn_url":"https://developer.mozilla.org/docs/Web/API/AbortSignal/abort","spec_url":"https://dom.spec.whatwg.org/#ref-for-dom-abortsignal-abort①","support":{"chrome":{"version_added":false},"chrome_android":{"version_added":false},"edge":{"version_added":false},"firefox":{"version_added":"88"},"firefox_android":{"version_added":"88"},"ie":{"version_added":false},"nodejs":{"version_added":false},"opera":{"version_added":false},"opera_android":{"version_added":false},"safari":{"version_added":false},"safari_ios":{"version_added":false},"samsunginternet_android":{"version_added":false},"webview_android":{"version_added":false}},"status":{"experimental":false,"standard_track":true,"deprecated":false}}},"abort_event":{"__compat":{"description":"<code>abort</code> event","mdn_url":"https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_event","spec_url":"https://dom.spec.whatwg.org/#eventdef-abortsignal-abort","support":{"chrome":{"version_added":"66"},"chrome_android":{"version_added":"66"},"edge":{"version_added":"16"},"firefox":{"version_added":"57"},"firefox_android":{"version_added":"57"},"ie":{"version_added":false},"nodejs":{"version_added":"15.0.0"},"opera":{"version_added":"53"},"opera_android":{"version_added":"47"},"safari":{"version_added":"11.1"},"safari_ios":{"version_added":"11.3"},"samsunginternet_android":{"version_added":"9.0"},"webview_android":{"version_added":"66"}},"status":{"experimental":false,"standard_track":true,"deprecated":false}}},"aborted":{"__compat":{"mdn_url":"https://developer.mozilla.org/docs/Web/API/AbortSignal/aborted","spec_url":"https://dom.spec.whatwg.org/#ref-for-dom-abortsignal-aborted①","support":{"chrome":{"version_added":"66"},"chrome_android":{"version_added":"66"},"edge":{"version_added":"16"},"firefox":{"version_added":"57"},"firefox_android":{"version_added":"57"},"ie":{"version_added":false},"nodejs":{"version_added":"15.0.0"},"opera":{"version_added":"53"},"opera_android":{"version_added":"47"},"safari":{"version_added":"11.1"},"safari_ios":{"version_added":"11.3"},"samsunginternet_android":{"version_added":"9.0"},"webview_android":{"version_added":"66"}},"status":{"experimental":false,"standard_track":true,"deprecated":false}}},"onabort":{"__compat":{"mdn_url":"https://developer.mozilla.org/docs/Web/API/AbortSignal/onabort","spec_url":"https://dom.spec.whatwg.org/#abortsignal-onabort","support":{"chrome":{"version_added":"66"},"chrome_android":{"version_added":"66"},"edge":{"version_added":"16"},"firefox":{"version_added":"57"},"firefox_android":{"version_added":"57"},"ie":{"version_added":false},"nodejs":{"version_added":"15.0.0"},"opera":{"version_added":"53"},"opera_android":{"version_added":"47"},"safari":{"version_added":"11.1"},"safari_ios":{"version_added":"11.3"},"samsunginternet_android":{"version_added":"9.0"},"webview_android":{"version_added":"66"}},"status":{"experimental":false,"standard_track":true,"deprecated":false}}}},"AbsoluteOrientationSensor":{"__compat":{"mdn_url":"https://developer.mozilla.org/docs/Web/API/AbsoluteOrientationSensor","spec_url":"https://w3c.github.io/orientation-sensor/#absoluteorientationsensor-interface","support":{"chrome":{"version_added":"67"},"chrome_android":{"version_added":"67"},"edge":{"version_added":"79"},"firefox":{"version_added":false},"firefox_android":{"version_added":false},"ie":{"version_added":false},"opera":{"version_added":"54"},"opera_android":{"version_added":"48"},"safari":{"version_added":false},"safari_ios":{"version_added":false},"samsunginternet_android":{"version_added":"9.0"},"webview_android":{"version_added":"67"}},"status":{"experimental":false,"standard_track":true,"deprecated":false}},"AbsoluteOrientationSensor":{"__compat":{"mdn_url":"https://developer.mozilla.org/docs/Web/API/AbsoluteOrientationSensor/AbsoluteOrientationSensor","spec_url":"https://w3c.github.io/orientation-sensor/#dom-absoluteorientationsensor-absoluteorientationsensor","description":"<code>AbsoluteOrientationSensor()</code> constructor","support":{"chrome":{"version_added":"67"},"chrome_android":{"version_added":"67"},"edge":{"version_added":"79"},"firefox":{"version_added":false},"firefox_android":{"version_added":false},"ie":{"version_added":false},"opera":{"version_added":"54"},"opera_android":{"version_added":"48"},"safari":{"version_added":false},"safari_ios":{"version_added":false},"samsunginternet_android":{"version_added":"9.0"},"webview_android":{"version_added":"67"}},"status":{"experimental":false,"standard_track":true,"deprecated":false}}}},"AbstractRange":{"__compat":{"mdn_url":"https://developer.mozilla.org/docs/Web/API/AbstractRange","spec_url":"https://dom.spec.whatwg.org/#interface-abstractrange","support":{"chrome":{"version_added":"90"},"chrome_android":{"version_added":"90"},"edge":[{"version_added":"90"},{"version_added":"18","version_removed":"79"}],"firefox":{"version_added":"69"},"firefox_android":{"version_added":false},"ie":{"version_added":false},"opera":{"version_added":false},"opera_android":{"version_added":false},"safari":{"version_added":"14.1"},"safari_ios":{"version_added":"14.5"},"samsunginternet_android":{"version_added":false},"webview_android":{"version_added":"90"}},"status":{"experimental":false,"standard_track":true,"deprecated":false}},"collapsed":{"__compat":{"mdn_url":"https://developer.mozilla.org/docs/Web/API/AbstractRange/collapsed","spec_url":"https://dom.spec.whatwg.org/#ref-for-dom-range-collapsed①","support":{"chrome":{"version_added":"90"},"chrome_android":{"version_added":"90"},"edge":[{"version_added":"90"},{"version_added":"18","version_removed":"79"}],"firefox":{"version_added":"69"},"firefox_android":{"version_added":false},"ie":{"version_added":false},"opera":{"version_added":false},"opera_android":"# +
1468− "\u{1b}[0m\n\u{1b}[38;5;231m \u{1b}[0m\u{1b}[38;5;231m{\u{1b}[0m\u{1b}[38;5;208m\"\u{1b}[0m\u{1b}[38;5;208mversion_added\u{1b}[0m\u{1b}[38;5;208m\"\u{1b}[0m\u{1b}[38;5;231m:\u{1b}[0m\u{1b}[38;5;141mfalse\u{1b}[0m\u{1b}[38;5;231m}\u{1b}[0m\n";
1469−
1470− bat()
1471− .arg("-f")
1472− .arg("--theme")
1473− .arg("Monokai Extended")
1474− .arg("-p")
1475− .arg("longline.json")
1476− .assert()
1477− .success()
1478− .stdout(expected)
1479− .stderr("");
1480−}
1481−
14821410#[test]
14831411fn all_global_git_config_locations_syntax_mapping_work() {
14841412 let fake_home = Path::new(EXAMPLES_DIR).join("git").canonicalize().unwrap();
@@ -1490,8 +1418,6 @@ fn all_global_git_config_locations_syntax_mapping_work() {
14901418 bat()
14911419 .env("XDG_CONFIG_HOME", fake_home.join(".config").as_os_str())
14921420 .arg("-f")
1493− .arg("--theme")
1494− .arg("Monokai Extended")
14951421 .arg("-p")
14961422 .arg("git/.config/git/config")
14971423 .assert()
@@ -1502,8 +1428,6 @@ fn all_global_git_config_locations_syntax_mapping_work() {
15021428 bat()
15031429 .env("HOME", fake_home.as_os_str())
15041430 .arg("-f")
1505− .arg("--theme")
1506− .arg("Monokai Extended")
15071431 .arg("-p")
15081432 .arg("git/.config/git/config")
15091433 .assert()
@@ -1514,8 +1438,6 @@ fn all_global_git_config_locations_syntax_mapping_work() {
15141438 bat()
15151439 .env("HOME", fake_home.as_os_str())
15161440 .arg("-f")
1517− .arg("--theme")
1518− .arg("Monokai Extended")
15191441 .arg("-p")
15201442 .arg("git/.gitconfig")
15211443 .assert()
tests/syntax-tests/highlighted/INI/test.infdeleted−5
@@ -1,5 +0,0 @@
1−[section]
2−key=value
3−# This file is just for testing that the INI syntax is registered to handle
4−# the .inf file extension, it is not testing the syntax highlighting capabilities
5−# of the INI syntax itself
tests/syntax-tests/highlighted/Svelte/App.svelte+1−5
@@ -27,13 +27,9 @@
2727</script>
2828
2929<script type="text/livescript">
30− // This block is a regression test for a bat panic when a LiveScript syntax definition is missing
30+ // This block is a regression test for a bat panic when a LiveScript syntax definition is missing
3131</script>
3232
33−<style lang="text/postcss">
34− /* This block is a regression test for a bat panic when a PostCSS syntax definition is missing */
35−</style>
36−
3733<style>
3834 main {
3935 position: relative;
tests/syntax-tests/highlighted/Vue/example.vue−5
@@ -8,11 +8,6 @@
88 </div>
99</template>
1010
11−<template lang='pug'>
12− #container.col
13− p This shall be formatted as Plain Text as long as a Pug syntax definition is missing
14−</template>
15−
1611<script>
1712import AppHeader from "@/components/AppHeader";
1813import AppLoadingIndicator from "@/components/AppLoadingIndicator";
tests/syntax-tests/highlighted/Zig/example.zig+39−39
@@ -1,18 +1,18 @@
11//! this is a top level doc, starts with "//!"
22
3−const std = @import("std");
3+const std = @import("std");
44
55pub fn main() anyerror!void {
6− const stdout = std.io.getStdOut().writer();
7− try stdout.print("Hello, {}!\n", .{"world"});
6+ const stdout = std.io.getStdOut().writer();
7+ try stdout.print("Hello, {}!\n", .{"world"});
88}
99
10−const expect = std.testing.expect;
10+const expect = std.testing.expect;
1111
1212test "comments" {
1313 // comments start with "//" until newline
1414 // foo bar baz
15− const x = true; // another comment
15+ const x = true; // another comment
1616 expect(x);
1717}
1818
@@ -25,26 +25,26 @@
2525 /// number of nanoseconds past the second
2626 nano: u32,
2727
28− const Self = @This();
28+ const Self = @This();
2929
3030 pub fn unixEpoch() Self {
3131 return Self{
32− .seconds = 0,
33− .nanos = 0,
32+ .seconds = 0,
33+ .nanos = 0,
3434 };
3535 }
3636};
3737
38−const my_val = switch (std.Target.current.os.tag) {
39− .linux => "Linux",
38+const my_val = switch (std.Target.current.os.tag) {
39+ .linux => "Linux",
4040 else => "not Linux",
4141};
4242
4343const Book = enum {
44− paperback,
45− hardcover,
46− ebook,
47− pdf,
44+ paperback,
45+ hardcover,
46+ ebook,
47+ pdf,
4848};
4949
5050const TokenType = union(enum) {
@@ -54,54 +54,54 @@
5454};
5555
5656const array_lit: [4]u8 = .{ 11, 22, 33, 44 };
57−const sentinal_lit = [_:0]u8{ 1, 2, 3, 4 };
57+const sentinal_lit = [_:0]u8{ 1, 2, 3, 4 };
5858
5959test "address of syntax" {
6060 // Get the address of a variable:
6161 const x: i32 = 1234;
62− const x_ptr = &x;
62+ const x_ptr = &x;
6363
6464 // Dereference a pointer:
6565 expect(x_ptr.* == 1234);
6666
6767 // When you get the address of a const variable, you get a const pointer to a single item.
68− expect(@TypeOf(x_ptr) == *const i32);
68+ expect(@TypeOf(x_ptr) == *const i32);
6969
7070 // If you want to mutate the value, you'd need an address of a mutable variable:
7171 var y: i32 = 5678;
72− const y_ptr = &y;
73− expect(@TypeOf(y_ptr) == *i32);
74− y_ptr.* += 1;
72+ const y_ptr = &y;
73+ expect(@TypeOf(y_ptr) == *i32);
74+ y_ptr.* += 1;
7575 expect(y_ptr.* == 5679);
7676}
7777
7878// integer literals
79−const decimal_int = 98222;
80−const hex_int = 0xff;
81−const another_hex_int = 0xFF;
82−const octal_int = 0o755;
83−const binary_int = 0b11110000;
79+const decimal_int = 98222;
80+const hex_int = 0xff;
81+const another_hex_int = 0xFF;
82+const octal_int = 0o755;
83+const binary_int = 0b11110000;
8484
8585// underscores may be placed between two digits as a visual separator
86−const one_billion = 1_000_000_000;
87−const binary_mask = 0b1_1111_1111;
88−const permissions = 0o7_5_5;
89−const big_address = 0xFF80_0000_0000_0000;
86+const one_billion = 1_000_000_000;
87+const binary_mask = 0b1_1111_1111;
88+const permissions = 0o7_5_5;
89+const big_address = 0xFF80_0000_0000_0000;
9090
9191// float literals
92−const floating_point = 123.0E+77;
93−const another_float = 123.0;
94−const yet_another = 123.0e+77;
92+const floating_point = 123.0E+77;
93+const another_float = 123.0;
94+const yet_another = 123.0e+77;
9595
96−const hex_floating_point = 0x103.70p-5;
97−const another_hex_float = 0x103.70;
98−const yet_another_hex_float = 0x103.70P-5;
96+const hex_floating_point = 0x103.70p-5;
97+const another_hex_float = 0x103.70;
98+const yet_another_hex_float = 0x103.70P-5;
9999
100100// underscores may be placed between two digits as a visual separator
101−const lightspeed = 299_792_458.000_000;
102−const nanosecond = 0.000_000_001;
103−const more_hex = 0x1234_5678.9ABC_CDEFp-10;
101+const lightspeed = 299_792_458.000_000;
102+const nanosecond = 0.000_000_001;
103+const more_hex = 0x1234_5678.9ABC_CDEFp-10;
104104
105105fn max(comptime T: type, a: T, b: T) T {
106− return if (a > b) a else b;
106+ return if (a > b) a else b;
107107}
tests/syntax-tests/source/INI/test.infdeleted−5
@@ -1,5 +0,0 @@
1−[section]
2−key=value
3−# This file is just for testing that the INI syntax is registered to handle
4−# the .inf file extension, it is not testing the syntax highlighting capabilities
5−# of the INI syntax itself
tests/syntax-tests/source/Svelte/App.svelte+1−5
@@ -27,13 +27,9 @@
2727</script>
2828
2929<script type="text/livescript">
30− // This block is a regression test for a bat panic when a LiveScript syntax definition is missing
30+ // This block is a regression test for a bat panic when a LiveScript syntax definition is missing
3131</script>
3232
33−<style lang="text/postcss">
34− /* This block is a regression test for a bat panic when a PostCSS syntax definition is missing */
35−</style>
36−
3733<style>
3834 main {
3935 position: relative;
tests/syntax-tests/source/Vue/example.vue−5
@@ -8,11 +8,6 @@
88 </div>
99</template>
1010
11−<template lang='pug'>
12− #container.col
13− p This shall be formatted as Plain Text as long as a Pug syntax definition is missing
14−</template>
15−
1611<script>
1712import AppHeader from "@/components/AppHeader";
1813import AppLoadingIndicator from "@/components/AppLoadingIndicator";