[BUG][FIX] Celeste>>updateTOC

Steve Elkins sgelkins at bellsouth.net
Wed Nov 24 17:40:33 UTC 1999


The method version included below fixes a pair of
minor bugs in Celeste>>updateTOC.  To see the bugs,
make sure no category is selected in the category
pane and choose 'empty trash' from the category
menu.  The fixes account for the possibility that
'currentMessages' may be nil.

-----------8<----------->8-----------

'From Squeak2.7alpha of 13 November 1999 [latest update: #1637] on 24 November 1999 at 5:16:03 pm'!

!Celeste methodsFor: 'table of contents pane' stamp: 'sge 11/24/1999 17:11'!
updateTOC
	"Update the table of contents after a moving, removing, or deleting a message. Select a message near the removed message in the table of contents if possible."

	| currentMsgIndex |
	(currentCategory isNil or:
	 [currentMsgID isNil or:
	 [currentMessages size < 2]])
		ifTrue: [currentMsgIndex _ 1]
		ifFalse: [currentMsgIndex _ currentMessages indexOf: currentMsgID].
	currentMsgID _ nil.
	self setCategory: currentCategory.  "update currentMessages, currentTOC"
	currentMessages isEmptyOrNil ifFalse: [
		(currentMsgIndex <= currentMessages size)
			ifTrue: [currentMsgID _ currentMessages at: currentMsgIndex]
			ifFalse: [currentMsgID _ currentMessages last].
	].

	self changed: #tocEntryList.
	self changed: #tocEntry.
	self changed: #messageText.
! !





More information about the Squeak-dev mailing list