Excessive space in lstinline after using Reactivatenumber

I'm using the code presented by this answer (which itself is based on this) to suppress line numbers on some lines in lstlisting. This works, but after I use it, the spacing in lstinline is messed up:

This seems to be because of |\Reactivatenumber{12}|. Why is that and how do I fix it?

MWE:

\documentclass{article}
\usepackage{listings}
\lstset{numbers=left,escapeinside=||, basicstyle=\ttfamily\footnotesize}

\let\origthelstnumber\thelstnumber
\makeatletter
\newcommand*\Suppressnumber{%
\let\thelstnumber\relax%
}%
}

\newcommand*\Reactivatenumber[1]{%
\setcounter{lstnumber}{\numexpr#1-1\relax}
\let\thelstnumber\origthelstnumber%
\refstepcounter{lstnumber}
}%
}
\makeatother

\begin{document}
This looks fine: \lstinline!some-words-with-minus! more text\dots
\begin{lstlisting}[firstnumber=1]
var myFunc = function() {|\Suppressnumber|
//my function does many great things
//and it's only 10 lines long!|\Reactivatenumber{12}|
}
\end{lstlisting}

This looks awful: \lstinline!some-words-with-minus! some more text
\end{document}


OK found it: I needed to add a % after \refstepcounter{lstnumber}.

Complete snippet:

\let\origthelstnumber\thelstnumber
\makeatletter
\newcommand*\Suppressnumber{%
\let\thelstnumber\relax%