Sorry Haris,
but that's not it. It happens for him when he *IS* pressing shift to do a selection based replacement.
Just to clarify, this does not happen for me. My TextMate does not insert any text at the end of the document or other funny stuff. I'll attach the file we troubleshooted in irc. It makes things a little clearer than the inline code in the original email.
Soryu.