Skip to content

Commit

Permalink
implement Clone for text_editor::Content
Browse files Browse the repository at this point in the history
  • Loading branch information
JL710 committed Feb 4, 2025
1 parent 1f9723a commit bbebdf3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion core/src/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ pub trait Renderer: crate::Renderer {
type Paragraph: Paragraph<Font = Self::Font> + 'static;

/// The [`Editor`] of this [`Renderer`].
type Editor: Editor<Font = Self::Font> + 'static;
type Editor: Editor<Font = Self::Font> + Clone + 'static;

/// The icon font of the backend.
const ICON_FONT: Self::Font;
Expand Down
2 changes: 1 addition & 1 deletion graphics/src/text/editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use std::fmt;
use std::sync::{self, Arc};

/// A multi-line text editor.
#[derive(Debug, PartialEq)]
#[derive(Clone, Debug, PartialEq)]
pub struct Editor(Option<Arc<Internal>>);

struct Internal {
Expand Down
2 changes: 2 additions & 0 deletions widget/src/text_editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -372,10 +372,12 @@ where
}

/// The content of a [`TextEditor`].
#[derive(Clone)]
pub struct Content<R = crate::Renderer>(RefCell<Internal<R>>)
where
R: text::Renderer;

#[derive(Clone)]
struct Internal<R>
where
R: text::Renderer,
Expand Down

0 comments on commit bbebdf3

Please sign in to comment.