[squeak-dev] The Trunk: System-eem.1402.mcz

commits at source.squeak.org commits at source.squeak.org
Sat Mar 25 00:35:19 UTC 2023


Eliot Miranda uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-eem.1402.mcz

==================== Summary ====================

Name: System-eem.1402
Author: eem
Time: 24 March 2023, 5:35:13.352983 pm
UUID: 46842e93-0131-498f-8233-2566b7594127
Ancestors: System-eem.1401

Don't waste effort pasting HTML for plain texts.

=============== Diff against System-eem.1401 ===============

Item was changed:
  ----- Method: ExtendedClipboardMacInterface>>clipboardText: (in category 'general-api-add') -----
  clipboardText: aText
  	"Attempt to paste aText to the system clipboard in as many formats as makes sense on the platform.
  	 Answer if the attempt succeeded.  On the Mac we paste HTML and UTF8. But we can only paste more
  	 than one thing at a time with the VMMaker.oscog-eem.3276 version of the plugin, or later."
  	| htmlPayload |
+ 	(aText isPlainText
+ 	 or: [clipboard = 0
+ 	 or: [self class pluginVersion < 3276]]) ifTrue:
- 	(aText isText
- 	 and: [clipboard ~= 0
- 	 and: [self class pluginVersion >= 3276]]) ifFalse:
  		[^false].
  	htmlPayload := String streamContents:
  						[:stream |
  						stream nextPutAll: '<meta charset="UTF-8">'.
  						aText printHtmlOn: stream].
  	self
  		clearClipboard;
  		addClipboardData: htmlPayload dataFormat: 'public.html';
  		addClipboardData: (UTF8TextConverter new encodeString: aText asString) dataFormat: 'public.utf8-plain-text'.
  	^true!

Item was changed:
  ----- Method: ExtendedClipboardWinInterface>>clipboardText: (in category 'private') -----
  clipboardText: aText
  	"Attempt to paste aText to the system clipboard in as many formats as makes sense on the platform.
  	 Answer if the attempt succeeded.  On Windows we paste HTML and UTF8. But we can only paste more
  	 than one thing at a time with the VMMaker.oscog-eem.3276 version of the plugin, or later.  Note that
  	 the funky HTML format (see packageAsHTML:) has been derived by observing Chrome and Edge."
  	| htmlPayload |
+ 	(aText isPlainText
+ 	 or: [clipboard = 0
+ 	 or: [self class pluginVersion < 3276]]) ifTrue:
- 	(aText isText
- 	 and: [clipboard ~= 0
- 	 and: [self class pluginVersion >= 3276]]) ifFalse:
  		[^false].
  	htmlPayload := self packageAsHTML: aText printHtmlString.
  	self clearClipboard.
  	"We don't understand why yet, but sometimes the plugin fails to copy HTML text."
  	^(self tryAddClipboardData: htmlPayload dataFormat: CF_HTMLTEXT)
  	 and: [self tryAddClipboardData: (UTF8TextConverter new encodeString: aText asString) dataFormat: CF_UTF8TEXT]!



More information about the Squeak-dev mailing list