From a3f9d88271b8cf53158570bd0232edbc185fec36 Mon Sep 17 00:00:00 2001 From: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com> Date: Sun, 12 Nov 2023 20:59:00 +0100 Subject: [PATCH 1/2] Remove 2 px margin on sidebar --- novelwriter/gui/sidebar.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/novelwriter/gui/sidebar.py b/novelwriter/gui/sidebar.py index 6bee63a60..87ce22aa5 100644 --- a/novelwriter/gui/sidebar.py +++ b/novelwriter/gui/sidebar.py @@ -111,7 +111,7 @@ def __init__(self, mainGui: GuiMain) -> None: self.outerBox.addWidget(self.tbDetails) self.outerBox.addWidget(self.tbStats) self.outerBox.addWidget(self.tbSettings) - self.outerBox.setContentsMargins(0, 0, CONFIG.pxInt(2), 0) + self.outerBox.setContentsMargins(0, 0, 0, 0) self.outerBox.setSpacing(CONFIG.pxInt(4)) self.setLayout(self.outerBox) From a5b2e47098dfc8a46155cbfca240e08667bbbd6c Mon Sep 17 00:00:00 2001 From: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com> Date: Sun, 12 Nov 2023 21:27:24 +0100 Subject: [PATCH 2/2] Don't block auto-replace on keyword lines, and only show completer on single keypresses --- novelwriter/gui/doceditor.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/novelwriter/gui/doceditor.py b/novelwriter/gui/doceditor.py index 8adde7012..d6d9c683b 100644 --- a/novelwriter/gui/doceditor.py +++ b/novelwriter/gui/doceditor.py @@ -1008,7 +1008,9 @@ def _docChange(self, pos: int, removed: int, added: int) -> None: return text = block.text() - if text.startswith("@"): + if text.startswith("@") and added + removed == 1: + # Only run on single keypresses, otherwise it will trigger + # at unwanted times when other changes are made to the document cursor = self.textCursor() bPos = cursor.positionInBlock() if bPos > 0: @@ -1016,8 +1018,10 @@ def _docChange(self, pos: int, removed: int, added: int) -> None: point = self.cursorRect().bottomRight() self._completer.move(self.viewport().mapToGlobal(point)) self._completer.setVisible(show) + else: + self._completer.setVisible(False) - elif self._doReplace and added == 1: + if self._doReplace and added == 1: self._docAutoReplace(text) return