Skip to content

Commit 8f35154

Browse files
committed
fix: Don't crash when highlighting JS
It appears that the `regex-fancy` engine fall down flat here and we need to use `regex-onig`, which is what `bat` uses. Fixes #71
1 parent 062db00 commit 8f35154

File tree

3 files changed

+25
-34
lines changed

3 files changed

+25
-34
lines changed

Cargo.lock

Lines changed: 23 additions & 26 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ concolor-clap = { version = "0.1.0", features = ["api"] }
3939
proc-exit = "2.0.1"
4040
human-panic = "1.1.3"
4141
anyhow = "1.0.68"
42-
syntect = { version = "5.0.0", default-features = false, features = ["parsing", "regex-fancy"] }
42+
syntect = { version = "5.0.0", default-features = false, features = ["parsing", "regex-onig"] }
4343
terminal_size = "0.2.3"
4444
textwrap = "0.16.0"
4545
anstyle = "0.3.1"

tests/cli.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,9 @@ fn js_highlight_panics() {
6161
.current_dir(root_path)
6262
.env("CLICOLOR_FORCE", "1")
6363
.assert()
64-
.failure()
65-
.stdout_eq(
66-
"\
67-
",
68-
)
64+
.success()
6965
.stderr_matches(
7066
"\
71-
thread 'main' panicked at 'regex string should be pre-tested: [..]
72-
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
7367
",
7468
);
7569

0 commit comments

Comments
 (0)