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

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

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Fri, 15 Mar 2013 18:25:30 +0100
changeset 2490
3d011f457ddd
parent 2488
0ac8e48f7092
child 2492
91ab554e3465

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

QScintilla/Editor.py file | annotate | diff | comparison | revisions
diff -r 0ac8e48f7092 -r 3d011f457ddd QScintilla/Editor.py
--- a/QScintilla/Editor.py	Wed Mar 13 19:23:22 2013 +0100
+++ b/QScintilla/Editor.py	Fri Mar 15 18:25:30 2013 +0100
@@ -3157,7 +3157,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