diff --git a/novelwriter/guimain.py b/novelwriter/guimain.py index b7ccfedf5..1732e1137 100644 --- a/novelwriter/guimain.py +++ b/novelwriter/guimain.py @@ -1023,9 +1023,10 @@ def _switchFocus(self, paneNo: nwFocus) -> None: self.projView.setTreeFocus() elif paneNo == nwFocus.DOCUMENT: self._changeView(nwView.EDITOR) - if self.docEditor.anyFocus(): + hasViewer = self.splitView.isVisible() + if hasViewer and self.docEditor.anyFocus(): self.docViewer.setFocus() - elif self.docViewer.anyFocus(): + elif hasViewer and self.docViewer.anyFocus(): self.docEditor.setFocus() else: self.docEditor.setFocus()