The original intent was to have a working #flash, and do that when the
very next keystroke would result in an empty filter.
Because by the time you've emptied the list, you can't use backspace
to see where the matching started to fail, and the results thus far.
So does this option lead the user into a dead-end?
The system is too fast, #flash is rather useless, I think we should
put the delay back in to #flash, so it can be a the good indicator it
was meant to be of "no more results"...
On Thu, Jul 21, 2016 at 4:23 AM, <commits(a)source.squeak.org> wrote:
> Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
> http://source.squeak.org/trunk/Morphic-mt.1196.mcz
>
> ==================== Summary ====================
>
> Name: Morphic-mt.1196
> Author: mt
> Time: 21 July 2016, 11:23:40.453126 am
> UUID: d866228c-fedc-2147-afd9-821191a84612
> Ancestors: Morphic-mt.1195
>
> For lists, add an option to allow empty filter results. Also support setting the current filter string programmatically.
>
> =============== Diff against Morphic-mt.1195 ===============
>
> Item was added:
> + ----- Method: PluggableListMorph>>allowEmptyFilterResult (in category 'filtering') -----
> + allowEmptyFilterResult
> + ^ self valueOfProperty: #allowEmptyFilterResult ifAbsent: [false]!
>
> Item was added:
> + ----- Method: PluggableListMorph>>allowEmptyFilterResult: (in category 'filtering') -----
> + allowEmptyFilterResult: aBoolean
> +
> + self
> + setProperty: #allowEmptyFilterResult
> + toValue: aBoolean.!
>
> Item was changed:
> ----- Method: PluggableListMorph>>filterList (in category 'filtering') -----
> filterList
> self hasFilter
> ifTrue:
> [ | frontMatching substringMatching newList |
> self indicateFiltered.
> frontMatching := OrderedCollection new.
> substringMatching := OrderedCollection new.
> list withIndexDo:
> [ : each : n | | foundPos |
> foundPos := each asString
> findString: lastKeystrokes
> startingAt: 1
> caseSensitive: false.
> foundPos = 1
> ifTrue: [ frontMatching add: each ]
> ifFalse:
> [ foundPos = 0 ifFalse: [ substringMatching add: each ] ] ].
> newList := frontMatching , substringMatching.
> + (newList isEmpty not or: [ self allowEmptyFilterResult ])
> + ifTrue: [ list := newList ]
> + ifFalse:
> - newList
> - ifEmpty:
> [ lastKeystrokes := lastKeystrokes allButLast: 1.
> self
> flash ;
> + filterList ] ]
> - filterList ]
> - ifNotEmpty: [ list := newList ] ]
> ifFalse: [ self indicateUnfiltered ]!
>
> Item was added:
> + ----- Method: PluggableListMorph>>filterList: (in category 'filtering') -----
> + filterList: aString
> + "Manually set the list filter."
> +
> + lastKeystrokes := aString.
> + self filterList.
> + self updateList.
> + self changeModelSelection: (list ifEmpty: [0] ifNotEmpty: [self modelIndexFor: 1]).!
>
>
tim Rowledge uploaded a new version of Graphics to project The Trunk:
http://source.squeak.org/trunk/Graphics-tpr.354.mcz
==================== Summary ====================
Name: Graphics-tpr.354
Author: tpr
Time: 21 July 2016, 6:14:06.280273 pm
UUID: 31f2b403-7687-49a8-944b-b067f32fb482
Ancestors: Graphics-mt.353
Extend Color class>>fromString parsing to allow also a string of the forrm 'r,g,b' where each item can be the string representation of an integer between 0 and 255
=============== Diff against Graphics-mt.353 ===============
Item was changed:
----- Method: Color class>>fromString: (in category 'instance creation') -----
fromString: aString
+ "for HTML color spec: #FFCCAA or white/black/red/other name, or an r,g,b triplet string"
- "for HTML color spec: #FFCCAA or white/black"
"Color fromString: '#FFCCAA'.
Color fromString: 'white'.
+ Color fromString: 'orange'
+ Color fromString: '126,42,33' "
- Color fromString: 'orange'"
+ | aColorHex rgb|
- | aColorHex |
aString isEmptyOrNil ifTrue: [ ^self white ].
aString first = $#
ifTrue: [ aColorHex := aString allButFirst ]
ifFalse: [ aColorHex := aString ].
+ "is the string a 6 digit hex number?"
(aColorHex size = 6 and: [
aColorHex allSatisfy: [ :each | '0123456789ABCDEFabcdef' includes: each ] ])
ifTrue: [
| green red blue |
+ red := (Integer readFrom: (aColorHex first: 2) base: 16).
+ green := (Integer readFrom: (aColorHex copyFrom: 3 to: 4) base: 16).
+ blue := (Integer readFrom: (aColorHex last: 2) base: 16).
+ ^self r: red g: green b: blue range: 255].
+ "is the string in the form a,b,c ?"
+ rgb := aColorHex findTokens: $, .
+ rgb size = 3 ifTrue: [
+ | green red blue |
+ red := (Integer readFrom:(rgb at: 1)) min: 255 max: 0.
+ green := (Integer readFrom:(rgb at: 2)) min: 255 max: 0.
+ blue := (Integer readFrom:(rgb at: 3)) min: 255 max: 0.
+ ^self r: red g: green b: blue range: 255].
- red := (Integer readFrom: (aColorHex first: 2) base: 16) / 255.
- green := (Integer readFrom: (aColorHex copyFrom: 3 to: 4) base: 16) / 255.
- blue := (Integer readFrom: (aColorHex last: 2) base: 16) / 255.
- ^self r: red g: green b: blue ].
"try to match aColorHex with known named colors, case insensitive"
^self perform: (ColorNames detect: [:colorSymbol | aColorHex sameAs: colorSymbol] ifNone: [ #white ])!
Chris Muller uploaded a new version of Files to project The Trunk:
http://source.squeak.org/trunk/Files-cmm.159.mcz
==================== Summary ====================
Name: Files-cmm.159
Author: cmm
Time: 21 July 2016, 3:44:04.16263 pm
UUID: 52077283-7106-4ab6-8368-d5f4b5f6f641
Ancestors: Files-eem.158
Fix FileDirectory>>#/ to not assume the argument represents another directory; it could be a file.
=============== Diff against Files-eem.158 ===============
Item was changed:
----- Method: FileDirectory>>/ (in category 'path access') -----
/ aString
"Answer a FileDirectory on a subdirectory named aString, of the receiver."
+ ^ FileDirectory directoryEntryFor: (self fullNameFor: aString)!
- ^ FileDirectory on: (self fullNameFor: aString)!
commits-2 wrote
> Patrick Rein uploaded a new version of Morphic to project The Trunk:
> http://source.squeak.org/trunk/Morphic-pre.1192.mcz
>
> ==================== Summary ====================
>
> Name: Morphic-pre.1192
> Author: pre
> Time: 20 July 2016, 11:03:12.063382 pm
> UUID: bd2a03f6-120a-d543-af91-d4535051c547
> Ancestors: Morphic-mt.1191
>
> Removing code from the TextMorph which copied text attributes from the old
> content to the new content in certain cases.
>
> =============== Diff against Morphic-mt.1191 ===============
>
> Item was changed:
> ----- Method: TextMorph>>newContents: (in category 'accessing') -----
> newContents: stringOrText
> "Accept new text contents."
> | newText embeddedMorphs oldSelection |
> "If my text is all the same font, use the font for my new contents"
> + newText := stringOrText isString
> + ifTrue: [Text fromString: stringOrText copy ]
> + ifFalse: [ stringOrText copy asText. "should be veryDeepCopy?" ].
> - newText := stringOrText isString ifTrue: [ | textSize |
> - (text notNil
> - and: [ (textSize := text size) > 0
> - and: [ (text runLengthFor: 1) = textSize ]]) ifTrue: [ | attribs |
> - attribs := text attributesAt: 1 forStyle: textStyle.
> - Text string: stringOrText copy attributes: attribs.
> - ]
> - ifFalse: [ Text fromString: stringOrText copy ]
> - ]
> - ifFalse: [ stringOrText copy asText. "should be veryDeepCopy?" ].
>
> (text = newText and: [text runs = newText runs]) ifTrue: [^ self]. "No
> substantive change"
> text ifNotNil: [(embeddedMorphs := text embeddedMorphs)
> ifNotNil:
> [self removeAllMorphsIn: embeddedMorphs.
> embeddedMorphs do: [:m | m delete]]].
>
> oldSelection := editor ifNotNil: [:ed | ed selectionInterval].
> text := newText.
>
> "add all morphs off the visible region; they'll be moved into the right
> place when they become visible. (this can make the scrollable area too
> large, though)"
> newText embeddedMorphs do:
> [:m |
> self addMorph: m.
> m position: -1000 @ 0].
> self releaseParagraph.
> "update the paragraph cache"
> self paragraph.
> oldSelection ifNotNil: [:sel | self selectFrom: sel first to: sel
> last].
> "re-instantiate to set bounds"
> self world ifNotNil: [self world startSteppingSubmorphsOf: self]!
Hi Patrick,
this does the same job:
...
newText := stringOrText copy asText.
...
Because Text >> #asText does not create a new instance of Text for a Text.
Best,
Marcel
--
View this message in context: http://forum.world.st/The-Trunk-Morphic-pre-1192-mcz-tp4907285p4907364.html
Sent from the Squeak - Dev mailing list archive at Nabble.com.
I know that it’s a hard thing to deal with floating point numbers around the fiddly edges, but are we really unable to do a decent job of rounding floats to reasonable numbers of decimal places? This can’t be a rare thing to need to do.
For example, I’m reading temperature values for various places from the openweathermap.org site and many of them are specified to 2dp, which seems a bit optimistic for a weather site. But if I try, for example
292.37 roundTo: 0.1
I get the very unhelpful 292.40000…00003 (with too many 0s to count by eye). I understand that one option is to use formatted printing of the number but that doesn’t seem practical for this usage right now.
So, numerics aficionados, can we do any better than the sensible seeming but unsuccessful code in Number>>roundTo: ?
tim
--
tim Rowledge; tim(a)rowledge.org; http://www.rowledge.org/tim
Ubi dubium ibi libertas
Marcel Taeumel uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-mt.839.mcz
==================== Summary ====================
Name: System-mt.839
Author: mt
Time: 21 July 2016, 12:00:37.651126 pm
UUID: b03d59a3-0b13-6f45-87f3-6cc36ac0eb78
Ancestors: System-mt.838
A more descriptive dialog when removing a selector that is used in the system.
=============== Diff against System-mt.838 ===============
Item was changed:
----- Method: SystemNavigation>>confirmRemovalOf:on: (in category 'ui') -----
confirmRemovalOf: aSelector on: aClass
"Determine if it is okay to remove the given selector. Answer 1 if it
should be removed, 2 if it should be removed followed by a senders
browse, and 3 if it should not be removed."
| count answer caption allCalls |
allCalls := self allCallsOn: aSelector.
(count := allCalls size) = 0
ifTrue: [^ 1].
"no senders -- let the removal happen without warning"
count = 1
ifTrue: [(allCalls first actualClass == aClass
and: [allCalls first methodSymbol == aSelector])
ifTrue: [^ 1]].
"only sender is itself"
+ caption := 'The message "{1}" has {2} sender{3}.' translated format: {aSelector. count. count > 1 ifTrue: ['s'] ifFalse: ['']}.
+
- caption := 'This message has ' , count printString , ' sender'.
- count > 1
- ifTrue: [caption := caption copyWith: $s].
answer := UIManager default
chooseFrom: #('Remove it'
'Remove, then browse senders'
'Don''t remove, but show me those senders'
'Forget it -- do nothing -- sorry I asked') title: caption.
answer = 3
ifTrue: [self
browseMessageList: allCalls
name: 'Senders of ' , aSelector
autoSelect: aSelector keywords first].
answer = 0
ifTrue: [answer := 3].
"If user didn't answer, treat it as cancel"
^ answer min: 3!
Marcel Taeumel uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-mt.838.mcz
==================== Summary ====================
Name: System-mt.838
Author: mt
Time: 21 July 2016, 11:55:13.013126 am
UUID: 2329d019-0868-b345-96ad-3eb65dc1509a
Ancestors: System-mt.837
In "slips detected - browse?" dialogs, use "confirm" instead of "choose".
=============== Diff against System-mt.837 ===============
Item was changed:
----- Method: ChangeSet>>fileOut (in category 'fileIn/Out') -----
fileOut
"File out the receiver, to a file whose name is a function of the
change-set name and either of the date & time or chosen to have a
unique numeric tag, depending on the preference
'changeSetVersionNumbers'"
| slips nameToUse |
self checkForConversionMethods.
ChangeSet promptForDefaultChangeSetDirectoryIfNecessary.
nameToUse := Preferences changeSetVersionNumbers
ifTrue: [self defaultChangeSetDirectory nextNameFor: self name extension: FileStream cs]
ifFalse: [self name , FileDirectory dot , Utilities dateTimeSuffix, FileDirectory dot , FileStream cs].
Cursor write showWhile: [ | internalStream |
internalStream := WriteStream on: (String new: 10000).
internalStream header; timeStamp.
self fileOutPreambleOn: internalStream.
self fileOutOn: internalStream.
self fileOutPostscriptOn: internalStream.
internalStream trailer.
FileStream writeSourceCodeFrom: internalStream baseName: (nameToUse copyFrom: 1 to: nameToUse size - 3) isSt: false useHtml: false.
].
Preferences checkForSlips
ifFalse: [^ self].
slips := self checkForSlips.
(slips size > 0
+ and: [UIManager default confirm: 'Changeset was filed out. Still, methods in this fileOut have halts\or references to the Transcript or other ''slips'' in them.\Would you like to browse them?' withCRs
+ title: 'Browse Slips?'])
- and: [(UIManager default chooseFrom: #('Ignore' 'Browse slips')
- title: 'Methods in this fileOut have halts
- or references to the Transcript
- or other ''slips'' in them.
- Would you like to browse them?')
- = 2])
ifTrue: [self systemNavigation browseMessageList: slips name: 'Possible slips in ' , name]!
Item was changed:
----- Method: ChangeSet>>lookForSlips (in category 'fileIn/Out') -----
lookForSlips
"Scan the receiver for changes that the user may regard as slips to be remedied"
| slips nameLine msg |
nameLine := '
"', self name, '"
'.
(slips := self checkForSlips) size = 0 ifTrue:
+ [^ self inform: ('No slips detected in change set\"{1}".' translated withCRs format: {self name})].
- [^ self inform: 'No slips detected in change set', nameLine].
msg := slips size = 1
ifTrue:
+ [ 'One method in change set "{1}"\has a halt, reference to the Transcript,
+ and/or some other ''slip'' in it.\Would you like to browse it?' translated withCRs format: {self name}]
- [ 'One method in change set', nameLine,
- 'has a halt, reference to the Transcript,
- and/or some other ''slip'' in it.
- Would you like to browse it? ?']
ifFalse:
+ [ '{1} methods in change set "{2}"\have halts or references to the
+ Transcript or other ''slips'' in them.\Would you like to browse them?' translated withCRs format: {slips size. self name}].
- [ slips size printString,
- ' methods in change set', nameLine, 'have halts or references to the
- Transcript or other ''slips'' in them.
- Would you like to browse them?'].
+ (UIManager default confirm: msg title: 'Browse Slips?')
+ ifTrue: [self systemNavigation
+ browseMessageList: slips
+ name: 'Possible slips in ', self name]!
- (UIManager default chooseFrom: #('Ignore' 'Browse slips') title: msg) = 2
- ifTrue: [self systemNavigation browseMessageList: slips
- name: 'Possible slips in ', name]!