Skip to content

Commit

Permalink
implemented maxNumberOfCommands
Browse files Browse the repository at this point in the history
  • Loading branch information
Aleksander Morgensterns committed Jul 2, 2024
1 parent 41c5651 commit 6accca4
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion source/GM-TE/GMTEEditor.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,15 @@ GMTEEditor class >> getVisibilityIndicator: aBoolean [
ifFalse: [^ ' (h)']
]

{
#category : #constants,
#'squeak_changestamp' : 'Alex M 7/2/2024 17:46'
}
GMTEEditor class >> maxNumberOfCommands [

^ 10
]

{
#category : #fileHandling,
#'squeak_changestamp' : 'jj 6/23/2024 14:09'
Expand Down Expand Up @@ -159,13 +168,16 @@ GMTEEditor class >> tileMapMinPaddingSize [

{
#category : #'command processing',
#'squeak_changestamp' : 'Alex M 6/28/2024 19:52'
#'squeak_changestamp' : 'Alex M 7/2/2024 17:50'
}
GMTEEditor >> addCommand: aCommand [

"when a new change is made, all timestamps from the 'future' are deleted"
[self commands size > self currentCommand] whileTrue: [self commands removeLast].

(self commands size > self class maxNumberOfCommands) ifTrue: [self commands removeFirst.
self currentCommand: self currentCommand - 1].

self commands add: aCommand.
self currentCommand: self currentCommand + 1
]
Expand Down

0 comments on commit 6accca4

Please sign in to comment.