mirror of
https://github.com/badlogic/pi-mono.git
synced 2026-11-05 23:37:25 +00:00
fix(tui): handle LaTeX control spaces across line endings
This commit is contained in:
parent
2a9b4ebc68
commit
534bcbffb7
3 changed files with 20 additions and 0 deletions
|
|
@ -15,6 +15,7 @@
|
|||
|
||||
- Fixed fullscreen transcript search snapping back to the current match during manual scrolling and fragmented SGR mouse input leaking into the search query.
|
||||
- Fixed required LaTeX arguments starting on a new line being parsed as empty ([#7760](https://github.com/earendil-works/pi/issues/7760)).
|
||||
- Fixed LaTeX control spaces split across line endings causing complete expressions to fall back to raw source.
|
||||
|
||||
## [0.84.1] - 2026-08-07
|
||||
|
||||
|
|
|
|||
|
|
@ -920,6 +920,13 @@ class LatexParser {
|
|||
|
||||
let command = "";
|
||||
const first = this.source[this.position] ?? "";
|
||||
if (first === "\n" || first === "\r") {
|
||||
this.position++;
|
||||
if (first === "\r" && this.source[this.position] === "\n") {
|
||||
this.position++;
|
||||
}
|
||||
return " ";
|
||||
}
|
||||
if (/[A-Za-z]/.test(first)) {
|
||||
const start = this.position;
|
||||
while (this.position < this.source.length && /[A-Za-z]/.test(this.source[this.position] ?? "")) {
|
||||
|
|
|
|||
|
|
@ -415,6 +415,18 @@ R\left(\frac{\pi}{4}\right)
|
|||
assert.strictEqual(renderLatex(String.raw`\det(A)`), "det(A)");
|
||||
});
|
||||
|
||||
it("treats a backslash followed by a line ending as control space", () => {
|
||||
const source = String.raw`\boxed{
|
||||
(1,1,1),\ (1,1,2),\ (1,2,5),\ (1,5,13),\ (2,5,29),\
|
||||
(1,13,34),\ (1,34,89)
|
||||
}.`;
|
||||
assert.strictEqual(
|
||||
renderLatex(source, { display: true }),
|
||||
"[(1,1,1), (1,1,2), (1,2,5), (1,5,13), (2,5,29), (1,13,34), (1,34,89)].",
|
||||
);
|
||||
assert.strictEqual(renderLatex("a\\\r\nb"), "a b");
|
||||
});
|
||||
|
||||
it("stacks operator limits in display mode", () => {
|
||||
assert.strictEqual(renderLatex(String.raw`\sum_{i=0}^n x_i`, { display: true }), " n\n ∑ xᵢ\ni=0");
|
||||
assert.strictEqual(renderLatex(String.raw`\min_{x\in X} f(x)`, { display: true }), "min f(x)\nx∈X");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue