diff options
| author | alex-ds13 <145657253+alex-ds13@users.noreply.github.com> | 2025-12-04 03:12:37 +0000 |
|---|---|---|
| committer | Polesznyák Márk <contact@pml68.dev> | 2025-12-30 18:13:59 +0100 |
| commit | 1b54e952d15fafac0c086f8312a6c3c64c9d120b (patch) | |
| tree | 72a85ae141ea7d1d3ebc3f0028608c0b04caf9fd /src | |
| parent | feat(selectable): draft implementation of selectable widget (diff) | |
| download | iced_selection-1b54e952d15fafac0c086f8312a6c3c64c9d120b.tar.gz | |
fix(selectable): update docs with warning about selectable usage
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib.rs | 13 | ||||
| -rw-r--r-- | src/selectable.rs | 8 |
2 files changed, 20 insertions, 1 deletions
@@ -229,9 +229,20 @@ pub fn span<'a, Link>( text::Span::new(text) } -/// Creates some [`Selectable`] with the given content. +/// Creates some [`Selectable`] with the given content. This [`Selectable`] will make all inner +/// [`Text`] or [`Rich`] change their behavior from an independent selectable to a global +/// selectable which makes it so you can select across widgets and start selections out of bounds +/// of widgets. This [`Selectable`] will also handle the 'ctrl + c' shortcut by getting all the +/// selected text inside it and write it to the clipboard. +/// +/// WARNING: You should only have one [`Selectable`] on your app, preferrably as the root of your +/// app to make sure that any [`Text`] or [`Rich`] is inside it. Having multiple selectables or a +/// selectable along side some [`Text`] or [`Rich`] is undefined behavior and even though the +/// selection might look ok for you the copied text will probably not be what you expect. /// /// [`Selectable`]: crate::selectable::Selectable +/// [`Text`]: crate::Text +/// [`Rich`]: crate::text::Rich /// /// # Example /// ```no_run,ignore diff --git a/src/selectable.rs b/src/selectable.rs index 217f913..fc0e996 100644 --- a/src/selectable.rs +++ b/src/selectable.rs @@ -4,6 +4,10 @@ //! for all selections contained inside it and writing to the [`Standard`] clipboard when there is //! some selection. //! +//! WARNING: You should only have one [`Selectable`] on your app, preferrably as the root of your +//! app to make sure that any [`Text`] or [`Rich`] is inside it. Having multiple selectables or a +//! selectable along side some [`Text`] or [`Rich`] is undefined behavior and even though the +//! selection might look ok for you the copied text will probably not be what you expect. //! //! [`Text`]: crate::Text //! [`Rich`]: crate::text::Rich @@ -25,6 +29,10 @@ use crate::core::{ /// for all selections contained inside it and writing to the [`Standard`] clipboard when there is /// some selection. /// +/// WARNING: You should only have one [`Selectable`] on your app, preferrably as the root of your +/// app to make sure that any [`Text`] or [`Rich`] is inside it. Having multiple selectables or a +/// selectable along side some [`Text`] or [`Rich`] is undefined behavior and even though the +/// selection might look ok for you the copied text will probably not be what you expect. /// /// [`Text`]: crate::Text /// [`Rich`]: crate::text::Rich |
