fix: route normal-mode cuts through clipboard pipeline

This commit is contained in:
2026-10-17 00:46:22 +02:00
parent b9f29d258c
commit d8be35e3bd
7 changed files with 103 additions and 23 deletions
+24 -2
View File
@@ -6992,7 +6992,7 @@ mod system_clipboard {
let revision = editor.text_revision();
fixture.fail("fail-write", true);
for keys in [
"yy", "2y3y", "2dd", "cc", "C", "D", "Y", "s", "d2w", "d2b", "c2w", "c2b",
"x", "yy", "2y3y", "2dd", "cc", "C", "D", "Y", "s", "d2w", "d2b", "c2w", "c2b",
] {
type_text(&mut editor, keys);
assert_eq!(editor.context().text, "Xone\ntwo\nthree");
@@ -7007,6 +7007,29 @@ mod system_clipboard {
assert_eq!(editor.context().text, "XXone\ntXwo\nthree");
}
#[test]
fn normal_x_publishes_graphemes_and_repeat_failure_is_atomic() {
let fixture = Fixture::new();
let mut editor = fixture.editor();
editor
.apply(vec![Effect::Replace("e\u{301}👩‍🚀z".into())])
.unwrap();
type_text(&mut editor, "x");
assert_eq!(editor.context().text, "👩‍🚀z");
assert_eq!(fixture.bytes("state"), "e\u{301}".as_bytes());
fixture.fail("fail-write", true);
let before = state(&editor);
type_text(&mut editor, ".");
assert_eq!(state(&editor), before);
assert_eq!(fixture.bytes("state"), "e\u{301}".as_bytes());
fixture.fail("fail-write", false);
type_text(&mut editor, ".");
assert_eq!(editor.context().text, "z");
assert_eq!(fixture.bytes("state"), "👩‍🚀".as_bytes());
type_text(&mut editor, "uUP");
assert_eq!(editor.context().text, "👩‍🚀z");
}
#[test]
fn copy_line_publication_failure_keeps_owned_shape_register_and_full_state() {
let fixture = Fixture::new();
@@ -7707,7 +7730,6 @@ mod system_clipboard {
editor.set_clipboard_mode("system").unwrap();
editor.apply(vec![Effect::Replace("plain".into())]).unwrap();
set_carets(&mut editor, &[(0, 0)], 0);
type_text(&mut editor, "x.");
type_text(&mut editor, "iX");
editor.handle(Input::Backspace);
editor.handle(Input::Delete);