Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use a new version of the forked syntect #968

Merged
merged 2 commits into from
Jan 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 11 additions & 17 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "broot"
version = "1.44.3"
version = "1.44.4-dev"
authors = ["dystroy <[email protected]>"]
repository = "https://github.com/Canop/broot"
homepage = "https://dystroy.org/broot"
Expand Down Expand Up @@ -57,7 +57,7 @@ serde = { version = "1.0", features = ["derive"] }
smallvec = "1.11" # version 2 is still alpha
splitty = "1.0.2"
strict = "0.1.4"
syntect = { package = "syntect-no-panic", version = "4.6.1", default-features = false, features = ["default-fancy"] } # see issues #485 and #956
syntect = { package = "syntect-5-no-panic", version = "5.2", default-features = false, features = ["default-fancy"] } # see issues #485, #956, #967
tempfile = "3.2"
termimad = "0.31"
terminal-clipboard = { version = "0.4.1", optional = true }
Expand Down Expand Up @@ -118,8 +118,7 @@ harness = false
# lfs-core = { path = "../lfs-core" }
# minimad = { path = "../minimad" }
# secular = { path = "../secular", features=["normalization"] }
# syntect = { path = "../syntect" }
# syntect-no-panic = { path = "../syntect" }
# syntect-5-no-panic = { path = "../syntect" }
# termimad = { path = "../termimad" }
# terminal-clipboard = { path = "../terminal-clipboard" }
# terminal-light = { path = "../terminal-light" }
Expand Down
2 changes: 1 addition & 1 deletion resources/syntect/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ The [bat](https://github.com/sharkdp/bat) project maintains with care an importa

It's the best public list I found, so I've included the resulting syntax set here as `syntaxes.bin`.

You may replace this file with your own, building it with Syntect's [`syntect::dumps::dump_to_file`](https://docs.rs/syntect/4.6.0/syntect/dumps/fn.dump_to_file.html) function.
You may replace this file with your own, building it with Syntect's [`syntect::dumps::dump_to_uncompressed_file`](https://docs.rs/syntect/latest/syntect/dumps/fn.dump_to_uncompressed_file.html) function.
Binary file modified resources/syntect/syntaxes.bin
Binary file not shown.
4 changes: 2 additions & 2 deletions src/syntactic/syntactic_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ impl SyntacticView {
// Those chars are removed on printing
let name_match = pattern.search_string(&line);
let regions = if let Some(highlighter) = highlighter.as_mut() {
highlighter
.highlight(&line, &SYNTAXER.syntax_set)
highlighter
.highlight_line(&line, &SYNTAXER.syntax_set)
.map_err(|e| ProgramError::SyntectCrashed { details: e.to_string() })?
.iter()
.map(Region::from_syntect)
Expand Down
5 changes: 4 additions & 1 deletion src/syntactic/syntaxer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ pub struct Syntaxer {
impl Default for Syntaxer {
fn default() -> Self {
Self {
syntax_set: time!(Debug, syntect::dumps::from_binary(SYNTAXES)),
syntax_set: time!(
Debug,
syntect::dumps::from_uncompressed_data(SYNTAXES).unwrap()
),
theme_set: ThemeSet::load_defaults(),
}
}
Expand Down
Loading