editor: Make kill ring cut at EOF a no-op (#39069)

Release Notes:

- Emacs's kill ring cut at the end of the last line of the file will now
no-op instead of cutting the entire line
This commit is contained in:
AidanV
2025-09-29 08:55:38 -06:00
committed by GitHub
parent f96fd928d7
commit 163219af35
2 changed files with 9 additions and 1 deletions
+1 -1
View File
@@ -12338,7 +12338,7 @@ impl Editor {
}
});
});
let item = self.cut_common(true, window, cx);
let item = self.cut_common(false, window, cx);
cx.set_global(KillRing(item))
}
+8
View File
@@ -6742,6 +6742,14 @@ async fn test_cut_line_ends(cx: &mut TestAppContext) {
let mut cx = EditorTestContext::new(cx).await;
cx.set_state(indoc! {"The quick brownˇ"});
cx.update_editor(|e, window, cx| e.cut_to_end_of_line(&CutToEndOfLine::default(), window, cx));
cx.assert_editor_state(indoc! {"The quick brownˇ"});
cx.set_state(indoc! {"The emacs foxˇ"});
cx.update_editor(|e, window, cx| e.kill_ring_cut(&KillRingCut, window, cx));
cx.assert_editor_state(indoc! {"The emacs foxˇ"});
cx.set_state(indoc! {"
The quick« brownˇ»
fox jumps overˇ