From 4c35239288c2ef7fc4d789091feaa782391ddae6 Mon Sep 17 00:00:00 2001 From: Neil Puttock Date: Tue, 1 Mar 2011 23:35:32 +0000 Subject: [PATCH] Fix #1540: correct display method for single note chords. * input/regression/display-lily-tests.ly: add test for EventChord with single NoteEvent and post_events * scm/define-music-display-methods.scm (EventChord display method): use post-event? predicate to filter 'articulations --- input/regression/display-lily-tests.ly | 3 ++- scm/define-music-display-methods.scm | 10 +++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/input/regression/display-lily-tests.ly b/input/regression/display-lily-tests.ly index c28ebf7e3b..e435730ab2 100644 --- a/input/regression/display-lily-tests.ly +++ b/input/regression/display-lily-tests.ly @@ -1,4 +1,4 @@ -\version "2.13.20" +\version "2.13.53" #(use-modules (srfi srfi-13) (ice-9 format)) @@ -76,6 +76,7 @@ stderr of this run." \test "" ##[ R1.*2/3 #] % MultiMeasureRestMusicGroup, MultiMeasureRestEvent \test "" ##[ \skip 2.*3/4 #] % SkipMusic \test "" ##[ < c\1 e\3 >4.*3/4-. #] % EventChord, NoteEvent, StringNumberEvent, ArticulationEvent +\test "" ##[ < c-1\4 >8 #] \test "NOT A BUG" ##[ { < c e g c' > q8-. } #] % RepeatedChord %% tags diff --git a/scm/define-music-display-methods.scm b/scm/define-music-display-methods.scm index 574ba04678..2440e15bea 100644 --- a/scm/define-music-display-methods.scm +++ b/scm/define-music-display-methods.scm @@ -457,11 +457,11 @@ Otherwise, return #f." (music->lily-string (car elements) parser) (if (and (not (null? simple-elements)) (null? (cdr simple-elements)) - ;; special case: if this simple_element has a HarmonicEvent in its - ;; 'articulations list, it should be interpreted instead as a - ;; note_chord_element, since \harmonic only works inside chords, - ;; even for single notes, e.g., < c\harmonic > - (null? (filter (make-music-type-predicate 'HarmonicEvent) + ;; special case: if this simple_element has any post_events in + ;; its 'articulations list, it should be interpreted instead + ;; as a note_chord_element to prevent spurious output, e.g., + ;; \displayLilyMusic < c-1\4 >8 -> c-1\48 + (null? (filter post-event? (ly:music-property (car simple-elements) 'articulations)))) ;; simple_element : note | figure | rest | mmrest | lyric_element | skip (let* ((simple-element (car simple-elements)) -- 2.39.5