I've seen the question (and this one) explaining how to break the line after the list label but sometimes I have labels for my items that fill the whole line in which case I don't want to create an empty line. Is there a way to insert a command that only breaks the line if a full line isn't taken up so the author doesn't have to manually adjust the code depending on margins etc..
For instance, in this case the blank line after the second Case statement is undesired.

This was produced with the following code.
\documentclass{amsart}
\usepackage{xparse}
\usepackage{amsmath,amssymb}
\usepackage{enumitem}
\usepackage{unicode-math}
\setmainfont{XITS}
\setmathfont{XITS Math}
\setmathfont{XITS Math}[range={\mathscr,\mathbfscr}]
\setmathfont{XITS Math}[range={\mathcal,\mathbfcal},StylisticSet=1]
\makeatletter
\newlist{pfcasesnonum}{enumerate}{3}
\setlist[pfcasesnonum]{
label={Case}\protect\thiscase:~,
align=left,
labelsep=!,
itemindent=-1em,
leftmargin=2em,
labelindent=0pt,
labelwidth=0pt
}
\setlist[pfcasesnonum,1]{
before=\def\pfcasecounter@pmg{pfcasesnonumi},
}
\newenvironment{pfcases}{
\ProvideDocumentCommand{\case}{o}{
\def\thiscase{~##1}%
\item \protected@edef@currentlabel{##1}
}
\begin{pfcasesnonum}
}
{\end{pfcasesnonum}}
\makeatother
\begin{document}
% \directlua{tex.write("2020-02-24 v1.15")}
% @ifundefinedcolor{Black}{undefined}{defined}
\begin{pfcases}
\case[foo foo foo foo foo foo foo foo foo foo foo foo] \mbox{} \bar bar
\case[foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo] \mbox{} \bar bar
\end{pfcases}
\end{document}
I want the user to be able to use the same code to get the case statement on it's own line without needing to check if it fills the whole line or not.
Note that this code has been considerably simplified (but I may have left in some unnecessary aspects) to remove extraneous features such as numbering, having the reference repeat the case condition which is why I'm bothering to define this environment in the first place. Ideally, there would be some way I could modify the case command so that users who don't have deep tex knowledge can do this with a simple \\ or something like \hfil \\ or \leavevmode \\.
