'This should be called when the buffer has been changed
somehow.  It will handle unsaved flag and undo updating.
Args:
buf (str): The text to update the buffer with.'

def update_buffer(self, buf):

    if is_iter(buf):
        buf = '\n'.join(buf)
    if (buf != self._buffer):
        self._buffer = buf
        self.update_undo()
        self._unsaved = True
        if self._persistent:
            self._caller.attributes.add('_eveditor_buffer_temp', (self._buffer, self._undo_buffer))
            self._caller.attributes.add('_eveditor_unsaved', True)
            self._caller.attributes.add('_eveditor_indent', self._indent)
