@@ -834,11 +834,11 @@ impl Document {
837− fn undo_redo_impl(&mut self, view_id: ViewId, undo: bool) -> bool {
837+ fn undo_redo_impl(&mut self, view: &mut View, undo: bool) -> bool {
838 let mut history = self.history.take();
838 let mut history = self.history.take();
839 let txn = if undo { history.undo() } else { history.redo() };
839 let txn = if undo { history.undo() } else { history.redo() };
840 let success = if let Some(txn) = txn {
840 let success = if let Some(txn) = txn {
841− self.apply_impl(txn, view_id)
841+ self.apply_impl(txn, view.id) && view.apply(txn, self)
@@ -852,13 +852,13 @@ impl Document {
854 /// Undo the last modification to the [`Document`]. Returns whether the undo was successful.
854 /// Undo the last modification to the [`Document`]. Returns whether the undo was successful.
855− pub fn undo(&mut self, view_id: ViewId) -> bool {
855+ pub fn undo(&mut self, view: &mut View) -> bool {
856− self.undo_redo_impl(view_id, true)
856+ self.undo_redo_impl(view, true)
859 /// Redo the last modification to the [`Document`]. Returns whether the redo was successful.
859 /// Redo the last modification to the [`Document`]. Returns whether the redo was successful.
860− pub fn redo(&mut self, view_id: ViewId) -> bool {
860+ pub fn redo(&mut self, view: &mut View) -> bool {
861− self.undo_redo_impl(view_id, false)
861+ self.undo_redo_impl(view, false)
864 pub fn savepoint(&mut self) {
864 pub fn savepoint(&mut self) {
@@ -871,7 +871,7 @@ impl Document {
874− fn earlier_later_impl(&mut self, view_id: ViewId, uk: UndoKind, earlier: bool) -> bool {
874+ fn earlier_later_impl(&mut self, view: &mut View, uk: UndoKind, earlier: bool) -> bool {
875 let txns = if earlier {
875 let txns = if earlier {
876 self.history.get_mut().earlier(uk)
876 self.history.get_mut().earlier(uk)
@@ -879,7 +879,7 @@ impl Document {
880 let mut success = false;
880 let mut success = false;
881 for txn in txns {
881 for txn in txns {
882− if self.apply_impl(&txn, view_id) {
882+ if self.apply_impl(&txn, view.id) && view.apply(&txn, self) {
883 success = true;
883 success = true;
@@ -891,13 +891,13 @@ impl Document {
893 /// Undo modifications to the [`Document`] according to `uk`.
893 /// Undo modifications to the [`Document`] according to `uk`.
894− pub fn earlier(&mut self, view_id: ViewId, uk: UndoKind) -> bool {
894+ pub fn earlier(&mut self, view: &mut View, uk: UndoKind) -> bool {
895− self.earlier_later_impl(view_id, uk, true)
895+ self.earlier_later_impl(view, uk, true)
898 /// Redo modifications to the [`Document`] according to `uk`.
898 /// Redo modifications to the [`Document`] according to `uk`.
899− pub fn later(&mut self, view_id: ViewId, uk: UndoKind) -> bool {
899+ pub fn later(&mut self, view: &mut View, uk: UndoKind) -> bool {
900− self.earlier_later_impl(view_id, uk, false)
900+ self.earlier_later_impl(view, uk, false)
903 /// Commit pending changes to history
903 /// Commit pending changes to history