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

commits at source.squeak.org commits at source.squeak.org
Fri Dec 27 22:46:58 UTC 2019


A new version of Morphic was added to project The Inbox:
http://source.squeak.org/inbox/Morphic-ct.1613.mcz

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

Name: Morphic-ct.1613
Author: ct
Time: 27 December 2019, 11:46:47.586723 pm
UUID: 8f865366-6490-c546-a7e0-7b5a41716611
Ancestors: Morphic-mt.1612

Proposal: Smarten autoEnclose by only inserting the closer if the trailing character is a separator, or if the cursor is at the end of the text. This roughly matches the default behavior of VS Code, for example. If the next character belongs to an identifier, the user is likely to enclose the next words, so he won't need a closing character just here.

Full discussion can be viewed here: http://forum.world.st/Preference-settings-for-5-3-release-tt5108535.html#a5108698

=============== Diff against Morphic-mt.1612 ===============

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 |
  	openers := '([{'.
  	closers := ')]}'.
  	(closers includes: typedChar) ifTrue:
  		[ | pos |
  		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) and: [
+ 		self text
+ 			at: self markIndex
+ 			ifPresent: #isSeparator
+ 			ifAbsent: [true]]) ifTrue:
- 	(openers includes: typedChar) ifTrue:
  		[ 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 Squeak-dev mailing list