Skip to content

Commit 0b10def

Browse files
committed
CI
1 parent e49c58f commit 0b10def

File tree

5 files changed

+7
-139
lines changed

5 files changed

+7
-139
lines changed

crates/bevy_text/src/input/buffer.rs

Lines changed: 3 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,3 @@
1-
//! This module provides text editing functionality, by wrapping the functionality of the
2-
//! [`cosmic_text`] crate.
3-
//!
4-
//! The primary entry point into the text editing functionality is the [`TextInputBuffer`] component,
5-
//! which includes a [`cosmic_text::Editor`], and adds the associated "required components" needed
6-
//! to construct functioning text input fields.
7-
//!
8-
//! ## How this works
9-
//!
10-
//! Text editing functionality is included as part of [`TextPlugin`](crate::TextPlugin),
11-
//! and the systems which perform the work are grouped under the [`TextInputSystems`] system set.
12-
//!
13-
//! The [`TextInputBuffer`] comes with the following required components that act as machinery to convert user inputs into text:
14-
//!
15-
//! * [`TextInputValue`] - Contains the current text in the text input buffer.
16-
//! * Automatically synchronized with the buffer by [`apply_text_edits`] after any edits are applied.
17-
//! * [`TextEdits`] - Text input commands queue, used to queue up text edit and navigation actions.\
18-
//! * Contains a queue of [`TextEdit`] actions that are applied to the buffer.
19-
//! * These are applied by the [`apply_text_edits` system.
20-
//! * [`TextInputTarget`] - Details of the render target the text input will be rendered to, such as size and scale factor.
21-
//!
22-
//!
23-
//! Layouting is done in:
24-
//!
25-
//! * [`update_text_input_layouts`] - Updates the `TextLayoutInfo` for each text input for rendering.
26-
//! * [`update_placeholder_layouts`] - Updates the `TextLayoutInfo` for each [`Placeholder`] for rendering.
27-
//!
28-
//! ## Configuring text input
29-
//!
30-
//! Several components are used to configure the text input, and belong on the [`TextInputBuffer`] entity:
31-
//!
32-
//! * [`TextInputAttributes`] - Common text input properties set by the user, such as font, font size, line height, justification, maximum characters etc.
33-
//! * [`TextInputFilter`] - Optional component that can be added to restrict the text input to certain formats, such as integers, decimals, hexadecimal etc.
34-
//! * [`PasswordMask`] - Optional component that can be added to hide the text input buffer contents by replacing the characters with a mask character.
35-
//! * [`Placeholder`] - Optional component that can be added to display placeholder text when the input buffer is empty.
36-
//! * [`CursorBlink`] - Optional component that controls cursor blinking.
37-
//!
38-
//! ## Copy-paste and clipboard support
39-
//!
40-
//! The clipboard support provided by this module is very basic, and only works within the `bevy` app,
41-
//! storing a simple [`String`].
42-
//!
43-
//! It can be accessed via the [`Clipboard`] resource.
44-
451
use bevy_asset::{AssetEvent, Assets, Handle};
462
use bevy_derive::Deref;
473
use bevy_ecs::{
@@ -65,7 +21,7 @@ use crate::{
6521
/// On changes, the text input systems will automatically update the buffer, layout and fonts as required.
6622
#[derive(Component, Debug, PartialEq)]
6723
pub struct TextInputAttributes {
68-
/// The text input's font, which also applies to any [`Placeholder`] text or password mask.
24+
/// The text input's font, which also applies to any [`crate::Placeholder`] text or password mask.
6925
/// A text input's glyphs must all be from the same font.
7026
pub font: Handle<Font>,
7127
/// The size of the font.
@@ -96,7 +52,7 @@ pub struct TextInputAttributes {
9652
pub const DEFAULT_FONT_SIZE: f32 = 20.;
9753
/// Default line height factor (relative to font size)
9854
///
99-
/// `1.2` corresponds to `normal` in https://developer.mozilla.org/en-US/docs/Web/CSS/line-height
55+
/// `1.2` corresponds to `normal` in `<https://developer.mozilla.org/en-US/docs/Web/CSS/line-height>`
10056
pub const DEFAULT_LINE_HEIGHT_FACTOR: f32 = 1.2;
10157
/// Default line height
10258
pub const DEFAULT_LINE_HEIGHT: f32 = DEFAULT_FONT_SIZE * DEFAULT_LINE_HEIGHT_FACTOR;
@@ -119,7 +75,7 @@ impl Default for TextInputAttributes {
11975
}
12076

12177
/// Contains the current text in the text input buffer.
122-
/// Automatically synchronized with the buffer by [`apply_text_edits`] after any edits are applied.
78+
/// Automatically synchronized with the buffer by [`crate::apply_text_edits`] after any edits are applied.
12379
/// On insertion, replaces the current text in the text buffer.
12480
#[derive(Component, PartialEq, Debug, Default, Deref)]
12581
#[component(

crates/bevy_text/src/input/clipboard.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use bevy_ecs::resource::Resource;
22

33
/// Basic clipboard implementation that only works within the bevy app.
44
///
5-
/// This is written to in the [`apply_text_edits`] system when
6-
/// [`TextEdit::Copy`], [`TextEdit::Cut`] or [`TextEdit::Paste`] edits are applied.
5+
/// This is written to in the [`crate::apply_text_edits`] system when
6+
/// [`crate::TextEdit::Copy`], [`crate::TextEdit::Cut`] or [`crate::TextEdit::Paste`] edits are applied.
77
#[derive(Resource, Default)]
88
pub struct Clipboard(pub String);

crates/bevy_text/src/input/filtering.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use bevy_ecs::component::Component;
22

3-
/// If a text input entity has a `TextInputFilter` component, after each [`TextEdit`] is applied, the [`TextInputBuffer`]’s text is checked
4-
/// against the filter, and if it fails, the `TextEdit` is immediately rolled back, and a [`TextInputEvent::InvalidEdit`] event is emitted.
3+
/// If a text input entity has a `TextInputFilter` component, after each [`crate::TextEdit`] is applied, the [`crate::TextInputBuffer`]’s text is checked
4+
/// against the filter, and if it fails, the `TextEdit` is immediately rolled back, and a [`crate::TextInputEvent::InvalidEdit`] event is emitted.
55
#[derive(Component)]
66
pub enum TextInputFilter {
77
/// Positive integer input

crates/bevy_text/src/input/target.rs

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,3 @@
1-
//! This module provides text editing functionality, by wrapping the functionality of the
2-
//! [`cosmic_text`] crate.
3-
//!
4-
//! The primary entry point into the text editing functionality is the [`TextInputBuffer`] component,
5-
//! which includes a [`cosmic_text::Editor`], and adds the associated "required components" needed
6-
//! to construct functioning text input fields.
7-
//!
8-
//! ## How this works
9-
//!
10-
//! Text editing functionality is included as part of [`TextPlugin`](crate::TextPlugin),
11-
//! and the systems which perform the work are grouped under the [`TextInputSystems`] system set.
12-
//!
13-
//! The [`TextInputBuffer`] comes with the following required components that act as machinery to convert user inputs into text:
14-
//!
15-
//! * [`TextInputValue`] - Contains the current text in the text input buffer.
16-
//! * Automatically synchronized with the buffer by [`apply_text_edits`] after any edits are applied.
17-
//! * [`TextEdits`] - Text input commands queue, used to queue up text edit and navigation actions.\
18-
//! * Contains a queue of [`TextEdit`] actions that are applied to the buffer.
19-
//! * These are applied by the [`apply_text_edits` system.
20-
//! * [`TextInputTarget`] - Details of the render target the text input will be rendered to, such as size and scale factor.
21-
//!
22-
//!
23-
//! Layouting is done in:
24-
//!
25-
//! * [`update_text_input_layouts`] - Updates the `TextLayoutInfo` for each text input for rendering.
26-
//! * [`update_placeholder_layouts`] - Updates the `TextLayoutInfo` for each [`Placeholder`] for rendering.
27-
//!
28-
//! ## Configuring text input
29-
//!
30-
//! Several components are used to configure the text input, and belong on the [`TextInputBuffer`] entity:
31-
//!
32-
//! * [`TextInputAttributes`] - Common text input properties set by the user, such as font, font size, line height, justification, maximum characters etc.
33-
//! * [`TextInputFilter`] - Optional component that can be added to restrict the text input to certain formats, such as integers, decimals, hexadecimal etc.
34-
//! * [`PasswordMask`] - Optional component that can be added to hide the text input buffer contents by replacing the characters with a mask character.
35-
//! * [`Placeholder`] - Optional component that can be added to display placeholder text when the input buffer is empty.
36-
//! * [`CursorBlink`] - Optional component that controls cursor blinking.
37-
//!
38-
//! ## Copy-paste and clipboard support
39-
//!
40-
//! The clipboard support provided by this module is very basic, and only works within the `bevy` app,
41-
//! storing a simple [`String`].
42-
//!
43-
//! It can be accessed via the [`Clipboard`] resource.
44-
451
use bevy_ecs::component::Component;
462
use bevy_math::Vec2;
473

crates/bevy_text/src/input/text_edit.rs

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,3 @@
1-
//! This module provides text editing functionality, by wrapping the functionality of the
2-
//! [`cosmic_text`] crate.
3-
//!
4-
//! The primary entry point into the text editing functionality is the [`TextInputBuffer`] component,
5-
//! which includes a [`cosmic_text::Editor`], and adds the associated "required components" needed
6-
//! to construct functioning text input fields.
7-
//!
8-
//! ## How this works
9-
//!
10-
//! Text editing functionality is included as part of [`TextPlugin`](crate::TextPlugin),
11-
//! and the systems which perform the work are grouped under the [`TextInputSystems`] system set.
12-
//!
13-
//! The [`TextInputBuffer`] comes with the following required components that act as machinery to convert user inputs into text:
14-
//!
15-
//! * [`TextInputValue`] - Contains the current text in the text input buffer.
16-
//! * Automatically synchronized with the buffer by [`apply_text_edits`] after any edits are applied.
17-
//! * [`TextEdits`] - Text input commands queue, used to queue up text edit and navigation actions.\
18-
//! * Contains a queue of [`TextEdit`] actions that are applied to the buffer.
19-
//! * These are applied by the [`apply_text_edits` system.
20-
//! * [`TextInputTarget`] - Details of the render target the text input will be rendered to, such as size and scale factor.
21-
//!
22-
//!
23-
//! Layouting is done in:
24-
//!
25-
//! * [`update_text_input_layouts`] - Updates the `TextLayoutInfo` for each text input for rendering.
26-
//! * [`update_placeholder_layouts`] - Updates the `TextLayoutInfo` for each [`Placeholder`] for rendering.
27-
//!
28-
//! ## Configuring text input
29-
//!
30-
//! Several components are used to configure the text input, and belong on the [`TextInputBuffer`] entity:
31-
//!
32-
//! * [`TextInputAttributes`] - Common text input properties set by the user, such as font, font size, line height, justification, maximum characters etc.
33-
//! * [`TextInputFilter`] - Optional component that can be added to restrict the text input to certain formats, such as integers, decimals, hexadecimal etc.
34-
//! * [`PasswordMask`] - Optional component that can be added to hide the text input buffer contents by replacing the characters with a mask character.
35-
//! * [`Placeholder`] - Optional component that can be added to display placeholder text when the input buffer is empty.
36-
//! * [`CursorBlink`] - Optional component that controls cursor blinking.
37-
//!
38-
//! ## Copy-paste and clipboard support
39-
//!
40-
//! The clipboard support provided by this module is very basic, and only works within the `bevy` app,
41-
//! storing a simple [`String`].
42-
//!
43-
//! It can be accessed via the [`Clipboard`] resource.
44-
451
use alloc::collections::VecDeque;
462
use bevy_ecs::{
473
component::Component,

0 commit comments

Comments
 (0)