@@ -317,6 +317,22 @@ public void Dispose()
317317 }
318318 }
319319
320+ internal struct CursorColorScope : IDisposable
321+ {
322+ private Color oldCursorColor ;
323+
324+ public CursorColorScope ( Color color )
325+ {
326+ oldCursorColor = GUI . skin . settings . cursorColor ;
327+ GUI . skin . settings . cursorColor = color ;
328+ }
329+
330+ public void Dispose ( )
331+ {
332+ GUI . skin . settings . cursorColor = oldCursorColor ;
333+ }
334+ }
335+
320336 // Create a group of controls that can be disabled.
321337 internal static void BeginDisabled ( bool disabled )
322338 {
@@ -584,14 +600,14 @@ static void ShowTextEditorPopupMenu()
584600 // Cut
585601 if ( RecycledTextEditor . s_AllowContextCutOrPaste )
586602 {
587- if ( s_RecycledEditor . hasSelection && ! s_RecycledEditor . isPasswordField && enabled )
603+ if ( s_RecycledEditor . hasSelection && ! s_RecycledEditor . isPasswordField && enabled && ! EditorGUI . showMixedValue )
588604 pm . AddItem ( EditorGUIUtility . TrTextContent ( "Cut" ) , false , new PopupMenuEvent ( EventCommandNames . Cut , GUIView . current ) . SendEvent ) ;
589605 else
590606 pm . AddDisabledItem ( EditorGUIUtility . TrTextContent ( "Cut" ) ) ;
591607 }
592608
593609 // Copy -- when GUI is disabled, allow Copy even with no selection (will copy everything)
594- if ( ( s_RecycledEditor . hasSelection || ! enabled ) && ! s_RecycledEditor . isPasswordField )
610+ if ( ( s_RecycledEditor . hasSelection || ! enabled ) && ! s_RecycledEditor . isPasswordField && ! EditorGUI . showMixedValue )
595611 pm . AddItem ( EditorGUIUtility . TrTextContent ( "Copy" ) , false , new PopupMenuEvent ( EventCommandNames . Copy , GUIView . current ) . SendEvent ) ;
596612 else
597613 pm . AddDisabledItem ( EditorGUIUtility . TrTextContent ( "Copy" ) ) ;
@@ -1912,19 +1928,17 @@ internal static void SelectableLabelInternal(Rect position, string text, GUIStyl
19121928 sendEventToTextEditor = false ;
19131929 }
19141930
1915-
1916- Color tempCursorColor = GUI . skin . settings . cursorColor ;
1917- GUI . skin . settings . cursorColor = new Color ( 0 , 0 , 0 , 0 ) ;
1918-
1919- RecycledTextEditor . s_AllowContextCutOrPaste = false ;
1920-
1921- if ( sendEventToTextEditor )
1931+ // Its possible that DoTextField will throw so we use a scoped cursor that we can safely reset the color.
1932+ using ( new CursorColorScope ( Color . clear ) )
19221933 {
1923- bool dummy ;
1924- DoTextField ( s_RecycledEditor , id , IndentedRect ( position ) , text , style , string . Empty , out dummy , false , true , false ) ;
1925- }
1934+ RecycledTextEditor . s_AllowContextCutOrPaste = false ;
19261935
1927- GUI . skin . settings . cursorColor = tempCursorColor ;
1936+ if ( sendEventToTextEditor )
1937+ {
1938+ bool dummy ;
1939+ DoTextField ( s_RecycledEditor , id , IndentedRect ( position ) , text , style , string . Empty , out dummy , false , true , false ) ;
1940+ }
1941+ }
19281942 }
19291943
19301944 [ Obsolete ( "Use PasswordField instead." ) ]
0 commit comments