M0.9: reuse printable diagnostic text at the CLI boundary

Expose the existing plain helper within the crate so final CLI errors use exactly the same escaping rule as file and script diagnostics.
This commit is contained in:
Mex
2026-11-15 19:52:54 +01:00
committed by GitHub
parent fff48fc441
commit 6b272dc857
+1 -1
View File
@@ -12,7 +12,7 @@ use crate::{CliError, CliResult};
/// A document's or plugin's text as a terminal should show it: control characters escaped, and
/// everything else (quotes, backslashes in paths) left as it is.
fn plain(text: &str) -> String {
pub(crate) fn plain(text: &str) -> String {
text.chars().map(|c| if c.is_control() { c.escape_default().to_string() } else { c.to_string() }).collect()
}