docs: def readline(self, prompt=''):
          u'''Try to act like GNU readline.'''
          # handle startup_hook
          if self.first_prompt:
              self.first_prompt = False
              if self.startup_hook:
                  try:
                      self.startup_hook()
                  except:
                      print u'startup hook failed'
                      traceback.print_exc()
  
          c = self.console
          self.l_buffer.reset_line()
          self.prompt = prompt
          self._print_prompt()
  
          if self.pre_input_hook:
              try:
                  self.pre_input_hook()
              except:
                  print u'pre_input_hook failed'
                  traceback.print_exc()
                  self.pre_input_hook = None
  
          log(u"in readline: %s"%self.paste_line_buffer)
          if len(self.paste_line_buffer)>0:
              self.l_buffer=lineobj.ReadlineTextBuffer(self.paste_line_buffer[0])
              self._update_line()
              self.paste_line_buffer=self.paste_line_buffer[1:]
              c.write(u'\r\n')
          else:
              self._readline_from_keyboard()
              c.write(u'\r\n')
  
          self.add_history(self.l_buffer.copy())
  
          log(u'returning(%s)' % self.l_buffer.get_line_text())
          return self.l_buffer.get_line_text() + '\n'