ElyMark: R4.10 round 3 fixes; R4.10 marked [~]
The copy guard also compares the clipboard's HTML, which gpui omits, so a later rich copy with the same plain text is not overwritten. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
2c374b23ed
commit
65514599fe
6 files changed
+49
-4
No files matched your search
@@ -204,6 +204,32 @@ fn a_later_editor_copy_outlives_a_pending_conversion(cx: &mut TestAppContext) {
|
||||
assert_eq!(clipboard(cx).as_deref(), Some("alpha"));
|
||||
}
|
||||
|
||||
#[gpui::test]
|
||||
fn a_later_rich_copy_with_the_same_text_outlives_a_pending_conversion(cx: &mut TestAppContext) {
|
||||
use ely_platform::clipboard::{self, Clip};
|
||||
if std::env::var_os("ELY_CLIPBOARD_TEST").is_none() {
|
||||
eprintln!("SKIP: set ELY_CLIPBOARD_TEST=1; this replaces the clipboard");
|
||||
return;
|
||||
}
|
||||
let rich = |html: &str| Clip::Html {
|
||||
html: html.into(),
|
||||
text: "x".into(),
|
||||
};
|
||||
let (_desk, cx, _files) = opened("alpha *it*\n", cx);
|
||||
clipboard::write(&rich("<b>x</b>")).expect("writes");
|
||||
cx.write_to_clipboard(gpui::ClipboardItem::new_string("x".into()));
|
||||
cx.update(|window, cx| window.dispatch_action(Box::new(crate::export::CopyHtml), cx));
|
||||
clipboard::write(&rich("<i>x</i>")).expect("writes");
|
||||
cx.run_until_parked();
|
||||
let html = clipboard::html().expect("reads");
|
||||
assert_eq!(
|
||||
clipboard(cx).as_deref(),
|
||||
Some("x"),
|
||||
"the conversion is dropped"
|
||||
);
|
||||
assert!(html.is_some_and(|html| html.contains("<i>x</i>")));
|
||||
}
|
||||
|
||||
#[gpui::test]
|
||||
fn a_shut_menu_stays_shut_when_its_tab_returns(cx: &mut TestAppContext) {
|
||||
let (desk, cx, files) = opened("alpha\n", cx);
|
||||
|
||||
Reference in new issue
Block a user