Extended the logic of the 'Toggle Comment Block' action to consider the current selection first. 5_3_x

Fri, 15 Mar 2013 18:25:30 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Fri, 15 Mar 2013 18:25:30 +0100
branch
5_3_x
changeset 2491
c6e2c7b1a52e
parent 2489
4f6cc64ca547
child 2495
33cbc28c3ba9

Extended the logic of the 'Toggle Comment Block' action to consider the current selection first.
(grafted from 3d011f457ddddb4c43619f3d9b6ac7672b1f3eb7)

QScintilla/Editor.py file | annotate | diff | comparison | revisions
--- a/QScintilla/Editor.py	Wed Mar 13 19:24:23 2013 +0100
+++ b/QScintilla/Editor.py	Fri Mar 15 18:25:30 2013 +0100
@@ -3181,7 +3181,10 @@
         
         # check if line starts with our comment string (i.e. was commented
         # by our comment...() slots
-        if not self.text(line).strip().startswith(commentStr):
+        if self.hasSelectedText() and \
+           self.text(self.getSelection()[0]).strip().startswith(commentStr):
+            self.uncommentLineOrSelection()
+        elif not self.text(line).strip().startswith(commentStr):
             # it doesn't, so comment the line or selection
             self.commentLineOrSelection()
         else:

eric ide

mercurial