[Pkg] The Trunk: Collections-nice.870.mcz

commits at source.squeak.org commits at source.squeak.org
Mon Jan 6 16:16:02 UTC 2020


Nicolas Cellier uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-nice.870.mcz

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

Name: Collections-nice.870
Author: nice
Time: 6 January 2020, 5:12:04.309788 pm
UUID: 1dd850f8-5ca9-4444-833f-fd10805c0e43
Ancestors: Collections-fn.869

Fix sendersOfIt for searching senders of an expression including a literal (byte) array

If you select following text

	preference: 'Send Mouse Wheel Events to Keyboard Focus'
		categoryList: #(Morphic keyboard mouse)
		description: 'If enabled, follow the behavior known from Microsoft Windows, where the mouse wheel works for the widget that has the keyboard focus. If disabled, follow the Mac OS style, where the mouse wheel is send to the widget under the mouse position'
		type: #Boolean
		
and browse senders, then if search for senders of #preference: instead of the whole keyword

This is because '#(Morphic keyboard mouse)' was replaced with '#aSymbol keyboard mouse)'

Also handle the nasty character literals like $: or those that create imbalanced enclosing $( $[ ${

=============== Diff against Collections-fn.869 ===============

Item was changed:
  ----- Method: String>>findSelector (in category 'converting') -----
  findSelector
  	"Dan's code for hunting down selectors with keyword parts; while this doesn't give a true parse, in most cases it does what we want, in where it doesn't, we're none the worse for it."
  	| sel possibleParens |
  	sel := self withBlanksTrimmed.
  	(sel includes: $:)
  		ifTrue:
  			[sel := sel copyWithRegex: '''[^'']*''' matchesReplacedWith: '''a string'''.
+ 			sel := sel copyWithRegex: '#[^\[\(\s\.$]*' matchesReplacedWith: '#aSymbol'.
+ 			sel := sel copyWithRegex: '\$.' matchesReplacedWith: '$x'. "handle $( $[ and $:"
- 			sel := sel copyWithRegex: '#[^\s\.$]*' matchesReplacedWith: '#aSymbol'.
  			sel := sel copyReplaceAll: ':' with: ': '.	"for the style (aa max:bb) with no space"
  			sel := sel copyReplaceAll: '[:' with: '[ :'.    "for the style ([:a) with no space"  
  			possibleParens := sel substrings.
  			sel := self class streamContents:
  				[:s | | level |
  				level := 0.
  				possibleParens do:
  					[:token |
  					(level = 0 and: [token endsWith: ':'])
  						ifTrue: [s nextPutAll: token]
  						ifFalse: [level := level
  								+ (token occurrencesOf: $() - (token occurrencesOf: $))
  								+ (token occurrencesOf: $[) - (token occurrencesOf: $])
  								+ (token occurrencesOf: ${) - (token occurrencesOf: $})]]]]
  		ifFalse:
  			[sel := self substrings ifNotEmpty: [:tokens | tokens last]].
  	sel ifEmpty: [^ nil].
  	sel first = $# ifTrue:
  		[sel := sel allButFirst.
  		sel ifEmpty: [^ nil]].
  	sel isOctetString ifTrue: [sel := sel asOctetString].
  	^ Symbol lookup: sel!



More information about the Packages mailing list