Skip to content

Commit

Permalink
Refactor build settings (#2031)
Browse files Browse the repository at this point in the history
  • Loading branch information
vkbo authored Sep 28, 2024
2 parents 7cc48ae + e97a476 commit 3da5074
Show file tree
Hide file tree
Showing 5 changed files with 316 additions and 277 deletions.
6 changes: 2 additions & 4 deletions novelwriter/core/buildsettings.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,11 @@
"text.includeKeywords": QT_TRANSLATE_NOOP("Builds", "Include Keywords"),
"text.includeBodyText": QT_TRANSLATE_NOOP("Builds", "Include Body Text"),
"text.ignoredKeywords": QT_TRANSLATE_NOOP("Builds", "Ignore These Keywords"),
"text.grpInsert": QT_TRANSLATE_NOOP("Builds", "Insert Content"),
"text.addNoteHeadings": QT_TRANSLATE_NOOP("Builds", "Add Titles for Notes"),

"format.grpFormat": QT_TRANSLATE_NOOP("Builds", "Text Format"),
"format.textFont": QT_TRANSLATE_NOOP("Builds", "Text Font"),
"format.lineHeight": QT_TRANSLATE_NOOP("Builds", "Line Height"),
"format.grpOptions": QT_TRANSLATE_NOOP("Builds", "Text Options"),
"format.justifyText": QT_TRANSLATE_NOOP("Builds", "Justify Text Margins"),
"format.stripUnicode": QT_TRANSLATE_NOOP("Builds", "Replace Unicode Characters"),
"format.replaceTabs": QT_TRANSLATE_NOOP("Builds", "Replace Tabs with Spaces"),
Expand All @@ -149,12 +147,12 @@
"format.leftMargin": QT_TRANSLATE_NOOP("Builds", "Left Margin"),
"format.rightMargin": QT_TRANSLATE_NOOP("Builds", "Right Margin"),

"odt": QT_TRANSLATE_NOOP("Builds", "Open Document (.odt)"),
"odt": QT_TRANSLATE_NOOP("Builds", "ODT Documents"),
"odt.addColours": QT_TRANSLATE_NOOP("Builds", "Add Highlight Colours"),
"odt.pageHeader": QT_TRANSLATE_NOOP("Builds", "Page Header"),
"odt.pageCountOffset": QT_TRANSLATE_NOOP("Builds", "Page Counter Offset"),

"html": QT_TRANSLATE_NOOP("Builds", "HTML (.html)"),
"html": QT_TRANSLATE_NOOP("Builds", "HTML Document"),
"html.addStyles": QT_TRANSLATE_NOOP("Builds", "Add CSS Styles"),
"html.preserveTabs": QT_TRANSLATE_NOOP("Builds", "Preserve Tab Characters"),
}
Expand Down
11 changes: 6 additions & 5 deletions novelwriter/gui/doceditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1095,6 +1095,12 @@ def _insertCompletion(self, pos: int, length: int, text: str) -> None:
self._completer.hide()
return

@pyqtSlot()
def _openContextFromCursor(self) -> None:
"""Open the spell check context menu at the cursor."""
self._openContextMenu(self.cursorRect().center())
return

@pyqtSlot("QPoint")
def _openContextMenu(self, pos: QPoint) -> None:
"""Open the editor context menu at a given coordinate."""
Expand Down Expand Up @@ -1938,11 +1944,6 @@ def _emitRenameItem(self, block: QTextBlock) -> None:
self.requestProjectItemRenamed.emit(self._docHandle, text)
return

def _openContextFromCursor(self) -> None:
"""Open the spell check context menu at the cursor."""
self._openContextMenu(self.cursorRect().center())
return

def _docAutoReplace(self, text: str) -> None:
"""Auto-replace text elements based on main configuration."""
cursor = self.textCursor()
Expand Down
2 changes: 1 addition & 1 deletion novelwriter/gui/dochighlight.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ def spellCheck(self, text: str, offset: int) -> list[tuple[int, int]]:

self._spellErrors = []
checker = SHARED.spelling
for match in RX_WORDS.finditer(text.replace("_", " ")):
for match in RX_WORDS.finditer(text.replace("_", " "), offset):
if (
(word := match.group(0))
and not (word.isnumeric() or word.isupper() or checker.checkWord(word))
Expand Down
Loading

0 comments on commit 3da5074

Please sign in to comment.