Skip to content
Permalink
Browse files

[pyqgis-console] fix comment/uncomment code also on Windows OS

  • Loading branch information
slarosa committed May 1, 2013
1 parent e11f4e8 commit 36e613ae5af7b512e47b757d720449adf94542aa
Showing with 12 additions and 20 deletions.
  1. +12 −20 python/console/console_editor.py
@@ -389,32 +389,24 @@ def commentEditorCode(self, commentCheck):
if self.hasSelectedText():
startLine, _, endLine, _ = self.getSelection()
for line in range(startLine, endLine + 1):
selCmd = self.text(line)
self.setSelection(line, 0, line, selCmd.length())
self.removeSelectedText()
if commentCheck:
self.insert('#' + selCmd)
self.setCursorPosition(endLine, selCmd.length())
self.insertAt('#', line, 0)
else:
if selCmd.startsWith('#'):
self.insert(selCmd[1:])
else:
self.insert(selCmd)
self.setCursorPosition(endLine, self.text(line).length() - 1)
if not self.text(line).trimmed().startsWith('#'):
continue
self.setSelection(line, self.indentation(line),
line, self.indentation(line) + 1)
self.removeSelectedText()
else:
line, pos = self.getCursorPosition()
selCmd = self.text(line)
self.setSelection(line, 0, line, selCmd.length())
self.removeSelectedText()
if commentCheck:
self.insert('#' + selCmd)
self.setCursorPosition(line, selCmd.length())
self.insertAt('#', line, 0)
else:
if selCmd.startsWith('#'):
self.insert(selCmd[1:])
else:
self.insert(selCmd)
self.setCursorPosition(line, self.text(line).length() - 1)
if not self.text(line).trimmed().startsWith('#'):
return
self.setSelection(line, self.indentation(line),
line, self.indentation(line) + 1)
self.removeSelectedText()
self.endUndoAction()

def createTempFile(self):

0 comments on commit 36e613a

Please sign in to comment.
You can’t perform that action at this time.