Skip to content
Draft
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 crates/bevy_text/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ bevy_platform = { path = "../bevy_platform", version = "0.17.0-dev", default-fea

# other
cosmic-text = { version = "0.14", features = ["shape-run-cache"] }
cosmic_undo_2 = { version = "0.2.0" }
bevy_undo_2 = { version = "0.3.0" }
thiserror = { version = "2", default-features = false }
serde = { version = "1", features = ["derive"] }
smallvec = { version = "1", default-features = false }
Expand Down
14 changes: 7 additions & 7 deletions crates/bevy_text/src/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ impl TextInputBuffer {
#[derive(Component, Debug, Default)]
pub struct UndoHistory {
/// The commands to undo and undo
pub changes: cosmic_undo_2::Commands<cosmic_text::Change>,
pub changes: bevy_undo_2::Commands<cosmic_text::Change>,
}

impl UndoHistory {
Expand Down Expand Up @@ -248,7 +248,7 @@ impl Default for TextInputAttributes {
}

/// If a text input entity has a `TextInputFilter` component, after each [TextEdit] is applied, the [TextInputBuffer]’s text is checked
/// against the filter, and if it fails, the `TextEdit is rolled back.
/// against the filter, and if it fails, the `TextEdit` is rolled back.
#[derive(Component)]
pub enum TextInputFilter {
/// Positive integer input
Expand Down Expand Up @@ -458,13 +458,13 @@ pub fn is_cursor_at_end_of_line(editor: &mut BorrowedWithFontSystem<Editor<'_>>)
/// apply an action from the undo history to the text input buffer
fn apply_action<'a>(
editor: &mut BorrowedWithFontSystem<Editor<'a>>,
action: cosmic_undo_2::Action<&cosmic_text::Change>,
action: bevy_undo_2::Action<&cosmic_text::Change>,
) {
match action {
cosmic_undo_2::Action::Do(change) => {
bevy_undo_2::Action::Do(change) => {
editor.apply_change(change);
}
cosmic_undo_2::Action::Undo(change) => {
bevy_undo_2::Action::Undo(change) => {
let mut reversed = change.clone();
reversed.reverse();
editor.apply_change(&reversed);
Expand All @@ -475,8 +475,8 @@ fn apply_action<'a>(

/// Applies the [`TextEdit`]s queued for each [`TextInputBuffer`].
///
/// After all edits are applied, if a text input entity has a [TextInputValue] component and its buffer was changed,
/// then the [TextInputValue]'s text is updated with the new contents of the [TextInputBuffer].
/// After all edits are applied, if a text input entity has a [`TextInputValue`] component and its buffer was changed,
/// then the [`TextInputValue`]'s text is updated with the new contents of the [`TextInputBuffer`].
pub fn apply_text_edits(
mut commands: Commands,
mut font_system: ResMut<CosmicFontSystem>,
Expand Down
9 changes: 9 additions & 0 deletions crates/bevy_ui/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,9 @@ impl Plugin for UiPlugin {

let ui_layout_system_config = ui_layout_system
.in_set(UiSystems::Layout)
.ambiguous_with(bevy_text::update_password_masks)
.ambiguous_with(bevy_text::update_placeholder_layouts)
.ambiguous_with(bevy_text::update_text_input_layouts)
.before(TransformSystems::Propagate);

let ui_layout_system_config = ui_layout_system_config
Expand Down Expand Up @@ -257,6 +260,9 @@ fn build_text_interop(app: &mut App) {
)
.chain()
.in_set(UiSystems::Content)
.ambiguous_with(bevy_text::update_password_masks)
.ambiguous_with(bevy_text::update_placeholder_layouts)
.ambiguous_with(bevy_text::update_text_input_layouts)
// Text and Text2d are independent.
.ambiguous_with(bevy_text::detect_text_needs_rerender::<bevy_text::Text2d>)
// Potential conflict: `Assets<Image>`
Expand All @@ -271,6 +277,9 @@ fn build_text_interop(app: &mut App) {
.after(bevy_text::remove_dropped_font_atlas_sets)
.before(bevy_asset::AssetEventSystems)
// Text2d and bevy_ui text are entirely on separate entities
.ambiguous_with(bevy_text::update_password_masks)
.ambiguous_with(bevy_text::update_placeholder_layouts)
.ambiguous_with(bevy_text::update_text_input_layouts)
.ambiguous_with(bevy_text::detect_text_needs_rerender::<bevy_text::Text2d>)
.ambiguous_with(bevy_text::update_text2d_layout)
.ambiguous_with(bevy_text::calculate_bounds_text2d),
Expand Down