parameters: (self)
docstring: Display proper prompt for the context: ps1, ps2 or ps3.
          
          If this is a continuation line, autoindent as necessary.
docstring_summary: Display proper prompt for the context: ps1, ps2 or ps3.
          
          If this is a continuation line, autoindent as necessary.
docstring_tokens: Display proper prompt for the context : ps1 ps2 or ps3 . If this is a continuation line autoindent as necessary .
function: def prompt(self): # Autoindent added!!!
          """Display proper prompt for the context: ps1, ps2 or ps3.
          
          If this is a continuation line, autoindent as necessary."""
          # TODO : How much of this can I do away with now without prompts??
          
          isreading = self.reader.isreading
          
          skip = True
          if isreading:
              prompt = str(sys.ps3)
          elif self.more:
              prompt = str(sys.ps2)
          else:
              prompt = str(sys.ps1)
          pos = self.GetCurLine()[1]
          if pos > 0:
              if isreading:
                  skip = True
              else:
                  self.write(os.linesep,type='Input')
          if not self.more:
              # Not needed anymore! # self.promptPosStart = self.GetCurrentPos()
              pass
          if not skip:
              self.write(prompt,type='Input')
          if not self.more:
              # Not needed anymore! # self.promptPosEnd = self.GetCurrentPos()
              # Clear the undo history after running a command.
              self.EmptyUndoBuffer()
          
          #DNM/CP
          # Autoindent magic
          # Match the indent of the line above
          # UNLESS the line above ends in a colon...then add four spaces
          # (after valid keywords (if, else, etc...) only)
          if self.more:
              line_num=self.GetCurrentLine()
              currentLine=self.GetLine(line_num)
              previousLine=self.GetLine(line_num-1)
              pstrip=previousLine.strip()
              lstrip=previousLine.lstrip()
              
              if pstrip == '':
                  # because it is all whitespace!
                  indent=previousLine.strip('\n').strip('\r')
              else:
                  indent=previousLine[:(len(previousLine)-len(lstrip))]
                  if testForContinuations(previousLine,ignoreErrors=True)[1][0]:
                      indent+=' '*4
              
              #ADD UNDO
              cpos=self.GetCurrentPos()
              s=indent
              self.UpdateUndoHistoryBefore('insert',s,cpos,cpos+len(s))
              self.write(s,type='Input')
              self.UpdateUndoHistoryAfter()
              
              
          self.EnsureCaretVisible()
          self.ScrollToColumn(0)
function_tokens: def prompt ( self ) : # Autoindent added!!! # TODO : How much of this can I do away with now without prompts?? isreading = self . reader . isreading skip = True if isreading : prompt = str ( sys . ps3 ) elif self . more : prompt = str ( sys . ps2 ) else : prompt = str ( sys . ps1 ) pos = self . GetCurLine ( ) [ 1 ] if pos > 0 : if isreading : skip = True else : self . write ( os . linesep , type = 'Input' ) if not self . more : # Not needed anymore! # self.promptPosStart = self.GetCurrentPos() pass if not skip : self . write ( prompt , type = 'Input' ) if not self . more : # Not needed anymore! # self.promptPosEnd = self.GetCurrentPos() # Clear the undo history after running a command. self . EmptyUndoBuffer ( ) #DNM/CP # Autoindent magic # Match the indent of the line above # UNLESS the line above ends in a colon...then add four spaces # (after valid keywords (if, else, etc...) only) if self . more : line_num = self . GetCurrentLine ( ) currentLine = self . GetLine ( line_num ) previousLine = self . GetLine ( line_num - 1 ) pstrip = previousLine . strip ( ) lstrip = previousLine . lstrip ( ) if pstrip == '' : # because it is all whitespace! indent = previousLine . strip ( '\n' ) . strip ( '\r' ) else : indent = previousLine [ : ( len ( previousLine ) - len ( lstrip ) ) ] if testForContinuations ( previousLine , ignoreErrors = True ) [ 1 ] [ 0 ] : indent += ' ' * 4 #ADD UNDO cpos = self . GetCurrentPos ( ) s = indent self . UpdateUndoHistoryBefore ( 'insert' , s , cpos , cpos + len ( s ) ) self . write ( s , type = 'Input' ) self . UpdateUndoHistoryAfter ( ) self . EnsureCaretVisible ( ) self . ScrollToColumn ( 0 )