# Displaying source code listing with strikethrough/strikeout

I'm preparing for a presentation in which I would like to show some source code with bits struck out. Does anyone know a package that can do that? I've googled but can't find anything.

Here's my MWE, based on the listings package (for listings) and ulem (for the strikeout) albeit in the beamer environment

\documentclass{beamer}
\usepackage{listings}
\usepackage[latin1]{inputenc}
\usepackage{ulem}
\usetheme{CambridgeUS}
\usecolortheme{seahorse}

\title[Test]{Test}
\author{Me}
\institute{Stuff}
\date{\today}
\begin{document}

\lstset{moredelim=[is][\sout]{|}{|}}

\begin{frame}[fragile]{Test}
\begin{lstlisting}[]

text
|text|
\end{lstlisting}
\end{frame}

\end{document}


Unfortunately the strikeout begins from the start of the line as shown below

Update

Putting a single character before the strikeout stops it from being so greedy

\begin{frame}[fragile]{Test}
\begin{lstlisting}[]

text
.|You will not pass|
\end{lstlisting}
\end{frame}


Result

Now if only I could replace the dot with a non printable character.

• – Ignasi Jan 22 '16 at 9:06
• Thanks. I've made some progress with the listings package. – Olumide Jan 22 '16 at 11:17
• You're welcome. If you finally manage to get a solution for your question, remember that you can post your own answer. It can be useful for someone else. – Ignasi Jan 22 '16 at 11:19