Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement Clone for text_editor::Content #2787

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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