lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Remove spurious spaces from music expression display, adapt tests. (


From: dak
Subject: Re: Remove spurious spaces from music expression display, adapt tests. (issue 5437140)
Date: Tue, 06 Dec 2011 10:55:31 +0000

Reviewers: carl.d.sorensen_gmail.com, lemzwerg,

Message:
On 2011/12/06 05:39:42, lemzwerg wrote:
David, I suggest to apply patches of that kind directly to the
repository
without setting up a Rietveld issue.

Done.  It is actually part of my EventChord work.  I got oodles of
display difference due to all those spurious spaces differing in
different contexts.  I first aimed for bug compatibility, but then this
got too crazy.

Anyway, pushed to staging.

Description:
Remove spurious spaces from music expression display, adapt tests.

Please review this at http://codereview.appspot.com/5437140/

Affected files:
  M input/regression/display-lily-tests.ly
  M scm/define-music-display-methods.scm


Index: input/regression/display-lily-tests.ly
diff --git a/input/regression/display-lily-tests.ly b/input/regression/display-lily-tests.ly index 226d08d5e69a52cbfb81767325670f0941ff6fdc..998627b716b3664c835a6e6147326418d1e60084 100644
--- a/input/regression/display-lily-tests.ly
+++ b/input/regression/display-lily-tests.ly
@@ -92,8 +92,8 @@ stderr of this run."

 %% Lyrics
 \test ##[ \lyrics { a b } #]
-\test ##[ \lyricmode { a --  b } #]            % HyphenEvent
-\test ##[ \lyricmode { a __  b } #]            % ExtenderEvent
+\test ##[ \lyricmode { a -- b } #]             % HyphenEvent
+\test ##[ \lyricmode { a __ b } #]             % ExtenderEvent
 \test ##[ \lyricmode { "a " } #]                     % LyricEvent
 \test ##[ \lyricsto "foo" { bla bla  } #]            % LyricCombineMusic
 \test ##[ { { c d }
@@ -107,41 +107,41 @@ stderr of this run."
 \test ##[ c4 ~ #]                                      % TieEvent
 \test ##[ c\noBeam #]                                  % BeamForbidEvent
 \test ##[ c\1 #]                                       % StringNumberEvent
-\test ##[ { c:  c:1  } #]                              % TremoloEvent
-\test ##[ { c-^  c^^  c_^  } #]                                % 
ArticulationEvent
-\test ##[ { c-+  c^+  c_+  } #]
-\test ##[ { c--  c^-  c_-  } #]
-\test ##[ { c-|  c^|  c_|  } #]
-\test ##[ { c->  c^>  c_>  } #]
-\test ##[ { c-.  c^.  c_.  } #]
-\test ##[ { c-_  c^_  c__  } #]
-\test ##[ { c-\trill  c^\trill  c_\trill  } #]
-\test ##[ { c-1  c^2  c_3  } #]                                % FingerEvent
-\test ##[ { c-"foo"  c^"foo"  c_"foo"  } #]      % TextScriptEvent
-\test ##[ { R1*4-"foo"  R^"foo"  R_"foo"  } #]           % 
MultiMeasureTextEvent
+\test ##[ { c: c:1 } #]                                        % TremoloEvent
+\test ##[ { c-^ c^^ c_^ } #]                           % ArticulationEvent
+\test ##[ { c-+ c^+ c_+ } #]
+\test ##[ { c-- c^- c_- } #]
+\test ##[ { c-| c^| c_| } #]
+\test ##[ { c-> c^> c_> } #]
+\test ##[ { c-. c^. c_. } #]
+\test ##[ { c-_ c^_ c__ } #]
+\test ##[ { c-\trill c^\trill c_\trill } #]
+\test ##[ { c-1 c^2 c_3 } #]                           % FingerEvent
+\test ##[ { c-"foo" c^"foo" c_"foo" } #]         % TextScriptEvent
+\test ##[ { R1*4-"foo" R^"foo" R_"foo" } #]              % 
MultiMeasureTextEvent
 \test ##[ { < c\harmonic >4 < c e\harmonic > } #]  % HarmonicEvent
-\test ##[ { c-\glissando c^\glissando c_\glissando } #] % GlissandoEvent
-\test ##[ { c-\arpeggio  c^\arpeggio  c_\arpeggio  } #]        % ArpeggioEvent
-\test ##[ { c\p  c^\ff  c_\sfz  } #]                   % AbsoluteDynamicEvent
-\test ##[ { c[  c]  c^[  c^]  c_[  c_]  } #]           % BeamEvent
-\test ##[ { c(  c)  c^(  c^)  c_(  c_)  } #]           % SlurEvent
-\test ##[ { c\<  c\!  c^\<  c^\!  c_\<  c_\!  } #]    % CrescendoEvent
-\test ##[ { c\>  c\!  c^\>  c^\!  c_\>  c_\!  } #]    % DecrescendoEvent
-\test ##[ { c\episemInitium  c\episemFinis  } #]    % EpisemaEvent
-\test ##[ { c\(  c\)  c^\(  c^\)  c_\(  c_\)  } #]     % PhrasingSlurEvent
-\test ##[ { c\sustainOn  c\sustainOff  } #]    % SustainEvent
-\test ##[ { c\sostenutoOn  c\sostenutoOff  } #]    % SostenutoEvent
+\test ##[ { c-\glissando c^\glissando c_\glissando } #]        % GlissandoEvent
+\test ##[ { c-\arpeggio c^\arpeggio c_\arpeggio } #]   % ArpeggioEvent
+\test ##[ { c\p c^\ff c_\sfz } #]                      % AbsoluteDynamicEvent
+\test ##[ { c[ c] c^[ c^] c_[ c_] } #]                         % BeamEvent
+\test ##[ { c( c) c^( c^) c_( c_) } #]                         % SlurEvent
+\test ##[ { c\< c\! c^\< c^\! c_\< c_\! } #]          % CrescendoEvent
+\test ##[ { c\> c\! c^\> c^\! c_\> c_\! } #]          % DecrescendoEvent
+\test ##[ { c\episemInitium c\episemFinis } #]         % EpisemaEvent
+\test ##[ { c\( c\) c^\( c^\) c_\( c_\) } #]           % PhrasingSlurEvent
+\test ##[ { c\sustainOn c\sustainOff } #]              % SustainEvent
+\test ##[ { c\sostenutoOn c\sostenutoOff } #]          % SostenutoEvent
 \test ##[ \melisma #]
 \test ##[ \melismaEnd #]
-\test ##[ { c\startTextSpan  c\stopTextSpan  } #]    % TextSpanEvent
-\test ##[ { c\startTrillSpan  c\stopTrillSpan  } #]    % TrillSpanEvent
-\test ##[ { c \startStaff c \stopStaff } #]    % StaffSpanEvent
-\test ##[ { c\startGroup c\stopGroup c^\startGroup c^\stopGroup c_\startGroup c_\stopGroup } #] % NoteGroupingEvent
-\test ##[ { c\unaCorda  c\treCorde  } #]    % UnaCordaEvent
+\test ##[ { c\startTextSpan c\stopTextSpan } #]                % TextSpanEvent
+\test ##[ { c\startTrillSpan c\stopTrillSpan } #]      % TrillSpanEvent
+\test ##[ { c \startStaff c \stopStaff } #]            % StaffSpanEvent
+\test ##[ { c\startGroup c\stopGroup c^\startGroup c^\stopGroup c_\startGroup c_\stopGroup } #] % NoteGroupingEvent
+\test ##[ { c\unaCorda c\treCorde } #]                 % UnaCordaEvent
 \test ##[ \breathe #]
 \test ##[ { c \[ c \] } #]                     % LigatureEvent
 \test ##[ \~ #]                                                % 
PesOrFlexaEvent
-\test ##[ { c-\bendAfter #3  } #]    % BendAfterEvent
+\test ##[ { c-\bendAfter #3 } #]    % BendAfterEvent
 \test ##[ < c-\rightHandFinger #1 > #]    % StrokeFingerEvent

 \test ##[ \break #]
Index: scm/define-music-display-methods.scm
diff --git a/scm/define-music-display-methods.scm b/scm/define-music-display-methods.scm index 0c5673c8249da5998104f072b6907df46c14c2ce..ef2b5bd580576a8025487f615052342d9961fcc8 100644
--- a/scm/define-music-display-methods.scm
+++ b/scm/define-music-display-methods.scm
@@ -377,7 +377,7 @@ expression."
        (chord? (make-music-type-predicate 'EventChord))
        (cluster? (make-music-type-predicate 'ClusterNoteEvent))
        (note? (make-music-type-predicate 'NoteEvent)))
-    (format #f "~a~a{~v%~v_~{~a ~}~v%~v_}"
+    (format #f "~a~a{~v%~v_~{~a~^ ~}~v%~v_}"
            (if (any (lambda (e)
                       (and (chord? e)
                            (any cluster? (ly:music-property e 'elements))))
@@ -415,7 +415,7 @@ expression."
                                          (music->lily-string music parser))
                                        elements))
            (if force-line-break 1 0)
-           (if force-line-break (*indent*) 0))))
+           (if force-line-break (*indent*) 1))))

 (define-display-method SimultaneousMusic (sim parser)
   (parameterize ((*indent* (+ 3 (*indent*))))
@@ -473,7 +473,7 @@ Otherwise, return #f."
;; simple_element : note | figure | rest | mmrest | lyric_element | skip
            (let* ((simple-element (car simple-elements))
                   (duration (ly:music-property simple-element 'duration))
-                  (lily-string (format #f "~a~a~a~{~a ~}"
+                  (lily-string (format #f "~a~a~a~{~a~^ ~}"
                                        (music->lily-string simple-element 
parser)
                                        (duration->lily-string duration)
                                        (if (and ((make-music-type-predicate 
'RestEvent) simple-element)
@@ -491,7 +491,7 @@ Otherwise, return #f."
                  (post-events (filter post-event? elements)))
              (if (not (null? chord-elements))
;; note_chord_element : '<' (notepitch | drumpitch)* '>" duration post_events
-                 (let ((lily-string (format #f "< ~{~a ~}>~a~{~a ~}"
+                 (let ((lily-string (format #f "< ~{~a ~}>~a~{~a~^ ~}"
                                             (map-in-order (lambda (music)
                                                             
(music->lily-string music parser))
                                                           chord-elements)
@@ -503,13 +503,13 @@ Otherwise, return #f."
(*previous-duration* (ly:music-property (car chord-elements) 'duration))
                    lily-string)
                  ;; command_element
-                 (format #f "~{~a ~}" (map-in-order (lambda (music)
+                 (format #f "~{~a~^ ~}" (map-in-order (lambda (music)
                                                       (music->lily-string 
music parser))
                                                     elements))))))))

 (define-display-method MultiMeasureRestMusic (mmrest parser)
   (let* ((dur (ly:music-property mmrest 'duration))
-        (ly (format #f "R~a~{~a ~}"
+        (ly (format #f "R~a~{~a~^ ~}"
                     (duration->lily-string dur)
                     (map-in-order (lambda (music)
                                     (music->lily-string music parser))





reply via email to

[Prev in Thread] Current Thread [Next in Thread]