'From etoys3.0 of 24 February 2008 [latest update: #2119] on 29 August 2008 at 12:34:57 pm'! "Change Set: zeroClipboardWorkaround-yo Date: 29 August 2008 Author: Yoshiki Ohshima Workaround for strange results from the clipboard primitive. Chop it when there is null in the string."! !Clipboard methodsFor: 'accessing' stamp: 'yo 8/29/2008 12:31'! clipboardText "Return the text currently in the clipboard. If the system clipboard is empty, or if it differs from the Smalltalk clipboard text, use the Smalltalk clipboard. This is done since (a) the Mac clipboard gives up on very large chunks of text and (b) since not all platforms support the notion of a clipboard." | string decodedString ind | string _ self primitiveClipboardText. (string size > 0 and: [(ind := string indexOf: (Character value: 0)) > 0]) ifTrue: [ string _ string copyFrom: 1 to: ind - 1]. (string isEmpty or: [string = contents asString]) ifTrue: [^ contents]. decodedString _ self interpreter fromSystemClipboard: string. ^ decodedString = contents asString ifTrue: [contents] ifFalse: [decodedString asText]. ! !