Skip to content

Commit 50ab706

Browse files
committed
refactor: Simplify key-signature naturalization
1 parent 572ab6d commit 50ab706

File tree

10 files changed

+7
-4
lines changed

10 files changed

+7
-4
lines changed

src.compiler/csharp/CSharpAstPrinter.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,10 @@ export default class CSharpAstPrinter extends AstPrinterBase {
727727
let exprs: cs.Expression[] = [];
728728
expr.chunks.forEach(c => {
729729
if (cs.isStringLiteral(c)) {
730-
const escapedText = c.text.split('"').join('""');
730+
const escapedText = c.text
731+
.replaceAll('"', '""')
732+
.replaceAll('{', '{{')
733+
.replaceAll('}', '}}');
731734
this.write(escapedText);
732735
} else {
733736
this.write(`{${exprs.length}}`);

src/rendering/ScoreBarRenderer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -531,8 +531,8 @@ export class ScoreBarRenderer extends LineBarRenderer {
531531
newLines.set(step, true);
532532
}
533533
}
534-
// naturalize previous key
535-
if (this.index > 0) {
534+
// naturalize previous key if naturalizing
535+
if (this.bar.masterBar.keySignature === KeySignature.C) {
536536
let naturalizeSymbols: number = Math.abs(previousKey);
537537
let previousKeyPositions = ModelUtils.keySignatureIsSharp(previousKey)
538538
? ScoreBarRenderer.SharpKsSteps
1 KB
Loading
1.19 KB
Loading
1.2 KB
Loading
1.19 KB
Loading
-1.6 KB
Loading
1.19 KB
Loading
-2.76 KB
Loading

test/visualTests/features/MusicNotation.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { Settings } from '@src/Settings';
44
import { VisualTestHelper } from '@test/visualTests/VisualTestHelper';
55
import { NotationElement } from '@src/NotationSettings';
66
import { SystemsLayoutMode } from '@src/DisplaySettings';
7-
import { KeySignature, NoteAccidentalMode, Score } from '@src/model';
7+
import { Score } from '@src/model';
88
import { TestPlatform } from '@test/TestPlatform';
99
import { ScoreLoader } from '@src/importer';
1010
import { AlphaTexImporter } from '@src/importer/AlphaTexImporter';

0 commit comments

Comments
 (0)