From 42b1e6a55905934564dc10295cafb31093915da2 Mon Sep 17 00:00:00 2001 From: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com> Date: Wed, 3 Jul 2024 18:38:32 +0200 Subject: [PATCH] Only switch focus between editor and viewer when viewer is visible (#1950) --- novelwriter/guimain.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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()