The code lines I write within a lstlisting sometimes are too long. So at the end a line break occurs. But sometimes these breaks are not well chosen and can make the code much more unreadable.
Is there a way to predefine the places where a break should appear if it is necessary?
My document:
\documentclass{book}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{listings}
\lstdefinestyle{General} {
basicstyle=\small\ttfamily,
breaklines=true
}
\lstset{style=General}
\begin{document}
\begin{lstlisting}
This is a very long listing which eventually needs a break at the end of this beautiful line.
\end{lstlisting}
\end{document}
In this case the line break occurs after "break". It would be great to define the break after "listing" for example. Or maybe a second one after "beautiful" if there is enough space (maybe after changing some document settings as borders or format). In that case the first one should be ignored.