In light of the explanations given in LuaTeX and em dashes
"\automatichyphenmode=1 avoids the problem by not converting the hyphen to a discretionary in a number of cases."
and the LuaTeX Reference Manual (8.2.7 disc nodes}
''The \discretionary and -, the - character but also the hyphenation mechanism produces these nodes.''
I looked at the node lists in 4 diferent cases involving the hyphen/minus sign, using both \automatichyphenmode=1 and \automatichyphenmode=0
The correct expected behavior (after the bug is fixed) will be that the glyph char 45 [-] nodes in the 4 cases will be produced as disc (automatic) nodes? (that is, mode=node (0) behavior will also be modified? glyph char 45 ==> disc in both columns?)
This a very very basic code. The output will match the table.
\automatichyphenmode=1
Glyph
Glyph ; Glyph
Glyph ; Glyph
Glyph ; Disc > Subtype 2 ; Glyph
\automatichyphenmode=0
Glyph
Glyph ; Glyph
Disc > Subtype 2 ; Glyph
Glyph ; Disc > Subtype 2; Glyph
% !TeX TS-program = lualatex
\documentclass{minimal}
\usepackage{fontspec}
\directlua{
show_dash = function(head)
while head do
if head.id == 0 or head.id == 1 then % hlist, vlist
texio.write_nl(" ")
show_dash(head.head)
elseif head.id == 7 then % disc
texio.write_nl("Disc > Subtype " .. head.subtype)
elseif head.id == 29 then % glyph
texio.write_nl("Glyph ")
end
head = head.next
end
end
luatexbase.add_to_callback("post_linebreak_filter",show_dash,"show_dash")
}
\begin{document}
\begin{minipage}{20pt}
\automatichyphenmode=1 % good for en dash and em dash
-
A-
-B
A-B
\end{minipage}
\begin{minipage}{20pt}
\automatichyphenmode=0
-
A-
-B
A-B
\end{minipage}
\end{document}