Skip to content

Commit 5ffd4fd

Browse files
committed
CI
1 parent 5c96245 commit 5ffd4fd

File tree

11 files changed

+47
-58
lines changed

11 files changed

+47
-58
lines changed

crates/bevy_clipboard/src/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ impl ClipboardRead {
6161
pub struct ClipboardBasic(pub String);
6262
// TODO: remove ClipboardNotSupported , write into ClipboardBasic instead
6363

64-
6564
/// Resource providing access to the clipboard
6665
#[cfg(unix)]
6766
#[derive(Resource)]
@@ -153,7 +152,7 @@ impl Clipboard {
153152
use wasm_bindgen_futures::JsFuture;
154153

155154
let clipboard = web_sys::window()
156-
.and_then(|w| w.navigator().clipboard())
155+
.and_then(|w| Some(w.navigator().clipboard()))
157156
.ok_or(ClipboardError::ClipboardNotSupported)?;
158157

159158
let result = JsFuture::from(clipboard.read_text()).await;

crates/bevy_text/src/input/mod.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,7 @@
3737
//!
3838
//! ## Copy-paste and clipboard support
3939
//!
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.
40+
//! This module integrates clipboard support from [`bevy_clipboard`].
4441
4542
use bevy_ecs::schedule::SystemSet;
4643
pub use cosmic_text::Motion;

crates/bevy_text/src/input/text_edit.rs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ pub use cosmic_text::Motion;
1212
use cosmic_text::{Action, BorrowedWithFontSystem, Edit, Editor, Selection};
1313

1414
use crate::{
15-
get_cosmic_text_buffer_contents, CosmicFontSystem, TextInputAttributes,
16-
TextInputBuffer, TextInputFilter, TextInputValue,
15+
get_cosmic_text_buffer_contents, CosmicFontSystem, TextInputAttributes, TextInputBuffer,
16+
TextInputFilter, TextInputValue,
1717
};
1818

1919
/// Text input commands queue
@@ -198,7 +198,8 @@ pub fn apply_text_edits(
198198
clipboard.as_mut(),
199199
&action,
200200
) {
201-
commands.trigger_targets(TextInputEvent::InvalidEdit(error, action), entity);
201+
commands
202+
.trigger_targets(TextInputEvent::InvalidEdit(error, action), entity);
202203
}
203204
}
204205
}
@@ -231,15 +232,14 @@ pub fn apply_text_edit(
231232
clipboard: Option<&mut ResMut<Clipboard>>,
232233
edit: &TextEdit,
233234
) -> Result<(), InvalidTextEditError> {
234-
235235
editor.start_change();
236236

237237
match edit {
238238
TextEdit::Copy => {
239-
if let Some(text) = editor.copy_selection() {
240-
if let Some(clipboard) = clipboard {
241-
let _ = clipboard.set_text(text);
242-
}
239+
if let Some(text) = editor.copy_selection()
240+
&& let Some(clipboard) = clipboard
241+
{
242+
let _ = clipboard.set_text(text);
243243
}
244244
}
245245
TextEdit::Cut => {
@@ -379,7 +379,6 @@ pub fn apply_text_edit(
379379
Ok(())
380380
}
381381

382-
383382
/// Automatically propagated events that can be dispatched by a text input entity.
384383
#[derive(EntityEvent, Clone, Debug, Component)]
385384
#[entity_event(traversal = &'static ChildOf, auto_propagate)]

crates/bevy_text/src/lib.rs

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -110,21 +110,20 @@ impl Plugin for TextPlugin {
110110
)
111111
.add_systems(Last, trim_cosmic_cache);
112112

113-
app.init_resource::<TextCursorBlinkInterval>()
114-
.add_systems(
115-
PostUpdate,
116-
(
117-
update_text_input_buffers,
118-
apply_text_edits,
119-
update_password_masks,
120-
update_text_input_layouts,
121-
update_placeholder_layouts,
122-
)
123-
.chain()
124-
.in_set(TextInputSystems)
125-
.before(AssetEventSystems)
126-
.ambiguous_with(Text2dUpdateSystems)
127-
);
113+
app.init_resource::<TextCursorBlinkInterval>().add_systems(
114+
PostUpdate,
115+
(
116+
update_text_input_buffers,
117+
apply_text_edits,
118+
update_password_masks,
119+
update_text_input_layouts,
120+
update_placeholder_layouts,
121+
)
122+
.chain()
123+
.in_set(TextInputSystems)
124+
.before(AssetEventSystems)
125+
.ambiguous_with(Text2dUpdateSystems),
126+
);
128127

129128
#[cfg(feature = "default_font")]
130129
{

crates/bevy_text/src/text.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ pub struct TextEntity {
4040
#[derive(Component, Debug, Clone, Reflect)]
4141
#[reflect(Component, Debug, Default, Clone)]
4242
pub struct ComputedTextBlock {
43-
/// Buffer for managing text layout and creating [`TextLayoutInfo`](crate::pipeline::TextLayoutInfo).
43+
/// Buffer for managing text layout and creating [`crate::pipeline::TextLayoutInfo`].
4444
///
4545
/// This is private because buffer contents are always refreshed from ECS state when writing glyphs to
4646
/// `TextLayoutInfo`. If you want to control the buffer contents manually or use the `cosmic-text`

crates/bevy_ui/src/widget/event.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
use bevy_ecs::{
2-
component::Component, entity::Entity, event::EntityEvent
3-
};
1+
use bevy_ecs::{component::Component, entity::Entity, event::EntityEvent};
42

53
/// Represents one or more text inputs in a form being submitted
64
#[derive(EntityEvent, Clone, Debug, Component)]

crates/bevy_ui/src/widget/text_box.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ use bevy_picking::pointer::PointerButton;
5252
use bevy_text::Justify;
5353
use bevy_text::LineBreak;
5454
use bevy_text::Motion;
55-
use bevy_text::TextFont;
5655
use bevy_text::TextEdit;
5756
use bevy_text::TextEdits;
57+
use bevy_text::TextFont;
5858
use bevy_text::TextInputAttributes;
5959
use bevy_text::TextInputBuffer;
6060
use bevy_text::TextInputSystems;
@@ -149,7 +149,7 @@ impl Default for TextUnderCursorColor {
149149
TextInputStyle,
150150
TextInputMultiClickCounter,
151151
TextInputBuffer,
152-
TextCursorBlinkTimer,
152+
TextCursorBlinkTimer
153153
)]
154154
#[component(
155155
on_add = on_add_text_input_node,
@@ -429,7 +429,12 @@ impl Default for NextFocus {
429429
pub fn on_focused_keyboard_input(
430430
mut trigger: On<FocusedInput<KeyboardInput>>,
431431
mut commands: Commands,
432-
mut query: Query<(&mut TextEdits, Has<SingleLineInputField>, &TextBox, &TextInputBuffer)>,
432+
mut query: Query<(
433+
&mut TextEdits,
434+
Has<SingleLineInputField>,
435+
&TextBox,
436+
&TextInputBuffer,
437+
)>,
433438
mut modifiers: Option<ResMut<GlobalTextInputState>>,
434439
keyboard_state: Res<ButtonInput<Key>>,
435440
) {
@@ -500,10 +505,7 @@ pub fn on_focused_keyboard_input(
500505
}
501506
}
502507
Key::Home => {
503-
actions.queue(TextEdit::motion(
504-
Motion::BufferStart,
505-
is_shift_pressed,
506-
));
508+
actions.queue(TextEdit::motion(Motion::BufferStart, is_shift_pressed));
507509
}
508510
Key::End => {
509511
actions.queue(TextEdit::motion(Motion::BufferEnd, is_shift_pressed));

crates/bevy_ui/src/widget/text_field.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ use bevy_picking::events::Pointer;
3636
use bevy_picking::events::Press;
3737
use bevy_picking::pointer::PointerButton;
3838
use bevy_text::Justify;
39-
use bevy_text::TextFont;
4039
use bevy_text::TextEdit;
4140
use bevy_text::TextEdits;
41+
use bevy_text::TextFont;
4242
use bevy_text::TextInputAttributes;
4343
use bevy_text::TextInputBuffer;
4444
use bevy_text::TextInputTarget;

crates/bevy_ui_render/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ use gradient::GradientPlugin;
6262

6363
use bevy_platform::collections::{HashMap, HashSet};
6464
use bevy_text::{
65-
ComputedTextBlock, PositionedGlyph, PlaceholderLayout, TextBackgroundColor, TextColor,
65+
ComputedTextBlock, PlaceholderLayout, PositionedGlyph, TextBackgroundColor, TextColor,
6666
TextInputBuffer, TextLayoutInfo,
6767
};
6868
use bevy_transform::components::GlobalTransform;

examples/ui/password_input.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ use bevy::input_focus::tab_navigation::TabNavigationPlugin;
1212
use bevy::input_focus::InputDispatchPlugin;
1313
use bevy::picking::hover::Hovered;
1414
use bevy::prelude::*;
15-
use bevy::text::Placeholder;
1615
use bevy::text::PasswordMask;
16+
use bevy::text::Placeholder;
1717
use bevy::text::TextInputValue;
1818
use bevy::ui::widget::TextField;
1919
use bevy::ui::widget::TextInputPlugin;
@@ -41,13 +41,12 @@ fn setup(mut commands: Commands) {
4141
// UI camera
4242
commands.spawn(Camera2d);
4343

44-
let on_click = commands.register_system(
45-
|_: In<Activate>, mut query: Query<&mut PasswordMask>| {
44+
let on_click =
45+
commands.register_system(|_: In<Activate>, mut query: Query<&mut PasswordMask>| {
4646
for mut password in query.iter_mut() {
4747
password.show_password = !password.show_password;
4848
}
49-
},
50-
);
49+
});
5150

5251
commands.spawn((
5352
Node {

0 commit comments

Comments
 (0)