- if (pending_extender_)
- {
- Pointer_group_interface::add_grob (pending_extender_,
- ly_symbol2scm ("heads"), h);
- }
- }
+ if (pending_extender_)
+ {
+ Pointer_group_interface::add_grob (pending_extender_,
+ ly_symbol2scm ("heads"), h);
+ /*
+ The following check addresses the case where the lyrics end before
+ the associated voice. The current_lyric_is_skip_ check is
+ necessary to handle manual melismata, which should not result in
+ extenders being completized. We also need to make sure that we're not
+ in the middle of a note (happens when this function is called because
+ of an event in a voice other than our associated one).
+ */
+ if (!melisma_busy (voice) && !current_lyric_is_skip_)
+ {
+ Moment now = voice->now_mom ();
+ Paper_column *column = (dynamic_cast<Item *> (h))->get_column ();
+ Moment *start_mom = column ? unsmob_moment (column->get_property ("when")) : 0;
+ if (!column || (start_mom->main_part_ == now.main_part_))
+ {
+ completize_extender (pending_extender_);
+ pending_extender_ = 0;
+ }
+ }
+ }
+ }