From 163219af356a17d1b87a7327dca81bf35bae7f2f Mon Sep 17 00:00:00 2001 From: AidanV <84053180+AidanV@users.noreply.github.com> Date: Mon, 29 Sep 2025 07:55:38 -0700 Subject: [PATCH] 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 --- crates/editor/src/editor.rs | 2 +- crates/editor/src/editor_tests.rs | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index 037844239c39fb6aa6754e897b1c859ec965e102..e261df4867779a5ecebd8ca4f1dc52394bac62e8 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -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)) } diff --git a/crates/editor/src/editor_tests.rs b/crates/editor/src/editor_tests.rs index b85998c6b821560df8abc17e8ef4bb01ca1a7b6e..c6692e00fd66b333c367a193ec59398af4391d62 100644 --- a/crates/editor/src/editor_tests.rs +++ b/crates/editor/src/editor_tests.rs @@ -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ˇ