Redirect native TeX diagnostics to real output streams
This commit is contained in:
1 parent
6ebcb75794
commit
6675ab639a
11 files changed
+540
-21
No files matched your search
@@ -95,7 +95,7 @@ fn leader_node(leader: &LeaderGlue) -> DiagnosticNode {
|
||||
pattern: Box::new(pattern),
|
||||
}
|
||||
}
|
||||
fn vertical_nodes(nodes: &[NativeVerticalNode]) -> Vec<DiagnosticNode> {
|
||||
pub(super) fn vertical_nodes(nodes: &[NativeVerticalNode]) -> Vec<DiagnosticNode> {
|
||||
nodes
|
||||
.iter()
|
||||
.map(|n| match n {
|
||||
@@ -258,6 +258,7 @@ struct Printer<'a> {
|
||||
depth: i32,
|
||||
limit: usize,
|
||||
overflow: bool,
|
||||
wrap: bool,
|
||||
reads: BTreeSet<Dependency>,
|
||||
}
|
||||
impl Printer<'_> {
|
||||
@@ -272,7 +273,7 @@ impl Printer<'_> {
|
||||
} else {
|
||||
self.tally += 1;
|
||||
self.column += 1;
|
||||
if self.column == 79 {
|
||||
if self.wrap && self.column == 79 {
|
||||
self.out.push('\n');
|
||||
self.column = 0;
|
||||
}
|
||||
@@ -750,6 +751,7 @@ pub(super) fn show_box(
|
||||
breadth: i32,
|
||||
depth: i32,
|
||||
limit: usize,
|
||||
wrap: bool,
|
||||
) -> Result<(String, BTreeSet<Dependency>), String> {
|
||||
let mut p = Printer {
|
||||
state,
|
||||
@@ -760,6 +762,7 @@ pub(super) fn show_box(
|
||||
depth,
|
||||
limit,
|
||||
overflow: false,
|
||||
wrap,
|
||||
reads: BTreeSet::new(),
|
||||
};
|
||||
p.literal(&format!("> \\box{index}="));
|
||||
@@ -797,6 +800,7 @@ pub(super) fn shipout_box(
|
||||
depth,
|
||||
limit,
|
||||
overflow: false,
|
||||
wrap: true,
|
||||
reads: BTreeSet::new(),
|
||||
};
|
||||
if depth < 0 {
|
||||
@@ -811,3 +815,31 @@ pub(super) fn shipout_box(
|
||||
}
|
||||
Ok((p.out, p.reads))
|
||||
}
|
||||
|
||||
|
||||
pub(super) fn show_nodes(
|
||||
state: &State,
|
||||
nodes: &[DiagnosticNode],
|
||||
breadth: i32,
|
||||
depth: i32,
|
||||
limit: usize,
|
||||
wrap: bool,
|
||||
) -> Result<(String, BTreeSet<Dependency>), String> {
|
||||
let mut printer = Printer {
|
||||
state,
|
||||
out: String::new(),
|
||||
column: 0,
|
||||
tally: 0,
|
||||
breadth: if breadth <= 0 { 5 } else { breadth as usize },
|
||||
depth,
|
||||
limit,
|
||||
overflow: false,
|
||||
wrap,
|
||||
reads: BTreeSet::new(),
|
||||
};
|
||||
printer.nodes(nodes, "")?;
|
||||
if printer.overflow {
|
||||
return Err("native list diagnostic output capacity exceeded".into());
|
||||
}
|
||||
Ok((printer.out, printer.reads))
|
||||
}
|
||||
Reference in new issue
Block a user