code: def _set_input_buffer(self, text):
          
          if self.current_prompt_pos is not None:
              self.replace_text(self.current_prompt_pos, 'eol', text)
          else:
              self.insert(text)
          self.set_cursor_position('eof')
docs: Set input buffer