From eed349ab85d6a151c3f1b1aa333f02efe21b3c1f Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Sun, 18 Oct 2020 19:56:24 +0200 Subject: [PATCH] Added more comments and tweaked the scroll features --- nw/config.py | 62 +++++++++++++++++++++++++-------------------- nw/gui/doceditor.py | 5 ++-- 2 files changed, 37 insertions(+), 30 deletions(-) diff --git a/nw/config.py b/nw/config.py index 993d657c..65fd4d8a 100644 --- a/nw/config.py +++ b/nw/config.py @@ -107,44 +107,52 @@ class Config: self.hideHScroll = False # Hide horizontal scroll bars on main widgets ## Project - self.autoSaveProj = 60 - self.autoSaveDoc = 30 + self.autoSaveProj = 60 # Interval for auto-saving project in seconds + self.autoSaveDoc = 30 # Interval for auto-saving document in seconds ## Text Editor - self.textFont = None - self.textSize = 12 - self.textFixedW = True - self.textWidth = 600 - self.textMargin = 40 - self.tabWidth = 40 - self.focusWidth = 800 - self.hideFocusFooter = False - self.doJustify = False - self.autoSelect = True - self.doReplace = True - self.doReplaceSQuote = True - self.doReplaceDQuote = True - self.doReplaceDash = True - self.doReplaceDots = True - self.scrollPastEnd = True - self.autoScroll = False - self.autoScrollPos = 30 + self.textFont = None # Editor font + self.textSize = 12 # Editor font size + self.textFixedW = True # Keep editor text fixed width + self.textWidth = 600 # Editor text width + self.textMargin = 40 # Editor/viewer text margin + self.tabWidth = 40 # Editor tabulator width - self.wordCountTimer = 5.0 - self.showTabsNSpaces = False - self.showLineEndings = False - self.bigDocLimit = 800 - self.showFullPath = True - self.highlightQuotes = True - self.highlightEmph = True + self.focusWidth = 800 # Focus Mode text width + self.hideFocusFooter = False # Hide document footer in Focus Mode + self.showFullPath = True # Show full document path in editor header + self.autoSelect = True # Auto-select word when applying format with no selection + self.doJustify = False # Justify text + self.showTabsNSpaces = False # Show tabs and spaces in edior + self.showLineEndings = False # Show line endings in editor + + self.doReplace = True # Enable auto-replace as you type + self.doReplaceSQuote = True # Smart single quotes + self.doReplaceDQuote = True # Smart double quotes + self.doReplaceDash = True # Replace multiple hyphens with dashes + self.doReplaceDots = True # Replace three dots with ellipsis + + self.scrollPastEnd = True # Allow scrolling past end of document + self.autoScroll = False # Typewriter-like scrolling + self.autoScrollPos = 30 # Start point for typewriter-like scrolling + + self.wordCountTimer = 5.0 # Interval for word count update in seconds + self.bigDocLimit = 800 # Size threshold for heavy editor features in kilobytes + + self.highlightQuotes = True # Highlight text in quotes + self.highlightEmph = True # Add colour to text emphasis + + ## User-Selected Symbols self.fmtApostrophe = nwUnicode.U_RSQUO self.fmtSingleQuotes = [nwUnicode.U_LSQUO, nwUnicode.U_RSQUO] self.fmtDoubleQuotes = [nwUnicode.U_LDQUO, nwUnicode.U_RDQUO] + ## Spell Checking self.spellTool = None self.spellLanguage = None + ## Search Bar Switches self.searchCase = False self.searchWord = False self.searchRegEx = False diff --git a/nw/gui/doceditor.py b/nw/gui/doceditor.py index c6f0a0f4..9a2cb683 100644 --- a/nw/gui/doceditor.py +++ b/nw/gui/doceditor.py @@ -441,8 +441,7 @@ class GuiDocEditor(QTextEdit): if self.mainConf.scrollPastEnd: docFrame = self.qDocument.rootFrame().frameFormat() - docMargin = wH - uM - lM - 4*tB - 5*self.theTheme.fontPixelSize - docFrame.setBottomMargin(max(0, docMargin)) + docFrame.setBottomMargin(max(0, 0.6*(wH - uM - lM - 4*tB))) self.qDocument.rootFrame().setFrameFormat(docFrame) return @@ -794,7 +793,7 @@ class GuiDocEditor(QTextEdit): # Move the scroll bar vBar = self.verticalScrollBar() doAnim = QPropertyAnimation(vBar, b"value", self) - doAnim.setDuration(150) + doAnim.setDuration(120) doAnim.setStartValue(vBar.value()) doAnim.setEndValue(vBar.value() + cMov) doAnim.start()