fix: syntax highlighting was broken in bundled app
This commit is contained in:
30
Cargo.lock
generated
30
Cargo.lock
generated
@@ -374,19 +374,6 @@ dependencies = [
|
|||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "ansi-to-tui"
|
|
||||||
version = "8.0.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "e42366bb9d958f042bf58f0a85e1b2d091997c1257ca49bddd7e4827aadc65fd"
|
|
||||||
dependencies = [
|
|
||||||
"nom 8.0.0",
|
|
||||||
"ratatui-core",
|
|
||||||
"simdutf8",
|
|
||||||
"smallvec",
|
|
||||||
"thiserror 2.0.19",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "anstream"
|
name = "anstream"
|
||||||
version = "1.0.0"
|
version = "1.0.0"
|
||||||
@@ -3059,6 +3046,17 @@ dependencies = [
|
|||||||
"regex",
|
"regex",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "fancy-regex"
|
||||||
|
version = "0.16.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "998b056554fbe42e03ae0e152895cd1a7e1002aec800fdc6635d20270260c46f"
|
||||||
|
dependencies = [
|
||||||
|
"bit-set 0.8.0",
|
||||||
|
"regex-automata",
|
||||||
|
"regex-syntax",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "fast-srgb8"
|
name = "fast-srgb8"
|
||||||
version = "1.0.0"
|
version = "1.0.0"
|
||||||
@@ -9513,10 +9511,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "656b45c05d95a5704399aeef6bd0ddec7b2b3531b7c9e900abbf7c4d2190c925"
|
checksum = "656b45c05d95a5704399aeef6bd0ddec7b2b3531b7c9e900abbf7c4d2190c925"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bincode",
|
"bincode",
|
||||||
|
"fancy-regex 0.16.2",
|
||||||
"flate2",
|
"flate2",
|
||||||
"fnv",
|
"fnv",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"onig",
|
|
||||||
"plist",
|
"plist",
|
||||||
"regex-syntax",
|
"regex-syntax",
|
||||||
"serde",
|
"serde",
|
||||||
@@ -9646,7 +9644,7 @@ dependencies = [
|
|||||||
"anyhow",
|
"anyhow",
|
||||||
"base64 0.22.1",
|
"base64 0.22.1",
|
||||||
"bitflags 2.13.1",
|
"bitflags 2.13.1",
|
||||||
"fancy-regex",
|
"fancy-regex 0.11.0",
|
||||||
"filedescriptor",
|
"filedescriptor",
|
||||||
"finl_unicode",
|
"finl_unicode",
|
||||||
"fixedbitset",
|
"fixedbitset",
|
||||||
@@ -10180,13 +10178,11 @@ version = "0.3.8"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c6779056a6ae2d46013edb3692be1eb55d2e1d3f0d1d454042163efe1b64baca"
|
checksum = "c6779056a6ae2d46013edb3692be1eb55d2e1d3f0d1d454042163efe1b64baca"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ansi-to-tui",
|
|
||||||
"itertools 0.15.0",
|
"itertools 0.15.0",
|
||||||
"pretty_assertions",
|
"pretty_assertions",
|
||||||
"pulldown-cmark 0.13.4",
|
"pulldown-cmark 0.13.4",
|
||||||
"ratatui-core",
|
"ratatui-core",
|
||||||
"rstest",
|
"rstest",
|
||||||
"syntect",
|
|
||||||
"tracing",
|
"tracing",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ ort = { version = "=2.0.0-rc.12", default-features = false, features = ["std", "
|
|||||||
russh = "0.62.2"
|
russh = "0.62.2"
|
||||||
ratatui = "0.30.2"
|
ratatui = "0.30.2"
|
||||||
ratatui-image = { version = "11.0.6", default-features = false, features = ["crossterm", "image-defaults"] }
|
ratatui-image = { version = "11.0.6", default-features = false, features = ["crossterm", "image-defaults"] }
|
||||||
tui-markdown = "0.3.8"
|
tui-markdown = { version = "0.3.8", default-features = false }
|
||||||
|
|
||||||
# UI framework
|
# UI framework
|
||||||
iced = { version = "0.13", features = ["wgpu", "advanced", "canvas", "image", "svg", "tokio", "markdown"] }
|
iced = { version = "0.13", features = ["wgpu", "advanced", "canvas", "image", "svg", "tokio", "markdown"] }
|
||||||
@@ -68,7 +68,7 @@ iced = { version = "0.13", features = ["wgpu", "advanced", "canvas", "image", "s
|
|||||||
# Editor widget
|
# Editor widget
|
||||||
cosmic-text = "0.12"
|
cosmic-text = "0.12"
|
||||||
ropey = "1"
|
ropey = "1"
|
||||||
syntect = "5"
|
syntect = { version = "5", default-features = false, features = ["default-fancy"] }
|
||||||
|
|
||||||
# Platform integration (cross-platform)
|
# Platform integration (cross-platform)
|
||||||
muda = "0.15"
|
muda = "0.15"
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
fn main() {
|
|
||||||
// syntect and fastembed both reach onig_sys across separate Rust dylibs.
|
|
||||||
// Keep the vendored static archive on this dylib's final native link line.
|
|
||||||
if std::env::var("CARGO_CFG_TARGET_ENV").as_deref() == Ok("msvc") {
|
|
||||||
println!("cargo:rustc-link-arg=onig.lib");
|
|
||||||
} else {
|
|
||||||
println!("cargo:rustc-link-arg=-lonig");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
26
crates/bds-ui/tests/bundled_highlighting.rs
Normal file
26
crates/bds-ui/tests/bundled_highlighting.rs
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
use std::collections::HashSet;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn linked_editor_highlights_markdown() {
|
||||||
|
// Retain the dylib that previously interposed bds-editor's regex symbols.
|
||||||
|
let _ = std::hint::black_box(
|
||||||
|
bds_server::run_headless
|
||||||
|
as fn(bds_server::boot::BootMode, bds_server::ServerConfig) -> anyhow::Result<()>,
|
||||||
|
);
|
||||||
|
let highlighter = bds_editor::highlighter();
|
||||||
|
assert_eq!(
|
||||||
|
highlighter.syntax_for_extension("md").name,
|
||||||
|
"Markdown with Macros"
|
||||||
|
);
|
||||||
|
let colors = highlighter
|
||||||
|
.highlight_lines(
|
||||||
|
"plain\n# Heading\n[link](https://example.com)\n`code`",
|
||||||
|
highlighter.syntax_for_extension("md"),
|
||||||
|
)
|
||||||
|
.into_iter()
|
||||||
|
.flatten()
|
||||||
|
.map(|(style, _)| style.foreground)
|
||||||
|
.collect::<HashSet<_>>();
|
||||||
|
|
||||||
|
assert!(colors.len() > 1, "linked editor should use syntax colors");
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user