@@ -704,8 +704,8 @@ impl Document {
707− /// Undo the last modification to the [`Document`].
707+ /// Undo the last modification to the [`Document`]. Returns whether the undo was successful.
708− pub fn undo(&mut self, view_id: ViewId) {
708+ pub fn undo(&mut self, view_id: ViewId) -> bool {
709 let mut history = self.history.take();
709 let mut history = self.history.take();
710 let success = if let Some(transaction) = history.undo() {
710 let success = if let Some(transaction) = history.undo() {
711 self.apply_impl(transaction, view_id)
711 self.apply_impl(transaction, view_id)
@@ -718,10 +718,11 @@ impl Document {
718 // reset changeset to fix len
718 // reset changeset to fix len
719 self.changes = ChangeSet::new(self.text());
719 self.changes = ChangeSet::new(self.text());
723− /// Redo the last modification to the [`Document`].
724+ /// Redo the last modification to the [`Document`]. Returns whether the redo was sucessful.
724− pub fn redo(&mut self, view_id: ViewId) {
725+ pub fn redo(&mut self, view_id: ViewId) -> bool {
725 let mut history = self.history.take();
726 let mut history = self.history.take();
726 let success = if let Some(transaction) = history.redo() {
727 let success = if let Some(transaction) = history.redo() {
727 self.apply_impl(transaction, view_id)
728 self.apply_impl(transaction, view_id)
@@ -734,6 +735,7 @@ impl Document {
734 // reset changeset to fix len
735 // reset changeset to fix len
735 self.changes = ChangeSet::new(self.text());
736 self.changes = ChangeSet::new(self.text());
739 pub fn savepoint(&mut self) {
741 pub fn savepoint(&mut self) {