Correct usage of algomathdisplay in algorithm2e

What is the correct usage of algomathdisplay from the algorithm2e package? I appear to have misunderstood its usage, see example below. There are two different attempts one with just

\begin{algomathdisplay}
...
\end{algomathdisplay}
%
next line


which causes weird indentations on the next line, and a second attempt:

\begin{algomathdisplay}
...
\end{algomathdisplay}\;
%
next line


which results in an empty semicolon-line

lastly here is the full code

\begin{algorithm}
\While{test}{
Some words introducing the following equation
\begin{algomathdisplay}
1+1
\end{algomathdisplay}
Another line\;
Words introducing the second equation
\begin{algomathdisplay}
2+2
\end{algomathdisplay}\;
Last Line;
}
\end{algorithm}


Wrong Solutions

Suggested Macro fix by https://tex.stackexchange.com/a/543384/82917

\makeatletter
\renewenvironment{algomathdisplay}
{$} {\@endalgocfline\vspace{-\baselineskip}$\;}
\makeatother

\begin{algorithm}
\While{test}{
Another line\;
Words introducing the second equation
\begin{algomathdisplay}
2+2
\end{algomathdisplay}
Last Line\;
}
\end{algorithm}


results in

• @campa thanks for the comment - so I guess this should work in normal circumstances? Because I just assumed I made an immediately obvious user error. Aug 20, 2021 at 12:05
• @campa yeah sorry - fixed it Aug 20, 2021 at 12:11

The issue was the global \DontPrintSemicolon in https://tex.stackexchange.com/a/543384/82917
\makeatletter
{$} {\@endalgocfline\vspace{-\baselineskip}${\DontPrintSemicolon\;}}