[squeak-dev] The Inbox: Collections-nice.867.mcz

Marcel Taeumel marcel.taeumel at hpi.de
Mon Jan 6 14:02:18 UTC 2020


+1

Could you also update StringTest >> #testFindSelector?

Best,
Marcel
Am 27.12.2019 22:30:08 schrieb commits at source.squeak.org <commits at source.squeak.org>:
Nicolas Cellier uploaded a new version of Collections to project The Inbox:
http://source.squeak.org/inbox/Collections-nice.867.mcz

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

Name: Collections-nice.867
Author: nice
Time: 27 December 2019, 10:29:53.018596 pm
UUID: d3b5ceb3-62ab-4f61-a9a3-dd757041b47f
Ancestors: Collections-mt.866

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)'

=============== Diff against Collections-mt.866 ===============

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: '#[^\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!


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20200106/2fe7ec08/attachment-0001.html>


More information about the Squeak-dev mailing list