From 7a1922f391fc8625ab51b75e2cda5c2470c724fc Mon Sep 17 00:00:00 2001
From: sam edelsten <samedelsten1@gmail.com>
Date: Tue, 30 Apr 2024 16:47:02 +0100
Subject: [PATCH] fix doctests, add missing docs

---
 src/cursor.rs      | 12 ++++++++++++
 src/input.rs       |  3 +++
 src/lib.rs         |  8 --------
 src/placeholder.rs |  5 +----
 src/util.rs        |  2 +-
 5 files changed, 17 insertions(+), 13 deletions(-)

diff --git a/src/cursor.rs b/src/cursor.rs
index f7c5056..04bb4e0 100644
--- a/src/cursor.rs
+++ b/src/cursor.rs
@@ -8,6 +8,18 @@ use bevy::{input::mouse::MouseMotion, prelude::*, window::PrimaryWindow};
 #[derive(SystemSet, Debug, Clone, PartialEq, Eq, Hash)]
 pub struct CursorSet;
 
+/// Config enum for mouse cursor events.
+#[derive(Default, Clone)]
+pub enum CursorConfig {
+    /// Emit [`TextHoverIn`] and [`TextHoverOut`] events and change mouse cursor on hover
+    #[default]
+    Default,
+    /// Emit [`TextHoverIn`] and [`TextHoverOut`] events, but do not change the cursor
+    Events,
+    /// Ignore mouse events
+    None,
+}
+
 pub(crate) struct CursorPlugin {
     pub change_cursor: CursorConfig,
 }
diff --git a/src/input.rs b/src/input.rs
index 7d292ee..8aae13b 100644
--- a/src/input.rs
+++ b/src/input.rs
@@ -38,16 +38,19 @@ impl Plugin for InputPlugin {
     }
 }
 
+/// Timer for double / triple clicks
 #[derive(Resource)]
 pub struct ClickTimer(pub Timer);
 
 // TODO: hide this behind #cfg wasm, depends on wasm having own copy/paste fn
+/// Crossbeam channel struct for Wasm clipboard data
 #[allow(dead_code)]
 pub struct WasmPaste {
     text: String,
     entity: Entity,
 }
 
+/// Async channel for receiving from the clipboard in Wasm
 #[derive(Resource)]
 pub struct WasmPasteAsyncChannel {
     pub tx: crossbeam_channel::Sender<WasmPaste>,
diff --git a/src/lib.rs b/src/lib.rs
index 3c42569..17beeed 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -72,14 +72,6 @@ impl Plugin for CosmicEditPlugin {
 #[derive(Component)]
 pub struct CosmicPrimaryCamera;
 
-#[derive(Default, Clone)]
-pub enum CursorConfig {
-    #[default]
-    Default,
-    Events,
-    None,
-}
-
 /// Resource struct that holds configuration options for cosmic fonts.
 #[derive(Resource, Clone)]
 pub struct CosmicFontConfig {
diff --git a/src/placeholder.rs b/src/placeholder.rs
index 0fc5b21..a7b4797 100644
--- a/src/placeholder.rs
+++ b/src/placeholder.rs
@@ -7,9 +7,7 @@ use cosmic_text::{Attrs, Edit};
 /// ```
 /// # use bevy::prelude::*;
 /// # use bevy_cosmic_edit::*;
-/// #
 /// # fn setup(mut commands: Commands) {
-/// // Create a new cosmic bundle
 /// commands.spawn((CosmicEditBundle {
 ///     sprite_bundle: SpriteBundle {
 ///         sprite: Sprite {
@@ -20,10 +18,9 @@ use cosmic_text::{Attrs, Edit};
 ///     },
 ///     ..default()
 ///     },
-///     Placeholder::new("Email", Attrs::new().color(Color::GRAY.to_cosmic()),
+///     Placeholder::new("Email", Attrs::new().color(Color::GRAY.to_cosmic())),
 /// ));
 /// # }
-/// #
 /// # fn main() {
 /// #     App::new()
 /// #         .add_plugins(MinimalPlugins)
diff --git a/src/util.rs b/src/util.rs
index be8d84c..e518608 100644
--- a/src/util.rs
+++ b/src/util.rs
@@ -18,7 +18,7 @@ impl ColorExtras for Color {
     }
 }
 
-/// System to unfocus editors when [Esc] is pressed
+/// System to unfocus editors when \[Esc\] is pressed
 pub fn deselect_editor_on_esc(i: Res<ButtonInput<KeyCode>>, mut focus: ResMut<FocusedWidget>) {
     if i.just_pressed(KeyCode::Escape) {
         focus.0 = None;
-- 
GitLab