[squeak-dev] The Trunk: EToys-mt.452.mcz

commits at source.squeak.org commits at source.squeak.org
Sat Dec 4 11:26:57 UTC 2021


Marcel Taeumel uploaded a new version of EToys to project The Trunk:
http://source.squeak.org/trunk/EToys-mt.452.mcz

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

Name: EToys-mt.452
Author: mt
Time: 4 December 2021, 12:26:49.651493 pm
UUID: c72f2909-3bc4-3243-b5cb-19d0f84d8f7f
Ancestors: EToys-mt.451

Complements Morphic-mt.1812

=============== Diff against EToys-mt.451 ===============

Item was removed:
- ----- Method: ParagraphEditor>>shiftEnclose: (in category '*Etoys-Squeakland-editing keys') -----
- shiftEnclose: characterStream
- 	"Insert or remove bracket characters around the current selection.
- 	 Flushes typeahead."
- 
- 	| char left right startIndex stopIndex oldSelection which text |
- 	char := sensor keyboard.
- 	char = $9 ifTrue: [ char := $( ].
- 	char = $, ifTrue:     "[ char := $< ]"
- 		[self closeTypeIn.
- 		Project current world showSourceKeyHit.
- 		^ true].
- 	char = $[ ifTrue: [ char := ${ ].
- 	char = $' ifTrue: [ char := $" ].
- 	char asciiValue = 27 ifTrue: [ char := ${ ].	"ctrl-["
- 
- 	self closeTypeIn.
- 	startIndex := self startIndex.
- 	stopIndex := self stopIndex.
- 	oldSelection := self selection.
- 	which := '([<{"''' indexOf: char ifAbsent: [1].
- 	left := '([<{"''' at: which.
- 	right := ')]>}"''' at: which.
- 	text := paragraph text.
- 	((startIndex > 1 and: [stopIndex <= text size])
- 		and:
- 		[(text at: startIndex-1) = left and: [(text at: stopIndex) = right]])
- 		ifTrue:
- 			["already enclosed; strip off brackets"
- 			self selectFrom: startIndex-1 to: stopIndex.
- 			self replaceSelectionWith: oldSelection]
- 		ifFalse:
- 			["not enclosed; enclose by matching brackets"
- 			self replaceSelectionWith:
- 				(Text string: (String with: left), oldSelection string ,(String with: right)
- 					emphasis: emphasisHere).
- 			self selectFrom: startIndex+1 to: stopIndex].
- 	^true!



More information about the Squeak-dev mailing list