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

+18 -7
View File
@@ -7,7 +7,7 @@ use gpui::{
use super::MarkdownDocument;
use crate::{
documents::{MarkdownMode, render::draw_nodes},
forms::{Down, Up},
forms::{self, Down, Up},
primitives::FocusRing as _,
theme::{ActiveTheme, Radius, TextSize},
};
@@ -158,13 +158,24 @@ impl Render for MarkdownDocument {
MarkdownMode::Visual => root
.key_context(CONTEXT)
.track_focus(&self.focus)
.on_action(cx.listener(|document, _: &Undo, _, cx| {
document.commit(cx);
document.editor.update(cx, |editor, cx| editor.undo(cx));
.on_action(cx.listener(|document, _: &Undo, window, cx| {
document.history(false, window, cx);
}))
.on_action(cx.listener(|document, _: &Redo, _, cx| {
document.commit(cx);
document.editor.update(cx, |editor, cx| editor.redo(cx));
.on_action(cx.listener(|document, _: &Redo, window, cx| {
document.history(true, window, cx);
}))
// An untouched block leaves undo to the document.
.capture_action(cx.listener(|document, _: &forms::Undo, window, cx| {
if document.untouched(cx) {
cx.stop_propagation();
document.history(false, window, cx);
}
}))
.capture_action(cx.listener(|document, _: &forms::Redo, window, cx| {
if document.untouched(cx) {
cx.stop_propagation();
document.history(true, window, cx);
}
}))
.capture_action(cx.listener(|document, _: &Up, window, cx| {
if document.step(false, window, cx) {