From c1988bcc17f6f5340fdf5f1758c1a48cb11545eb Mon Sep 17 00:00:00 2001 From: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com> Date: Sun, 30 Oct 2022 17:07:24 +0100 Subject: [PATCH] Fix bug where split document loses status or importance --- novelwriter/core/doctools.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/novelwriter/core/doctools.py b/novelwriter/core/doctools.py index 54cb9d25..95fec897 100644 --- a/novelwriter/core/doctools.py +++ b/novelwriter/core/doctools.py @@ -192,7 +192,7 @@ class DocSplitter: """An iterator that will write each document in the buffer, and return its new handle, parent handle, and sibling handle. """ - if self._srcHandle is None: + if self._srcHandle is None or self._srcItem is None: return pHandle = self._parHandle @@ -224,6 +224,10 @@ class DocSplitter: dHandle = self.theProject.newFile(docLabel, pHandle) hHandle[hLevel] = dHandle + newItem = self.theProject.tree[dHandle] + newItem.setStatus(self._srcItem.itemStatus) + newItem.setImport(self._srcItem.itemImport) + outDoc = NWDoc(self.theProject, dHandle) status = outDoc.writeDocument("\n".join(docText)) if not status: