Personally, I sometimes type-to-filter a menu for things like '...' or ' ' (space). Am I the only one who does this? :)
I still would consider something like Character>>#isControlCharacter useful. How about this?
Unicode class>>isControlCode: charCode ^ (self generalCategoryOf: charCode) <= Cs
Character>>isControlCharacter ^ self encodedCharSet isControlCode: self charCode
Versions for other char sets would have to be added.
Best, Christoph ________________________________ Von: Squeak-dev squeak-dev-bounces@lists.squeakfoundation.org im Auftrag von commits@source.squeak.org commits@source.squeak.org Gesendet: Donnerstag, 5. September 2019 14:36:59 An: squeak-dev@lists.squeakfoundation.org; packages@lists.squeakfoundation.org Betreff: [squeak-dev] The Trunk: Morphic-mt.1514.mcz
Marcel Taeumel uploaded a new version of Morphic to project The Trunk: http://source.squeak.org/trunk/Morphic-mt.1514.mcz
==================== Summary ====================
Name: Morphic-mt.1514 Author: mt Time: 5 September 2019, 2:36:47.777837 pm UUID: 49f63b40-72ce-c447-9fb0-9400ea43fab2 Ancestors: Morphic-mt.1513, Morphic-ct.1501
Merges Morphic-ct.1500. and 1501.
Can't we just filter for #isAlphaNumeric? Do we need parentheses etc.? Would be more readable than ">= 32". I also do not think that #caseOf: helps much in terms of readability. ;-)
=============== Diff against Morphic-mt.1513 ===============
Item was changed: ----- Method: MenuMorph>>handleFiltering: (in category 'keystroke helpers') ----- handleFiltering: evt
| matchString | matchString := self valueOfProperty: #matchString ifAbsentPut: [ String new ]. + matchString := true + caseOf: { + [ evt keyCharacter = Character backspace ] -> + [ matchString isEmpty + ifTrue: [ matchString ] + ifFalse: [ matchString allButLast ] ]. + [ evt keyValue >= 32 ] -> + [ matchString , evt keyCharacter ] } + otherwise: [ matchString ]. - matchString := evt keyValue = 8 " Character backspace asciiValue " - ifTrue: [ - matchString isEmpty - ifTrue: [ matchString ] - ifFalse: [ matchString allButLast ] ] - ifFalse: [ - matchString copyWith: evt keyCharacter ]. self setProperty: #matchString toValue: matchString. self displayFiltered: evt!