Skip to content

Commit 5f35e97

Browse files
committed
Fix colour formatting for joined tables
1 parent 6e5fc81 commit 5f35e97

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

BooleanExpressionParser/.vscode/launch.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// "A+B",
1313
// "!(A+B+C)",
1414
// "(((A.B&C) OR A) AND (NOT B + !C)) AND NOT D",
15-
// "!S.D_0 + D_1 AND S",
15+
// "[D_0 . !S] + [D_1 . S];S,D_0,D_1",
1616
],
1717
"cwd": "${workspaceFolder}",
1818
"console": "integratedTerminal", // enables input (instead of internalConsole)

BooleanExpressionParser/Formatter.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System.Text;
2+
using Spectre.Console;
23

34
namespace BooleanExpressionParser;
45

@@ -34,7 +35,7 @@ public string FormatTruthTable(Ast ast, List<bool[]> table, string label = "Resu
3435

3536
sb.Append("┃ ");
3637
ast.Variables.ForEach(v => sb.Append($" {v} "));
37-
sb.AppendLine($" ┃ {label} ┃");
38+
sb.AppendLine($" ┃ {label.EscapeMarkup()} ┃");
3839

3940
sb.Append("┣━");
4041
sb.AppendJoin(null, variableLine);

BooleanExpressionParser/Program.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,13 @@ static void Main(params string[] args)
5656

5757
if (tables.Count > 1)
5858
{
59-
Console.WriteLine(formatter.JoinTruthTables(tables.ToArray()));
59+
var output = formatter.JoinTruthTables(tables.ToArray());
60+
Console.WriteLine(output);
61+
AnsiConsole.Markup(output);
6062

6163
}
6264
else
6365
{
64-
// Console.WriteLine(tables[0]);
6566
AnsiConsole.Markup(tables[0]);
6667
}
6768
}

0 commit comments

Comments
 (0)