As you inject discretionaries the best you can do is inject specific
penalties (maybe combined with glue) as that is more predictable.
The problem is that if I do that, I have to make \pretolerance=-1,
otherwise the cut will be after the discretionary (its third argument
will be used), not "on" it (using its first and second arguments)... I
don't know if you read [email protected], but I believe I have found what
was going on:
http://tug.org/pipermail/luatex/2013-July/004516.html
Anyhow, at first sight I see no issue with luatex (as we have clearly
separated hyphenation, ligaturing and kerning stages there i trust
luatex more).
\showframe % \everypar{}
\starttext
\startbuffer
% this cuts after the discretionary
{aaaaab\discretionary{1}{2}{3}\penalty-10000cd\par}
% this doesn't cut
{aaaaab\discretionary{1}{2}{3}cd\par}
% this cuts on the discretionary (both pdfTeX and LuaTeX)
{\hyphenpenalty=-10000 aaaaab\discretionary{1}{2}{3}cd\par}
% with pdfTeX: it cuts on the discretionary
% with LuaTeX: it doesn't cut
{aaaaab\discretionary{1}{2}{3}cd \par}
\stopbuffer
\dostepwiserecurse{30}{70}{1}
{\hsize #1pt
\framed[width=\hsize]{\the\hsize}\par
\getbuffer
\page}
\stoptext
Ok, one can see how \hyphenpenalty=-10000 controls the tolerance i.e.
permits a bit more overflow but that's to be expected.
I have to say I cannot compile your example... but I definitely believe
that if there is a change (\hyphenpenalty ignored during first attempt
of line breaking), it should be documented in the manual... maybe there
could be an option for it?
Thank you!
--
Elie