parameters: (self, start, end, uncomment=False)
docstring: (Un)Comments a line or a selected block of text
          in a document.
          @param start: beginning line (int)
          @param end: end line (int)
          @keyword uncomment: uncomment selection
docstring_summary: (Un)Comments a line or a selected block of text
          in a document.
          @param start: beginning line (int)
          @param end: end line (int)
          @keyword uncomment: uncomment selection
docstring_tokens: ( Un ) Comments a line or a selected block of text in a document . @param start : beginning line ( int ) @param end : end line ( int ) @keyword uncomment : uncomment selection
function: def Comment(self, start, end, uncomment=False):
          """(Un)Comments a line or a selected block of text
          in a document.
          @param start: beginning line (int)
          @param end: end line (int)
          @keyword uncomment: uncomment selection
  
          """
          if len(self._code['comment']):
              sel = self.GetSelection()
              c_start = self._code['comment'][0]
              c_end = u''
              if len(self._code['comment']) > 1:
                  c_end = self._code['comment'][1]
  
              # Modify the selected line(s)
              self.BeginUndoAction()
              try:
                  nchars = 0
                  lines = range(start, end+1)
                  lines.reverse()
                  for line_num in lines:
                      lstart = self.PositionFromLine(line_num)
                      lend = self.GetLineEndPosition(line_num)
                      text = self.GetTextRange(lstart, lend)
                      tmp = text.strip()
                      if len(tmp):
                          if uncomment:
                              if tmp.startswith(c_start):
                                  text = text.replace(c_start, u'', 1)
                              if c_end and tmp.endswith(c_end):
                                  text = text.replace(c_end, u'', 1)
                              nchars = nchars - len(c_start + c_end)
                          else:
                              text = c_start + text + c_end
                              nchars = nchars + len(c_start + c_end)
  
                          self.SetTargetStart(lstart)
                          self.SetTargetEnd(lend)
                          self.ReplaceTarget(text)
              finally:
                  self.EndUndoAction()
                  if sel[0] != sel[1]:
                      self.SetSelection(sel[0], sel[1] + nchars)
                  else:
                      if len(self._code['comment']) > 1:
                          nchars = nchars - len(self._code['comment'][1])
                      self.GotoPos(sel[0] + nchars)
function_tokens: def Comment ( self , start , end , uncomment = False ) : if len ( self . _code [ 'comment' ] ) : sel = self . GetSelection ( ) c_start = self . _code [ 'comment' ] [ 0 ] c_end = u'' if len ( self . _code [ 'comment' ] ) > 1 : c_end = self . _code [ 'comment' ] [ 1 ] # Modify the selected line(s) self . BeginUndoAction ( ) try : nchars = 0 lines = range ( start , end + 1 ) lines . reverse ( ) for line_num in lines : lstart = self . PositionFromLine ( line_num ) lend = self . GetLineEndPosition ( line_num ) text = self . GetTextRange ( lstart , lend ) tmp = text . strip ( ) if len ( tmp ) : if uncomment : if tmp . startswith ( c_start ) : text = text . replace ( c_start , u'' , 1 ) if c_end and tmp . endswith ( c_end ) : text = text . replace ( c_end , u'' , 1 ) nchars = nchars - len ( c_start + c_end ) else : text = c_start + text + c_end nchars = nchars + len ( c_start + c_end ) self . SetTargetStart ( lstart ) self . SetTargetEnd ( lend ) self . ReplaceTarget ( text ) finally : self . EndUndoAction ( ) if sel [ 0 ] != sel [ 1 ] : self . SetSelection ( sel [ 0 ] , sel [ 1 ] + nchars ) else : if len ( self . _code [ 'comment' ] ) > 1 : nchars = nchars - len ( self . _code [ 'comment' ] [ 1 ] ) self . GotoPos ( sel [ 0 ] + nchars )