A new version of System was added to project The Inbox:
http://source.squeak.org/inbox/System-topa.378.mcz ==================== Summary ==================== Name: System-topa.378 Author: topa Time: 27 September 2010, 11:17:30.574 am UUID: beb6b8d8-c9fb-41ff-b859-731ca8f6b843 Ancestors: System-nice.377 Fix the menu build method that relied on coverting a collection of strings to a large string just to split it again. =============== Diff against System-nice.377 =============== Item was changed: ----- Method: SystemNavigation>>showMenuOf:withFirstItem:ifChosenDo:withCaption: (in category 'ui') ----- showMenuOf: selectorCollection withFirstItem: firstItem ifChosenDo: choiceBlock withCaption: aCaption "Show a sorted menu of the given selectors, preceded by firstItem, and all abbreviated to 40 characters. Use aCaption as the menu title, if it is not nil. Evaluate choiceBlock if a message is chosen." | index menuLabels sortedList | sortedList := selectorCollection asSortedCollection. + menuLabels := Array streamContents: + [:strm | strm nextPut: (firstItem contractTo: 40). + sortedList do: [:sel | strm nextPut: (sel contractTo: 40)]]. + index := UIManager default chooseFrom: menuLabels lines: #(1). - menuLabels := String streamContents: - [:strm | strm nextPutAll: (firstItem contractTo: 40). - sortedList do: [:sel | strm cr; nextPutAll: (sel contractTo: 40)]]. - index := UIManager default chooseFrom: (menuLabels substrings) lines: #(1). index = 1 ifTrue: [choiceBlock value: firstItem]. index > 1 ifTrue: [choiceBlock value: (sortedList at: index - 1)]! |
Hi,
is there a trunk-commiter that would take care of including this? Background: In a class of mine i had a method with a special selector that contained a space (I needed that, really, and had it working) but then the senders/implementors button stopped working: instead of _______________ |some selector| +-------------+ |msg:with: | |value: | |at:put: | +-------------+ I got ___________ |some | +---------+ |selector | |msg:with:| |value: | |at:put: | +---------+ which, additionally, resulted in an off-by-one when clicking an item: clicking on 'value:' resulted in the list of senders/implementors of at:put: The Provided patch fixes this behaviour. So Long, -Tobias Am 2010-09-27 um 09:17 schrieb [hidden email]: > A new version of System was added to project The Inbox: > http://source.squeak.org/inbox/System-topa.378.mcz > > ==================== Summary ==================== > > Name: System-topa.378 > Author: topa > Time: 27 September 2010, 11:17:30.574 am > UUID: beb6b8d8-c9fb-41ff-b859-731ca8f6b843 > Ancestors: System-nice.377 > > Fix the menu build method that relied on > coverting a collection of strings to a large string just to split it again. > > =============== Diff against System-nice.377 =============== > > Item was changed: > ----- Method: SystemNavigation>>showMenuOf:withFirstItem:ifChosenDo:withCaption: (in category 'ui') ----- > showMenuOf: selectorCollection withFirstItem: firstItem ifChosenDo: choiceBlock withCaption: aCaption > "Show a sorted menu of the given selectors, preceded by firstItem, and all abbreviated to 40 characters. Use aCaption as the menu title, if it is not nil. Evaluate choiceBlock if a message is chosen." > > | index menuLabels sortedList | > sortedList := selectorCollection asSortedCollection. > + menuLabels := Array streamContents: > + [:strm | strm nextPut: (firstItem contractTo: 40). > + sortedList do: [:sel | strm nextPut: (sel contractTo: 40)]]. > + index := UIManager default chooseFrom: menuLabels lines: #(1). > - menuLabels := String streamContents: > - [:strm | strm nextPutAll: (firstItem contractTo: 40). > - sortedList do: [:sel | strm cr; nextPutAll: (sel contractTo: 40)]]. > - index := UIManager default chooseFrom: (menuLabels substrings) lines: #(1). > index = 1 ifTrue: [choiceBlock value: firstItem]. > index > 1 ifTrue: [choiceBlock value: (sortedList at: index - 1)]! > > |
On 9/27/10, Tobias Pape <[hidden email]> wrote:
> Hi, > > is there a trunk-commiter that would take care of including this? > > Background: In a class of mine i had a method with a special > selector that contained a space (I needed that, really, and had it working) > but then the senders/implementors button stopped working: Could you please explain a bit more why you think you need selectors with spaces? Actually space are meant to separate selectors..... --Hannes |
In reply to this post by Tobias Pape
On Mon, 27 Sep 2010, Tobias Pape wrote:
> Hi, > > is there a trunk-commiter that would take care of including this? Why not? Though whitespaces in selectors is a bit strange, but this doesn't break anything, but improves the code a bit. Levente > > Background: In a class of mine i had a method with a special > selector that contained a space (I needed that, really, and had it working) > but then the senders/implementors button stopped working: > > instead of > _______________ > |some selector| > +-------------+ > |msg:with: | > |value: | > |at:put: | > +-------------+ > > I got > ___________ > |some | > +---------+ > |selector | > |msg:with:| > |value: | > |at:put: | > +---------+ > > which, additionally, resulted in an off-by-one when clicking an > item: clicking on 'value:' resulted in the list of senders/implementors > of at:put: > > The Provided patch fixes this behaviour. > > So Long, > -Tobias > > > Am 2010-09-27 um 09:17 schrieb [hidden email]: >> A new version of System was added to project The Inbox: >> http://source.squeak.org/inbox/System-topa.378.mcz >> >> ==================== Summary ==================== >> >> Name: System-topa.378 >> Author: topa >> Time: 27 September 2010, 11:17:30.574 am >> UUID: beb6b8d8-c9fb-41ff-b859-731ca8f6b843 >> Ancestors: System-nice.377 >> >> Fix the menu build method that relied on >> coverting a collection of strings to a large string just to split it again. >> >> =============== Diff against System-nice.377 =============== >> >> Item was changed: >> ----- Method: SystemNavigation>>showMenuOf:withFirstItem:ifChosenDo:withCaption: (in category 'ui') ----- >> showMenuOf: selectorCollection withFirstItem: firstItem ifChosenDo: choiceBlock withCaption: aCaption >> "Show a sorted menu of the given selectors, preceded by firstItem, and all abbreviated to 40 characters. Use aCaption as the menu title, if it is not nil. Evaluate choiceBlock if a message is chosen." >> >> | index menuLabels sortedList | >> sortedList := selectorCollection asSortedCollection. >> + menuLabels := Array streamContents: >> + [:strm | strm nextPut: (firstItem contractTo: 40). >> + sortedList do: [:sel | strm nextPut: (sel contractTo: 40)]]. >> + index := UIManager default chooseFrom: menuLabels lines: #(1). >> - menuLabels := String streamContents: >> - [:strm | strm nextPutAll: (firstItem contractTo: 40). >> - sortedList do: [:sel | strm cr; nextPutAll: (sel contractTo: 40)]]. >> - index := UIManager default chooseFrom: (menuLabels substrings) lines: #(1). >> index = 1 ifTrue: [choiceBlock value: firstItem]. >> index > 1 ifTrue: [choiceBlock value: (sortedList at: index - 1)]! >> >> > > > > |
In reply to this post by Hannes Hirzel
Am 2010-09-27 um 13:56 schrieb Hannes Hirzel:
> On 9/27/10, Tobias Pape <[hidden email]> wrote: >> Hi, >> >> is there a trunk-commiter that would take care of including this? >> >> Background: In a class of mine i had a method with a special >> selector that contained a space (I needed that, really, and had it working) >> but then the senders/implementors button stopped working: > > Could you please explain a bit more why you think you need selectors > with spaces? Actually space are meant to separate selectors..... Hi Hannes, Indeed, normal selectors are separatable by spaces. However, in my class I use a custom compiler and a custom method dictionary. Actually, the selectors for methods in that class can contain any character, not only just spaces, but no Newline (contrasting normal selectors in a method) My point isn't that selectors are not separatable by strings, but that the implementation SystemNavigation>>showMenuOf:withFirstItem:ifChosenDo:withCaption: relies on that there are no spaces in the list. However, the method has a generic name and is actually relatively agnostic of the lists content. So, you can have different drop down lists, when implementing your own system navigation. Look at the now removed lines: - menuLabels := String streamContents: - [:strm | strm nextPutAll: (firstItem contractTo: 40). - sortedList do: [:sel | strm cr; nextPutAll: (sel contractTo: 40)]]. that is, when firstItem is 'foo' and the sortedList is #(bar: baz: zork:) the menuLabels becomes: 'foo bar: baz: zork:' just to be splitted into #('foo' 'bar:' 'baz:' 'zork:') right after that ;) Hope that clarified my motivation So Long, -Tobias |
In reply to this post by Levente Uzonyi-2
Am 2010-09-27 um 14:10 schrieb Levente Uzonyi:
> On Mon, 27 Sep 2010, Tobias Pape wrote: > >> Hi, >> >> is there a trunk-commiter that would take care of including this? > > Why not? Though whitespaces in selectors is a bit strange, but this doesn't break anything, but improves the code a bit. > > > Levente Thanks, -Tobias |
Thank you for the explanation. I agree.
--Hannes On 9/27/10, Tobias Pape <[hidden email]> wrote: > Am 2010-09-27 um 14:10 schrieb Levente Uzonyi: >> On Mon, 27 Sep 2010, Tobias Pape wrote: >> >>> Hi, >>> >>> is there a trunk-commiter that would take care of including this? >> >> Why not? Though whitespaces in selectors is a bit strange, but this >> doesn't break anything, but improves the code a bit. >> >> >> Levente > > > Thanks, > -Tobias > |
Free forum by Nabble | Edit this page |