what is happening is:
you type '='
text is '='
it changes to '\='
you type another '='
text is '\=='
it changes to '\\=\='
you type another '='
text is '\\=\=='
it changes to '\\\=\\=\='
you should only be replacing new characters, not the entire text.