Fix search pattern being erased after a save in python files