windows: Improve platform clipboard (#11553)
CharlesChen0823
created
I thought platform clipboard should share one ctx. and fixed in vim
mode, read from clipboard crash when using `unwrap`.
Release Notes:
- N/A
Change summary
crates/gpui/src/platform/windows/platform.rs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Detailed changes
@@ -684,7 +684,7 @@ impl Platform for WindowsPlatform {
fn read_from_clipboard(&self) -> Option<ClipboardItem> {
let mut ctx = ClipboardContext::new().unwrap();
- let content = ctx.get_contents().unwrap();
+ let content = ctx.get_contents().ok()?;
Some(ClipboardItem {
text: content,
metadata: None,