documents: one undo history; a block's own never runs
Undo or redo in an open block writes it back as one step and steps the document, so redo survives mode switches and further undos. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
a3d9f089a3
commit
639521e109
4 files changed
+35
-39
No files matched your search
@@ -1,6 +1,6 @@
|
||||
use std::ops::Range;
|
||||
|
||||
use gpui::{App, AppContext as _, Context, Focusable as _, Window};
|
||||
use gpui::{AppContext as _, Context, Focusable as _, Window};
|
||||
|
||||
use super::{DocumentEvent, MarkdownDocument, Open};
|
||||
use crate::{
|
||||
@@ -31,13 +31,6 @@ impl MarkdownDocument {
|
||||
}
|
||||
}
|
||||
|
||||
/// The open block has no step left that way.
|
||||
pub(super) fn at_edge_of_history(&self, redo: bool, cx: &App) -> bool {
|
||||
self.open
|
||||
.as_ref()
|
||||
.is_some_and(|open| !open.input.read(cx).can_step(redo))
|
||||
}
|
||||
|
||||
/// Undo or redo in the document's one history.
|
||||
pub(super) fn history(&mut self, redo: bool, window: &mut Window, cx: &mut Context<Self>) {
|
||||
self.commit(cx);
|
||||
|
||||
Reference in new issue
Block a user