Sorry for resurrecting the thread after months. I ran into a strange bug(?) I think.
Using this code in combination with \partCombine confuses Lilypond and the spanner is terminated mid-bar where the invisible full-measure rest of the other part is hidden.
I could tweak the right padding but honestly i'm really tired with huge amounts of manual adjustments in complex scores. Anything almost-automatic is a win for me.
Here is a tiny example:
\version "2.23.0"
#(define (encompass-spanner-duration grob)
(let* ((rb (ly:spanner-bound grob RIGHT))
(right-col (ly:item-get-column rb))
(right-neighbor (ly:grob-object right-col 'right-neighbor)))
(if (ly:grob? right-neighbor)
(ly:spanner-set-bound! grob RIGHT right-neighbor))))
instrumentOne = \relative c' {
c4 d e f |
R1 |
\override Score.TextSpanner.after-line-breaking =
#encompass-spanner-duration
d'2\startTrillSpan c | b a |
b2 g2 | f1 |
e1\stopTrillSpan |
}
instrumentTwo = \relative g' {
R1 |
g4 a b c |
\override Score.TextSpanner.after-line-breaking =
#encompass-spanner-duration
d2\startTrillSpan c | b a |
g2 f( | e) d |
e1\stopTrillSpan |
}
<<
\new Staff \instrumentOne
\new Staff \instrumentTwo
\new Staff \partCombine \instrumentOne \instrumentTwo
>>
Dimitris