<div dir="ltr"><br>There is a bit of text currently missing from bidi documentation. bidi also provides the command \bidicolor similar to \color. If you typeset just some portion of a text in color, you use \color, but if you want to color all that text, you use \bidicolor. This can be clearly seen in your example when the lstlisting environment is actually RTL.<br>
<br clear="all"><br>-- <br>Best wishes,<br>Vafa Khalighi<br>
</div>