diff --git a/core/src/text.rs b/core/src/text.rs index a7e1f28163..228d6ee9ba 100644 --- a/core/src/text.rs +++ b/core/src/text.rs @@ -191,7 +191,7 @@ pub trait Renderer: crate::Renderer { type Paragraph: Paragraph + 'static; /// The [`Editor`] of this [`Renderer`]. - type Editor: Editor + 'static; + type Editor: Editor + Clone + 'static; /// The icon font of the backend. const ICON_FONT: Self::Font; diff --git a/graphics/src/text/editor.rs b/graphics/src/text/editor.rs index c73d189c8e..c317205bde 100644 --- a/graphics/src/text/editor.rs +++ b/graphics/src/text/editor.rs @@ -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>); struct Internal { diff --git a/widget/src/text_editor.rs b/widget/src/text_editor.rs index e685256bff..595bfb57c7 100644 --- a/widget/src/text_editor.rs +++ b/widget/src/text_editor.rs @@ -372,10 +372,12 @@ where } /// The content of a [`TextEditor`]. +#[derive(Clone)] pub struct Content(RefCell>) where R: text::Renderer; +#[derive(Clone)] struct Internal where R: text::Renderer,