'From etoys4.0 of 9 October 2008 [latest update: #2212] on 2 April 2009 at 2:58:27 pm'! "Change Set: tabLoopFix-sw Date: 2 April 2009 Author: Scott Wallace Fix to the bug that hitting tab key in a text field when the 'tabAmongFields' preference is false can result in an infinite loop."! !Morph methodsFor: 'structure' stamp: 'sw 4/2/2009 14:56'! pasteUpMorphHandlingTabAmongFields "For the purpose of determing how to service a 'tab' character hit within some text field, answer the nearest PasteUpMorph in my owner chain that would want to interpret the tab key as an attempt to navigate from field to field. Unless some playfield, book-page, or some such, has explicitly had its #tabAmongFields property set, this will normally be the World. Note that the only situation in which nil will be returned by this method is if the #tabAmongFields preference is set to false *and* there is no pasteup in the owner chain of the text-morph into which the tab-key was it which itself has the #tabAmongFields property." | aPasteUp next | aPasteUp _ self pasteUpMorphOrWorld. [aPasteUp notNil] whileTrue: [((aPasteUp hasProperty: #tabAmongFields) or: [aPasteUp isWorldMorph and: [Preferences tabAmongFields]]) ifTrue: [^ aPasteUp]. next := aPasteUp pasteUpMorphOrWorld. next == aPasteUp ifTrue: [^ nil]. aPasteUp := next]. ^ nil! !