The mindflow environment provided by the package "mindflow" wraps text in two wide lines \mfSepLine, which is defined by
\newcommand*{\mfSepLine}{%
\parskip=0pt
\LNturnsONfalse%
\ifLineNumbers\LNturnsONtrue\fi\nolinenumbers%
\par\noindent\nopagebreak%
\if@mindflow@incolumn%
\makebox[\linewidth]{\rule{\linewidth}{\mindflowLineHeight}}%
\else%
\hspace*{-\paperwidth}%
\makebox[\linewidth]{\rule{4\paperwidth}{\mindflowLineHeight}}%
\fi%
\nopagebreak\par%
\ifLNturnsON\linenumbers\fi%
}
However, even with two \nopagebreaks before and after the line, sometimes the separation line is still located on a new page. Below is an example when the second separation line is on the next page alone:
\documentclass{article}
\usepackage[a4paper]{geometry}
\usepackage{mindflow}
\usepackage{blindtext}
\begin{document}
\blindtext[5]
\begin{mindflow}
\blindtext
More text
% \nopagebreak
\end{mindflow}
\end{document}
which produces:
How should I fix this behavior?
By the way, is it possible to make sure that there are at least two lines of text with this separation line when it is near the page break?


\breakand\nowidowin the same place of yours (I inserted them in\mfSepLineinstead of\endmindflow), so if there's any error then the fault is on me. – Jinwen May 25 '21 at 10:20