[squeak-dev] The Inbox: Protocols-jr.88.mcz

commits at source.squeak.org commits at source.squeak.org
Sun Aug 21 19:21:15 UTC 2022


A new version of Protocols was added to project The Inbox:
http://source.squeak.org/inbox/Protocols-jr.88.mcz

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

Name: Protocols-jr.88
Author: jr
Time: 21 August 2022, 7:22:57.120081 pm
UUID: b1c250d9-d09e-4d4b-ba35-ca77e2f35f4c
Ancestors: Protocols-ct.86

Extract navigation management by using the new MessageNavigation class

This also fixes the bug that the "view the previous active method" button (or "<" button) only toggled between the previous and the current method, but could not go back further in history.

=============== Diff against Protocols-ct.86 ===============

Item was changed:
  ----- Method: Lexicon>>navigateToNextMethod (in category 'history') -----
  navigateToNextMethod
  	"Navigate to the 'next' method in the current viewing sequence"
  
+ 	| next |
+ 	next := self selectorsVisited goForward.
+ 	next ifNil: [^ self].
+ 	self selectorsVisited suspendNavigationLogDuring:
+ 		[self selectedCategoryName == self class viewedCategoryName 
+ 			ifTrue:
+ 				[self selectWithinCurrentCategory: next]
+ 			ifFalse:
+ 				[self displaySelector: next]].!
- 	| anIndex aSelector |
- 	self selectorsVisited size = 0 ifTrue: [^ self].
- 	anIndex := (aSelector := self selectedMessageName) notNil ifTrue: [selectorsVisited indexOf: aSelector ifAbsent: [selectorsVisited size]] ifFalse: [1].
- 	self selectedCategoryName == self class viewedCategoryName 
- 		ifTrue:
- 			[self selectWithinCurrentCategory: (selectorsVisited atWrap: (anIndex + 1))]
- 		ifFalse:
- 			[self displaySelector: (selectorsVisited atWrap: (anIndex + 1))]!

Item was changed:
  ----- Method: Lexicon>>navigateToPreviousMethod (in category 'history') -----
  navigateToPreviousMethod
  	"Navigate to the 'previous' method in the current viewing sequence"
  
+ 	| previous |
+ 	previous := self selectorsVisited goBack.
+ 	previous ifNil: [^ self].
+ 	self selectorsVisited suspendNavigationLogDuring:
+ 		[self selectedCategoryName == self class viewedCategoryName 
+ 			ifTrue:
+ 				[self selectWithinCurrentCategory: previous]
+ 			ifFalse:
+ 				[self displaySelector: previous]].
+ 	!
- 	| anIndex aSelector |
- 	self selectorsVisited size = 0 ifTrue: [^ self].
- 	anIndex := (aSelector := self selectedMessageName) notNil
- 		ifTrue: [selectorsVisited indexOf: aSelector ifAbsent: [selectorsVisited size]]
- 		ifFalse: [selectorsVisited size].
- 	self selectedCategoryName == self class viewedCategoryName 
- 		ifTrue:
- 			[self selectWithinCurrentCategory: (selectorsVisited atWrap: (anIndex - 1))]
- 		ifFalse:
- 			[self displaySelector: (selectorsVisited atWrap: (anIndex - 1))]!

Item was changed:
  ----- Method: Lexicon>>noteAcceptanceOfCodeFor: (in category 'transition') -----
  noteAcceptanceOfCodeFor: newSelector
  	"The user has submitted new code for the given selector; take a note of it.  NB that the selectors-changed list gets added to here, but is not currently used in the system."
+ 	self selectorsVisited current: newSelector.!
- 
- 	(self selectorsVisited includes: newSelector) ifFalse: [selectorsVisited add: newSelector].!

Item was changed:
  ----- Method: Lexicon>>selectorsVisited (in category 'history') -----
  selectorsVisited
  	"Answer the list of selectors visited in this tool"
+ 	selectorsVisited ifNil: [selectorsVisited := MessageNavigation new].
+ 	(selectorsVisited isMemberOf: OrderedCollection)
+ 		ifTrue: "migrate old instances"
+ 			[| new | new := MessageNavigation new.
+ 			selectorsVisited do: [:each | new current: each].
+ 			selectorsVisited := new].
+ 	^ selectorsVisited!
- 
- 	^ selectorsVisited ifNil: [selectorsVisited := OrderedCollection new]!

Item was changed:
  ----- Method: Lexicon>>updateSelectorsVisitedfrom:to: (in category 'history') -----
  updateSelectorsVisitedfrom: oldSelector to: newSelector
  	"Update the list of selectors visited."
  
+ 	self selectorsVisited current: newSelector.!
- 	newSelector == oldSelector ifTrue: [^ self].
- 	self selectorsVisited remove: newSelector ifAbsent: [].
- 		
- 	(selectorsVisited includes:  oldSelector)
- 		ifTrue:
- 			[selectorsVisited add: newSelector after: oldSelector]
- 		ifFalse:
- 			[selectorsVisited add: newSelector]
- !



More information about the Squeak-dev mailing list