[squeak-dev] #isControlCharacter (was: The Trunk: Morphic-mt.1514.mcz)

David T. Lewis lewis at mail.msen.com
Thu Oct 3 00:34:28 UTC 2019


My personal event horizon does not extend beyond seven bits, so
anything that I say about Unicode should not be taken seriously.
However:

The concept of "isControlCharacter" dates back to the days of data
terminals connected over seven bit serial lines, and to the use of control
characters for various functions not related to printing characters on
the display screen. I do not really understand the reference to
"type-to-filter a menu for things like '...' or ' ' (space)", but 
it does not sound to me like "control character" would be the right
description.

Wikipedia has http://en.wikipedia.org/wiki/Control_character which
gives good background. It includes a paragraph about Unicode that
says this:

  In Unicode, "Control-characters" are U+0000—U+001F
  (C0 controls), U+007F (delete), and U+0080—U+009F
  (C1 controls). Their General Category is "Cc". Formatting codes
  are distinct, in General Category "Cf". The Cc control characters
  have no Name in Unicode, but are given labels such as "<control-001A>"
  instead. 

So it certainly would be possible to define #isControlCharacter
for Unicode characters, but IMHO it seems to drag along some ancient
concepts of serial data communications that are probably not
meaningful inside a Squeak image.

Another reference is "man 3 isalpha" on Unix/Linux (C89 and Posix).
There are quite a few character testing functions. Most of them
do not exist in Squeak, and I would not be inclined to start adding
any of them without a good reason.

Dave


On Wed, Oct 02, 2019 at 11:05:04PM +0000, Thiede, Christoph wrote:
> Hi,
> 
> 
> any opinions about this proposal? :-)
> 
> 
> Best,
> 
> Christoph
> 
> ________________________________
> Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im Auftrag von Thiede, Christoph
> Gesendet: Donnerstag, 5. September 2019 15:06 Uhr
> An: squeak-dev at lists.squeakfoundation.org; packages at lists.squeakfoundation.org
> Betreff: Re: [squeak-dev] The Trunk: Morphic-mt.1514.mcz
> 
> 
> 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 at lists.squeakfoundation.org> im Auftrag von commits at source.squeak.org <commits at source.squeak.org>
> Gesendet: Donnerstag, 5. September 2019 14:36:59
> An: squeak-dev at lists.squeakfoundation.org; packages at 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!
> 
> 

> 



More information about the Squeak-dev mailing list