--- 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: