Merge "Don't clear the pattern when window focus changes."