@@ -88,10 +88,10 @@ pub fn on_key_input(
8888 // Process modifier key combinations
8989 match & input. key_code {
9090 KeyCode :: KeyC => {
91- if let Some ( selected_text) = text_field. get_selected_text ( ) {
92- if let Err ( e) = clipboard. set_text ( selected_text) {
93- warn ! ( "Clipboard error: {}" , e ) ;
94- }
91+ if let Some ( selected_text) = text_field. get_selected_text ( )
92+ && let Err ( e) = clipboard. set_text ( selected_text)
93+ {
94+ warn ! ( "Clipboard error: {}" , e ) ;
9595 }
9696 }
9797 KeyCode :: KeyV => match clipboard. get_text ( ) {
@@ -114,10 +114,10 @@ pub fn on_key_input(
114114 }
115115 } ,
116116 KeyCode :: KeyX => {
117- if let Some ( selected_text) = text_field. get_selected_text ( ) {
118- if let Err ( e) = clipboard. set_text ( selected_text) {
119- warn ! ( "Clipboard error: {}" , e ) ;
120- }
117+ if let Some ( selected_text) = text_field. get_selected_text ( )
118+ && let Err ( e) = clipboard. set_text ( selected_text)
119+ {
120+ warn ! ( "Clipboard error: {}" , e ) ;
121121 }
122122 if let Some ( selected_range) = text_field. selection_range ( ) {
123123 text_change = TextChange :: remove_change ( selected_range) ;
@@ -137,10 +137,10 @@ pub fn on_key_input(
137137 // Process regular (non-modifier) key press
138138 match & input. logical_key {
139139 Key :: Space => {
140- if let Some ( allowed_chars) = & text_field. allowed_chars {
141- if !allowed_chars. contains ( & ' ' ) {
142- return ;
143- }
140+ if let Some ( allowed_chars) = & text_field. allowed_chars
141+ && !allowed_chars. contains ( & ' ' )
142+ {
143+ return ;
144144 }
145145
146146 if let Some ( ( start, end) ) = text_field. selection_range ( ) {
@@ -269,11 +269,11 @@ pub fn update_has_focus(
269269 // Gained focus
270270 commands. entity ( entity) . insert ( HasFocus ( true ) ) ;
271271
272- if let Ok ( mut text_field) = q_editable_texts. get_mut ( entity) {
273- if text_field. cursor_position . is_none ( ) {
274- text_field . cursor_position = Some ( CharPosition ( 0 ) ) ;
275- commands . trigger_targets ( RenderWidget :: show_cursor ( ) , entity ) ;
276- }
272+ if let Ok ( mut text_field) = q_editable_texts. get_mut ( entity)
273+ && text_field. cursor_position . is_none ( )
274+ {
275+ text_field . cursor_position = Some ( CharPosition ( 0 ) ) ;
276+ commands . trigger_targets ( RenderWidget :: show_cursor ( ) , entity ) ;
277277 }
278278 }
279279 } else if has_focus. 0 {
0 commit comments