Aha! Found the culprit. As you can see if other staves have different durations (shorter than the span that needs to be covered), the spanner terminates at the first next duration it finds. Could you make the spanner to see only the relevant duration of the context it is applied to? Voice, Staff etc.?
Apologies for the redundant erroneous mails.
Dimitris
%%%%%%%%%%%%%%%%%%%%%
\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' {
\partCombineAutomatic
c4 d e f |
R1 |
\override TrillSpanner.after-line-breaking =
#encompass-spanner-duration
d'2\startTrillSpan c | b a |
b2 g2 | f1\stopTrillSpan |
e1 |
}
instrumentTwo = \relative g' {
R1 |
R1 |
R1 |
R1 |
R1 |
R1 |
R1 |
}
instrumentThree = \relative g' {
a4 b c d e f d e c b a d g f e d c b c d e f e d c1
}
<<
\new Staff \instrumentTwo
\new Staff \instrumentOne
>>
<<
\new Staff \instrumentThree
\new Staff \instrumentOne
>>