Issue #377 collapse button staying red

Basically it checks if the current command is not empty. If it's not then the command was actually executed, otherwise last_command is discarded
I like this solution a lot! There are two changes I would like to see before I merge:

1. Please adapt the code style to what is used elsewhere (space after `if`, curly braces around blocks)
2. IMO, if `last_command` is `null`, `command_executed` should never be invoked, so the invocation should be moved into the first part of the `if` clause.