documents: undo in an untouched block steps the document; visual after preview opens an empty end
CI / platforms (windows-latest) (push) Failing after 8s
CI / site (push) Successful in 22s
CI / crate (push) Failing after 11m33s
CI / platforms (ubuntu-24.04) (push) Canceled after 0s

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
ZacharyZhang-NYandClaude Opus 5.5 committed 2026-10-12 04:14:19 -04:00
1 parent 6f0401e967
commit 362a0fc9fa
4 files changed
+86 -8

No files matched your search

+19 -1
View File
@@ -1,6 +1,6 @@
use std::ops::Range;
use gpui::{AppContext as _, Context, Focusable as _, Window};
use gpui::{App, AppContext as _, Context, Focusable as _, Window};
use super::{DocumentEvent, MarkdownDocument, Open};
use crate::{
@@ -31,6 +31,24 @@ impl MarkdownDocument {
}
}
/// The open block still holds what it opened with.
pub(super) fn untouched(&self, cx: &App) -> bool {
self.open.as_ref().is_some_and(|open| {
open.input.read(cx).text() == &self.editor.read(cx).text()[open.range.clone()]
})
}
/// 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);
self.editor.update(cx, |editor, cx| match redo {
true => editor.redo(cx),
false => editor.undo(cx),
});
window.focus(&self.focus, cx);
self.focused(window, cx);
}
/// Opens block `ix` as shown, or one past the end.
pub(super) fn open(
&mut self,