[Pkg] The Trunk: Morphic-mt.1809.mcz
commits at source.squeak.org
commits at source.squeak.org
Thu Dec 2 16:40:57 UTC 2021
Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-mt.1809.mcz
==================== Summary ====================
Name: Morphic-mt.1809
Author: mt
Time: 2 December 2021, 5:40:51.014715 pm
UUID: c4587ea6-ec38-da4c-923c-3f9382d32eeb
Ancestors: Morphic-mt.1808
Tweaks #autoEnclose feature. See http://lists.squeakfoundation.org/pipermail/squeak-dev/2021-December/217304.html
Please report issues ASAP.
=============== Diff against Morphic-mt.1808 ===============
Item was changed:
----- Method: TextEditor>>autoEncloseFor: (in category 'typing support') -----
autoEncloseFor: typedChar
"Answer whether typeChar was handled by auto-enclosure. Caller should call normalCharacter if not."
+ | openers closers next |
- | openers closers |
openers := '([{'.
closers := ')]}'.
+ next := self string at: self startIndex ifAbsent: nil.
(closers includes: typedChar) ifTrue:
[ | pos |
+ (next isNil or: [next = typedChar]) ifFalse: [ ^ false ].
self blinkPrevParen: typedChar.
((pos := self indexOfNextNonwhitespaceCharacter) notNil and: [ (paragraph string at: pos) = typedChar ])
ifTrue:
[ self
moveCursor: [ : position | position + pos - pointBlock stringIndex + 1 ]
forward: true
select: false.
^ true ]
ifFalse: [ ^ false ] ].
(openers includes: typedChar) ifTrue:
+ [ (self hasSelection or: [next isNil or: [next isSeparator or: [closers includes: next]]]) ifFalse: [ ^ false ].
+ self
- [ self
openTypeIn;
addString: typedChar asString;
addString: (closers at: (openers indexOf: typedChar)) asString;
insertAndCloseTypeIn;
moveCursor: [ : position | position - 1 ]
forward: false
select: false.
^ true ].
^ false!
More information about the Packages
mailing list