[squeak-dev] The Inbox: Morphic-ct.1502.mcz

Marcel Taeumel marcel.taeumel at hpi.de
Mon Aug 12 16:59:36 UTC 2019


-1 :-)

Why making assumptions about what can be handled in any higher-level tool at such a low-level point in the text editor? Isn't such a filter kind of surprising there?

If we need input validation, I would implement it as an extra concept. Think about "only type a valid e-mail address" or "only type visible characters". :-) The tool could configure its text editor with an input validator.

Best,
Marcel
Am 12.08.2019 14:20:44 schrieb commits at source.squeak.org <commits at source.squeak.org>:
A new version of Morphic was added to project The Inbox:
http://source.squeak.org/inbox/Morphic-ct.1502.mcz

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

Name: Morphic-ct.1502
Author: ct
Time: 12 August 2019, 2:20:26.720463 pm
UUID: 6787b177-fd9b-f44b-a8fc-d9e8b46dc54a
Ancestors: Morphic-mt.1498

Do not print invisible characters

Complements ST80-ct.238. Requires Collections-ct.848. Replaces Morphic-ct.1499!

=============== Diff against Morphic-mt.1498 ===============

Item was changed:
----- Method: TextEditor>>dispatchOnKeyboardEvent: (in category 'typing support') -----
dispatchOnKeyboardEvent: aKeyboardEvent
"Carry out the action associated with this character, if any. Type-ahead is passed so some routines can flush or use it."

| honorCommandKeys typedChar |
typedChar := aKeyboardEvent keyCharacter.

"Handle one-line input fields."
(typedChar == Character cr and: [morph acceptOnCR])
ifTrue: [^ true].

"Clear highlight for last opened parenthesis."
self clearParens.

"Handle line breaks and auto indent."
typedChar == Character cr ifTrue: [
aKeyboardEvent controlKeyPressed
ifTrue: [^ self normalCharacter: aKeyboardEvent].
aKeyboardEvent shiftPressed
ifTrue: [^ self lf: aKeyboardEvent].
aKeyboardEvent commandKeyPressed
ifTrue: [^ self crlf: aKeyboardEvent].
^ self crWithIndent: aKeyboardEvent].

"Handle indent/outdent with selected text block."
typedChar == Character tab ifTrue: [
aKeyboardEvent shiftPressed
ifTrue: [self outdent: aKeyboardEvent. ^ true]
ifFalse: [self hasMultipleLinesSelected
ifTrue: [self indent: aKeyboardEvent. ^ true]]].

honorCommandKeys := Preferences cmdKeysInText.

(honorCommandKeys and: [typedChar == Character enter])
ifTrue: [^ self dispatchOnEnterWith: aKeyboardEvent].

"Special keys overwrite crtl+key combinations - at least on Windows. To resolve this
conflict, assume that keys other than cursor keys aren't used together with Crtl."
((self class specialShiftCmdKeys includes: aKeyboardEvent keyValue)
and: [aKeyboardEvent keyValue <>
ifTrue: [^ aKeyboardEvent controlKeyPressed
ifTrue: [self
perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1)
with: aKeyboardEvent]
ifFalse: [self
perform: (self class cmdActions at: aKeyboardEvent keyValue + 1)
with: aKeyboardEvent]].

"backspace, and escape keys (ascii 8 and 27) are command keys"
((honorCommandKeys and: [aKeyboardEvent commandKeyPressed])
or: [self class specialShiftCmdKeys includes: aKeyboardEvent keyValue])
ifTrue: [ ^ aKeyboardEvent shiftPressed
ifTrue: [self
perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1)
with: aKeyboardEvent]
ifFalse: [self
perform: (self class cmdActions at: aKeyboardEvent keyValue + 1)
with: aKeyboardEvent]].

"the control key can be used to invoke shift-cmd shortcuts"
(honorCommandKeys and: [ aKeyboardEvent controlKeyPressed ])
ifTrue: [^ self
perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1)
with: aKeyboardEvent].

"Enclose selection with brackets etc."
((self class encloseSelection and: [self hasSelection]) and: [self enclose: aKeyboardEvent])
ifTrue: [^ true].

"Automatically enclose paired characters such as brackets."
(self class autoEnclose and: [self autoEncloseFor: typedChar])
ifTrue: [^ true].

"Even if no enclosing feature was used, highlight the matching bracket when closing one."
(')]}' includes: typedChar)
ifTrue: [self blinkPrevParen: typedChar].
+
+ typedChar isInvisible
+ ifTrue: [^ true].
+ ^ self normalCharacter: aKeyboardEvent!
-
- self normalCharacter: aKeyboardEvent.
- ^ false!


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20190812/b5ee963e/attachment.html>


More information about the Squeak-dev mailing list