[BUG][FIX] Squeak 3.8 TextMorph does not implement selectFrom:to: sent from TextMorphEditor

David Shaffer cdshaffer at acm.org
Wed Jun 1 14:55:01 UTC 2005


Bring up a text morph in 3.8 and try to change the font.  You should get
attached walkback.  I fixed this by changing receiver of selectFrom:to:
(in TextMorphEditor>>changeStyle) from the TextMorph to the
TextMorphEditor itself.  I have no idea if this is consistent with the
intent of the morph/editor design but it works.

David

-------------- next part --------------
A non-text attachment was scrubbed...
Name: SqueakDebug.log
Type: text/x-log
Size: 4414 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20050601/eb2c299f/SqueakDebug.bin
-------------- next part --------------
'From Squeak3.8 of ''5 May 2005'' [latest update: #6665] on 1 June 2005 at 10:52:07 am'!

!TextMorphEditor methodsFor: 'attributes' stamp: 'cds 6/1/2005 10:51'!
changeStyle
	"Let user change styles for the current text pane."
	| aList reply style theStyle menuList startIndex stopIndex |
	self flag: #arNote. "Move this up once we get rid of MVC"
	startIndex := self startIndex.
	stopIndex := self stopIndex-1 min: paragraph text size.
	aList := StrikeFont actualFamilyNames.
	theStyle := paragraph textStyle.
	menuList := aList collect:[:styleName|
		"Hack!! use defaultFont for comparison - we have no name that we could use for compare and the style changes with alignment so they're no longer equal."
		(TextConstants at: styleName) defaultFont == theStyle defaultFont
			ifTrue:['<on>', styleName]
			ifFalse:['<off>',styleName]].
	theStyle = TextStyle default
		ifTrue:[menuList addFirst: '<on>DefaultTextStyle']
		ifFalse:[menuList addFirst: '<off>DefaultTextStyle'].
	aList addFirst: 'DefaultTextStyle'.
	reply := (SelectionMenu labelList: menuList lines: #(1) selections: aList) startUpWithCaption: nil at: ActiveHand position allowKeyboard: false.
	reply ifNotNil:
		[(style := TextStyle named: reply) ifNil: [Beeper beep. ^ true].
		paragraph textStyle: style copy.
		paragraph composeAll.
		self recomputeSelection.
		self mvcRedisplay].
	self selectFrom: startIndex to: stopIndex.
	^ true! !


More information about the Squeak-dev mailing list