From 6accca40ce7ab13f221a6107688757145cc08740 Mon Sep 17 00:00:00 2001 From: Aleksander Morgensterns Date: Tue, 2 Jul 2024 17:51:22 +0200 Subject: [PATCH] implemented maxNumberOfCommands --- source/GM-TE/GMTEEditor.class.st | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/source/GM-TE/GMTEEditor.class.st b/source/GM-TE/GMTEEditor.class.st index 3465a630..ca0d85ea 100644 --- a/source/GM-TE/GMTEEditor.class.st +++ b/source/GM-TE/GMTEEditor.class.st @@ -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' @@ -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 ]