Block adding spaces before colon (French language feature) in certain meta data cases
This commit is contained in:
@@ -1982,12 +1982,14 @@ class GuiDocEditor(QTextEdit):
|
||||
|
||||
tCheck = tInsert
|
||||
if tCheck in self.mainConf.fmtPadBefore:
|
||||
nDelete = max(nDelete, 1)
|
||||
tInsert = self._typPadChar + tInsert
|
||||
if self.allowSpaceBeforeColon(theText, tCheck):
|
||||
nDelete = max(nDelete, 1)
|
||||
tInsert = self._typPadChar + tInsert
|
||||
|
||||
if tCheck in self.mainConf.fmtPadAfter:
|
||||
nDelete = max(nDelete, 1)
|
||||
tInsert = tInsert + self._typPadChar
|
||||
if self.allowSpaceBeforeColon(theText, tCheck):
|
||||
nDelete = max(nDelete, 1)
|
||||
tInsert = tInsert + self._typPadChar
|
||||
|
||||
if nDelete > 0:
|
||||
theCursor.movePosition(QTextCursor.Left, QTextCursor.KeepAnchor, nDelete)
|
||||
@@ -1995,6 +1997,20 @@ class GuiDocEditor(QTextEdit):
|
||||
|
||||
return
|
||||
|
||||
@staticmethod
|
||||
def _allowSpaceBeforeColon(text, char):
|
||||
"""Special checker function only used by the insert space
|
||||
feature for French, Spanish, etc, so it doesn't insert a
|
||||
sapce before colons in meta data lines.
|
||||
"""
|
||||
if char == ":" and len(text) > 1:
|
||||
if text[0] == "@":
|
||||
return False
|
||||
if text[0] == "%":
|
||||
if text[1:].lstrip()[:9].lower() == "synopsis:":
|
||||
return False
|
||||
return True
|
||||
|
||||
def _updateHeaders(self, checkPos=False, checkLevel=False):
|
||||
"""Update the headers record and return True if anything
|
||||
changed, if a check flag was provided.
|
||||
|
||||
Reference in New Issue
Block a user