'From Cuis 2.4 of 17 June 2010 [latest update: #509] on 2 July 2010 at 2:09:57 pm'!

!TextEditor methodsFor: 'events' stamp: 'jmv 7/2/2010 14:08'!
mouseUp: evt
	"An attempt to break up the old processRedButton code into threee phases"
	| cursorBlock cursorIndex startBlock startIndex stopBlock stopIndex |
	oldInterval ifNil: [^ self].  "Patched during clickAt: repair"

	oldInterval = self selectionInterval
		ifTrue: [
			evt shiftPressed
				ifFalse: [
					"Not a real double-click, but the second click in the same place, without shift.
					Act as if double click (classic Squeak behavior)"
					self selectWord ]
				ifTrue: [
					"Squeak classic behavior for click, move, shift-click sequence "
					"self pointBlock: (paragraph characterBlockAtPoint: (evt cursorPoint))."

					"Mac behavior"
					cursorBlock _ paragraph characterBlockAtPoint: evt cursorPoint.
					cursorIndex _ cursorBlock stringIndex.
					startBlock _ self startBlock min: cursorBlock.
					startIndex _ startBlock stringIndex.
					stopBlock _ self stopBlock max: cursorBlock.
					stopIndex _ stopBlock stringIndex.
					(stopIndex - cursorIndex) < (cursorIndex - startIndex)
						ifTrue: [
							self markBlock: startBlock.
							self pointBlock: cursorBlock ]
						ifFalse: [
							self markBlock: stopBlock.
							self pointBlock: cursorBlock ]]].

	self setEmphasisHereFromText.
	(self isDisjointFrom: oldInterval) ifTrue: [
		otherInterval _ oldInterval].

	self storeSelectionInParagraph	"store selection , done in this method, (shift click) or perhaps in #mouseDown: (click)"! !

