3179 commentStr = self.lexer_.commentStr() |
3179 commentStr = self.lexer_.commentStr() |
3180 line, index = self.getCursorPosition() |
3180 line, index = self.getCursorPosition() |
3181 |
3181 |
3182 # check if line starts with our comment string (i.e. was commented |
3182 # check if line starts with our comment string (i.e. was commented |
3183 # by our comment...() slots |
3183 # by our comment...() slots |
3184 if not self.text(line).strip().startswith(commentStr): |
3184 if self.hasSelectedText() and \ |
|
3185 self.text(self.getSelection()[0]).strip().startswith(commentStr): |
|
3186 self.uncommentLineOrSelection() |
|
3187 elif not self.text(line).strip().startswith(commentStr): |
3185 # it doesn't, so comment the line or selection |
3188 # it doesn't, so comment the line or selection |
3186 self.commentLineOrSelection() |
3189 self.commentLineOrSelection() |
3187 else: |
3190 else: |
3188 # determine the start of the comment block |
3191 # determine the start of the comment block |
3189 begline = line |
3192 begline = line |