Mac terminal strange output on return
Found the reason, in the terminals settings under edit there is an option called mark. 

Seems this is designed to mark the prompt line, once disabled this behaviour stops.