Handle comments with and without an initial space
This commit is contained in:
@@ -799,6 +799,9 @@ class GuiDocEditor(QTextEdit):
|
|||||||
if theText.startswith("@"):
|
if theText.startswith("@"):
|
||||||
logger.error("Cannot apply block format to keyword/value line")
|
logger.error("Cannot apply block format to keyword/value line")
|
||||||
return
|
return
|
||||||
|
elif theText.startswith("% "):
|
||||||
|
newText = theText[2:]
|
||||||
|
cOffset = 2
|
||||||
elif theText.startswith("%"):
|
elif theText.startswith("%"):
|
||||||
newText = theText[1:]
|
newText = theText[1:]
|
||||||
cOffset = 1
|
cOffset = 1
|
||||||
@@ -820,8 +823,8 @@ class GuiDocEditor(QTextEdit):
|
|||||||
|
|
||||||
# Apply new format
|
# Apply new format
|
||||||
if docAction == nwDocAction.BLOCK_COM:
|
if docAction == nwDocAction.BLOCK_COM:
|
||||||
theText = "%"+newText
|
theText = "% "+newText
|
||||||
cOffset -= 1
|
cOffset -= 2
|
||||||
elif docAction == nwDocAction.BLOCK_H1:
|
elif docAction == nwDocAction.BLOCK_H1:
|
||||||
theText = "# "+newText
|
theText = "# "+newText
|
||||||
cOffset -= 2
|
cOffset -= 2
|
||||||
|
|||||||
@@ -459,6 +459,9 @@ class GuiMain(QMainWindow):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
def passDocumentAction(self, theAction):
|
def passDocumentAction(self, theAction):
|
||||||
|
"""Pass on document action theAction to whatever document has
|
||||||
|
the focus. If no document has focus, the action is discarded.
|
||||||
|
"""
|
||||||
if self.docEditor.hasFocus():
|
if self.docEditor.hasFocus():
|
||||||
self.docEditor.docAction(theAction)
|
self.docEditor.docAction(theAction)
|
||||||
elif self.docViewer.hasFocus():
|
elif self.docViewer.hasFocus():
|
||||||
|
|||||||
Reference in New Issue
Block a user