Only apply format to the first block when multiple blocks are selected
This commit is contained in:
+1
-1
@@ -955,4 +955,4 @@ class Config:
|
||||
|
||||
return
|
||||
|
||||
# End Class Config
|
||||
# END Class Config
|
||||
|
||||
+13
-1
@@ -1299,13 +1299,25 @@ class GuiDocEditor(QTextEdit):
|
||||
return theCursor
|
||||
|
||||
def _toggleFormat(self, fLen, fChar):
|
||||
"""Toggle strikethrough text.
|
||||
"""Toggle the formatting of a specific type for a piece of text.
|
||||
If more than one block is selected, the formatting is applied to
|
||||
the first block.
|
||||
"""
|
||||
theCursor = self._autoSelect()
|
||||
if theCursor.hasSelection():
|
||||
posS = theCursor.selectionStart()
|
||||
posE = theCursor.selectionEnd()
|
||||
|
||||
blockS = self.qDocument.findBlock(posS)
|
||||
blockE = self.qDocument.findBlock(posE)
|
||||
|
||||
if blockS != blockE:
|
||||
posE = blockS.position() + blockS.length() - 1
|
||||
theCursor.clearSelection()
|
||||
theCursor.setPosition(posS, QTextCursor.MoveAnchor)
|
||||
theCursor.setPosition(posE, QTextCursor.KeepAnchor)
|
||||
self.setTextCursor(theCursor)
|
||||
|
||||
numB = 0
|
||||
for n in range(fLen):
|
||||
if self.qDocument.characterAt(posS-n-1) == fChar:
|
||||
|
||||
Reference in New Issue
Block a user