code: def text(self, value):
          
          assert isinstance(value, six.text_type), 'Got %r' % value
          assert self.cursor_position <= len(value)
  
          # Don't allow editing of read-only buffers.
          if self.read_only():
              raise EditReadOnlyBuffer()
  
          changed = self._set_text(value)
  
          if changed:
              self._text_changed()
  
              # Reset history search text.
              self.history_search_text = None
docs: Setting text. (When doing this, make sure that the cursor_position is
          valid for this text. text/cursor_position should be consistent at any time,
          otherwise set a Document instead.)