title: Linux Terminal: typing feedback gone, line breaks not displayed
body: <p>From time to time I have to run a command-line tool (a Python script) whose output seems to break my terminal.
  After the execution is finished, the typing feedback is gone (I can't see what I'm typing), and also line breaks are not displayed. This happens if the terminal is started remotely via <code>Putty</code>, and also locally when using <code>gnome-terminal</code>.</p>
  
  <p>For example, after the problem happens, if I type <kbd>ENTER</kbd> <code>pwd</code> <kbd>ENTER</kbd>, I would expect to see:</p>
  
  <pre><code>[userA@host006 ~]$
  [userA@host006 ~]$ pwd
  /home/userA
  [userA@host006 ~]$
  </code></pre>
  
  <p>But actually the output is:</p>
  
  <pre><code>[userA@host006 ~]$ [userA@host006 ~]$ /home/userA
                                                               [userA@host006 ~]$
  </code></pre>
  
  <p>The only way to fix it is to close that terminal and start a new one.</p>
  
  <p>Maybe be related: the script output contains some terminal-based formatting (e.g. invert foreground/background to highlight some status messages). If I dump this output to a file I can see things like <code>[07mSome Message Here[0m</code>.</p>
  
  <p>Any ideas what I could do to prevent this?</p>