repl: Set up a way to copy output from the REPL (#16649)
Closes #15494 Simple copy button to copy an individual output since selection is a bit more work. <img width="790" alt="image" src="https://github.com/user-attachments/assets/4a7d8b69-70cc-428e-8fe3-b95386d341ee"> Release Notes: - repl: Copy output from the REPL using a button --------- Co-authored-by: Mikayla <mikayla@zed.dev>
This commit is contained in:
parent
26f2369fa6
commit
80c25960dd
4 changed files with 231 additions and 23 deletions
|
@ -30,7 +30,7 @@ impl AssetSource for () {
|
|||
|
||||
/// A unique identifier for the image cache
|
||||
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
|
||||
pub struct ImageId(usize);
|
||||
pub struct ImageId(pub usize);
|
||||
|
||||
#[derive(PartialEq, Eq, Hash, Clone)]
|
||||
pub(crate) struct RenderImageParams {
|
||||
|
|
|
@ -1016,6 +1016,13 @@ impl ClipboardItem {
|
|||
}
|
||||
}
|
||||
|
||||
/// Create a new ClipboardItem::Image with the given image with no associated metadata
|
||||
pub fn new_image(image: &Image) -> Self {
|
||||
Self {
|
||||
entries: vec![ClipboardEntry::Image(image.clone())],
|
||||
}
|
||||
}
|
||||
|
||||
/// Concatenates together all the ClipboardString entries in the item.
|
||||
/// Returns None if there were no ClipboardString entries.
|
||||
pub fn text(&self) -> Option<String> {
|
||||
|
@ -1084,10 +1091,11 @@ pub enum ImageFormat {
|
|||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct Image {
|
||||
/// The image format the bytes represent (e.g. PNG)
|
||||
format: ImageFormat,
|
||||
pub format: ImageFormat,
|
||||
/// The raw image bytes
|
||||
bytes: Vec<u8>,
|
||||
id: u64,
|
||||
pub bytes: Vec<u8>,
|
||||
/// The unique ID for the image
|
||||
pub id: u64,
|
||||
}
|
||||
|
||||
impl Hash for Image {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue