Fixes #2082, Find Replace inf loop

See https://github.com/processing/processing/issues/2082