I typed as example a lot of “s”. Then i type arrow up to look for the previous command in the history. But however some “ssssssssssssssss” stay and the last command “clear” appear after it.
This is probably just an artifact of the way the different color codes were implemented in the shell prompt.
Many people learn how to implement fancy colors in their prompt by way of so-called escape codes, but they also have to be properly terminated, because escape codes are not only used for changing colors, but also for cursor placement and overwriting screen locations that had previously been written to. It’s actually not just the shell that’s responsible for this, but also the terminal. It’s an interaction between the two.
There is ample documentation on the web regarding prompt customization, and some of that goes very deep. You can look into that, if you will. Here are a couple of links to get you started.