@@ -704,8 +704,8 @@ impl Document {
704704 success
705705 }
706706
707− /// Undo the last modification to the [`Document`].
708− pub fn undo(&mut self, view_id: ViewId) {
707+ /// Undo the last modification to the [`Document`]. Returns whether the undo was successful.
708+ pub fn undo(&mut self, view_id: ViewId) -> bool {
709709 let mut history = self.history.take();
710710 let success = if let Some(transaction) = history.undo() {
711711 self.apply_impl(transaction, view_id)
@@ -718,10 +718,11 @@ impl Document {
718718 // reset changeset to fix len
719719 self.changes = ChangeSet::new(self.text());
720720 }
721+ success
721722 }
722723
723− /// Redo the last modification to the [`Document`].
724− pub fn redo(&mut self, view_id: ViewId) {
724+ /// Redo the last modification to the [`Document`]. Returns whether the redo was sucessful.
725+ pub fn redo(&mut self, view_id: ViewId) -> bool {
725726 let mut history = self.history.take();
726727 let success = if let Some(transaction) = history.redo() {
727728 self.apply_impl(transaction, view_id)
@@ -734,6 +735,7 @@ impl Document {
734735 // reset changeset to fix len
735736 self.changes = ChangeSet::new(self.text());
736737 }
738+ success
737739 }
738740
739741 pub fn savepoint(&mut self) {