@@ -857,11 +857,11 @@ impl Document {
857857 success
858858 }
859859
860− fn undo_redo_impl(&mut self, view: &mut View, undo: bool) -> bool {
860+ fn undo_redo_impl(&mut self, view_id: ViewId, undo: bool) -> bool {
861861 let mut history = self.history.take();
862862 let txn = if undo { history.undo() } else { history.redo() };
863863 let success = if let Some(txn) = txn {
864− self.apply_impl(txn, view.id) && view.apply(txn, self)
864+ self.apply_impl(txn, view_id)
865865 } else {
866866 false
867867 };
@@ -875,13 +875,13 @@ impl Document {
875875 }
876876
877877 /// Undo the last modification to the [`Document`]. Returns whether the undo was successful.
878− pub fn undo(&mut self, view: &mut View) -> bool {
879− self.undo_redo_impl(view, true)
878+ pub fn undo(&mut self, view_id: ViewId) -> bool {
879+ self.undo_redo_impl(view_id, true)
880880 }
881881
882882 /// Redo the last modification to the [`Document`]. Returns whether the redo was successful.
883− pub fn redo(&mut self, view: &mut View) -> bool {
884− self.undo_redo_impl(view, false)
883+ pub fn redo(&mut self, view_id: ViewId) -> bool {
884+ self.undo_redo_impl(view_id, false)
885885 }
886886
887887 pub fn savepoint(&mut self) {
@@ -894,7 +894,7 @@ impl Document {
894894 }
895895 }
896896
897− fn earlier_later_impl(&mut self, view: &mut View, uk: UndoKind, earlier: bool) -> bool {
897+ fn earlier_later_impl(&mut self, view_id: ViewId, uk: UndoKind, earlier: bool) -> bool {
898898 let txns = if earlier {
899899 self.history.get_mut().earlier(uk)
900900 } else {
@@ -902,7 +902,7 @@ impl Document {
902902 };
903903 let mut success = false;
904904 for txn in txns {
905− if self.apply_impl(&txn, view.id) && view.apply(&txn, self) {
905+ if self.apply_impl(&txn, view_id) {
906906 success = true;
907907 }
908908 }
@@ -914,13 +914,13 @@ impl Document {
914914 }
915915
916916 /// Undo modifications to the [`Document`] according to `uk`.
917− pub fn earlier(&mut self, view: &mut View, uk: UndoKind) -> bool {
918− self.earlier_later_impl(view, uk, true)
917+ pub fn earlier(&mut self, view_id: ViewId, uk: UndoKind) -> bool {
918+ self.earlier_later_impl(view_id, uk, true)
919919 }
920920
921921 /// Redo modifications to the [`Document`] according to `uk`.
922− pub fn later(&mut self, view: &mut View, uk: UndoKind) -> bool {
923− self.earlier_later_impl(view, uk, false)
922+ pub fn later(&mut self, view_id: ViewId, uk: UndoKind) -> bool {
923+ self.earlier_later_impl(view_id, uk, false)
924924 }
925925
926926 /// Commit pending changes to history