in plc4go/tools/plc4xpcapanalyzer/ui/config.go [147:168]
func addCommandHistoryEntry(command string) {
switch command {
case "clear":
return
case "history":
return
}
existingIndex := -1
for i, lastCommand := range config.History.Last10Commands {
if lastCommand == command {
existingIndex = i
break
}
}
if existingIndex >= 0 {
config.History.Last10Commands = append(config.History.Last10Commands[:existingIndex], config.History.Last10Commands[existingIndex+1:]...)
}
if len(config.History.Last10Commands) >= 10 {
config.History.Last10Commands = config.History.Last10Commands[1:]
}
config.History.Last10Commands = append(config.History.Last10Commands, command)
}