Skip to content

Commit a1a646e

Browse files
authored
Fix punctuation (#128)
* Fix punctuation * Wait longer since we want to ensure a caret toggle * Try again
1 parent bddf4df commit a1a646e

File tree

15 files changed

+23
-18
lines changed

15 files changed

+23
-18
lines changed

CSharpMath.CoreTests/LaTeXParserTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public static MathList ParseLaTeX(string latex) {
2525
[InlineData("(", new[] { typeof(Open) }, "(")]
2626
[InlineData(")", new[] { typeof(Close) }, ")")]
2727
[InlineData(",", new[] { typeof(Punctuation) }, ",")]
28-
[InlineData("?!", new[] { typeof(Close), typeof(Close) }, "?!")]
28+
[InlineData("?!", new[] { typeof(Punctuation), typeof(Punctuation) }, "?!")]
2929
[InlineData("=", new[] { typeof(Relation) }, "=")]
3030
[InlineData("x+2", new[] { typeof(Variable), typeof(BinaryOperator), typeof(Number) }, "x+2")]
3131
[InlineData("(2.3 * 8)", new[] { typeof(Open), typeof(Number), typeof(Number), typeof(Number), typeof(BinaryOperator), typeof(Number), typeof(Close) }, "(2.3*8)")]

CSharpMath.CoreTests/MathListTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
using Xunit;
66

77
namespace CSharpMath.CoreTests {
8-
using Range = CSharpMath.Atom.Range;
8+
using Range = Atom.Range;
99
public class MathListTest {
1010
internal static void CheckClone(MathAtom? original, MathAtom? clone) {
1111
Assert.Equal(original, clone);
@@ -197,7 +197,7 @@ static void CheckListContents(MathList? list) {
197197
);
198198
var radical = Assert.IsType<Radical>(Assert.Single(integral.Superscript));
199199
Assert.Collection(radical.Degree,
200-
CheckAtomNucleusAndRange<Close>("!", 0, 1),
200+
CheckAtomNucleusAndRange<Punctuation>("!", 0, 1),
201201
CheckAtomNucleusAndRange<Ordinary>(" ", 1, 1)
202202
);
203203
Assert.Collection(radical.Radicand,

CSharpMath.Editor.Tests/CaretTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ public async Task Test() {
146146
await Task.Delay((int)MathKeyboard<TestFont, char>.DefaultBlinkMilliseconds - CaretBlinks.MillisecondBuffer);
147147

148148
Assert.Equal(MathKeyboardCaretState.Shown, keyboard.CaretState);
149-
await Task.Delay((int)MathKeyboard<TestFont, char>.DefaultBlinkMilliseconds - CaretBlinks.MillisecondBuffer);
149+
await Task.Delay(2 * CaretBlinks.MillisecondBuffer);
150150
Assert.Equal(MathKeyboardCaretState.TemporarilyHidden, keyboard.CaretState);
151151
}
152152
}

CSharpMath.Editor/MathKeyboard.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ void HandleSlashButton() {
165165
case (null, _): throw new InvalidCodePathException("Invalid _insertionIndex");
166166
// Stop looking behind upon encountering these atoms unparenthesized
167167
case (Atoms.Open _, _) when --parenDepth < 0: goto stop;
168-
case (Atoms.Close { HasCorrespondingOpen: true } a, _): parenDepth++; numerator.Push(a); break;
168+
case (Atoms.Close a, _): parenDepth++; numerator.Push(a); break;
169169
case (Atoms.UnaryOperator _, 0): goto stop;
170170
case (Atoms.BinaryOperator _, 0): goto stop;
171171
case (Atoms.Relation _, 0): goto stop;

CSharpMath.Evaluation/Evaluation.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ _ when LaTeXSettings.CommandForAtom(atom) is string s => MathS.Var(s + subscript
501501
if (levelsDeep == 0) open = i;
502502
levelsDeep++;
503503
break;
504-
case Atoms.Close { HasCorrespondingOpen: true } close:
504+
case Atoms.Close close:
505505
levelsDeep--;
506506
if (levelsDeep == 0) {
507507
if (open == -1) return "Missing argument for " + atom.Nucleus;

CSharpMath/Atom/Atoms/BinaryOperator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
namespace CSharpMath.Atom.Atoms {
2-
/// <summary>A binary operator</summary>
2+
/// <summary>AMSMath class 2: Binary Operator (conjunction), e.g. +, \cup, \wedge</summary>
33
public sealed class BinaryOperator : MathAtom {
44
public BinaryOperator(string nucleus) : base(nucleus) { }
55
public override bool ScriptsAllowed => true;

CSharpMath/Atom/Atoms/Close.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
namespace CSharpMath.Atom.Atoms {
2-
/// <summary>Close brackets</summary>
2+
/// <summary>AMSMath class 5: Right/closing delimiter, e.g. ), ], }, \rangle</summary>
33
public sealed class Close : MathAtom {
4-
public Close(string nucleus, bool hasCorrespondingOpen = true) : base(nucleus) =>
5-
HasCorrespondingOpen = hasCorrespondingOpen;
6-
public bool HasCorrespondingOpen { get; }
4+
public Close(string nucleus) : base(nucleus) { }
75
public override bool ScriptsAllowed => true;
86
public new Close Clone(bool finalize) => (Close)base.Clone(finalize);
97
protected override MathAtom CloneInside(bool finalize) => new Close(Nucleus);

CSharpMath/Atom/Atoms/LargeOperator.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
namespace CSharpMath.Atom.Atoms {
2-
/// <summary>A large operator such as sin/cos, integral, etc.</summary>
1+
namespace CSharpMath.Atom.Atoms {
2+
/// <summary>AMSMath class 1: Prefix operator, e.g. \sin, \cos, \sum, \prod, \int</summary>
33
public sealed class LargeOperator : MathAtom {
44
bool? _limits;
55
/// <summary>

CSharpMath/Atom/Atoms/Number.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
namespace CSharpMath.Atom.Atoms {
2+
/// <summary>Class 0: ordinary for Arabic numerals 0–9 and the decimal dot .</summary>
23
public sealed class Number : MathAtom {
34
public Number(string number) : base(number) { }
45
public override bool ScriptsAllowed => true;

CSharpMath/Atom/Atoms/Open.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
namespace CSharpMath.Atom.Atoms {
2-
/// <summary>Open brackets</summary>
2+
/// <summary>AMSMath class 4: Left/Opening delimiter, e.g. (, [, {, \langle</summary>
33
public sealed class Open : MathAtom {
44
public Open(string nucleus) : base(nucleus) { }
55
public override bool ScriptsAllowed => true;

0 commit comments

Comments
 (0)