fix: yank whole lines with yy and preserve paste shape

This commit is contained in:
Valdemar Lorenzen
2026-10-13 12:59:07 +02:00
parent c4f72a45ba
commit c912abaf17
7 changed files with 417 additions and 12 deletions
+16
View File
@@ -0,0 +1,16 @@
use vamp::editor::{Editor, Effect, Input};
#[test]
fn yy_copies_current_whole_line_for_paste_below_it() {
let mut editor = Editor::open(None, vec![]).unwrap();
editor.set_clipboard_mode("separate").unwrap();
editor
.apply(vec![Effect::Replace("first\nsecond\n".into())])
.unwrap();
for key in "llyy".chars() {
editor.handle(Input::Char(key));
}
assert_eq!(editor.cursor().column, 2);
assert_eq!(editor.context().text, "first\nsecond\n");
editor.handle(Input::Char('p'));
assert_eq!(editor.context().text, "first\nfirst\nsecond\n");
}