Fix query copy command after switching to other pane or page