@@ -395,11 +395,11 @@ where
395395 position,
396396 ) ;
397397
398- let is_cursor_visible = ( ( focus . now - focus . updated_at )
399- . as_millis ( )
400- / CURSOR_BLINK_INTERVAL_MILLIS )
401- % 2
402- == 0 ;
398+ let is_cursor_visible = !is_disabled
399+ && ( ( focus . now - focus . updated_at ) . as_millis ( )
400+ / CURSOR_BLINK_INTERVAL_MILLIS )
401+ % 2
402+ == 0 ;
403403
404404 let cursor = if is_cursor_visible {
405405 Some ( (
@@ -531,12 +531,9 @@ where
531531 fn diff ( & self , tree : & mut Tree ) {
532532 let state = tree. state . downcast_mut :: < State < Renderer :: Paragraph > > ( ) ;
533533
534- // Unfocus text input if it becomes disabled
534+ // Stop pasting if input becomes disabled
535535 if self . on_input . is_none ( ) {
536- state. last_click = None ;
537- state. is_focused = None ;
538536 state. is_pasting = None ;
539- state. is_dragging = false ;
540537 }
541538 }
542539
@@ -597,11 +594,7 @@ where
597594 | Event :: Touch ( touch:: Event :: FingerPressed { .. } ) => {
598595 let state = state :: < Renderer > ( tree) ;
599596
600- let click_position = if self . on_input . is_some ( ) {
601- cursor. position_over ( layout. bounds ( ) )
602- } else {
603- None
604- } ;
597+ let click_position = cursor. position_over ( layout. bounds ( ) ) ;
605598
606599 state. is_focused = if click_position. is_some ( ) {
607600 state. is_focused . or_else ( || {
@@ -747,10 +740,6 @@ where
747740 let state = state :: < Renderer > ( tree) ;
748741
749742 if let Some ( focus) = & mut state. is_focused {
750- let Some ( on_input) = & self . on_input else {
751- return event:: Status :: Ignored ;
752- } ;
753-
754743 let modifiers = state. keyboard_modifiers ;
755744 focus. updated_at = Instant :: now ( ) ;
756745
@@ -774,6 +763,10 @@ where
774763 if state. keyboard_modifiers . command ( )
775764 && !self . is_secure =>
776765 {
766+ let Some ( on_input) = & self . on_input else {
767+ return event:: Status :: Ignored ;
768+ } ;
769+
777770 if let Some ( ( start, end) ) =
778771 state. cursor . selection ( & self . value )
779772 {
@@ -798,6 +791,10 @@ where
798791 if state. keyboard_modifiers . command ( )
799792 && !state. keyboard_modifiers . alt ( ) =>
800793 {
794+ let Some ( on_input) = & self . on_input else {
795+ return event:: Status :: Ignored ;
796+ } ;
797+
801798 let content = match state. is_pasting . take ( ) {
802799 Some ( content) => content,
803800 None => {
@@ -841,6 +838,10 @@ where
841838 }
842839
843840 if let Some ( text) = text {
841+ let Some ( on_input) = & self . on_input else {
842+ return event:: Status :: Ignored ;
843+ } ;
844+
844845 state. is_pasting = None ;
845846
846847 if let Some ( c) =
@@ -869,6 +870,10 @@ where
869870 }
870871 }
871872 keyboard:: Key :: Named ( key:: Named :: Backspace ) => {
873+ let Some ( on_input) = & self . on_input else {
874+ return event:: Status :: Ignored ;
875+ } ;
876+
872877 if modifiers. jump ( )
873878 && state. cursor . selection ( & self . value ) . is_none ( )
874879 {
@@ -893,6 +898,10 @@ where
893898 update_cache ( state, & self . value ) ;
894899 }
895900 keyboard:: Key :: Named ( key:: Named :: Delete ) => {
901+ let Some ( on_input) = & self . on_input else {
902+ return event:: Status :: Ignored ;
903+ } ;
904+
896905 if modifiers. jump ( )
897906 && state. cursor . selection ( & self . value ) . is_none ( )
898907 {
@@ -1111,7 +1120,7 @@ where
11111120 ) -> mouse:: Interaction {
11121121 if cursor. is_over ( layout. bounds ( ) ) {
11131122 if self . on_input . is_none ( ) {
1114- mouse:: Interaction :: NotAllowed
1123+ mouse:: Interaction :: Idle
11151124 } else {
11161125 mouse:: Interaction :: Text
11171126 }
0 commit comments