[Tex/LaTex] Code not wrapping in listings even though breaklines=true

codelistingswrap

I read that enabling breaklines in listings will make the included code wrap, but it does not in my case. Maybe something is interfering with this function?

Full code is shown below:

\ifdefined\docdefined
\else
    \documentclass[a4paper,twoside,12pt, openright]{report}
    \input{include_start}
    \begin{document}
\fi

\definecolor{dkgreen}{rgb}{0,0.6,0}
\definecolor{gray}{rgb}{0.5,0.5,0.5}
\definecolor{mauve}{rgb}{0.58,0,0.82}

% START DOCUMENT

\begin{appendices}
\makeatletter

\chapter{GUI Code}
%%%%%%%%%%%%%%%%%    XML
\section{Code XML}

\lstset{language=XML, 
numbers=left, 
frame=single, 
commentstyle=\color{dkgreen}, 
basicstyle={\scriptsize\ttfamily}, 
keywordstyle=\color{blue}, 
%identifierstyle=\color{blue}, 
stringstyle=\color{mauve},
captionpos=t,
showstringspaces=false,
breaklines=true,
breakatwhitespace=true,
tabsize=3,
caption={\protect\filename@parse{\lstname}\protect\filename@base\text{.}\protect\filename@ext},
}

\begin{frame}

\lstinputlisting{C:/Users/hab/SW/GUI/android/AndroidManifest.xml}    

\end{frame}

\end{appendices}

% END DOCUMENT
\ifdefined\docdefined
\else
    \input{include_end}
    \end{document}
\fi

Best Answer

The solution was simple.

I had:

breakatwhitespace=true

which mean it will only break at whitespace. Since some of the XML does not have whitspaces and long strings, it will not wrap!

Solution:

breakatwhitespace=false

It does now wrap even if no whitespace is found.

Related Question