# lstlisting border bug when breaking lines

I have a certain bug regarding listings. I have used the \lstset command to configure my lstlisting environment.

Somehow, when I have a line that is too long to fit into one row the listing breaks it properly, but somehow the border gets the same colour as the font.

Here is the \lstset:

\lstnewenvironment{pascalCode}[1][]
{
\lstset{
backgroundcolor=\color{lightgrey},
breaklines=true,
basicstyle=\footnotesize,
keywordstyle=\color{Blue},
numbers=left,
numberstyle=\footnotesize,
stringstyle=\color{red},
showspaces = false,
showstringspaces = false,
tabsize = 2,
%numbers=left,
%numbersyle=\tiny
frame=single,
xleftmargin=5pt,
xrightmargin=3pt,
language =  Pascal,
aboveskip = 20pt,
#1
}
}{}


-
Is this really a bug - or a feature? –  Stephen Nov 5 '12 at 19:18
i'd prefere a black border over a colored one... –  Andreas Pabst Nov 5 '12 at 19:22
Welcome to TeX.sx! Please add a minimal working example (MWE) that illustrates your problem. It is considered a lot better to put in some code that will compile, as it makes it a lot easier for us to copy it into our text editor and work with it, and see exactly what it is you are trying to do. –  Kurt Nov 5 '12 at 19:36

Using the option rulecolor=\color{black} fixes that. Here is a before and after comparison:

## Code:

\documentclass{article}
\usepackage{xcolor}
\usepackage{listings}

\lstnewenvironment{pascalCode}[1][]
{
\lstset{
backgroundcolor=\color{gray!40},
breaklines=true,
basicstyle=\footnotesize,
keywordstyle=\color{blue},
numbers=left,
numberstyle=\footnotesize,
stringstyle=\color{red},
showspaces = false,
showstringspaces = false,
tabsize = 2,
%numbers=left,
%numbersyle=\tiny
frame=single,
xleftmargin=5pt,
xrightmargin=3pt,
language =  Pascal,
aboveskip = 20pt,
rulecolor=\color{black},
#1
}
}{}

\begin{document}
\begin{pascalCode}
(*
Some really long line that takes more than one line so lstlistings needs to wrap this line.
*)
\end{pascalCode}
\end{document}

-
Thank you very much! That solved my problem. :) –  Andreas Pabst Nov 5 '12 at 21:36